@managesome/eposmatic-toolkit 0.4.93 → 0.4.95
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.
- package/esm/constants/WORKER_ENDPOINTS.js +1 -0
- package/esm/schemas/models/pending_uploads.js +3 -2
- package/lib/constants/WORKER_ENDPOINTS.d.ts +1 -0
- package/lib/constants/WORKER_ENDPOINTS.js +1 -0
- package/lib/helpers/types/workers.d.ts +26 -0
- package/lib/schemas/models/pending_uploads.d.ts +3 -2
- package/lib/schemas/models/pending_uploads.js +3 -2
- package/package.json +1 -1
|
@@ -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',
|
|
@@ -11,8 +11,9 @@ export const PENDING_UPLOADS_COLLECTION_NAME = 'pending_uploads';
|
|
|
11
11
|
* a late discard/confirm can still answer deterministically.
|
|
12
12
|
*
|
|
13
13
|
* A repeated `/sign` for the same deterministic path supersedes the row with
|
|
14
|
-
* `findOneAndReplace`,
|
|
15
|
-
*
|
|
14
|
+
* `findOneAndReplace`, resetting the attempt timestamps. `committed_at` is
|
|
15
|
+
* sticky once set: a path that has ever been referenced by a document must
|
|
16
|
+
* stay un-discardable even after a new upload signs the same path.
|
|
16
17
|
*/
|
|
17
18
|
export const PendingUploadSchema = new Schema({
|
|
18
19
|
path: {
|
|
@@ -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',
|
|
@@ -34,6 +34,32 @@ export interface IWorker_UpdateCustomerInfoOnCancelOrder {
|
|
|
34
34
|
brand_id: string;
|
|
35
35
|
phoneNumber?: string;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Order-update wallet sync. Fills the gap between the create-time
|
|
39
|
+
* out-of-wallet consumption and the settlement-time into-wallet grant: a
|
|
40
|
+
* `redeemed_offers` / `wallet_redemptions` change made through an order update
|
|
41
|
+
* must move the out-of-wallet delta (points, voucher pathway, cashback,
|
|
42
|
+
* gift cards) and update the redemption counters.
|
|
43
|
+
*
|
|
44
|
+
* The worker is idempotent per `(order._id, updateVersion)` and never rejects
|
|
45
|
+
* the order update.
|
|
46
|
+
*/
|
|
47
|
+
export interface IWorker_SyncCustomerWalletOnOrderUpdate {
|
|
48
|
+
order: IOrder;
|
|
49
|
+
previousOrder: IOrder;
|
|
50
|
+
brand_id: string;
|
|
51
|
+
phoneNumber: string;
|
|
52
|
+
previousPhoneNumber: string;
|
|
53
|
+
/** `updatedOrder.updatedAt` ISO string — the idempotency version. */
|
|
54
|
+
updateVersion: string;
|
|
55
|
+
/**
|
|
56
|
+
* True when the order was ALREADY fully paid BEFORE this update. The
|
|
57
|
+
* settlement worker only grants into-wallet rewards for an order that was
|
|
58
|
+
* not settled yet; an already-settled order edited afterwards has no settle
|
|
59
|
+
* run, so this worker must apply the added into-wallet delta itself.
|
|
60
|
+
*/
|
|
61
|
+
wasOrderAlreadySettled: boolean;
|
|
62
|
+
}
|
|
37
63
|
export interface IWorker_AddOfferFingerprintsOnSettleOrder {
|
|
38
64
|
order: IOrder;
|
|
39
65
|
brand_id: string;
|
|
@@ -9,8 +9,9 @@ export declare const PENDING_UPLOADS_COLLECTION_NAME = "pending_uploads";
|
|
|
9
9
|
* a late discard/confirm can still answer deterministically.
|
|
10
10
|
*
|
|
11
11
|
* A repeated `/sign` for the same deterministic path supersedes the row with
|
|
12
|
-
* `findOneAndReplace`,
|
|
13
|
-
*
|
|
12
|
+
* `findOneAndReplace`, resetting the attempt timestamps. `committed_at` is
|
|
13
|
+
* sticky once set: a path that has ever been referenced by a document must
|
|
14
|
+
* stay un-discardable even after a new upload signs the same path.
|
|
14
15
|
*/
|
|
15
16
|
export declare const PendingUploadSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
16
17
|
collection: string;
|
|
@@ -14,8 +14,9 @@ exports.PENDING_UPLOADS_COLLECTION_NAME = 'pending_uploads';
|
|
|
14
14
|
* a late discard/confirm can still answer deterministically.
|
|
15
15
|
*
|
|
16
16
|
* A repeated `/sign` for the same deterministic path supersedes the row with
|
|
17
|
-
* `findOneAndReplace`,
|
|
18
|
-
*
|
|
17
|
+
* `findOneAndReplace`, resetting the attempt timestamps. `committed_at` is
|
|
18
|
+
* sticky once set: a path that has ever been referenced by a document must
|
|
19
|
+
* stay un-discardable even after a new upload signs the same path.
|
|
19
20
|
*/
|
|
20
21
|
exports.PendingUploadSchema = new mongoose_1.Schema({
|
|
21
22
|
path: {
|