Wiki source code of Receipt history migration
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | (% class="lead" %) | ||
| 2 | During transition to Loymax Loyalty Program (LP), a Company purchase history can be imported into Loymax Loyalty. As a result, customers will see their purchase history from the previous loyalty program. | ||
| 3 | |||
| 4 | This article presents a **simplified integration contract**. The format is used when migrating historical receipts from external loyalty programs for display in personal accounts and CRM systems. The description focuses on the historical data migration scenario and does not cover all Loymax integration capabilities. Examples are provided in simplified form and reflect minimal valid structures. | ||
| 5 | |||
| 6 | Company data is transmitted to Loymax via a special utility and the messaging broker **Apache Kafka**. The utility converts the JSON file provided by the Company into a historical record model. The sender publishes the message to Kafka in the topic ##hist-items-records##. The consumer **HistoryItemsConsumer** reads the message, converts it to protobuf format, and writes it to the **History **database. As a result, when accessing the Loymax history service via API in the Admin Panel, Personal Account, or Mobile App, the customer's receipt history is displayed. | ||
| 7 | |||
| 8 | {{showhide showmessage="View JSON file example for upload" hidemessage="Hide example"}} | ||
| 9 | {{code language="protobuf"}} | ||
| 10 | { | ||
| 11 | "externalId": "34489de3-362c-49ed-9ac0-2ac982907d64", // Unique identifier of this history record. Required. | ||
| 12 | "dateTime": "2025-07-17T18:19:57Z", // Date/time of the event. Required. | ||
| 13 | "type": "PurchaseData", // Event type. Required. | ||
| 14 | "userId": null, // Identifier of the customer associated with the event. Optional. | ||
| 15 | "customerUid": "76bcd3cc-8825-46a6-9ca4-58c7a6cd5680", // Customer Uid. Required. | ||
| 16 | "identity": "2010000000304", // Additional data allowing identification of the event. Required. | ||
| 17 | "description": null, // Description. Optional. | ||
| 18 | "locationId": null, // Identifier of the store location where the purchase was made. Optional. | ||
| 19 | "partnerId": null, // Company identifier. Optional. | ||
| 20 | "brandUid": null, // Brand Uid. Optional. | ||
| 21 | "historyPurchase": { | ||
| 22 | "externalPurchaseId": "346501602", // External purchase identifier. Required. | ||
| 23 | "amount": 1600.47, // Purchase amount. Required. | ||
| 24 | "currencyUid": "718ae69b-76be-413f-ad19-7b7e02e4a438", // External currency identifier at the cash register (euros). Required. One currency can be passed for all purchases. | ||
| 25 | "merchantUid": "2cf2a75e-353a-9d28-7239-4e22d45fa191", // External store identifier. Required. One store can be passed for all purchases. | ||
| 26 | "deviceUid": "df99a5ed-fc31-d9bd-c594-d8d25261a437", // External cash register identifier. Required. One register can be passed for all purchases. | ||
| 27 | "chequeItems": [ | ||
| 28 | { | ||
| 29 | "positionId": 1, // Receipt item position. Required. Filled as sequential number within each receipt. | ||
| 30 | "description": null, // Description. Optional. | ||
| 31 | "quantity": 1.000, // Quantity. Optional. If not provided, 0 will be displayed. | ||
| 32 | "unit": null, // Unit of measure. Optional. | ||
| 33 | "amount": 493.99, // Amount. Required. | ||
| 34 | "itemId": "161029", // External product identifier. Optional. | ||
| 35 | "discounts": [ | ||
| 36 | { | ||
| 37 | "discountType": "CalculatedDiscount", // Discount type description. Required. | ||
| 38 | "offerId": 40, // Internal offer identifier. Required. | ||
| 39 | "offerVersionId": 81, // Internal version identifier of the offer. Required. | ||
| 40 | "amount": 22.00, // Size of the discount provided in virtual currency. Required. | ||
| 41 | "currencyId": 2, // Discount currency identifier. Required. | ||
| 42 | "cashAmount": null // Amount in original currency (for payments). Required | ||
| 43 | } | ||
| 44 | ], | ||
| 45 | "commonCode": null, // Common code of the item. Optional. | ||
| 46 | "attributes": [], // Item attributes. Optional. | ||
| 47 | "internalGoodId": 125 // Internal product identifier. Optional | ||
| 48 | } | ||
| 49 | ], | ||
| 50 | "withdraws": [ | ||
| 51 | { | ||
| 52 | "moneyAmount": 69.60, // Amount in register currency. Required. | ||
| 53 | "withdrawType": "Bonus", // Withdrawal type. Required. | ||
| 54 | "description": null, // Operation description. Optional. | ||
| 55 | "positionInfo": [ // Distribution of withdrawal across positions. Optional. | ||
| 56 | { | ||
| 57 | "key": 1, | ||
| 58 | "value": 69.60 | ||
| 59 | } | ||
| 60 | ], | ||
| 61 | "amount": 69.60, // Amount in bonuses. Required. | ||
| 62 | "currencyUid": "718ae69b-76be-413f-ad19-7b7e02e4a438" // External currency identifier. Required | ||
| 63 | } | ||
| 64 | ], | ||
| 65 | "rewards": [ | ||
| 66 | { | ||
| 67 | "offerExternalId": "c4aa82c8-57f9-4ba6-9e41-3449d9db1fd7", // External offer identifier. Required. | ||
| 68 | "description": null, // Reward description. Optional. | ||
| 69 | "positionInfo": { // Distribution of reward across positions. Optional. | ||
| 70 | "1": 22.00 | ||
| 71 | }, | ||
| 72 | "amount": 22.00, // Preference amount. Required. | ||
| 73 | "rewardType": "Discount", // Preference type. Required. | ||
| 74 | "currencyUid": "718ae69b-76be-413f-ad19-7b7e02e4a438" // External currency identifier. Required | ||
| 75 | } | ||
| 76 | ], | ||
| 77 | "isRefund": false, // Whether the purchase is a return. Optional. If not a return, value should be: false. | ||
| 78 | "chequeNumber": "H55052486709-170723", // Receipt number. Required. | ||
| 79 | "chequeAdditionalAttributes": [], // Information about items in the receipt. Optional. | ||
| 80 | "state": "Confirmed", // Purchase state. Required. Always pass value: Confirmed. | ||
| 81 | "additionalParams": {}, // Additional purchase parameters. Optional. | ||
| 82 | "pays": [ | ||
| 83 | { | ||
| 84 | "id": 2, // Internal payment method identifier. Optional. | ||
| 85 | "name": "Unknown", // Payment method name. Optional. | ||
| 86 | "logicalName": "Unknown", // Logical name of the payment method. Optional. Value must match the LogicalName of the payment method created in the System. | ||
| 87 | "amount": 1600.47, // Amount. Optional. | ||
| 88 | "description": "Unknown" // Description. Optional | ||
| 89 | } | ||
| 90 | ], | ||
| 91 | "activities": [], // Activities. Optional. | ||
| 92 | "deviceEmulation": false, // Indicator whether the purchase was made on a test register. Optional. Value: false. | ||
| 93 | "operations": [], // Operations. Optional. | ||
| 94 | "coupons": [], // Coupons. Optional. | ||
| 95 | "completeTime": "2025-07-17T18:19:57Z" // Purchase completion date. Optional | ||
| 96 | }, | ||
| 97 | "withdraws": [ | ||
| 98 | { | ||
| 99 | "amount": -62.81, | ||
| 100 | "withdrawType": "Withdraw", | ||
| 101 | "currencyUid": "1f24174f-bfdb-4019-a3e7-4fb088b4a7a7" | ||
| 102 | } | ||
| 103 | ], | ||
| 104 | "rewards": [ | ||
| 105 | { | ||
| 106 | "offerExternalId": "8825a082-468f-43fd-8171-52bfeb4f74a9", | ||
| 107 | "positionInfo": { | ||
| 108 | "1": 13.45, | ||
| 109 | "2": 41.55 | ||
| 110 | }, | ||
| 111 | "amount": 55.00, | ||
| 112 | "rewardType": "Bonus", | ||
| 113 | "currencyUid": "1f24174f-bfdb-4019-a3e7-4fb088b4a7a7" | ||
| 114 | } | ||
| 115 | ], | ||
| 116 | "eventDateTime": 0, // File upload date and time. Required. Fill current date in ticks. | ||
| 117 | "loyalityUid": null, // External Loyalty Program identifier. Required. | ||
| 118 | "historyVersion": "V2", // History record version information. Required. Should be filled with value: V2. | ||
| 119 | "source": "true" // Record source information. Required. When saving data from Loymax loyalty system, leave this field empty. If the field is filled with any value other than an empty string or null, the history record is marked with Imported=true. | ||
| 120 | } | ||
| 121 | {{/code}} | ||
| 122 | {{/showhide}} | ||
| 123 | |||
| 124 | === Data processing speed === | ||
| 125 | |||
| 126 | The size of the data batch processed by the utility is fixed and equals 100. The optimal batch size for the **HistoryItemsConsumer** consumer is 1000. The processing time per message reaches 0.36 ms. Increasing the batch size in consumer settings increases processing time: 0.52 ms per message at a batch size of 10,000. Parallel operation of the utility and consumer reduces processing time to 0.22 ms per message. | ||
| 127 | |||
| 128 | = Types of purchases to import = | ||
| 129 | |||
| 130 | (% class="table-bordered" %) | ||
| 131 | |Purchase without detailed discounts and bonus points|Receipt with item composition and total amount without revealing discount, accrual, and deduction mechanics. | ||
| 132 | |Purchase with line-item discounts|Receipt where applied discounts are recorded for individual items. | ||
| 133 | |Purchase with line-item bonus points (with multi-currency support)|Receipt where bonus accruals are reflected for specific items. | ||
| 134 | |Purchase with bonus points deduction|Receipt where the customer used bonus points to pay part of the purchase. | ||
| 135 | |Separate accrual or deduction operations without a purchase|Bonus operations not linked to a specific receipt (e.g., manual corrections or expiration). | ||
| 136 | |||
| 137 | = Structure of transmitted data = | ||
| 138 | |||
| 139 | When transmitting purchase data, a single structure is used, including the following logical blocks: | ||
| 140 | |||
| 141 | 1. General information about the purchase event. | ||
| 142 | 1. Data about the purchase itself. | ||
| 143 | 1. Receipt composition (item positions). | ||
| 144 | 1. Discounts, accruals, and deductions (if applicable). | ||
| 145 | 1. Payment information (if necessary). | ||
| 146 | 1. Additional attributes and auxiliary data (optional). | ||
| 147 | |||
| 148 | Each of the above blocks is described below, specifying required and optional parameters. | ||
| 149 | |||
| 150 | (% class="box infomessage" %) | ||
| 151 | * Minimum required parameters are marked as **required**. | ||
| 152 | * Optional fields are either left unfilled or filled with default values. | ||
| 153 | |||
| 154 | (% class="table-bordered" %) | ||
| 155 | |=(% style="width: 245px; background-color: rgb(218, 238, 247);" %)Field|=(% style="width: 172px; background-color: rgb(218, 238, 247);" %)Required|=(% style="width: 311px; background-color: rgb(218, 238, 247);" %)Data Type|=(% style="width: 927px; background-color: rgb(218, 238, 247);" %)Description | ||
| 156 | |(% style="width:245px" %)**externalId**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##Guid##|(% style="width:927px" %)Unique identifier of this history record | ||
| 157 | |(% style="width:245px" %)**DateTime**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##DateTime##|(% style="width:927px" %)Date and time of the event | ||
| 158 | |(% style="width:245px" %)**Type**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##string##|(% style="width:927px" %)Event type | ||
| 159 | |(% style="width:245px" %)**UserId**|(% style="width:172px" %)Optional|(% style="width:311px" %)##int##|(% style="width:927px" %)Identifier of the customer associated with the event | ||
| 160 | |(% style="width:245px" %)**CustomerUid**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##Guid##|(% style="width:927px" %)Internal customer identifier, unique within the System | ||
| 161 | |(% style="width:245px" %)**Identity**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##string##|(% style="width:927px" %)Additional data allowing identification of the event. Fill with customer card number | ||
| 162 | |**Withdraw**|Optional|WithdrawDataViewModel|Deduction (manual) | ||
| 163 | |**Reward**|Optional|RewardDataViewModel|Accrual (manual) | ||
| 164 | |(% style="width:245px" %)**Description**|(% style="width:172px" %)Optional|(% style="width:311px" %)##string##|(% style="width:927px" %)Description for display in history | ||
| 165 | |(% style="width:245px" %)**LocationId**|(% style="width:172px" %)Optional|(% style="width:311px" %)##Guid##|(% style="width:927px" %)Point of sale location identifier where the purchase was made. Not recommended to fill | ||
| 166 | |(% style="width:245px" %)**PartnerId**|(% style="width:172px" %)Optional|(% style="width:311px" %)##Guid##|(% style="width:927px" %)Company identifier, constant | ||
| 167 | |(% style="width:245px" %)**BrandUid**|(% style="width:172px" %)Optional|(% style="width:311px" %)##Guid##|(% style="width:927px" %)Uid of the brand where the purchase occurred, often a constant | ||
| 168 | |(% style="width:245px" %)**HistoryPurchase**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##HistoryPurchaseDataViewModel##|(% style="width:927px" %)Historical purchase data. See [[HistoryPurchaseDataViewModel>>doc:||anchor="H41E43144943044F43843D44443E44043C43044643844F43E43F43E43A44343F43A435:HistoryPurchaseDataViewModel"]] model below | ||
| 169 | |(% style="width:245px" %)**EventDateTime**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##long##|(% style="width:927px" %)File upload date and time. Fill current date in ticks | ||
| 170 | |(% style="width:245px" %)**LoyalityUid**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##Guid##|(% style="width:927px" %)External Loyalty Program identifier, constant | ||
| 171 | |(% style="width:245px" %)**historyVersion**|(% style="width:172px" %)**Required**|(% style="width:311px" %)((( | ||
| 172 | ##HistoryVersionType## | ||
| 173 | )))|(% style="width:927px" %)Information about the history record version (database table where data from the uploaded file is written). Should be filled with value: V2 | ||
| 174 | |(% style="width:245px" %)**source**|(% style="width:172px" %)**Required**|(% style="width:311px" %)##string##|(% style="width:927px" %)Record source information. When saving data from Loymax, leave this field empty. When importing external data, fill with any value, then the history record is marked with Imported=true. | ||
| 175 | |||
| 176 | Below the nested models for required fields of the general structure are listed and described. These also include both required and optional fields. | ||
| 177 | |||
| 178 | {{toc depth="5" start="2"/}} | ||
| 179 | |||
| 180 | == General purchase information: HistoryPurchaseDataViewModel == | ||
| 181 | |||
| 182 | (% class="table-bordered" %) | ||
| 183 | |=(% style="width: 244px; background-color: rgb(218, 238, 247);" %)Field|=(% style="width: 171px; background-color: rgb(218, 238, 247);" %)Required|=(% style="width: 272px; background-color: rgb(218, 238, 247);" %)Data Type|=(% style="width: 968px; background-color: rgb(218, 238, 247);" %)Description | ||
| 184 | |(% style="width:244px" %)**ExternalPurchaseId**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##string##|(% style="width:968px" %)External purchase identifier | ||
| 185 | |(% style="width:244px" %)**Amount**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##decimal##|(% style="width:968px" %)Purchase amount after discounts | ||
| 186 | |(% style="width:244px" %)**CurrencyUid**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##string##|(% style="width:968px" %)External POS currency identifier (default POS currency: euros). One currency can be passed for all purchases | ||
| 187 | |(% style="width:244px" %)**MerchantUid**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##Guid##|(% style="width:968px" %)External point of sale identifier. One point of sale can be passed for all purchases | ||
| 188 | |(% style="width:244px" %)**DeviceUid**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##Guid##|(% style="width:968px" %)External POS identifier. One POS terminal can be passed for all purchases | ||
| 189 | |(% style="width:244px" %)**ChequeItems**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##HistoryChequeItemViewModel##|(% style="width:968px" %)Information about items in the receipt. See [[HistoryChequeItemViewModel>>doc:||anchor="H41843D44443E44043C43044643844F43F43E43F43E43743844643844F43C44743543A430:A0HistoryChequeItemViewModel"]] model below | ||
| 190 | |(% style="width:244px" %)**Withdraws**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##WithdrawDataViewModel##|(% style="width:968px" %)Deductions within the purchase. See [[WithdrawDataViewModel>>doc:||anchor="H41843D44443E44043C43044643844F43F43E44143F43844143043D43844F43C:A0WithdrawDataViewModel"]] model below | ||
| 191 | |(% style="width:244px" %)**Rewards**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##RewardDataViewModel##|(% style="width:968px" %)Accruals within the purchase. See [[RewardDataViewModel>>doc:||anchor="H41843D44443E44043C43044643844F43F43E43D43044743844143B43543D43844F43C:A0RewardDataViewModel"]] model below | ||
| 192 | |(% style="width:244px" %)**IsRefund**|(% style="width:171px" %)Optional|(% style="width:272px" %)##bool##|(% style="width:968px" %)Whether the purchase is a refund. If no refunds, value: false | ||
| 193 | |(% style="width:244px" %)**ChequeNumber**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##string##|(% style="width:968px" %)Receipt number | ||
| 194 | |(% style="width:244px" %)**ChequeAdditionalAttributes**|(% style="width:171px" %)Optional|(% style="width:272px" %)##ChequeAdditionalAttributeViewModel##|(% style="width:968px" %)Information about additional receipt attributes. Not recommended to transmit | ||
| 195 | |(% style="width:244px" %)**State**|(% style="width:171px" %)**Required**|(% style="width:272px" %)##OperationState##|(% style="width:968px" %)Purchase state. Always pass value: Confirmed | ||
| 196 | |(% style="width:244px" %)**AdditionalParams**|(% style="width:171px" %)Optional|(% style="width:272px" %)##string##|(% style="width:968px" %)Additional purchase parameters | ||
| 197 | |(% style="width:244px" %)**Pays**|(% style="width:171px" %)Optional|(% style="width:272px" %)##PayModel##|(% style="width:968px" %)Payment methods. Fill if needed to specify what portion was paid with POS currency (euros) | ||
| 198 | |(% style="width:244px" %)**Activities**|(% style="width:171px" %)Optional|(% style="width:272px" %)##Activity##|(% style="width:968px" %)Activities. Not recommended to transmit | ||
| 199 | |(% style="width:244px" %)**DeviceEmulation**|(% style="width:171px" %)Optional|(% style="width:272px" %)##bool##|(% style="width:968px" %)Indicator whether the purchase was made on a test POS terminal. If transmitted, value always: false | ||
| 200 | |(% style="width:244px" %)**Operations**|(% style="width:171px" %)Optional|(% style="width:272px" %)##PurchaseOperation##|(% style="width:968px" %)Operations | ||
| 201 | |(% style="width:244px" %)**Coupons**|(% style="width:171px" %)Optional|(% style="width:272px" %)##Coupon##|(% style="width:968px" %)Coupons | ||
| 202 | |(% style="width:244px" %)**ExternalPurchaseUid**|(% style="width:171px" %)Optional|(% style="width:272px" %)##string##|(% style="width:968px" %)Purchase identifier | ||
| 203 | |||
| 204 | * Fields **Withdraws** and **Rewards** in the model are marked as **required**, despite potentially being empty arrays. | ||
| 205 | * Field **IsRefund** is used to transmit refunds during migration (value true if transmitted). | ||
| 206 | |||
| 207 | === Receipt item information: HistoryChequeItemViewModel === | ||
| 208 | |||
| 209 | (% class="table-bordered" style="width:1914.5px" %) | ||
| 210 | |=(% style="width: 272px; background-color: rgb(218, 238, 247);" %)Field|=(% style="width: 196px; background-color: rgb(218, 238, 247);" %)Required|=(% style="width: 357px; background-color: rgb(218, 238, 247);" %)Data Type|=(% style="width: 1087px; background-color: rgb(218, 238, 247);" %)Description | ||
| 211 | |(% style="width:272px" %)**PositionId**|(% style="width:196px" %)**Required**|(% style="width:357px" %)##int?##|(% style="width:1087px" %)Receipt position. Filled as sequential number within each receipt | ||
| 212 | |(% style="width:272px" %)**Description**|(% style="width:196px" %)Optional|(% style="width:357px" %)##string##|(% style="width:1087px" %)Description | ||
| 213 | |(% style="width:272px" %)**Quantity**|(% style="width:196px" %)Optional|(% style="width:357px" %)##decimal##|(% style="width:1087px" %)Quantity. If not passed, 0 will be displayed | ||
| 214 | |(% style="width:272px" %)**Unit**|(% style="width:196px" %)Optional|(% style="width:357px" %)##string##|(% style="width:1087px" %)Unit of measure | ||
| 215 | |(% style="width:272px" %)**Amount**|(% style="width:196px" %)**Required**|(% style="width:357px" %)##decimal##|(% style="width:1087px" %)Amount after discount deduction | ||
| 216 | |(% style="width:272px" %)**ItemId**|(% style="width:196px" %)Optional|(% style="width:357px" %)##string##|(% style="width:1087px" %)External product identifier (article) | ||
| 217 | |(% style="width:272px" %)**Discounts**|(% style="width:196px" %)((( | ||
| 218 | **Required** | ||
| 219 | |||
| 220 | (conditional) | ||
| 221 | )))|(% style="width:357px" %)##Discount##|(% style="width:1087px" %)((( | ||
| 222 | Discounts provided on receipt positions. Required if line-item detail is needed. | ||
| 223 | |||
| 224 | See [[Discount >>doc:||anchor="H41C43E43443543B44C43F44043544443544043543D446438439:Discount"]]model below | ||
| 225 | ))) | ||
| 226 | |(% style="width:272px" %)**commonCode**|(% style="width:196px" %)Optional|(% style="width:357px" %)##string##|(% style="width:1087px" %)Common code of the item | ||
| 227 | |(% style="width:272px" %)**attributes**|(% style="width:196px" %)Optional|(% style="width:357px" %)##string##|(% style="width:1087px" %)Item attributes. Not recommended to transmit | ||
| 228 | |(% style="width:272px" %)**internalGoodId**|(% style="width:196px" %)Optional|(% style="width:357px" %)##int##|(% style="width:1087px" %)Internal product identifier | ||
| 229 | |||
| 230 | ==== Preference model: Discount ==== | ||
| 231 | |||
| 232 | This model is used **only when line-item discount detail is required** (discount detail/payment detail/bonus points detail) and is included in the [[HistoryChequeItemViewModel>>doc:||anchor="H41843D44443E44043C43044643844F43F43E43F43E43743844643844F43C44743543A430:A0HistoryChequeItemViewModel"]] model. | ||
| 233 | |||
| 234 | (% class="table-bordered" %) | ||
| 235 | |=(% style="width: 240px; background-color: rgb(218, 238, 247);" %)Field|=(% style="width: 170px; background-color: rgb(218, 238, 247);" %)Required|=(% style="width: 319px; background-color: rgb(218, 238, 247);" %)Data Type|=(% style="width: 915px; background-color: rgb(218, 238, 247);" %)Description | ||
| 236 | |(% style="width:240px" %)**DiscountType**|(% style="width:170px" %)**Required**|(% style="width:319px" %)##PositionDiscountType##|(% style="width:915px" %)Type of preference provided. See [[PositionDiscountType>>doc:||anchor="H42243843F44B43F44043543443E44144243043243B44F43543C44B44543F44043544443544043543D446438439:A0PositionDiscountType-3F43243E44244324443043D43044743043B43043F44344243044C44144F"]] model below | ||
| 237 | |(% style="width:240px" %)**OfferId**|(% style="width:170px" %)**Required**|(% style="width:319px" %)##int##|(% style="width:915px" %)Internal offer identifier. Value must not equal 0. Pass identifier of a offer specifically created in the System; one can be created and passed as a constant | ||
| 238 | |(% style="width:240px" %)**OfferVersionId**|(% style="width:170px" %)**Required**|(% style="width:319px" %)##int##|(% style="width:915px" %)Internal version identifier of the offer. Value must not equal 0. Pass identifier of a offer version specifically created in the System; one can be created and passed as a constant | ||
| 239 | |(% style="width:240px" %)**Amount**|(% style="width:170px" %)**Required**|(% style="width:319px" %)##decimal##|(% style="width:915px" %)((( | ||
| 240 | Amount of preference provided in virtual currency (if preference type: **CalculatedCashback**/**PartnerCashback** or **CalculatedPayment**) or in POS currency (if preference type: **CalculatedDiscount**/**PartnerDiscount**) | ||
| 241 | ))) | ||
| 242 | |(% style="width:240px" %)**CurrencyId**|(% style="width:170px" %)**Required**|(% style="width:319px" %)##int?##|(% style="width:915px" %)Preference discount currency identifier. Must pass a currency that actually exists in the System: monetary or any virtual currency | ||
| 243 | |(% style="width:240px" %)**CashAmount**|(% style="width:170px" %)**Required**|(% style="width:319px" %)##decimal?##|(% style="width:915px" %)Discount amount in POS currency (if preference type: **CalculatedPayment**). Do not fill if preference type: **CalculatedCashback** | ||
| 244 | |||
| 245 | ===== (% style="color:inherit; font-family:Montserrat,sans-serif; font-size:20px" %)Type of preference provided:(% style="color:inherit; font-family:Montserrat,sans-serif; font-size:20px; font-weight:600" %) (% style="color:inherit; font-family:Montserrat,sans-serif; font-size:20px" %)PositionDiscountType(%%) ===== | ||
| 246 | |||
| 247 | One of the specified values below must be passed if the [[Discount>>doc:||anchor="H41C43E43443543B44C43F44043544443544043543D446438439:Discount"]] model is transmitted (see above). | ||
| 248 | |||
| 249 | (% class="table-bordered" %) | ||
| 250 | |=(% style="width: 241px; background-color: rgb(218, 238, 247);" %)Value|=(% style="width: 272px; background-color: rgb(218, 238, 247);" %)Name|=(% style="width: 1138px; background-color: rgb(218, 238, 247);" %)Description | ||
| 251 | |(% style="width:241px" %)**CalculatedCashback**|(% style="width:272px" %)Deferred bonus points|(% style="width:1138px" %)bonus points | ||
| 252 | |(% style="width:241px" %)**CalculatedDiscount**|(% style="width:272px" %)Discount|(% style="width:1138px" %)Direct discount | ||
| 253 | |(% style="width:241px" %)**PartnerDiscount**|(% style="width:272px" %)Partner discount|(% style="width:1138px" %)External/POS discount (passed from the point of sale POS terminal) | ||
| 254 | |(% style="width:241px" %)**PartnerCashback**|(% style="width:272px" %)Partner bonus points|(% style="width:1138px" %)External/POS bonus points (passed from the point of sale POS terminal) | ||
| 255 | |(% style="width:241px" %)**PositionCharge**|(% style="width:272px" %)Bonus points accrual|(% style="width:1138px" %)Bonus points accrual. This value is not used | ||
| 256 | |(% style="width:241px" %)**CalculatedPayment**|(% style="width:272px" %)Payment|(% style="width:1138px" %)Deduction of bonus points for purchase | ||
| 257 | |||
| 258 | === Deduction information: WithdrawDataViewModel === | ||
| 259 | |||
| 260 | This model is used to transmit line-item deductions within a purchase in [[HistoryPurchaseDataViewModel>>doc:||anchor="H41E43144943044F43843D44443E44043C43044643844F43E43F43E43A44343F43A435:HistoryPurchaseDataViewModel"]], required to fill, and also for manual deductions in the root object (field **Withdraw**), filling optional. | ||
| 261 | |||
| 262 | (% class="table-bordered" %) | ||
| 263 | |=(% style="width: 242px; background-color: rgb(218, 238, 247);" %)Field|=(% style="width: 171px; background-color: rgb(218, 238, 247);" %)Required|=(% style="width: 318px; background-color: rgb(218, 238, 247);" %)Data Type|=(% style="width: 920px; background-color: rgb(218, 238, 247);" %)Description | ||
| 264 | |(% style="width:242px" %)**MoneyAmount**|(% style="width:171px" %)**Required**|(% style="width:318px" %)##decimal?##|(% style="width:920px" %)Amount in POS currency (euros) | ||
| 265 | |(% style="width:242px" %)**Description**|(% style="width:171px" %)**Required**|(% style="width:318px" %)##string##|(% style="width:920px" %)Operation description | ||
| 266 | |(% style="width:242px" %)**PositionInfo**|(% style="width:171px" %)Optional|(% style="width:318px" %)##int, decimal##|(% style="width:920px" %)Distribution of deduction across positions | ||
| 267 | |(% style="width:242px" %)**Amount**|(% style="width:171px" %)**Required**|(% style="width:318px" %)##decimal##|(% style="width:920px" %)Amount in bonus points | ||
| 268 | |(% style="width:242px" %)**WithdrawType**|(% style="width:171px" %)**Required**|(% style="width:318px" %)##WithdrawType##|(% style="width:920px" %)Deduction type. See [[WithdrawType>>doc:||anchor="H42243843F44B44143F43844143043D438439:A0WithdrawType"]] model below | ||
| 269 | |(% style="width:242px" %)**CurrencyUid**|(% style="width:171px" %)**Required**|(% style="width:318px" %)##string##|(% style="width:920px" %)External virtual currency identifier | ||
| 270 | |||
| 271 | ==== Deduction types: WithdrawType ==== | ||
| 272 | |||
| 273 | One of the specified values below must be passed if the [[WithdrawDataViewModel>>doc:||anchor="H41843D44443E44043C43044643844F43F43E44143F43844143043D43844F43C:A0WithdrawDataViewModel"]] model is transmitted (see above). | ||
| 274 | |||
| 275 | (% class="table-bordered" %) | ||
| 276 | |=(% style="width: 241px; background-color: rgb(218, 238, 247);" %)Value|=(% style="width: 271px; background-color: rgb(218, 238, 247);" %)Name|=(% style="width: 1139px; background-color: rgb(218, 238, 247);" %)Description | ||
| 277 | |(% style="width:241px" %)**Bonus**|(% style="width:271px" %)Bonuses|(% style="width:1139px" %)Bonus points deduction | ||
| 278 | |(% style="width:241px" %)**Withdraw**|(% style="width:271px" %)Deduction|(% style="width:1139px" %)Deduction as a separate operation type | ||
| 279 | |(% style="width:241px" %)((( | ||
| 280 | **Expiration** | ||
| 281 | )))|(% style="width:271px" %)((( | ||
| 282 | Expiration | ||
| 283 | )))|(% style="width:1139px" %)((( | ||
| 284 | Bonus points expiration | ||
| 285 | ))) | ||
| 286 | |||
| 287 | === Accrual information: RewardDataViewModel === | ||
| 288 | |||
| 289 | This model is used to transmit accruals within a purchase in [[HistoryPurchaseDataViewModel>>doc:||anchor="H41E43144943044F43843D44443E44043C43044643844F43E43F43E43A44343F43A435:HistoryPurchaseDataViewModel"]], required to fill, and also for manual accruals in the root object (field **Reward**), filling optional. | ||
| 290 | |||
| 291 | (% class="table-bordered" %) | ||
| 292 | |=(% style="width: 242px; background-color: rgb(218, 238, 247);" %)Field|=(% style="width: 170px; background-color: rgb(218, 238, 247);" %)Required|=(% style="width: 320px; background-color: rgb(218, 238, 247);" %)Type|=(% style="width: 920px; background-color: rgb(218, 238, 247);" %)Description | ||
| 293 | |(% style="width:242px" %)**OfferExternalId**|(% style="width:170px" %)**Required**|(% style="width:320px" %)##string##|(% style="width:920px" %)External offer identifier | ||
| 294 | |(% style="width:242px" %)**Description**|(% style="width:170px" %)**Required**|(% style="width:320px" %)##string##|(% style="width:920px" %)Detailed description specifying this accrual operation | ||
| 295 | |(% style="width:242px" %)**PositionInfo**|(% style="width:170px" %)Optional|(% style="width:320px" %)##int, decimal##|(% style="width:920px" %)Distribution of accrual across positions (position number, amount) | ||
| 296 | |(% style="width:242px" %)**Amount**|(% style="width:170px" %)**Required**|(% style="width:320px" %)##double?##|(% style="width:920px" %)Preference amount | ||
| 297 | |(% style="width:242px" %)**RewardType**|(% style="width:170px" %)**Required**|(% style="width:320px" %)##RewardType?##|(% style="width:920px" %)Accrual type. See [[RewardType>>doc:||anchor="H42243843F43D43044743844143B43543D43844F:RewardType"]] model below | ||
| 298 | |(% style="width:242px" %)**CurrencyUid**|(% style="width:170px" %)**Required**|(% style="width:320px" %)##string##|(% style="width:920px" %)External virtual currency identifier (if accrual type: **Bonus** or **Charging**) or POS currency (if accrual type: **Discount**) | ||
| 299 | |||
| 300 | ==== Accrual type: RewardType ==== | ||
| 301 | |||
| 302 | One of the specified values below must be passed if the [[RewardDataViewModel>>doc:||anchor="H41843D44443E44043C43044643844F43F43E43D43044743844143B43543D43844F43C:A0RewardDataViewModel"]] model is transmitted (see above). | ||
| 303 | |||
| 304 | (% class="table-bordered" %) | ||
| 305 | |=(% style="width: 243px; background-color: rgb(218, 238, 247);" %)Value|=(% style="width: 274px; background-color: rgb(218, 238, 247);" %)Name|=(% style="width: 1135px; background-color: rgb(218, 238, 247);" %)Description | ||
| 306 | |(% style="width:243px" %)**Bonus**|(% style="width:274px" %)bonus points|(% style="width:1135px" %)Bonus points | ||
| 307 | |(% style="width:243px" %)**Discount**|(% style="width:274px" %)Discount|(% style="width:1135px" %)Discount | ||
| 308 | |(% style="width:243px" %)**Charging**|(% style="width:274px" %)Accrual|(% style="width:1135px" %)Additional bonus points accrual (within receipt, but not linked to positions) |