@managesome/eposmatic-toolkit 0.4.94 → 0.4.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ export const WORKER_ENDPOINTS = {
4
4
  UPDATE_CUSTOMER_INFO_ON_CREATE_ORDER: '/update-customer-info-on-create-order',
5
5
  UPDATE_CUSTOMER_INFO_ON_CANCEL_ORDER: '/update-customer-info-on-cancel-order',
6
6
  UPDATE_CUSTOMER_INFO_ON_SETTLE_ORDER: '/update-customer-info-on-settle-order',
7
+ SYNC_CUSTOMER_WALLET_ON_ORDER_UPDATE: '/sync-customer-wallet-on-order-update',
7
8
  CLEANUP_REWARDS_AND_ASSETS_ON_SETTLE_ORDER: '/cleanup-rewards-and-assets-on-settle-order',
8
9
  ADD_OFFER_FINGERPRINTS_ON_SETTLE_ORDER: '/add-offer-fingerprints-on-settle-order',
9
10
  RESERVE_CUSTOMER_REDEMPTIONS_FOR_ORDER: '/reserve-customer-redemptions-for-order',
@@ -3,6 +3,7 @@ export declare const WORKER_ENDPOINTS: {
3
3
  readonly UPDATE_CUSTOMER_INFO_ON_CREATE_ORDER: "/update-customer-info-on-create-order";
4
4
  readonly UPDATE_CUSTOMER_INFO_ON_CANCEL_ORDER: "/update-customer-info-on-cancel-order";
5
5
  readonly UPDATE_CUSTOMER_INFO_ON_SETTLE_ORDER: "/update-customer-info-on-settle-order";
6
+ readonly SYNC_CUSTOMER_WALLET_ON_ORDER_UPDATE: "/sync-customer-wallet-on-order-update";
6
7
  readonly CLEANUP_REWARDS_AND_ASSETS_ON_SETTLE_ORDER: "/cleanup-rewards-and-assets-on-settle-order";
7
8
  readonly ADD_OFFER_FINGERPRINTS_ON_SETTLE_ORDER: "/add-offer-fingerprints-on-settle-order";
8
9
  readonly RESERVE_CUSTOMER_REDEMPTIONS_FOR_ORDER: "/reserve-customer-redemptions-for-order";
@@ -7,6 +7,7 @@ exports.WORKER_ENDPOINTS = {
7
7
  UPDATE_CUSTOMER_INFO_ON_CREATE_ORDER: '/update-customer-info-on-create-order',
8
8
  UPDATE_CUSTOMER_INFO_ON_CANCEL_ORDER: '/update-customer-info-on-cancel-order',
9
9
  UPDATE_CUSTOMER_INFO_ON_SETTLE_ORDER: '/update-customer-info-on-settle-order',
10
+ SYNC_CUSTOMER_WALLET_ON_ORDER_UPDATE: '/sync-customer-wallet-on-order-update',
10
11
  CLEANUP_REWARDS_AND_ASSETS_ON_SETTLE_ORDER: '/cleanup-rewards-and-assets-on-settle-order',
11
12
  ADD_OFFER_FINGERPRINTS_ON_SETTLE_ORDER: '/add-offer-fingerprints-on-settle-order',
12
13
  RESERVE_CUSTOMER_REDEMPTIONS_FOR_ORDER: '/reserve-customer-redemptions-for-order',
@@ -28,12 +28,47 @@ export interface IWorker_UpdateCustomerInfoOnSettleOrder {
28
28
  customerUid?: string;
29
29
  brand_id: string;
30
30
  phoneNumber: string;
31
+ /**
32
+ * The order state before this update. The producer supplies it only when
33
+ * this same update changed `redeemed_offers`/`wallet_redemptions` and the
34
+ * order settles. With `isNewOrder === false`, the worker applies the
35
+ * out-of-wallet delta from this snapshot; the full settlement rewards are
36
+ * already applied from `order`.
37
+ */
38
+ previousOrder?: IOrder;
31
39
  }
32
40
  export interface IWorker_UpdateCustomerInfoOnCancelOrder {
33
41
  order: IOrder;
34
42
  brand_id: string;
35
43
  phoneNumber?: string;
36
44
  }
45
+ /**
46
+ * Order-update wallet sync. Fills the gap between the create-time
47
+ * out-of-wallet consumption and the settlement-time into-wallet grant: a
48
+ * `redeemed_offers` / `wallet_redemptions` change made through an order update
49
+ * must move the out-of-wallet delta (points, voucher pathway, cashback,
50
+ * gift cards) and update the redemption counters.
51
+ *
52
+ * The worker follows the same at-least-once semantics as the other customer
53
+ * sync workers: it does not dedupe a retried/duplicate Cloud Task. It never
54
+ * rejects the order update, and it no-ops for an already-settled order.
55
+ */
56
+ export interface IWorker_SyncCustomerWalletOnOrderUpdate {
57
+ order: IOrder;
58
+ previousOrder: IOrder;
59
+ brand_id: string;
60
+ phoneNumber: string;
61
+ previousPhoneNumber: string;
62
+ /** `updatedOrder.updatedAt` ISO string — used for observability/logging. */
63
+ updateVersion: string;
64
+ /**
65
+ * True when the order was ALREADY fully paid BEFORE this update. The
66
+ * producer does not dispatch this worker for such an update, and the worker
67
+ * no-ops if it receives one: post-settlement reward/offer/wallet changes are
68
+ * not entertained.
69
+ */
70
+ wasOrderAlreadySettled: boolean;
71
+ }
37
72
  export interface IWorker_AddOfferFingerprintsOnSettleOrder {
38
73
  order: IOrder;
39
74
  brand_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.4.94",
3
+ "version": "0.4.96",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",