Show last authors
1 (% class="lead" %)
2 The Loymax System allows exchanging event results with Smart Communications. This allows real-time updates on events in Smart Communications. Events are transmitted via the message broker [[RabbitMQ>>https://www.rabbitmq.com/documentation.html]].
3
4 (% class="box" %)
5 (((
6 **Contents:**
7
8 {{toc depth="2" start="2"/}}
9 )))
10
11 == Data transmission process from the Loymax System to Smart Communications via RabbitMQ ==
12
13 Let’s use the **Customer registration** event as an example.
14
15 **Input parameters:**
16
17 * Customer registration, which includes events such as **Registration started**, **Registration completed**, **New card linked to LP Member**, etc. (marked as line A in the diagram).
18 * Other events (marked as line B in the diagram) unrelated to customer registration—for example, target audience calculation, offer edits, etc.
19
20 All events occurring in the system are sent to an **Exchange**. The exchange routes events (**Routing**) into one or more queues depending on the event type. Events related to **Customer registration**, in addition to their designated queues, are also routed to a dedicated queue linked to Smart Communications. The Smart Communications platform retrieves events from this queue in real time. All other events are routed only to their respective queues.
21
22 (% class="box infomessage" %)
23 (((
24 To transmit events to the Smart Communications platform, the [[Loymax.Plugins.SmartCommunications>>doc:Main.Installation_and_configuration.Extra_modules.Plugins_and_adapters.Plugins_list.WebHome||anchor="009"]] plugin must be connected. Enabling the plugin creates a dedicated queue linked to Smart Communications, and event messages are placed in that queue.
25 )))
26
27 |(% style="border-color:#ffffff; text-align:center" %){{lightbox image="smc_MMP.png" width="900"/}}
28
29 == Protocols of event transmission via RabbitMQ ==
30
31 Smart Communications receives information via RabbitMQ about the following events related to a Loyalty Program (LP) Member’s activity:
32
33 * Events related to LP Member registration:
34 ** LP registration started;
35 ** LP registration completed;
36 ** Card linked to LP Member;
37 ** LP Member profiles merge (consolidation under one account);
38 ** Card activation.
39 * Card blocking/unblocking;
40 * Card deletion/restoration;
41 * Card category change;
42 * LP Member attribute updates;
43 * Subscription status changes;
44 * Events related to LP Member's purchases:
45 ** Purchase;
46 ** Purchase refund.
47
48 Events are sent to the **smc.customerEvents** queue. Detailed information about all events is provided in the table below.
49
50 (% class="table-bordered table-scroll" %)
51 |=(% style="width: 20%;" %)Event|=(% style="width: 30%;" %)Description|=(% style="width: 15%;" %)Routing keys|=(% style="width: 35%;" %)Example model sent to the queue
52 |(% style="width:20%" %)[[Registration started>>doc:Sandbox.Papi_examples.Customer_registration.General_algorithm.WebHome||anchor="HRequesttostartregistration"]]|(% style="width:30%" %)The event is enqueued when a customer begins the LP registration process.|(% style="width:15%" %)customer.registration.begin|(% style="width:35%" %)(((
53 {{showhide showmessage="Show model" hidemessage="Hide model"}}
54 ((({{code language="json"}}
55 {
56 "eventCode":"OnBeginRegistration",
57 "customerInfo":{
58 "customerId":121,
59 "accountgroupId":"125",
60 "customerCode":"aca52e1b-f08b-44a7-a77b-69ae0442ce7b",
61 "mobileDeviceId":null,
62 "identifierId":826,
63 "applicationId":null
64 }
65 }
66 {{/code}}
67 )))
68 {{/showhide}}
69 )))
70 |(% style="width:20%" %)[[Registration completed>>doc:Sandbox.Papi_examples.Customer_registration.General_algorithm.WebHome||anchor="HRegistrationcompletion"]]|(% style="width:30%" %)The event is enqueued when a customer successfully completes registration.|(% style="width:15%" %)customer.registration.finish|(% style="width:35%" %)(((
71 {{showhide showmessage="Show model" hidemessage="Hide model"}}
72 {{code language="json"}}
73 {
74 "eventCode":"OnEndRegistration",
75 "customerInfo":{
76 "customerId":121,
77 "accountgroupId":"125",
78 "customerCode":"aca52e1b-f08b-44a7-a77b-69ae0442ce7b",
79 "mobileDeviceId":null,
80 "identifierId":826,
81 "applicationId":null
82 }
83 }
84 {{/code}}
85 {{/showhide}}
86 )))
87 |(% style="width:20%" %)(((
88 [[Card linking>>doc:Sandbox.Papi_examples.Customer_registration.General_algorithm.WebHome||anchor="HCardlinking"]]
89 )))|(% style="width:30%" %)(((
90 Card linking includes three events:
91
92 * Card replacement (**ReplaceCard**);
93 * Merging cards under one account (**AttachCard**);
94 * Attaching a new card (**SetCard**).
95
96 The linking method is passed in the **linkCardType** parameter.
97
98 For card replacement, new card details are provided in the **newCard** parameter, and the replaced card’s information is in **oldCard**.
99
100 In all other cases, **oldCard** is set to //null//.
101 )))|(% style="width:15%" %)customer.card.link|(% style="width:35%" %)(((
102 {{showhide showmessage="Show model" hidemessage="Hide model"}}
103 {{code language="json"}}
104 {
105 "newCard":{
106 "cardId":6,
107 "cardNumber":"1664669457201226",
108 "cardState":"Activated",
109 "activationDate":null,
110 "cardType":"General",
111 "cardCategory":"VIP",
112 "barCode":"1664669457201226",
113 "strip1":"1664669457201226",
114 "strip2":"1664669457201226=1664669457201226",
115 "strip3":"strip=1664669457201226",
116 "isBlocked":false,
117 "isDeleted":false
118 },
119 "oldCard":{
120 "cardId":5,
121 "cardNumber":"3515656237264935",
122 "cardState":"Replaced",
123 "activationDate":null,
124 "cardType":"General",
125 "cardCategory":"VIP",
126 "barCode":"3515656237264935",
127 "strip1":"3515656237264935",
128 "strip2":"3515656237264935=3515656237264935",
129 "strip3":"strip=3515656237264935",
130 "isBlocked":true,
131 "isDeleted":true
132 },
133 "linkSource":"UserPortal",
134 "linkCardType":"ReplaceCard",
135 "customerInfo":{
136 "customerId":11,
137 "accountgroupId":"15",
138 "customerUid":"b95f240a-9185-4075-89e2-13216a34c177",
139 "mobileDeviceId":null,
140 "identifierId":45,
141 "applicationId":1
142 },
143 "eventCode":"OnCardReplace"
144 }
145 {{/code}}
146 {{/showhide}}
147 )))
148 |(% style="width:20%" %)[[Merge under one account>>doc:Main.Integration.Ways_to_use_API.API_methods.Methods_of_public_api.Cards.WebHome||anchor="H41D43044743043B43E43F44043E44643543444344044B43E43144A43543443843D43543D43844F43A430440442"]]|(% style="width:30%" %)The event is enqueued when one LP Member’s account is merged with another’s.|(% style="width:15%" %)customer.profile.merge|(% style="width:35%" %)(((
149 {{showhide showmessage="Show model" hidemessage="Hide model"}}
150 {{code language="json"}}
151 {
152 "fromCustomerInfo": {
153 "customerId": 13,
154 "accountgroupId": "18",
155 "customerUid": "310408bf-ea5d-4d75-863a-0f46ffc159c8",
156 "mobileDeviceId": null,
157 "identifierId": null,
158 "applicationId": null
159 },
160 "toCustomerInfo": {
161 "customerId": 11,
162 "accountgroupId": "15",
163 "customerUid": "e3be78c4-348d-4685-ae47-4bea13c1a6f6",
164 "mobileDeviceId": null,
165 "identifierId": null,
166 "applicationId": null
167 },
168 "eventCode": "MergeCustomersProfiles",
169 }
170 {{/code}}
171 {{/showhide}}
172 )))
173 |(% style="width:20%" %)**Card activation**|(% style="width:30%" %)The event is enqueued when a card transitions from the **Issued** or **Activating** state to **Activated**.|(% style="width:15%" %)customer.card.changeState|(% style="width:35%" %)(((
174 {{showhide showmessage="Show model" hidemessage="Hide model"}}
175 {{code language="json"}}
176 {
177 "cardInfo":{
178 "cardId":20,
179 "cardNumber":"4510721265576184",
180 "cardState":"Activated",
181 "activationDate":"2021-07-19T16:33:24Z",
182 "cardType":"General",
183 "cardCategory":"VIP",
184 "barCode":"4510721265576184",
185 "strip1":"4510721265576184",
186 "strip2":"4510721265576184=4510721265576184",
187 "strip3":"strip=4510721265576184",
188 "isBlocked":false,
189 "isDeleted":false
190 },
191 "targetState":"Activated",
192 "customerInfo":{
193 "customerId":24,
194 "accountgroupId":"27",
195 "customerUid":"d4119aee-c0b1-48ea-902f-82beed917270",
196 "mobileDeviceId":null,
197 "identifierId":null,
198 "applicationId":1
199 },
200 "eventCode":"OnCardActivation"
201 }
202 {{/code}}
203 {{/showhide}}
204 )))
205 |(% style="width:20%" %)(((
206 [[Card blocking/unblocking>>doc:Main.Integration.Ways_to_use_API.API_methods.Methods_of_public_api.Cards.WebHome||anchor="H41143B43E43A43844043E43243A4302F44043043743143B43E43A43844043E43243A43043A43044044244B"]]
207 )))|(% style="width:30%" %)(((
208 Events are enqueued when an LP Member’s card status changes between **blocked** and **unblocked**.
209
210 For blocking, the request includes the parameter **targetBlockState** set to **true**.
211
212 For unblocking, **targetBlockState** is set to **false**.
213 )))|(% style="width:15%" %)customer.card.changeBlockState|(% style="width:35%" %)(((
214 {{showhide showmessage="Show model" hidemessage="Hide model"}}
215 {{code language="json"}}
216 {
217 "targetBlockState": true,
218 "cardInfo": {
219 "cardId": 13,
220 "cardNumber": "020000008"
221 },
222 "customerInfo": {
223 "customerId": 18,
224 "accountgroupId":"125",
225 "customerUid": "c3b84d0c-ff92-4e62-b5df-fbd4ec8ad1e4",
226 "mobileDeviceId": null,
227 "identifierId": null,
228 "applicationId": null
229 },
230 "eventCode": "OnBlockCard",
231 "externalId": "73d812984ef44a9fb7f1200a41ac7aba",
232 "tryCount": 0,
233 "delaySecond": null,
234 "toErrorQueue": false
235 }
236 {{/code}}
237 {{/showhide}}
238 )))
239 |(% style="width:20%" %)[[Card deletion/restoration>>doc:Main.Integration.Ways_to_use_API.System_Api_Methods.Methods_of_system_api.CallCenter.WebHome||anchor="H42343443043B43543D43843543843243E44144144243043D43E43243B43543D43843543A43044044244B"]]|(% style="width:30%" %)(((
240 Events are enqueued upon **deletion** or **restoration** of a card.
241
242 For deletion, the request includes the parameter **targetDeleteState** set to **true**.
243
244 For restoration, **targetDeleteState** is set to **false**.
245 )))|(% style="width:15%" %)customer.card.changeDeleteState|(% style="width:35%" %)(((
246 {{showhide showmessage="Show model" hidemessage="Hide model"}}
247 {{code language="json"}}
248 {
249 "targetDeleteState":true,
250 "cardId":39,
251 "cardNumber":"4237436357530502",
252 "customerInfo":{
253 "customerId":42,
254 "accountgroupId":"48",
255 "customerUid":"9f7e9313-ab7b-4f2c-b888-293a3088dac3",
256 "mobileDeviceId":null,
257 "identifierId":null,
258 "applicationId":null
259 },
260 "eventCode":"OnDeleteCard"
261 }
262 {{/code}}
263 {{/showhide}}
264 )))
265 |(% style="width:20%" %)[[Card category change>>doc:Main.Integration.Ways_to_use_API.System_Api_Methods.Methods_of_system_api.CallCenter.WebHome||anchor="H42143C43543D43043A43044243543343E44043843843A43044044244B"]]|(% style="width:30%" %)The event is enqueued when an LP Member’s card category changes—for example, when the customer’s LP status is upgraded.|(% style="width:15%" %)сustomer.card.changeCategory|(% style="width:35%" %)(((
266 {{showhide showmessage="Show model" hidemessage="Hide model"}}
267 {{code language="json"}}
268 {
269 "cardId":39,
270 "cardNumber":"4237436357530502",
271 "newcardCategory":"VIP",
272 "customerInfo":{
273 "customerId":42,
274 "accountgroupId":"48",
275 "customerUid":"9f7e9313-ab7b-4f2c-b888-293a3088dac3",
276 "mobileDeviceId":null,
277 "identifierId":null,
278 "applicationId":null
279 },
280 "eventCode":"OnChangeCategoryCard"
281 }
282 {{/code}}
283 {{/showhide}}
284 )))
285 |(% style="width:20%" %)[[LP Member attribute update>>doc:Main.Integration.Ways_to_use_API.API_methods.Papi_examples.Customer_registration.Registration.WebHome]]|(% style="width:30%" %)(((
286 The event is enqueued when LP Member attributes are updated. These include:
287
288 * Public Offer acceptance;
289 * Phone number confirmation;
290 * Completion of application form, etc.
291 )))|(% style="width:15%" %)customer.attribute.update|(% style="width:35%" %)(((
292 {{showhide showmessage="Show model" hidemessage="Hide model"}}
293 {{code language="json"}}
294 {
295 "fromBatchOperation":false,
296 "attributeCode":"Phone",
297 "userAttributeType":"Notifier",
298 "attributeId":3,
299 "oldValue":null,
300 "newValue":"79540286267",
301 "changeDateTime":"2021-06-15T09:17:07Z",
302 "activityUid":"5c4b232b-aa2d-4bff-b393-9f60b9b8c1f1",
303 "eventCode":"OnCustomerAttributeUpdate",
304 "customerInfo":{
305 "customerId":126,
306 "accountgroupId":"130",
307 "customerCode":"155b341e-f24c-4dd4-b105-ab58ce766a24",
308 "mobileDeviceId":"",
309 "identifierId":null,
310 "applicationId":1
311 }
312 }
313 {{/code}}
314 {{/showhide}}
315 )))
316 |(% style="width:20%" %)[[Subscription status change>>doc:Main.Integration.Ways_to_use_API.System_Api_Methods.Methods_of_system_api.CallCenter.WebHome||anchor="H42343F44043043243B43543D43843543F43E43443F43844143A43043C438"]]|(% style="width:30%" %)The event is enqueued when an LP Member’s subscription status changes.|(% style="width:15%" %)customer.subscription.update|(% style="width:35%" %)(((
317 {{showhide showmessage="Show model" hidemessage="Hide model"}}
318 {{code language="json"}}
319 {
320 "mailingSubscriptionType":"Cashback",
321 "subscriptionTypeId":1,
322 "subscriptionTypeCode":"DiscountOperation",
323 "subscriptionTypeName":"Discount accrual notifications",
324 "subscriptionInfo":{
325 "mail":"Enabled",
326 "push":"Enabled",
327 "sms":"Enabled",
328 "viber":"Enabled",
329 "chatBot":"Enabled",
330 "socialNetworks":"Enabled"
331 },
332 "eventCode":"OnCustomerSubscriptionChange",
333 "customerInfo":{
334 "customerId":164,
335 "accountgroupId":"168",
336 "customerUid":"5c6e502a-a3e5-4106-a420-e49ed3c82d92",
337 "mobileDeviceId":null,
338 "identifierId":null,
339 "applicationId":null
340 }
341 }
342 {{/code}}
343 {{/showhide}}
344 )))
345 |(% style="width:20%" %)(((
346 [[Purchase>>doc:Main.Integration.API.Public_Api_Methods.Methods_of_public_api.Processing_methods.WebHome||anchor="HPurchaseconfirmation"]]
347 )))|(% style="width:30%" %)The event is enqueued when an LP Member makes a purchase.|(% style="width:15%" %)purchases.confirm.modelUpdate|(% style="width:35%" %)(((
348 {{showhide showmessage="Show model" hidemessage="Hide model"}}
349 {{code language="json"}}
350 {
351 "purchaseOperationInfo":{
352 "merchantId":1,
353 "merchantUid":"b984731d-4597-431f-a70b-61250392c6a3",
354 "merchantCode":null,
355 "deviceCode":"001010",
356 "dateTime":"2020-08-13T16:53:47Z",
357 "type":"PurchaseData",
358 "identity":"020000001",
359 "cashierIdentifier":"666",
360 "description":"Noname POS",
361 "locationId":null,
362 "partnerId":"d1f94a6c-0d33-4cf2-79ab-9248f3dd2547",
363 "brandId":"82013554-3dd3-4e08-5a73-e8354f45ffa6",
364 "purchaseData":{
365 "chequeNumber":"123",
366 "purchaseId":512,
367 "externalPurchaseId":"5226324048",
368 "amount":135.0000,
369 "currencyExternalId":"718ae69b-76be-413f-ad19-7b7e02e4a438",
370 "chequeItems":[
371 {
372 "positionId":1,
373 "description":"Aqva",
374 "quantity":10.0000,
375 "unit":null,
376 "amount":90.0000,
377 "itemId":"1"
378 },
379 {
380 "positionId":2,
381 "description":"Вода",
382 "quantity":1.0000,
383 "unit":null,
384 "amount":45.0000,
385 "itemId":"2"
386 }
387 ],
388 "withdraws":[
389 {
390 "moneyAmount":10.0000,
391 "description":null,
392 "positionInfo":{
393 "1":-6.6700,
394 "2":-3.3300
395 },
396 "amount":-10.0000,
397 "withdrawType":"Bonus",
398 "currencyExternalId":"1f24174f-bfdb-4019-a3e7-4fb088b4a7a7"
399 }
400 ],
401 "rewards":[
402 {
403 "offerExternalId":"4848fd95-b3ee-4594-9ba1-211bcf148c43",
404 "description":null,
405 "positionInfo":{
406 "1":10.0000,
407 "2":5.0000
408 },
409 "amount":15.0000,
410 "rewardType":"Discount",
411 "currencyExternalId":"718ae69b-76be-413f-ad19-7b7e02e4a438"
412 },
413 {
414 "offerExternalId":"4848fd95-b3ee-4594-9ba1-211bcf148c43",
415 "description":null,
416 "positionInfo":{
417 "1":41.6700,
418 "2":20.8400
419 },
420 "amount":62.5100,
421 "rewardType":"Bonus",
422 "currencyExternalId":"1f24174f-bfdb-4019-a3e7-4fb088b4a7a7"
423 }
424 ],
425 "isRefund":false,
426 "purchaseAttributes":[
427 ]
428 }
429 },
430 "customerInfo":{
431 "customerId":107,
432 "accountfroupId":"111",
433 "customerUid":"6c0b4b64-ebd8-4397-a6f5-d6f3eb32cd2c",
434 "mobileDeviceId":null,
435 "identifierId":null,
436 "applicationId":null
437 },
438 "eventCode":"OnPurchaseConfirm"
439 }
440 {{/code}}
441 {{/showhide}}
442 )))
443 |(% style="width:20%" %)(((
444 [[Purchase refund>>doc:Main.Integration.API.Public_Api_Methods.Methods_of_public_api.Processing_methods.WebHome||anchor="HPurchaserefund"]]
445 )))|(% style="width:30%" %)The event is enqueued when an LP Member refunds a purchase.|(% style="width:15%" %)purchases.refundModelUpdate|(% style="width:35%" %)(((
446 {{showhide showmessage="Show model" hidemessage="Hide model"}}
447 {{code language="json"}}
448 {
449 "refundedPurchaseViewModel":{
450 "refundedPurchaseId":512,
451 "refundedPurchaseExternalId":"5226324048"
452 },
453 "refundOperationInfo":{
454 "merchantId":1,
455 "merchantUid":"b984731d-4597-431f-a70b-61250392c6a3",
456 "merchantCode":null,
457 "deviceCode":"001010",
458 "dateTime":"2021-08-13T16:53:47Z",
459 "type":"PurchaseData",
460 "identity":"020000001",
461 "cashierIdentifier":"666",
462 "description":"Refund. Test store",
463 "locationId":null,
464 "partnerId":"d1f94a6c-0d33-4cf2-79ab-9248f3dd2547",
465 "brandId":"82013554-3dd3-4e08-5a73-e8354f45ffa6",
466 "purchaseData":{
467 "purchaseId":513,
468 "externalPurchaseId":"9335645011",
469 "amount":100.0000,
470 "currencyDeviceExternalId":"718ae69b-76be-413f-ad19-7b7e02e4a438",
471 "chequeItems":[
472 {
473 "positionId":1,
474 "description":"Aqva",
475 "quantity":10.0000,
476 "unit":null,
477 "amount":100.0000,
478 "itemId":"1"
479 }
480 ],
481 "withdraws":[
482 {
483 "moneyAmount":6.67,
484 "description":null,
485 "positionInfo":{
486 "1":-6.6700
487 },
488 "amount":-6.6700,
489 "withdrawType":"Bonus",
490 "currencyExternalId":"1f24174f-bfdb-4019-a3e7-4fb088b4a7a7"
491 }
492 ],
493 "rewards":[
494 {
495 "offerExternalId":null,
496 "description":null,
497 "positionInfo":{
498 "1":41.6700
499 },
500 "amount":41.6700,
501 "rewardType":"Bonus",
502 "currencyExternalId":"1f24174f-bfdb-4019-a3e7-4fb088b4a7a7"
503 }
504 ],
505 "isRefund":true,
506 "chequeNumber":"123",
507 "purchaseAttributes":[
508 ]
509 }
510 },
511 "customerInfo":{
512 "customerId":107,
513 "accountgroupId":"111",
514 "customerUid":"6c0b4b64-ebd8-4397-a6f5-d6f3eb32cd2c",
515 "mobileDeviceId":null,
516 "identifierId":null,
517 "applicationId":null
518 },
519 "eventCode":"OnPurchaseRefund"
520 }
521 {{/code}}
522 {{/showhide}}
523 )))
524
525 (% class="box" %)
526 (((
527 **See also:**
528
529 * [[Data transmission from DWH to Smart Communications>>doc:Main.Usage.Services_interaction.DWH_SMC.WebHome]]
530 )))