@medusajs/types 1.12.0-snapshot-20240405070935 → 1.12.0-snapshot-20240406075900
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth/common/auth-user.d.ts +21 -16
- package/dist/auth/common/auth-user.d.ts.map +1 -1
- package/dist/auth/common/provider.d.ts +28 -15
- package/dist/auth/common/provider.d.ts.map +1 -1
- package/dist/auth/service.d.ts +137 -75
- package/dist/auth/service.d.ts.map +1 -1
- package/dist/bundles.d.ts +2 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +3 -1
- package/dist/bundles.js.map +1 -1
- package/dist/cart/common.d.ts +443 -62
- package/dist/cart/common.d.ts.map +1 -1
- package/dist/cart/mutations.d.ts +483 -0
- package/dist/cart/mutations.d.ts.map +1 -1
- package/dist/cart/mutations.js.map +1 -1
- package/dist/cart/service.d.ts +1607 -0
- package/dist/cart/service.d.ts.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/rule.d.ts +2 -0
- package/dist/common/rule.d.ts.map +1 -0
- package/dist/common/rule.js +3 -0
- package/dist/common/rule.js.map +1 -0
- package/dist/customer/service.d.ts +445 -197
- package/dist/customer/service.d.ts.map +1 -1
- package/dist/file/common.d.ts +14 -0
- package/dist/file/common.d.ts.map +1 -0
- package/dist/file/common.js +3 -0
- package/dist/file/common.js.map +1 -0
- package/dist/file/index.d.ts +4 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +20 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/mutations.d.ts +18 -0
- package/dist/file/mutations.d.ts.map +1 -0
- package/dist/file/mutations.js +3 -0
- package/dist/file/mutations.js.map +1 -0
- package/dist/file/service.d.ts +76 -0
- package/dist/file/service.d.ts.map +1 -0
- package/dist/file/service.js +3 -0
- package/dist/file/service.js.map +1 -0
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts +2 -2
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts.map +1 -1
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts +22 -0
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts +17 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts +14 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts +12 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts +15 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts +27 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment.js.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts +17 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.js +3 -0
- package/dist/http/fulfillment/admin/geo-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/index.d.ts +13 -0
- package/dist/http/fulfillment/admin/index.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/index.js +29 -0
- package/dist/http/fulfillment/admin/index.js.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts +14 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.js +3 -0
- package/dist/http/fulfillment/admin/service-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts +16 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts +14 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts +31 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts +13 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.js +3 -0
- package/dist/http/fulfillment/admin/shipping-profile.js.map +1 -0
- package/dist/http/fulfillment/index.d.ts +2 -0
- package/dist/http/fulfillment/index.d.ts.map +1 -0
- package/dist/http/fulfillment/index.js +18 -0
- package/dist/http/fulfillment/index.js.map +1 -0
- package/dist/http/index.d.ts +3 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +19 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/stock-locations/common.d.ts +28 -0
- package/dist/http/stock-locations/common.d.ts.map +1 -0
- package/dist/http/stock-locations/common.js +3 -0
- package/dist/http/stock-locations/common.js.map +1 -0
- package/dist/http/stock-locations/index.d.ts +2 -0
- package/dist/http/stock-locations/index.d.ts.map +1 -0
- package/dist/http/stock-locations/index.js +18 -0
- package/dist/http/stock-locations/index.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory/common/inventory-item.d.ts +55 -64
- package/dist/inventory/common/inventory-item.d.ts.map +1 -1
- package/dist/inventory/common/inventory-level.d.ts +37 -37
- package/dist/inventory/common/inventory-level.d.ts.map +1 -1
- package/dist/inventory/common/reservation-item.d.ts +34 -44
- package/dist/inventory/common/reservation-item.d.ts.map +1 -1
- package/dist/inventory/service-next.d.ts +596 -534
- package/dist/inventory/service-next.d.ts.map +1 -1
- package/dist/payment/common.d.ts +174 -53
- package/dist/payment/common.d.ts.map +1 -1
- package/dist/payment/common.js +3 -3
- package/dist/payment/common.js.map +1 -1
- package/dist/payment/mutations.d.ts +58 -17
- package/dist/payment/mutations.d.ts.map +1 -1
- package/dist/payment/provider.d.ts +128 -43
- package/dist/payment/provider.d.ts.map +1 -1
- package/dist/payment/provider.js.map +1 -1
- package/dist/payment/service.d.ts +460 -39
- package/dist/payment/service.d.ts.map +1 -1
- package/dist/pricing/common/price-list.d.ts +2 -2
- package/dist/pricing/common/price-set.d.ts +6 -4
- package/dist/pricing/common/price-set.d.ts.map +1 -1
- package/dist/pricing/service.d.ts +731 -1695
- package/dist/pricing/service.d.ts.map +1 -1
- package/dist/product/common.d.ts +4 -0
- package/dist/product/common.d.ts.map +1 -1
- package/dist/product-category/repository.d.ts +2 -1
- package/dist/product-category/repository.d.ts.map +1 -1
- package/dist/promotion/common/application-method.d.ts +153 -0
- package/dist/promotion/common/application-method.d.ts.map +1 -1
- package/dist/promotion/common/campaign-budget.d.ts +37 -0
- package/dist/promotion/common/campaign-budget.d.ts.map +1 -1
- package/dist/promotion/common/campaign.d.ts +36 -0
- package/dist/promotion/common/campaign.d.ts.map +1 -1
- package/dist/promotion/common/compute-actions.d.ts +135 -0
- package/dist/promotion/common/compute-actions.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule-value.d.ts +30 -0
- package/dist/promotion/common/promotion-rule-value.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule.d.ts +77 -0
- package/dist/promotion/common/promotion-rule.d.ts.map +1 -1
- package/dist/promotion/common/promotion.d.ts +100 -0
- package/dist/promotion/common/promotion.d.ts.map +1 -1
- package/dist/promotion/mutations.d.ts +84 -0
- package/dist/promotion/mutations.d.ts.map +1 -1
- package/dist/promotion/service.d.ts +786 -0
- package/dist/promotion/service.d.ts.map +1 -1
- package/dist/region/common.d.ts +9 -0
- package/dist/region/common.d.ts.map +1 -1
- package/dist/region/mutations.d.ts +11 -3
- package/dist/region/mutations.d.ts.map +1 -1
- package/dist/region/service.d.ts +210 -85
- package/dist/region/service.d.ts.map +1 -1
- package/dist/stock-location/common.d.ts +14 -0
- package/dist/stock-location/common.d.ts.map +1 -1
- package/dist/stock-location/service-next.d.ts +178 -186
- package/dist/stock-location/service-next.d.ts.map +1 -1
- package/dist/store/common/store.d.ts +42 -0
- package/dist/store/common/store.d.ts.map +1 -1
- package/dist/store/mutations/store.d.ts +75 -0
- package/dist/store/mutations/store.d.ts.map +1 -1
- package/dist/store/service.d.ts +113 -75
- package/dist/store/service.d.ts.map +1 -1
- package/dist/tax/common.d.ts +298 -10
- package/dist/tax/common.d.ts.map +1 -1
- package/dist/tax/mutations.d.ts +157 -0
- package/dist/tax/mutations.d.ts.map +1 -1
- package/dist/tax/provider.d.ts +126 -0
- package/dist/tax/provider.d.ts.map +1 -1
- package/dist/tax/service.d.ts +600 -0
- package/dist/tax/service.d.ts.map +1 -1
- package/dist/workflows/index.d.ts +2 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +18 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/stock-locations/index.d.ts +2 -0
- package/dist/workflows/stock-locations/index.d.ts.map +1 -0
- package/dist/workflows/stock-locations/index.js +18 -0
- package/dist/workflows/stock-locations/index.js.map +1 -0
- package/dist/workflows/stock-locations/mutations.d.ts +8 -0
- package/dist/workflows/stock-locations/mutations.d.ts.map +1 -0
- package/dist/workflows/stock-locations/mutations.js +3 -0
- package/dist/workflows/stock-locations/mutations.js.map +1 -0
- package/package.json +1 -1
@@ -4,7 +4,7 @@ import { Context } from "../shared-context";
|
|
4
4
|
import { CaptureDTO, FilterableCaptureProps, FilterablePaymentCollectionProps, FilterablePaymentProps, FilterablePaymentProviderProps, FilterablePaymentSessionProps, FilterableRefundProps, PaymentCollectionDTO, PaymentDTO, PaymentProviderDTO, PaymentSessionDTO, RefundDTO } from "./common";
|
5
5
|
import { CreateCaptureDTO, CreatePaymentCollectionDTO, CreatePaymentSessionDTO, CreateRefundDTO, PaymentCollectionUpdatableFields, ProviderWebhookPayload, UpdatePaymentDTO, UpdatePaymentSessionDTO, UpsertPaymentCollectionDTO } from "./mutations";
|
6
6
|
/**
|
7
|
-
* The main service interface for the
|
7
|
+
* The main service interface for the Payment Module.
|
8
8
|
*/
|
9
9
|
export interface IPaymentModuleService extends IModuleService {
|
10
10
|
/**
|
@@ -15,7 +15,19 @@ export interface IPaymentModuleService extends IModuleService {
|
|
15
15
|
* @returns {Promise<PaymentCollectionDTO[]>} The created payment collections.
|
16
16
|
*
|
17
17
|
* @example
|
18
|
-
*
|
18
|
+
* const paymentCollections =
|
19
|
+
* await paymentModuleService.createPaymentCollections([
|
20
|
+
* {
|
21
|
+
* region_id: "reg_123",
|
22
|
+
* currency_code: "usd",
|
23
|
+
* amount: 3000,
|
24
|
+
* },
|
25
|
+
* {
|
26
|
+
* region_id: "reg_321",
|
27
|
+
* currency_code: "eur",
|
28
|
+
* amount: 2000,
|
29
|
+
* },
|
30
|
+
* ])
|
19
31
|
*/
|
20
32
|
createPaymentCollections(data: CreatePaymentCollectionDTO[], sharedContext?: Context): Promise<PaymentCollectionDTO[]>;
|
21
33
|
/**
|
@@ -26,7 +38,12 @@ export interface IPaymentModuleService extends IModuleService {
|
|
26
38
|
* @returns {Promise<PaymentCollectionDTO>} The created payment collection.
|
27
39
|
*
|
28
40
|
* @example
|
29
|
-
*
|
41
|
+
* const paymentCollection =
|
42
|
+
* await paymentModuleService.createPaymentCollections({
|
43
|
+
* region_id: "reg_123",
|
44
|
+
* currency_code: "usd",
|
45
|
+
* amount: 3000,
|
46
|
+
* })
|
30
47
|
*/
|
31
48
|
createPaymentCollections(data: CreatePaymentCollectionDTO, sharedContext?: Context): Promise<PaymentCollectionDTO>;
|
32
49
|
/**
|
@@ -42,13 +59,22 @@ export interface IPaymentModuleService extends IModuleService {
|
|
42
59
|
* A simple example that retrieves a {type name} by its ID:
|
43
60
|
*
|
44
61
|
* ```ts
|
45
|
-
*
|
62
|
+
* const paymentCollection =
|
63
|
+
* await paymentModuleService.retrievePaymentCollection(
|
64
|
+
* "pay_col_123"
|
65
|
+
* )
|
46
66
|
* ```
|
47
67
|
*
|
48
68
|
* To specify relations that should be retrieved:
|
49
69
|
*
|
50
70
|
* ```ts
|
51
|
-
*
|
71
|
+
* const paymentCollection =
|
72
|
+
* await paymentModuleService.retrievePaymentCollection(
|
73
|
+
* "pay_col_123",
|
74
|
+
* {
|
75
|
+
* relations: ["payment_sessions"],
|
76
|
+
* }
|
77
|
+
* )
|
52
78
|
* ```
|
53
79
|
*
|
54
80
|
*
|
@@ -64,22 +90,43 @@ export interface IPaymentModuleService extends IModuleService {
|
|
64
90
|
* @returns {Promise<PaymentCollectionDTO[]>} The list of payment collections.
|
65
91
|
*
|
66
92
|
* @example
|
67
|
-
* To retrieve a list of
|
93
|
+
* To retrieve a list of payment collections using their IDs:
|
68
94
|
*
|
69
95
|
* ```ts
|
70
|
-
*
|
96
|
+
* const paymentCollections =
|
97
|
+
* await paymentModuleService.listPaymentCollections({
|
98
|
+
* id: ["pay_col_123", "pay_col_321"],
|
99
|
+
* })
|
71
100
|
* ```
|
72
101
|
*
|
73
|
-
* To specify relations that should be retrieved within the
|
102
|
+
* To specify relations that should be retrieved within the payment collection:
|
74
103
|
*
|
75
104
|
* ```ts
|
76
|
-
*
|
105
|
+
* const paymentCollections =
|
106
|
+
* await paymentModuleService.listPaymentCollections(
|
107
|
+
* {
|
108
|
+
* id: ["pay_col_123", "pay_col_321"],
|
109
|
+
* },
|
110
|
+
* {
|
111
|
+
* relations: ["payment_sessions"],
|
112
|
+
* }
|
113
|
+
* )
|
77
114
|
* ```
|
78
115
|
*
|
79
|
-
* By default, only the first `
|
116
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
80
117
|
*
|
81
118
|
* ```ts
|
82
|
-
*
|
119
|
+
* const paymentCollections =
|
120
|
+
* await paymentModuleService.listPaymentCollections(
|
121
|
+
* {
|
122
|
+
* id: ["pay_col_123", "pay_col_321"],
|
123
|
+
* },
|
124
|
+
* {
|
125
|
+
* relations: ["payment_sessions"],
|
126
|
+
* take: 20,
|
127
|
+
* skip: 2,
|
128
|
+
* }
|
129
|
+
* )
|
83
130
|
* ```
|
84
131
|
*
|
85
132
|
*
|
@@ -98,37 +145,134 @@ export interface IPaymentModuleService extends IModuleService {
|
|
98
145
|
* To retrieve a list of {type name} using their IDs:
|
99
146
|
*
|
100
147
|
* ```ts
|
101
|
-
*
|
148
|
+
* const paymentCollections =
|
149
|
+
* await paymentModuleService.listAndCountPaymentCollections({
|
150
|
+
* id: ["pay_col_123", "pay_col_321"],
|
151
|
+
* })
|
102
152
|
* ```
|
103
153
|
*
|
104
154
|
* To specify relations that should be retrieved within the {type name}:
|
105
155
|
*
|
106
156
|
* ```ts
|
107
|
-
*
|
157
|
+
* const paymentCollections =
|
158
|
+
* await paymentModuleService.listAndCountPaymentCollections(
|
159
|
+
* {
|
160
|
+
* id: ["pay_col_123", "pay_col_321"],
|
161
|
+
* },
|
162
|
+
* {
|
163
|
+
* relations: ["payment_sessions"],
|
164
|
+
* }
|
165
|
+
* )
|
108
166
|
* ```
|
109
167
|
*
|
110
168
|
* By default, only the first `{default limit}` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
111
169
|
*
|
112
170
|
* ```ts
|
113
|
-
*
|
171
|
+
* const paymentCollections =
|
172
|
+
* await paymentModuleService.listAndCountPaymentCollections(
|
173
|
+
* {
|
174
|
+
* id: ["pay_col_123", "pay_col_321"],
|
175
|
+
* },
|
176
|
+
* {
|
177
|
+
* relations: ["payment_sessions"],
|
178
|
+
* take: 20,
|
179
|
+
* skip: 2,
|
180
|
+
* }
|
181
|
+
* )
|
114
182
|
* ```
|
115
183
|
*
|
116
184
|
*
|
117
185
|
*/
|
118
186
|
listAndCountPaymentCollections(filters?: FilterablePaymentCollectionProps, config?: FindConfig<PaymentCollectionDTO>, sharedContext?: Context): Promise<[PaymentCollectionDTO[], number]>;
|
187
|
+
/**
|
188
|
+
* This method updates an existing payment collection.
|
189
|
+
*
|
190
|
+
* @param {string} paymentCollectionId - The payment collection's ID.
|
191
|
+
* @param {PaymentCollectionUpdatableFields} data - The attributes to update in the payment collection.
|
192
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
193
|
+
* @returns {Promise<PaymentCollectionDTO>} The updated payment collection.
|
194
|
+
*
|
195
|
+
* @example
|
196
|
+
* const paymentCollection =
|
197
|
+
* await paymentModuleService.updatePaymentCollections(
|
198
|
+
* "pay_col_123",
|
199
|
+
* {
|
200
|
+
* amount: 3000,
|
201
|
+
* }
|
202
|
+
* )
|
203
|
+
*/
|
119
204
|
updatePaymentCollections(paymentCollectionId: string, data: PaymentCollectionUpdatableFields, sharedContext?: Context): Promise<PaymentCollectionDTO>;
|
205
|
+
/**
|
206
|
+
* This method updates existing payment collections matching the specified filters.
|
207
|
+
*
|
208
|
+
* @param {FilterablePaymentCollectionProps} selector - The filters specifying which payment collections to update.
|
209
|
+
* @param {PaymentCollectionUpdatableFields} data - The attributes to update in the payment collections.
|
210
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
211
|
+
* @returns {Promise<PaymentCollectionDTO[]>} The updated payment collections.
|
212
|
+
*
|
213
|
+
* @example
|
214
|
+
* const paymentCollections =
|
215
|
+
* await paymentModuleService.updatePaymentCollections(
|
216
|
+
* {
|
217
|
+
* id: ["pay_col_123", "pay_col_321"],
|
218
|
+
* },
|
219
|
+
* {
|
220
|
+
* currency_code: "usd",
|
221
|
+
* }
|
222
|
+
* )
|
223
|
+
*/
|
120
224
|
updatePaymentCollections(selector: FilterablePaymentCollectionProps, data: PaymentCollectionUpdatableFields, sharedContext?: Context): Promise<PaymentCollectionDTO[]>;
|
225
|
+
/**
|
226
|
+
* This method updates or creates payment collections if they don't exist.
|
227
|
+
*
|
228
|
+
* @param {UpsertPaymentCollectionDTO[]} data - The attributes in the payment collections to be created or updated. If
|
229
|
+
* the object includes the `id` field, then the payment collection is updated. Otherise, it's created.
|
230
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
231
|
+
* @returns {Promise<PaymentCollectionDTO[]>} The created or updated payment collections.
|
232
|
+
*
|
233
|
+
* @example
|
234
|
+
* const paymentCollections =
|
235
|
+
* await paymentModuleService.upsertPaymentCollections([
|
236
|
+
* {
|
237
|
+
* id: "pay_col_123",
|
238
|
+
* region_id: "reg_123",
|
239
|
+
* },
|
240
|
+
* {
|
241
|
+
* region_id: "reg_123",
|
242
|
+
* currency_code: "usd",
|
243
|
+
* amount: 3000,
|
244
|
+
* },
|
245
|
+
* ])
|
246
|
+
*/
|
121
247
|
upsertPaymentCollections(data: UpsertPaymentCollectionDTO[], sharedContext?: Context): Promise<PaymentCollectionDTO[]>;
|
248
|
+
/**
|
249
|
+
* This method updates or creates a payment collection if it doesn't exist.
|
250
|
+
*
|
251
|
+
* @param {UpsertPaymentCollectionDTO} data - The attributes in the payment collection to be created or updated. If the `id`
|
252
|
+
* field is included, the payment collection is updated. Otherwise, it's created.
|
253
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
254
|
+
* @returns {Promise<PaymentCollectionDTO>} The created or updated payment collection.
|
255
|
+
*
|
256
|
+
* @example
|
257
|
+
* const paymentCollection =
|
258
|
+
* await paymentModuleService.upsertPaymentCollections({
|
259
|
+
* id: "pay_col_123",
|
260
|
+
* region_id: "reg_123",
|
261
|
+
* })
|
262
|
+
*/
|
122
263
|
upsertPaymentCollections(data: UpsertPaymentCollectionDTO, sharedContext?: Context): Promise<PaymentCollectionDTO>;
|
123
264
|
/**
|
124
265
|
* This method deletes a payment collection by its ID.
|
125
266
|
*
|
126
267
|
* @param {string[]} paymentCollectionId - The payment collection's ID.
|
127
268
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
128
|
-
* @returns {Promise<void>} Resolves when the payment collection is deleted.
|
269
|
+
* @returns {Promise<void>} Resolves when the payment collection is deleted successfully.
|
129
270
|
*
|
130
271
|
* @example
|
131
|
-
*
|
272
|
+
* await paymentModuleService.deletePaymentCollections([
|
273
|
+
* "pay_col_123",
|
274
|
+
* "pay_col_321",
|
275
|
+
* ])
|
132
276
|
*/
|
133
277
|
deletePaymentCollections(paymentCollectionId: string[], sharedContext?: Context): Promise<void>;
|
134
278
|
/**
|
@@ -136,36 +280,45 @@ export interface IPaymentModuleService extends IModuleService {
|
|
136
280
|
*
|
137
281
|
* @param {string} paymentCollectionId - The payment collection's ID.
|
138
282
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
139
|
-
* @returns {Promise<void>} Resolves when the payment collection is deleted.
|
283
|
+
* @returns {Promise<void>} Resolves when the payment collection is deleted successfully.
|
140
284
|
*
|
141
285
|
* @example
|
142
|
-
*
|
286
|
+
* await paymentModuleService.deletePaymentCollections(
|
287
|
+
* "pay_col_123"
|
288
|
+
* )
|
143
289
|
*/
|
144
290
|
deletePaymentCollections(paymentCollectionId: string, sharedContext?: Context): Promise<void>;
|
145
291
|
/**
|
146
|
-
* This method
|
292
|
+
* This method marks a payment collection as completed by settings its `completed_at` field to the current date and time.
|
147
293
|
*
|
148
294
|
* @param {string} paymentCollectionId - The payment collection's ID.
|
149
295
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
150
296
|
* @returns {Promise<PaymentCollectionDTO>} The payment collection's details.
|
151
297
|
*
|
152
298
|
* @example
|
153
|
-
*
|
299
|
+
* const paymentCollection =
|
300
|
+
* await paymentModuleService.completePaymentCollections(
|
301
|
+
* "pay_col_123"
|
302
|
+
* )
|
154
303
|
*/
|
155
304
|
completePaymentCollections(paymentCollectionId: string, sharedContext?: Context): Promise<PaymentCollectionDTO>;
|
156
305
|
/**
|
157
|
-
* This method
|
306
|
+
* This method marks payment collections as completed by settings their `completed_at` field to the current date and time.
|
158
307
|
*
|
159
308
|
* @param {string[]} paymentCollectionId - The payment collections' IDs.
|
160
309
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
161
310
|
* @returns {Promise<PaymentCollectionDTO[]>} The payment collections' details.
|
162
311
|
*
|
163
312
|
* @example
|
164
|
-
*
|
313
|
+
* const paymentCollection =
|
314
|
+
* await paymentModuleService.completePaymentCollections([
|
315
|
+
* "pay_col_123",
|
316
|
+
* "pay_col_321",
|
317
|
+
* ])
|
165
318
|
*/
|
166
319
|
completePaymentCollections(paymentCollectionId: string[], sharedContext?: Context): Promise<PaymentCollectionDTO[]>;
|
167
320
|
/**
|
168
|
-
* This method creates a payment session
|
321
|
+
* This method creates a payment session in a payment collection.
|
169
322
|
*
|
170
323
|
* @param {string} paymentCollectionId - The ID of the payment collection to create the session for.
|
171
324
|
* @param {CreatePaymentSessionDTO} data - The details of the payment session.
|
@@ -173,7 +326,16 @@ export interface IPaymentModuleService extends IModuleService {
|
|
173
326
|
* @returns {Promise<PaymentCollectionDTO>} The payment collection's details.
|
174
327
|
*
|
175
328
|
* @example
|
176
|
-
*
|
329
|
+
* const paymentSession =
|
330
|
+
* await paymentModuleService.createPaymentSession(
|
331
|
+
* "pay_col_1",
|
332
|
+
* {
|
333
|
+
* provider_id: "stripe",
|
334
|
+
* currency_code: "usd",
|
335
|
+
* amount: 3000,
|
336
|
+
* data: {},
|
337
|
+
* }
|
338
|
+
* )
|
177
339
|
*/
|
178
340
|
createPaymentSession(paymentCollectionId: string, data: CreatePaymentSessionDTO, sharedContext?: Context): Promise<PaymentSessionDTO>;
|
179
341
|
/**
|
@@ -184,7 +346,13 @@ export interface IPaymentModuleService extends IModuleService {
|
|
184
346
|
* @returns {Promise<PaymentSessionDTO>} The payment session's details.
|
185
347
|
*
|
186
348
|
* @example
|
187
|
-
*
|
349
|
+
* const paymentSession =
|
350
|
+
* await paymentModuleService.updatePaymentSession({
|
351
|
+
* id: "payses_123",
|
352
|
+
* currency_code: "usd",
|
353
|
+
* amount: 3000,
|
354
|
+
* data: {},
|
355
|
+
* })
|
188
356
|
*/
|
189
357
|
updatePaymentSession(data: UpdatePaymentSessionDTO, sharedContext?: Context): Promise<PaymentSessionDTO>;
|
190
358
|
/**
|
@@ -192,24 +360,79 @@ export interface IPaymentModuleService extends IModuleService {
|
|
192
360
|
*
|
193
361
|
* @param {string} id - The ID of the payment session.
|
194
362
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
195
|
-
* @returns {Promise<void>} Resolves whent the payment session is deleted.
|
363
|
+
* @returns {Promise<void>} Resolves whent the payment session is deleted successfully.
|
196
364
|
*
|
197
365
|
* @example
|
198
|
-
*
|
366
|
+
* await paymentModuleService.deletePaymentSession("payses_123")
|
199
367
|
*/
|
200
368
|
deletePaymentSession(id: string, sharedContext?: Context): Promise<void>;
|
201
369
|
/**
|
202
|
-
* This method authorizes a payment session.
|
370
|
+
* This method authorizes a payment session using its associated payment provider. This creates a payment that can later be captured.
|
371
|
+
*
|
372
|
+
* Learn more about the payment flow in [this guide](https://docs.medusajs.com/experimental/payment/payment-flow/)
|
203
373
|
*
|
204
374
|
* @param {string} id - The payment session's ID.
|
205
|
-
* @param {Record<string, unknown>} context -
|
375
|
+
* @param {Record<string, unknown>} context - Context data to pass to the associated payment provider.
|
206
376
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
207
|
-
* @returns {Promise<PaymentDTO>} The
|
377
|
+
* @returns {Promise<PaymentDTO>} The created payment.
|
208
378
|
*
|
209
379
|
* @example
|
210
|
-
*
|
380
|
+
* const payment =
|
381
|
+
* await paymentModuleService.authorizePaymentSession(
|
382
|
+
* "payses_123",
|
383
|
+
* {}
|
384
|
+
* )
|
211
385
|
*/
|
212
386
|
authorizePaymentSession(id: string, context: Record<string, unknown>, sharedContext?: Context): Promise<PaymentDTO>;
|
387
|
+
/**
|
388
|
+
* This method retrieves a paginated list of payment sessions based on optional filters and configuration.
|
389
|
+
*
|
390
|
+
* @param {FilterablePaymentSessionProps} filters - The filters to apply on the retrieved payment sessions.
|
391
|
+
* @param {FindConfig<PaymentSessionDTO>} config - The configurations determining how the payment session is retrieved. Its properties, such as `select` or `relations`, accept the
|
392
|
+
* attributes or relations associated with a payment session.
|
393
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
394
|
+
* @returns {Promise<PaymentSessionDTO[]>} The list of payment sessions.
|
395
|
+
*
|
396
|
+
* @example
|
397
|
+
* To retrieve a list of payment sessions using their IDs:
|
398
|
+
*
|
399
|
+
* ```ts
|
400
|
+
* const paymentSessions =
|
401
|
+
* await paymentModuleService.listPaymentSessions({
|
402
|
+
* id: ["payses_123", "payses_321"],
|
403
|
+
* })
|
404
|
+
* ```
|
405
|
+
*
|
406
|
+
* To specify relations that should be retrieved within the payment session:
|
407
|
+
*
|
408
|
+
* ```ts
|
409
|
+
* const paymentSessions =
|
410
|
+
* await paymentModuleService.listPaymentSessions(
|
411
|
+
* {
|
412
|
+
* id: ["payses_123", "payses_321"],
|
413
|
+
* },
|
414
|
+
* {
|
415
|
+
* relations: ["payment"],
|
416
|
+
* }
|
417
|
+
* )
|
418
|
+
* ```
|
419
|
+
*
|
420
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
421
|
+
*
|
422
|
+
* ```ts
|
423
|
+
* const paymentSessions =
|
424
|
+
* await paymentModuleService.listPaymentSessions(
|
425
|
+
* {
|
426
|
+
* id: ["payses_123", "payses_321"],
|
427
|
+
* },
|
428
|
+
* {
|
429
|
+
* relations: ["payment"],
|
430
|
+
* take: 20,
|
431
|
+
* skip: 2,
|
432
|
+
* }
|
433
|
+
* )
|
434
|
+
* ```
|
435
|
+
*/
|
213
436
|
listPaymentSessions(filters?: FilterablePaymentSessionProps, config?: FindConfig<PaymentSessionDTO>, sharedContext?: Context): Promise<PaymentSessionDTO[]>;
|
214
437
|
/**
|
215
438
|
* This method retrieves a paginated list of payments based on optional filters and configuration.
|
@@ -221,7 +444,41 @@ export interface IPaymentModuleService extends IModuleService {
|
|
221
444
|
* @returns {Promise<PaymentDTO[]>} A list of payment.
|
222
445
|
*
|
223
446
|
* @example
|
224
|
-
*
|
447
|
+
* To retrieve a list of payments using their IDs:
|
448
|
+
*
|
449
|
+
* ```ts
|
450
|
+
* const payments = await paymentModuleService.listPayments({
|
451
|
+
* id: ["pay_123", "pay_321"],
|
452
|
+
* })
|
453
|
+
* ```
|
454
|
+
*
|
455
|
+
* To specify relations that should be retrieved within the payment:
|
456
|
+
*
|
457
|
+
* ```ts
|
458
|
+
* const payments = await paymentModuleService.listPayments(
|
459
|
+
* {
|
460
|
+
* id: ["pay_123", "pay_321"],
|
461
|
+
* },
|
462
|
+
* {
|
463
|
+
* relations: ["payment_session"],
|
464
|
+
* }
|
465
|
+
* )
|
466
|
+
* ```
|
467
|
+
*
|
468
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
469
|
+
*
|
470
|
+
* ```ts
|
471
|
+
* const payments = await paymentModuleService.listPayments(
|
472
|
+
* {
|
473
|
+
* id: ["pay_123", "pay_321"],
|
474
|
+
* },
|
475
|
+
* {
|
476
|
+
* relations: ["payment_session"],
|
477
|
+
* take: 20,
|
478
|
+
* skip: 2,
|
479
|
+
* }
|
480
|
+
* )
|
481
|
+
* ```
|
225
482
|
*/
|
226
483
|
listPayments(filters?: FilterablePaymentProps, config?: FindConfig<PaymentDTO>, sharedContext?: Context): Promise<PaymentDTO[]>;
|
227
484
|
/**
|
@@ -232,55 +489,219 @@ export interface IPaymentModuleService extends IModuleService {
|
|
232
489
|
* @returns {Promise<PaymentDTO>} The updated payment.
|
233
490
|
*
|
234
491
|
* @example
|
235
|
-
* {
|
492
|
+
* const payment = await paymentModuleService.updatePayment({
|
493
|
+
* id: "pay_123",
|
494
|
+
* customer_id: "cus_123",
|
495
|
+
* })
|
236
496
|
*/
|
237
497
|
updatePayment(data: UpdatePaymentDTO, sharedContext?: Context): Promise<PaymentDTO>;
|
238
498
|
/**
|
239
|
-
* This method captures a payment.
|
499
|
+
* This method captures a payment using its associated payment provider.
|
500
|
+
*
|
501
|
+
* Learn more about the payment flow in [this guide](https://docs.medusajs.com/experimental/payment/payment-flow/)
|
240
502
|
*
|
241
503
|
* @param {CreateCaptureDTO} data - The payment capture to be created.
|
242
504
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
243
505
|
* @returns {Promise<PaymentDTO>} The payment's details.
|
244
506
|
*
|
245
507
|
* @example
|
246
|
-
* {
|
508
|
+
* const payment = await paymentModuleService.capturePayment({
|
509
|
+
* payment_id: "pay_123",
|
510
|
+
* })
|
247
511
|
*/
|
248
512
|
capturePayment(data: CreateCaptureDTO, sharedContext?: Context): Promise<PaymentDTO>;
|
249
513
|
/**
|
250
|
-
* This method refunds a payment.
|
514
|
+
* This method refunds a payment using its associated payment provider. An amount can only be refunded if it has been captured first.
|
251
515
|
*
|
252
516
|
* @param {CreateRefundDTO} data - The refund to be created.
|
253
517
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
254
518
|
* @returns {Promise<PaymentDTO>} The payment's details.
|
255
519
|
*
|
256
520
|
* @example
|
257
|
-
* {
|
521
|
+
* const payment = await paymentModuleService.refundPayment({
|
522
|
+
* payment_id: "pay_123",
|
523
|
+
* amount: 300,
|
524
|
+
* })
|
258
525
|
*/
|
259
526
|
refundPayment(data: CreateRefundDTO, sharedContext?: Context): Promise<PaymentDTO>;
|
260
527
|
/**
|
261
|
-
* This method cancels a payment
|
528
|
+
* This method cancels a payment.
|
262
529
|
*
|
263
530
|
* @param {string} paymentId - The payment's ID.
|
264
531
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
265
532
|
* @returns {Promise<PaymentDTO>} The payment's details.
|
266
533
|
*
|
267
534
|
* @example
|
268
|
-
*
|
535
|
+
* const payment =
|
536
|
+
* await paymentModuleService.cancelPayment("pay_123")
|
269
537
|
*/
|
270
538
|
cancelPayment(paymentId: string, sharedContext?: Context): Promise<PaymentDTO>;
|
539
|
+
/**
|
540
|
+
* This method retrieves a paginated list of payment providers based on optional filters and configuration.
|
541
|
+
*
|
542
|
+
* @param {FilterablePaymentProviderProps} filters - The filters to apply on the retrieved payment providers.
|
543
|
+
* @param {FindConfig<PaymentProviderDTO>} config - The configurations determining how the payment provider is retrieved. Its properties, such as `select` or `relations`, accept the
|
544
|
+
* attributes or relations associated with a payment provider.
|
545
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
546
|
+
* @returns {Promise<PaymentProviderDTO[]>} The list of payment providers.
|
547
|
+
*
|
548
|
+
* @example
|
549
|
+
* To retrieve a list of payment providers using their IDs:
|
550
|
+
*
|
551
|
+
* ```ts
|
552
|
+
* const paymentProviders =
|
553
|
+
* await paymentModuleService.listPaymentProviders({
|
554
|
+
* id: ["stripe", "system"],
|
555
|
+
* })
|
556
|
+
* ```
|
557
|
+
*
|
558
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
559
|
+
*
|
560
|
+
* ```ts
|
561
|
+
* const paymentProviders =
|
562
|
+
* await paymentModuleService.listPaymentProviders(
|
563
|
+
* {
|
564
|
+
* id: ["stripe", "system"],
|
565
|
+
* },
|
566
|
+
* {
|
567
|
+
* take: 20,
|
568
|
+
* skip: 2,
|
569
|
+
* }
|
570
|
+
* )
|
571
|
+
* ```
|
572
|
+
*/
|
271
573
|
listPaymentProviders(filters?: FilterablePaymentProviderProps, config?: FindConfig<PaymentProviderDTO>, sharedContext?: Context): Promise<PaymentProviderDTO[]>;
|
574
|
+
/**
|
575
|
+
* This method retrieves a paginated list of captures based on optional filters and configuration.
|
576
|
+
*
|
577
|
+
* @param {FilterableCaptureProps} filters - The filters to apply on the retrieved captures.
|
578
|
+
* @param {FindConfig<CaptureDTO>} config - The configurations determining how the capture is retrieved. Its properties, such as `select` or `relations`, accept the
|
579
|
+
* attributes or relations associated with a capture.
|
580
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
581
|
+
* @returns {Promise<CaptureDTO[]>} The list of captures.
|
582
|
+
*
|
583
|
+
* @example
|
584
|
+
* To retrieve a list of captures using their IDs:
|
585
|
+
*
|
586
|
+
* ```ts
|
587
|
+
* const captures = await paymentModuleService.listCaptures({
|
588
|
+
* id: ["capt_123", "capt_321"],
|
589
|
+
* })
|
590
|
+
* ```
|
591
|
+
*
|
592
|
+
* To specify relations that should be retrieved within the capture:
|
593
|
+
*
|
594
|
+
* ```ts
|
595
|
+
* const captures = await paymentModuleService.listCaptures(
|
596
|
+
* {
|
597
|
+
* id: ["capt_123", "capt_321"],
|
598
|
+
* },
|
599
|
+
* {
|
600
|
+
* relations: ["payment"],
|
601
|
+
* }
|
602
|
+
* )
|
603
|
+
* ```
|
604
|
+
*
|
605
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
606
|
+
*
|
607
|
+
* ```ts
|
608
|
+
* const captures = await paymentModuleService.listCaptures(
|
609
|
+
* {
|
610
|
+
* id: ["capt_123", "capt_321"],
|
611
|
+
* },
|
612
|
+
* {
|
613
|
+
* relations: ["payment"],
|
614
|
+
* take: 20,
|
615
|
+
* skip: 2,
|
616
|
+
* }
|
617
|
+
* )
|
618
|
+
* ```
|
619
|
+
*/
|
272
620
|
listCaptures(filters?: FilterableCaptureProps, config?: FindConfig<CaptureDTO>, sharedContext?: Context): Promise<CaptureDTO[]>;
|
621
|
+
/**
|
622
|
+
* This method retrieves a paginated list of refunds based on optional filters and configuration.
|
623
|
+
*
|
624
|
+
* @param {FilterableRefundProps} filters - The filters to apply on the retrieved refunds.
|
625
|
+
* @param {FindConfig<RefundDTO>} config - The configurations determining how the refund is retrieved. Its properties, such as `select` or `relations`, accept the
|
626
|
+
* attributes or relations associated with a refund.
|
627
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
628
|
+
* @returns {Promise<RefundDTO[]>} The list of refunds.
|
629
|
+
*
|
630
|
+
* @example
|
631
|
+
* To retrieve a list of refunds using their IDs:
|
632
|
+
*
|
633
|
+
* ```ts
|
634
|
+
* const refunds = await paymentModuleService.listRefunds({
|
635
|
+
* id: ["ref_123", "ref_321"],
|
636
|
+
* })
|
637
|
+
* ```
|
638
|
+
*
|
639
|
+
* To specify relations that should be retrieved within the refund:
|
640
|
+
*
|
641
|
+
* ```ts
|
642
|
+
* const refunds = await paymentModuleService.listRefunds(
|
643
|
+
* {
|
644
|
+
* id: ["ref_123", "ref_321"],
|
645
|
+
* },
|
646
|
+
* {
|
647
|
+
* relations: ["payment"],
|
648
|
+
* }
|
649
|
+
* )
|
650
|
+
* ```
|
651
|
+
*
|
652
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
653
|
+
*
|
654
|
+
* ```ts
|
655
|
+
* const refunds = await paymentModuleService.listRefunds(
|
656
|
+
* {
|
657
|
+
* id: ["ref_123", "ref_321"],
|
658
|
+
* },
|
659
|
+
* {
|
660
|
+
* relations: ["payment"],
|
661
|
+
* take: 20,
|
662
|
+
* skip: 2,
|
663
|
+
* }
|
664
|
+
* )
|
665
|
+
* ```
|
666
|
+
*/
|
273
667
|
listRefunds(filters?: FilterableRefundProps, config?: FindConfig<RefundDTO>, sharedContext?: Context): Promise<RefundDTO[]>;
|
668
|
+
/**
|
669
|
+
* This method handles a webhook event with the associated payment provider.
|
670
|
+
*
|
671
|
+
* Learn more about handling webhook events in [this guide](https://docs.medusajs.com/experimental/payment/webhook-events/)
|
672
|
+
*
|
673
|
+
* @param {ProviderWebhookPayload} data - The webhook event's details.
|
674
|
+
* @returns {Promise<void>} Resolves when the webhook event is handled successfully.
|
675
|
+
*
|
676
|
+
* @example
|
677
|
+
* In the following example, `req` is an instance of `MedusaRequest`:
|
678
|
+
*
|
679
|
+
* ```ts
|
680
|
+
* await paymentModuleService.processEvent({
|
681
|
+
* provider: "stripe",
|
682
|
+
* payload: {
|
683
|
+
* data: req.body,
|
684
|
+
* rawData: req.rawBody,
|
685
|
+
* headers: req.headers,
|
686
|
+
* },
|
687
|
+
* })
|
688
|
+
* ```
|
689
|
+
*/
|
274
690
|
processEvent(data: ProviderWebhookPayload): Promise<void>;
|
275
691
|
}
|
692
|
+
/**
|
693
|
+
* The options that the Payment Module accepts.
|
694
|
+
*/
|
276
695
|
export interface PaymentModuleOptions {
|
277
696
|
/**
|
278
697
|
* The delay in milliseconds before processing the webhook event.
|
698
|
+
*
|
279
699
|
* @defaultValue 5000
|
280
700
|
*/
|
281
701
|
webhook_delay?: number;
|
282
702
|
/**
|
283
703
|
* The number of times to retry the webhook event processing in case of an error.
|
704
|
+
*
|
284
705
|
* @defaultValue 3
|
285
706
|
*/
|
286
707
|
webhook_retries?: number;
|