@kshon/loyalty-plugin 2.14.2
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/.medusa/server/src/admin/index.js +69052 -0
- package/.medusa/server/src/admin/index.mjs +69034 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/orders/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/orders/route.js +28 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/route.js +41 -0
- package/.medusa/server/src/api/admin/gift-cards/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/admin/gift-cards/middlewares.js +46 -0
- package/.medusa/server/src/api/admin/gift-cards/query-config.d.ts +14 -0
- package/.medusa/server/src/api/admin/gift-cards/query-config.js +32 -0
- package/.medusa/server/src/api/admin/gift-cards/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/gift-cards/route.js +42 -0
- package/.medusa/server/src/api/admin/gift-cards/validators.d.ts +139 -0
- package/.medusa/server/src/api/admin/gift-cards/validators.js +56 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/credit/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/credit/route.js +30 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/route.js +19 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/transactions/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/transactions/route.js +23 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/middlewares.js +46 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/query-config.d.ts +18 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/query-config.js +44 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/route.js +52 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/validators.d.ts +142 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/validators.js +45 -0
- package/.medusa/server/src/api/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/middlewares.js +18 -0
- package/.medusa/server/src/api/store/carts/[id]/gift-cards/route.d.ts +5 -0
- package/.medusa/server/src/api/store/carts/[id]/gift-cards/route.js +43 -0
- package/.medusa/server/src/api/store/carts/[id]/store-credits/route.d.ts +4 -0
- package/.medusa/server/src/api/store/carts/[id]/store-credits/route.js +24 -0
- package/.medusa/server/src/api/store/carts/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/store/carts/middlewares.js +35 -0
- package/.medusa/server/src/api/store/carts/query-config.d.ts +4 -0
- package/.medusa/server/src/api/store/carts/query-config.js +9 -0
- package/.medusa/server/src/api/store/carts/validators.d.ts +13 -0
- package/.medusa/server/src/api/store/carts/validators.js +14 -0
- package/.medusa/server/src/api/store/gift-cards/[idOrCode]/route.d.ts +3 -0
- package/.medusa/server/src/api/store/gift-cards/[idOrCode]/route.js +24 -0
- package/.medusa/server/src/api/store/gift-cards/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/store/gift-cards/middlewares.js +16 -0
- package/.medusa/server/src/api/store/gift-cards/query-config.d.ts +9 -0
- package/.medusa/server/src/api/store/gift-cards/query-config.js +23 -0
- package/.medusa/server/src/api/store/gift-cards/validators.d.ts +7 -0
- package/.medusa/server/src/api/store/gift-cards/validators.js +8 -0
- package/.medusa/server/src/api/store/store-credit-accounts/[id]/route.d.ts +3 -0
- package/.medusa/server/src/api/store/store-credit-accounts/[id]/route.js +31 -0
- package/.medusa/server/src/api/store/store-credit-accounts/claim/route.d.ts +3 -0
- package/.medusa/server/src/api/store/store-credit-accounts/claim/route.js +25 -0
- package/.medusa/server/src/api/store/store-credit-accounts/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/store/store-credit-accounts/middlewares.js +36 -0
- package/.medusa/server/src/api/store/store-credit-accounts/query-config.d.ts +9 -0
- package/.medusa/server/src/api/store/store-credit-accounts/query-config.js +24 -0
- package/.medusa/server/src/api/store/store-credit-accounts/route.d.ts +3 -0
- package/.medusa/server/src/api/store/store-credit-accounts/route.js +40 -0
- package/.medusa/server/src/api/store/store-credit-accounts/validators.d.ts +44 -0
- package/.medusa/server/src/api/store/store-credit-accounts/validators.js +19 -0
- package/.medusa/server/src/links/cart-gift-cards-link.d.ts +2 -0
- package/.medusa/server/src/links/cart-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/customer-store-credit-account-link.d.ts +1 -0
- package/.medusa/server/src/links/customer-store-credit-account-link.js +13 -0
- package/.medusa/server/src/links/gift-card-store-credit.d.ts +2 -0
- package/.medusa/server/src/links/gift-card-store-credit.js +10 -0
- package/.medusa/server/src/links/order-gift-cards-link.d.ts +2 -0
- package/.medusa/server/src/links/order-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/order-line-item-gift-card-link.d.ts +1 -0
- package/.medusa/server/src/links/order-line-item-gift-card-link.js +19 -0
- package/.medusa/server/src/modules/loyalty/index.d.ts +21 -0
- package/.medusa/server/src/modules/loyalty/index.js +12 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250123130553.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250123130553.js +17 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250127174331.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250127174331.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141026.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141026.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141429.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141429.js +14 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206144714.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206144714.js +14 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250326095923.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250326095923.js +16 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250617080328.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250617080328.js +20 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card.d.ts +18 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card.js +18 -0
- package/.medusa/server/src/modules/loyalty/models/index.d.ts +1 -0
- package/.medusa/server/src/modules/loyalty/models/index.js +9 -0
- package/.medusa/server/src/modules/loyalty/service.d.ts +21 -0
- package/.medusa/server/src/modules/loyalty/service.js +13 -0
- package/.medusa/server/src/modules/store-credit/index.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/index.js +12 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250129115518.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250129115518.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130213237.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130213237.js +18 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130220640.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130220640.js +19 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250131205753.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250131205753.js +14 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250520081315.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250520081315.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250626081315.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250626081315.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250722080351.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250722080351.js +27 -0
- package/.medusa/server/src/modules/store-credit/models/account-transaction.d.ts +28 -0
- package/.medusa/server/src/modules/store-credit/models/account-transaction.js +21 -0
- package/.medusa/server/src/modules/store-credit/models/index.d.ts +2 -0
- package/.medusa/server/src/modules/store-credit/models/index.js +11 -0
- package/.medusa/server/src/modules/store-credit/models/store-credit-account.d.ts +27 -0
- package/.medusa/server/src/modules/store-credit/models/store-credit-account.js +27 -0
- package/.medusa/server/src/modules/store-credit/service.d.ts +29 -0
- package/.medusa/server/src/modules/store-credit/service.js +253 -0
- package/.medusa/server/src/subscribers/create-gift-card.d.ts +5 -0
- package/.medusa/server/src/subscribers/create-gift-card.js +53 -0
- package/.medusa/server/src/types/cart/index.d.ts +12 -0
- package/.medusa/server/src/types/cart/index.js +3 -0
- package/.medusa/server/src/types/http/gift-card.d.ts +42 -0
- package/.medusa/server/src/types/http/gift-card.js +3 -0
- package/.medusa/server/src/types/http/index.d.ts +3 -0
- package/.medusa/server/src/types/http/index.js +20 -0
- package/.medusa/server/src/types/http/store-credit-account.d.ts +60 -0
- package/.medusa/server/src/types/http/store-credit-account.js +3 -0
- package/.medusa/server/src/types/http/transaction.d.ts +19 -0
- package/.medusa/server/src/types/http/transaction.js +3 -0
- package/.medusa/server/src/types/index.d.ts +4 -0
- package/.medusa/server/src/types/index.js +21 -0
- package/.medusa/server/src/types/loyalty/index.d.ts +3 -0
- package/.medusa/server/src/types/loyalty/index.js +20 -0
- package/.medusa/server/src/types/loyalty/module.d.ts +151 -0
- package/.medusa/server/src/types/loyalty/module.js +12 -0
- package/.medusa/server/src/types/loyalty/service.d.ts +168 -0
- package/.medusa/server/src/types/loyalty/service.js +3 -0
- package/.medusa/server/src/types/loyalty/workflows.d.ts +3 -0
- package/.medusa/server/src/types/loyalty/workflows.js +3 -0
- package/.medusa/server/src/types/modules.d.ts +6 -0
- package/.medusa/server/src/types/modules.js +12 -0
- package/.medusa/server/src/types/store-credit/index.d.ts +2 -0
- package/.medusa/server/src/types/store-credit/index.js +19 -0
- package/.medusa/server/src/types/store-credit/module.d.ts +290 -0
- package/.medusa/server/src/types/store-credit/module.js +13 -0
- package/.medusa/server/src/types/store-credit/service.d.ts +325 -0
- package/.medusa/server/src/types/store-credit/service.js +3 -0
- package/.medusa/server/src/utils/code-generator.d.ts +1 -0
- package/.medusa/server/src/utils/code-generator.js +32 -0
- package/.medusa/server/src/workflows/carts/index.d.ts +5 -0
- package/.medusa/server/src/workflows/carts/index.js +22 -0
- package/.medusa/server/src/workflows/carts/steps/validate-gift-card-balances.d.ts +37 -0
- package/.medusa/server/src/workflows/carts/steps/validate-gift-card-balances.js +36 -0
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.d.ts +118 -0
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.js +179 -0
- package/.medusa/server/src/workflows/carts/workflows/add-store-credits-to-cart.d.ts +88 -0
- package/.medusa/server/src/workflows/carts/workflows/add-store-credits-to-cart.js +134 -0
- package/.medusa/server/src/workflows/carts/workflows/confirm-cart-credit-lines.d.ts +68 -0
- package/.medusa/server/src/workflows/carts/workflows/confirm-cart-credit-lines.js +110 -0
- package/.medusa/server/src/workflows/carts/workflows/refresh-cart-gift-cards.d.ts +30 -0
- package/.medusa/server/src/workflows/carts/workflows/refresh-cart-gift-cards.js +154 -0
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.d.ts +103 -0
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.js +124 -0
- package/.medusa/server/src/workflows/common/steps/validate-presence-of.d.ts +29 -0
- package/.medusa/server/src/workflows/common/steps/validate-presence-of.js +22 -0
- package/.medusa/server/src/workflows/gift-cards/index.d.ts +9 -0
- package/.medusa/server/src/workflows/gift-cards/index.js +26 -0
- package/.medusa/server/src/workflows/gift-cards/steps/create-gift-cards.d.ts +20 -0
- package/.medusa/server/src/workflows/gift-cards/steps/create-gift-cards.js +38 -0
- package/.medusa/server/src/workflows/gift-cards/steps/delete-gift-cards.d.ts +17 -0
- package/.medusa/server/src/workflows/gift-cards/steps/delete-gift-cards.js +24 -0
- package/.medusa/server/src/workflows/gift-cards/steps/retrieve-gift-card-balance.d.ts +32 -0
- package/.medusa/server/src/workflows/gift-cards/steps/retrieve-gift-card-balance.js +34 -0
- package/.medusa/server/src/workflows/gift-cards/steps/update-gift-cards.d.ts +19 -0
- package/.medusa/server/src/workflows/gift-cards/steps/update-gift-cards.js +41 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/claim-gift-card.d.ts +65 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/claim-gift-card.js +101 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/create-gift-cards.d.ts +36 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/create-gift-cards.js +88 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/delete-gift-card.d.ts +28 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/delete-gift-card.js +34 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/redeem-gift-card.d.ts +60 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/redeem-gift-card.js +129 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/update-gift-cards.d.ts +28 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/update-gift-cards.js +31 -0
- package/.medusa/server/src/workflows/hooks/after-order-created.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/after-order-created.js +31 -0
- package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.js +32 -0
- package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.js +26 -0
- package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.js +27 -0
- package/.medusa/server/src/workflows/index.d.ts +3 -0
- package/.medusa/server/src/workflows/index.js +20 -0
- package/.medusa/server/src/workflows/orders/index.d.ts +2 -0
- package/.medusa/server/src/workflows/orders/index.js +19 -0
- package/.medusa/server/src/workflows/orders/workflows/link-gift-cards-to-order.d.ts +34 -0
- package/.medusa/server/src/workflows/orders/workflows/link-gift-cards-to-order.js +75 -0
- package/.medusa/server/src/workflows/orders/workflows/refund-credit-lines.d.ts +88 -0
- package/.medusa/server/src/workflows/orders/workflows/refund-credit-lines.js +131 -0
- package/.medusa/server/src/workflows/store-credit/index.d.ts +8 -0
- package/.medusa/server/src/workflows/store-credit/index.js +25 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-store-credit-accounts.d.ts +19 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-store-credit-accounts.js +37 -0
- package/.medusa/server/src/workflows/store-credit/steps/credit-account.d.ts +20 -0
- package/.medusa/server/src/workflows/store-credit/steps/credit-account.js +31 -0
- package/.medusa/server/src/workflows/store-credit/steps/debit-account.d.ts +20 -0
- package/.medusa/server/src/workflows/store-credit/steps/debit-account.js +31 -0
- package/.medusa/server/src/workflows/store-credit/workflows/claim-store-credit-account.d.ts +91 -0
- package/.medusa/server/src/workflows/store-credit/workflows/claim-store-credit-account.js +170 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-store-credit-accounts.d.ts +50 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-store-credit-accounts.js +50 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-accounts.d.ts +29 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-accounts.js +32 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-store-credit-account.d.ts +29 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-store-credit-account.js +67 -0
- package/.medusa/server/src/workflows/store-credit/workflows/debit-accounts.d.ts +29 -0
- package/.medusa/server/src/workflows/store-credit/workflows/debit-accounts.js +32 -0
- package/.medusa/server/tailwind.config.d.ts +3 -0
- package/.medusa/server/tailwind.config.js +12 -0
- package/README.md +62 -0
- package/package.json +107 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { CustomerDTO } from "@medusajs/framework/types";
|
|
2
|
+
/**
|
|
3
|
+
* The status of a gift card.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum GiftCardStatus {
|
|
6
|
+
PENDING = "pending",
|
|
7
|
+
REDEEMED = "redeemed"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A union of the possible gift card status string values.
|
|
11
|
+
*/
|
|
12
|
+
export type GiftCardStatusValues = "pending" | "redeemed";
|
|
13
|
+
/**
|
|
14
|
+
* Represents a gift card in the Loyalty module.
|
|
15
|
+
*/
|
|
16
|
+
export type ModuleGiftCard = {
|
|
17
|
+
/**
|
|
18
|
+
* The gift card's ID.
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* The unique redemption code for the gift card.
|
|
23
|
+
*/
|
|
24
|
+
code: string;
|
|
25
|
+
/**
|
|
26
|
+
* The current status of the gift card.
|
|
27
|
+
*/
|
|
28
|
+
status: GiftCardStatus;
|
|
29
|
+
/**
|
|
30
|
+
* The monetary value of the gift card.
|
|
31
|
+
*/
|
|
32
|
+
value: number;
|
|
33
|
+
/**
|
|
34
|
+
* The three-letter ISO currency code of the gift card's value.
|
|
35
|
+
*/
|
|
36
|
+
currency_code: string;
|
|
37
|
+
/**
|
|
38
|
+
* The ID of the customer who owns this gift card.
|
|
39
|
+
*/
|
|
40
|
+
customer_id: string;
|
|
41
|
+
/**
|
|
42
|
+
* The customer who owns this gift card.
|
|
43
|
+
*/
|
|
44
|
+
customer: CustomerDTO;
|
|
45
|
+
/**
|
|
46
|
+
* The ID of the resource this gift card was created from (e.g. an order ID).
|
|
47
|
+
*/
|
|
48
|
+
reference_id: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* An optional note about the gift card.
|
|
51
|
+
*/
|
|
52
|
+
note: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* The resource type this gift card references (e.g. "order").
|
|
55
|
+
*/
|
|
56
|
+
reference: string | null;
|
|
57
|
+
/**
|
|
58
|
+
* The date the gift card expires, or null if it does not expire.
|
|
59
|
+
*/
|
|
60
|
+
expires_at: string | null;
|
|
61
|
+
/**
|
|
62
|
+
* The date the gift card was created.
|
|
63
|
+
*/
|
|
64
|
+
created_at: string;
|
|
65
|
+
/**
|
|
66
|
+
* The date the gift card was last updated.
|
|
67
|
+
*/
|
|
68
|
+
updated_at: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The data required to create a gift card.
|
|
72
|
+
*/
|
|
73
|
+
export type ModuleCreateGiftCard = {
|
|
74
|
+
/**
|
|
75
|
+
* The unique redemption code for the gift card. If not provided, one is auto-generated.
|
|
76
|
+
*/
|
|
77
|
+
code: string;
|
|
78
|
+
/**
|
|
79
|
+
* The monetary value of the gift card.
|
|
80
|
+
*/
|
|
81
|
+
value: number;
|
|
82
|
+
/**
|
|
83
|
+
* The three-letter ISO currency code for the gift card's value.
|
|
84
|
+
*
|
|
85
|
+
* @example usd
|
|
86
|
+
*/
|
|
87
|
+
currency_code: string;
|
|
88
|
+
/**
|
|
89
|
+
* The expiration date of the gift card, or null if it does not expire.
|
|
90
|
+
*/
|
|
91
|
+
expires_at: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* The ID of the resource this gift card is associated with.
|
|
94
|
+
*/
|
|
95
|
+
reference_id: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* The resource type this gift card is associated with (e.g. "order").
|
|
98
|
+
*/
|
|
99
|
+
reference: string | null;
|
|
100
|
+
/**
|
|
101
|
+
* The ID of the line item this gift card was purchased as.
|
|
102
|
+
*/
|
|
103
|
+
line_item_id: string;
|
|
104
|
+
/**
|
|
105
|
+
* The ID of the customer to associate with the gift card.
|
|
106
|
+
*/
|
|
107
|
+
customer_id: string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Custom key-value pairs to attach to the gift card.
|
|
110
|
+
*/
|
|
111
|
+
metadata: Record<string, unknown>;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* The data required to update a gift card.
|
|
115
|
+
*/
|
|
116
|
+
export type ModuleUpdateGiftCard = {
|
|
117
|
+
/**
|
|
118
|
+
* The ID of the gift card to update.
|
|
119
|
+
*/
|
|
120
|
+
id: string;
|
|
121
|
+
/**
|
|
122
|
+
* The updated monetary value of the gift card.
|
|
123
|
+
*/
|
|
124
|
+
value?: number;
|
|
125
|
+
/**
|
|
126
|
+
* The updated status of the gift card.
|
|
127
|
+
*/
|
|
128
|
+
status?: GiftCardStatus;
|
|
129
|
+
/**
|
|
130
|
+
* An updated note about the gift card.
|
|
131
|
+
*/
|
|
132
|
+
note?: string | null;
|
|
133
|
+
/**
|
|
134
|
+
* The updated three-letter ISO currency code.
|
|
135
|
+
*
|
|
136
|
+
* @example usd
|
|
137
|
+
*/
|
|
138
|
+
currency_code?: string;
|
|
139
|
+
/**
|
|
140
|
+
* The updated expiration date, or null to remove the expiration.
|
|
141
|
+
*/
|
|
142
|
+
expires_at?: string | null;
|
|
143
|
+
/**
|
|
144
|
+
* The updated ID of the customer associated with the gift card.
|
|
145
|
+
*/
|
|
146
|
+
customer_id?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Updated custom key-value pairs attached to the gift card.
|
|
149
|
+
*/
|
|
150
|
+
metadata?: Record<string, unknown>;
|
|
151
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GiftCardStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The status of a gift card.
|
|
6
|
+
*/
|
|
7
|
+
var GiftCardStatus;
|
|
8
|
+
(function (GiftCardStatus) {
|
|
9
|
+
GiftCardStatus["PENDING"] = "pending";
|
|
10
|
+
GiftCardStatus["REDEEMED"] = "redeemed";
|
|
11
|
+
})(GiftCardStatus || (exports.GiftCardStatus = GiftCardStatus = {}));
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL3R5cGVzL2xveWFsdHkvbW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUVBOztHQUVHO0FBQ0gsSUFBWSxjQUdYO0FBSEQsV0FBWSxjQUFjO0lBQ3hCLHFDQUFtQixDQUFBO0lBQ25CLHVDQUFxQixDQUFBO0FBQ3ZCLENBQUMsRUFIVyxjQUFjLDhCQUFkLGNBQWMsUUFHekIifQ==
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { BaseFilterable, Context, FindConfig, IModuleService } from "@medusajs/types";
|
|
2
|
+
import { ModuleCreateGiftCard, ModuleGiftCard, ModuleUpdateGiftCard } from "./module";
|
|
3
|
+
/**
|
|
4
|
+
* The filters to apply when retrieving gift cards.
|
|
5
|
+
*/
|
|
6
|
+
export interface ModuleGiftCardFilters extends BaseFilterable<ModuleGiftCardFilters> {
|
|
7
|
+
/**
|
|
8
|
+
* A search term to filter gift cards by.
|
|
9
|
+
*/
|
|
10
|
+
q?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Filter by gift card ID(s).
|
|
13
|
+
*/
|
|
14
|
+
id?: string | string[];
|
|
15
|
+
/**
|
|
16
|
+
* Filter by gift card code(s).
|
|
17
|
+
*/
|
|
18
|
+
code?: string | string[];
|
|
19
|
+
/**
|
|
20
|
+
* Filter by reference resource ID(s).
|
|
21
|
+
*/
|
|
22
|
+
reference_id?: string | string[];
|
|
23
|
+
/**
|
|
24
|
+
* Filter by reference resource type(s).
|
|
25
|
+
*/
|
|
26
|
+
reference?: string | string[];
|
|
27
|
+
/**
|
|
28
|
+
* Filter by gift card status(es).
|
|
29
|
+
*/
|
|
30
|
+
status?: string | string[];
|
|
31
|
+
/**
|
|
32
|
+
* Filter by currency code(s).
|
|
33
|
+
*/
|
|
34
|
+
currency_code?: string | string[];
|
|
35
|
+
/**
|
|
36
|
+
* The field to order results by.
|
|
37
|
+
*/
|
|
38
|
+
order?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The main service interface for the Loyalty Module.
|
|
42
|
+
*/
|
|
43
|
+
export interface ILoyaltyModuleService extends IModuleService {
|
|
44
|
+
/**
|
|
45
|
+
* This method creates a gift card.
|
|
46
|
+
*
|
|
47
|
+
* @param {ModuleCreateGiftCard} data - The gift card to create.
|
|
48
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
49
|
+
* @returns {Promise<ModuleGiftCard>} The created gift card.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const giftCard = await loyaltyModuleService.createGiftCards({
|
|
53
|
+
* code: "UNIQUECODE123",
|
|
54
|
+
* value: 100,
|
|
55
|
+
* currency_code: "usd",
|
|
56
|
+
* line_item_id: "li_123",
|
|
57
|
+
* customer_id: "cust_123",
|
|
58
|
+
* expires_at: null,
|
|
59
|
+
* reference_id: "order_123",
|
|
60
|
+
* reference: "order",
|
|
61
|
+
* metadata: {},
|
|
62
|
+
* })
|
|
63
|
+
*/
|
|
64
|
+
createGiftCards(data: ModuleCreateGiftCard, sharedContext?: Context): Promise<ModuleGiftCard>;
|
|
65
|
+
/**
|
|
66
|
+
* This method creates gift cards.
|
|
67
|
+
*
|
|
68
|
+
* @param {ModuleCreateGiftCard[]} data - The gift cards to create.
|
|
69
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
70
|
+
* @returns {Promise<ModuleGiftCard[]>} The created gift cards.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* const giftCards = await loyaltyModuleService.createGiftCards([
|
|
74
|
+
* {
|
|
75
|
+
* code: "UNIQUECODE123",
|
|
76
|
+
* value: 100,
|
|
77
|
+
* currency_code: "usd",
|
|
78
|
+
* line_item_id: "li_123",
|
|
79
|
+
* customer_id: "cust_123",
|
|
80
|
+
* expires_at: null,
|
|
81
|
+
* reference_id: "order_123",
|
|
82
|
+
* reference: "order",
|
|
83
|
+
* metadata: {},
|
|
84
|
+
* },
|
|
85
|
+
* ])
|
|
86
|
+
*/
|
|
87
|
+
createGiftCards(data: ModuleCreateGiftCard[], sharedContext?: Context): Promise<ModuleGiftCard[]>;
|
|
88
|
+
/**
|
|
89
|
+
* This method updates a gift card.
|
|
90
|
+
*
|
|
91
|
+
* @param {ModuleUpdateGiftCard} data - The attributes to update in the gift card.
|
|
92
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
93
|
+
* @returns {Promise<ModuleGiftCard>} The updated gift card.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* const giftCard = await loyaltyModuleService.updateGiftCards({
|
|
97
|
+
* id: "gc_123",
|
|
98
|
+
* value: 200,
|
|
99
|
+
* })
|
|
100
|
+
*/
|
|
101
|
+
updateGiftCards(data: ModuleUpdateGiftCard, sharedContext?: Context): Promise<ModuleGiftCard>;
|
|
102
|
+
/**
|
|
103
|
+
* This method updates gift cards.
|
|
104
|
+
*
|
|
105
|
+
* @param {ModuleUpdateGiftCard[]} data - The attributes to update in the gift cards.
|
|
106
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
107
|
+
* @returns {Promise<ModuleGiftCard[]>} The updated gift cards.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* const giftCards = await loyaltyModuleService.updateGiftCards([
|
|
111
|
+
* {
|
|
112
|
+
* id: "gc_123",
|
|
113
|
+
* value: 200,
|
|
114
|
+
* },
|
|
115
|
+
* ])
|
|
116
|
+
*/
|
|
117
|
+
updateGiftCards(data: ModuleUpdateGiftCard[], sharedContext?: Context): Promise<ModuleGiftCard[]>;
|
|
118
|
+
/**
|
|
119
|
+
* This method retrieves a paginated list of gift cards based on optional filters and configuration.
|
|
120
|
+
*
|
|
121
|
+
* @param {ModuleGiftCardFilters} filters - The filters to apply on the retrieved gift cards.
|
|
122
|
+
* @param {FindConfig<ModuleGiftCard>} config - The configurations determining how the gift cards are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a gift card.
|
|
123
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
124
|
+
* @returns {Promise<ModuleGiftCard[]>} The list of gift cards.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* To retrieve a list of gift cards using their IDs:
|
|
128
|
+
*
|
|
129
|
+
* ```ts
|
|
130
|
+
* const giftCards = await loyaltyModuleService.listGiftCards({
|
|
131
|
+
* id: ["gc_123", "gc_456"],
|
|
132
|
+
* })
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* const giftCards = await loyaltyModuleService.listGiftCards(
|
|
139
|
+
* { id: ["gc_123", "gc_456"] },
|
|
140
|
+
* { take: 20, skip: 2 }
|
|
141
|
+
* )
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
listGiftCards(filters?: ModuleGiftCardFilters, config?: FindConfig<ModuleGiftCard>, sharedContext?: Context): Promise<ModuleGiftCard[]>;
|
|
145
|
+
/**
|
|
146
|
+
* This method retrieves a gift card by its ID.
|
|
147
|
+
*
|
|
148
|
+
* @param {string} id - The ID of the gift card to retrieve.
|
|
149
|
+
* @param {FindConfig<ModuleGiftCard>} config - The configurations determining how the gift card is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a gift card.
|
|
150
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
151
|
+
* @returns {Promise<ModuleGiftCard>} The retrieved gift card.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* const giftCard = await loyaltyModuleService.retrieveGiftCard("gc_123")
|
|
155
|
+
*/
|
|
156
|
+
retrieveGiftCard(id: string, config?: FindConfig<ModuleGiftCard>, sharedContext?: Context): Promise<ModuleGiftCard>;
|
|
157
|
+
/**
|
|
158
|
+
* This method deletes gift cards by their IDs.
|
|
159
|
+
*
|
|
160
|
+
* @param {string[]} ids - The IDs of the gift cards to delete.
|
|
161
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
162
|
+
* @returns {Promise<void>} Resolves when the gift cards are deleted successfully.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* await loyaltyModuleService.deleteGiftCards(["gc_123", "gc_456"])
|
|
166
|
+
*/
|
|
167
|
+
deleteGiftCards(ids: string[], sharedContext?: Context): Promise<void>;
|
|
168
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy90eXBlcy9sb3lhbHR5L3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2Zsb3dzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL3R5cGVzL2xveWFsdHkvd29ya2Zsb3dzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoyaltyEvents = exports.PluginModule = void 0;
|
|
4
|
+
var PluginModule;
|
|
5
|
+
(function (PluginModule) {
|
|
6
|
+
PluginModule["LOYALTY"] = "loyalty";
|
|
7
|
+
PluginModule["STORE_CREDIT"] = "store_credit";
|
|
8
|
+
})(PluginModule || (exports.PluginModule = PluginModule = {}));
|
|
9
|
+
var LoyaltyEvents;
|
|
10
|
+
(function (LoyaltyEvents) {
|
|
11
|
+
})(LoyaltyEvents || (exports.LoyaltyEvents = LoyaltyEvents = {}));
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy90eXBlcy9tb2R1bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLElBQVksWUFHWDtBQUhELFdBQVksWUFBWTtJQUN0QixtQ0FBbUIsQ0FBQTtJQUNuQiw2Q0FBNkIsQ0FBQTtBQUMvQixDQUFDLEVBSFcsWUFBWSw0QkFBWixZQUFZLFFBR3ZCO0FBRUQsSUFBWSxhQUFnQjtBQUE1QixXQUFZLGFBQWE7QUFBRSxDQUFDLEVBQWhCLGFBQWEsNkJBQWIsYUFBYSxRQUFHIn0=
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./module"), exports);
|
|
18
|
+
__exportStar(require("./service"), exports);
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvdHlwZXMvc3RvcmUtY3JlZGl0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwyQ0FBeUI7QUFDekIsNENBQTBCIn0=
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { BigNumberValue } from "@medusajs/framework/types";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a store credit account in the Store Credit Module.
|
|
4
|
+
*/
|
|
5
|
+
export type ModuleStoreCreditAccount = {
|
|
6
|
+
/**
|
|
7
|
+
* The store credit account's ID.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the customer who owns this account, if any.
|
|
12
|
+
*/
|
|
13
|
+
customer_id?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The unique code that identifies this account, used for anonymous or gift card accounts.
|
|
16
|
+
*/
|
|
17
|
+
code?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The three-letter ISO currency code of the account's balance.
|
|
20
|
+
*
|
|
21
|
+
* @example usd
|
|
22
|
+
*/
|
|
23
|
+
currency_code: string;
|
|
24
|
+
/**
|
|
25
|
+
* The total amount credited to this account.
|
|
26
|
+
*/
|
|
27
|
+
credits: BigNumberValue;
|
|
28
|
+
/**
|
|
29
|
+
* The total amount debited from this account.
|
|
30
|
+
*/
|
|
31
|
+
debits: BigNumberValue;
|
|
32
|
+
/**
|
|
33
|
+
* The current balance of this account (credits minus debits).
|
|
34
|
+
*/
|
|
35
|
+
balance: BigNumberValue;
|
|
36
|
+
/**
|
|
37
|
+
* Custom key-value pairs attached to this account.
|
|
38
|
+
*/
|
|
39
|
+
metadata: Record<string, unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* The date the account was created.
|
|
42
|
+
*/
|
|
43
|
+
created_at: string;
|
|
44
|
+
/**
|
|
45
|
+
* The date the account was last updated.
|
|
46
|
+
*/
|
|
47
|
+
updated_at: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The data required to create a store credit account.
|
|
51
|
+
*/
|
|
52
|
+
export type ModuleCreateStoreCreditAccount = {
|
|
53
|
+
/**
|
|
54
|
+
* The unique code for the account. If not provided, one is auto-generated.
|
|
55
|
+
*/
|
|
56
|
+
code?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The ID of the customer to associate with the account.
|
|
59
|
+
*/
|
|
60
|
+
customer_id?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The three-letter ISO currency code for the account.
|
|
63
|
+
*
|
|
64
|
+
* @example usd
|
|
65
|
+
*/
|
|
66
|
+
currency_code: string;
|
|
67
|
+
/**
|
|
68
|
+
* Custom key-value pairs to attach to the account.
|
|
69
|
+
*/
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The data required to credit a store credit account with an amount.
|
|
74
|
+
*/
|
|
75
|
+
export type ModuleCreditStoreCreditAccount = {
|
|
76
|
+
/**
|
|
77
|
+
* The ID of the store credit account to credit.
|
|
78
|
+
*/
|
|
79
|
+
account_id: string;
|
|
80
|
+
/**
|
|
81
|
+
* The amount to credit to the account.
|
|
82
|
+
*/
|
|
83
|
+
amount: number;
|
|
84
|
+
/**
|
|
85
|
+
* An optional note describing the credit transaction.
|
|
86
|
+
*/
|
|
87
|
+
note?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The resource type this credit references (for example, "order", "gift_card").
|
|
90
|
+
*/
|
|
91
|
+
reference?: string;
|
|
92
|
+
/**
|
|
93
|
+
* The ID of the referenced resource.
|
|
94
|
+
*/
|
|
95
|
+
reference_id?: string;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The data required to update a store credit account.
|
|
99
|
+
*/
|
|
100
|
+
export type ModuleUpdateStoreCreditAccount = {
|
|
101
|
+
/**
|
|
102
|
+
* The ID of the store credit account to update.
|
|
103
|
+
*/
|
|
104
|
+
id: string;
|
|
105
|
+
/**
|
|
106
|
+
* The ID of the customer to associate with the account.
|
|
107
|
+
*/
|
|
108
|
+
customer_id?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The three-letter ISO currency code to update.
|
|
111
|
+
*/
|
|
112
|
+
currency_code?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Custom key-value pairs to update on the account.
|
|
115
|
+
*/
|
|
116
|
+
metadata?: Record<string, unknown>;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The type of an account transaction.
|
|
120
|
+
*/
|
|
121
|
+
export declare enum TransactionType {
|
|
122
|
+
CREDIT = "credit",
|
|
123
|
+
DEBIT = "debit"
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A union of the possible transaction type string values.
|
|
127
|
+
*/
|
|
128
|
+
export type TransactionTypeValues = TransactionType.CREDIT | TransactionType.DEBIT;
|
|
129
|
+
/**
|
|
130
|
+
* Represents a transaction on a store credit account.
|
|
131
|
+
*/
|
|
132
|
+
export type ModuleAccountTransaction = {
|
|
133
|
+
/**
|
|
134
|
+
* The transaction's ID.
|
|
135
|
+
*/
|
|
136
|
+
id: string;
|
|
137
|
+
/**
|
|
138
|
+
* The ID of the store credit account this transaction belongs to.
|
|
139
|
+
*/
|
|
140
|
+
account_id: string;
|
|
141
|
+
/**
|
|
142
|
+
* Whether this is a credit or debit transaction.
|
|
143
|
+
*/
|
|
144
|
+
type: TransactionTypeValues;
|
|
145
|
+
/**
|
|
146
|
+
* The transaction amount.
|
|
147
|
+
*/
|
|
148
|
+
amount: BigNumberValue;
|
|
149
|
+
/**
|
|
150
|
+
* The store credit account this transaction belongs to.
|
|
151
|
+
*/
|
|
152
|
+
account: ModuleStoreCreditAccount;
|
|
153
|
+
/**
|
|
154
|
+
* An optional note describing the transaction.
|
|
155
|
+
*/
|
|
156
|
+
note?: string;
|
|
157
|
+
/**
|
|
158
|
+
* The resource type this transaction references (for example, "order", "cart").
|
|
159
|
+
*/
|
|
160
|
+
reference?: string;
|
|
161
|
+
/**
|
|
162
|
+
* The ID of the referenced resource.
|
|
163
|
+
*/
|
|
164
|
+
reference_id?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Custom key-value pairs attached to this transaction.
|
|
167
|
+
*/
|
|
168
|
+
metadata: Record<string, unknown>;
|
|
169
|
+
/**
|
|
170
|
+
* The date the transaction was created.
|
|
171
|
+
*/
|
|
172
|
+
created_at: string;
|
|
173
|
+
/**
|
|
174
|
+
* The date the transaction was last updated.
|
|
175
|
+
*/
|
|
176
|
+
updated_at: string;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* The data required to create an account transaction.
|
|
180
|
+
*/
|
|
181
|
+
export type ModuleCreateAccountTransaction = {
|
|
182
|
+
/**
|
|
183
|
+
* The ID of the store credit account to transact on.
|
|
184
|
+
*/
|
|
185
|
+
account_id: string;
|
|
186
|
+
/**
|
|
187
|
+
* The transaction amount.
|
|
188
|
+
*/
|
|
189
|
+
amount: BigNumberValue;
|
|
190
|
+
/**
|
|
191
|
+
* Whether this is a credit or debit transaction.
|
|
192
|
+
*/
|
|
193
|
+
type: TransactionTypeValues;
|
|
194
|
+
/**
|
|
195
|
+
* An optional note describing the transaction.
|
|
196
|
+
*/
|
|
197
|
+
note?: string;
|
|
198
|
+
/**
|
|
199
|
+
* The resource type this transaction references.
|
|
200
|
+
*/
|
|
201
|
+
reference?: string;
|
|
202
|
+
/**
|
|
203
|
+
* The ID of the referenced resource.
|
|
204
|
+
*/
|
|
205
|
+
reference_id?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Custom key-value pairs to attach to the transaction.
|
|
208
|
+
*/
|
|
209
|
+
metadata?: Record<string, unknown>;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* The data required to credit a store credit account.
|
|
213
|
+
*/
|
|
214
|
+
export type ModuleCreditAccount = {
|
|
215
|
+
/**
|
|
216
|
+
* The ID of the store credit account to credit.
|
|
217
|
+
*/
|
|
218
|
+
account_id: string;
|
|
219
|
+
/**
|
|
220
|
+
* The amount to credit.
|
|
221
|
+
*/
|
|
222
|
+
amount: BigNumberValue;
|
|
223
|
+
/**
|
|
224
|
+
* An optional note describing the credit.
|
|
225
|
+
*/
|
|
226
|
+
note?: string;
|
|
227
|
+
/**
|
|
228
|
+
* The resource type this credit references (for example, "cart", "order").
|
|
229
|
+
*/
|
|
230
|
+
reference: string;
|
|
231
|
+
/**
|
|
232
|
+
* The ID of the referenced resource.
|
|
233
|
+
*/
|
|
234
|
+
reference_id: string;
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* The data required to debit a store credit account.
|
|
238
|
+
*/
|
|
239
|
+
export type ModuleDebitAccount = {
|
|
240
|
+
/**
|
|
241
|
+
* The ID of the store credit account to debit.
|
|
242
|
+
*/
|
|
243
|
+
account_id: string;
|
|
244
|
+
/**
|
|
245
|
+
* The amount to debit.
|
|
246
|
+
*/
|
|
247
|
+
amount: BigNumberValue;
|
|
248
|
+
/**
|
|
249
|
+
* An optional note describing the debit.
|
|
250
|
+
*/
|
|
251
|
+
note?: string;
|
|
252
|
+
/**
|
|
253
|
+
* The resource type this debit references (for example, "cart", "order").
|
|
254
|
+
*/
|
|
255
|
+
reference: string;
|
|
256
|
+
/**
|
|
257
|
+
* The ID of the referenced resource.
|
|
258
|
+
*/
|
|
259
|
+
reference_id: string;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* The data required to retrieve statistics for a store credit account.
|
|
263
|
+
*/
|
|
264
|
+
export type ModuleRetrieveAccountStats = {
|
|
265
|
+
/**
|
|
266
|
+
* The ID of the store credit account to retrieve stats for.
|
|
267
|
+
*/
|
|
268
|
+
account_id: string;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Aggregated balance statistics for a store credit account.
|
|
272
|
+
*/
|
|
273
|
+
export type ModuleAccountStats = {
|
|
274
|
+
/**
|
|
275
|
+
* The store credit account's ID.
|
|
276
|
+
*/
|
|
277
|
+
id: string;
|
|
278
|
+
/**
|
|
279
|
+
* The current balance of the account (credits minus debits).
|
|
280
|
+
*/
|
|
281
|
+
balance: BigNumberValue;
|
|
282
|
+
/**
|
|
283
|
+
* The total amount credited to the account.
|
|
284
|
+
*/
|
|
285
|
+
credits: BigNumberValue;
|
|
286
|
+
/**
|
|
287
|
+
* The total amount debited from the account.
|
|
288
|
+
*/
|
|
289
|
+
debits: BigNumberValue;
|
|
290
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionType = void 0;
|
|
4
|
+
/* Entity: AccountTransaction */
|
|
5
|
+
/**
|
|
6
|
+
* The type of an account transaction.
|
|
7
|
+
*/
|
|
8
|
+
var TransactionType;
|
|
9
|
+
(function (TransactionType) {
|
|
10
|
+
TransactionType["CREDIT"] = "credit";
|
|
11
|
+
TransactionType["DEBIT"] = "debit";
|
|
12
|
+
})(TransactionType || (exports.TransactionType = TransactionType = {}));
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL3R5cGVzL3N0b3JlLWNyZWRpdC9tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBNEhBLGdDQUFnQztBQUVoQzs7R0FFRztBQUNILElBQVksZUFHWDtBQUhELFdBQVksZUFBZTtJQUN6QixvQ0FBaUIsQ0FBQTtJQUNqQixrQ0FBZSxDQUFBO0FBQ2pCLENBQUMsRUFIVyxlQUFlLCtCQUFmLGVBQWUsUUFHMUIifQ==
|