@medusajs/js-sdk 2.0.1-snapshot-20241025090810 → 2.0.2-snapshot-20241104135243
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin/notification.d.ts +80 -0
- package/dist/admin/notification.d.ts.map +1 -1
- package/dist/admin/notification.js +80 -0
- package/dist/admin/notification.js.map +1 -1
- package/dist/admin/order-edit.d.ts +166 -1
- package/dist/admin/order-edit.d.ts.map +1 -1
- package/dist/admin/order-edit.js +165 -0
- package/dist/admin/order-edit.js.map +1 -1
- package/dist/admin/order.d.ts +248 -22
- package/dist/admin/order.d.ts.map +1 -1
- package/dist/admin/order.js +240 -0
- package/dist/admin/order.js.map +1 -1
- package/dist/admin/payment-collection.d.ts +55 -0
- package/dist/admin/payment-collection.d.ts.map +1 -1
- package/dist/admin/payment-collection.js +55 -0
- package/dist/admin/payment-collection.js.map +1 -1
- package/dist/admin/payment.d.ts +162 -1
- package/dist/admin/payment.d.ts.map +1 -1
- package/dist/admin/payment.js +161 -0
- package/dist/admin/payment.js.map +1 -1
- package/dist/admin/price-list.d.ts +195 -1
- package/dist/admin/price-list.d.ts.map +1 -1
- package/dist/admin/price-list.js +194 -0
- package/dist/admin/price-list.js.map +1 -1
- package/dist/admin/price-preference.d.ts +133 -0
- package/dist/admin/price-preference.d.ts.map +1 -1
- package/dist/admin/price-preference.js +133 -0
- package/dist/admin/price-preference.js.map +1 -1
- package/dist/admin/product-category.d.ts +150 -0
- package/dist/admin/product-category.d.ts.map +1 -1
- package/dist/admin/product-category.js +150 -0
- package/dist/admin/product-category.js.map +1 -1
- package/dist/admin/product-collection.d.ts +149 -0
- package/dist/admin/product-collection.d.ts.map +1 -1
- package/dist/admin/product-collection.js +149 -0
- package/dist/admin/product-collection.js.map +1 -1
- package/dist/esm/admin/notification.d.ts +80 -0
- package/dist/esm/admin/notification.d.ts.map +1 -1
- package/dist/esm/admin/notification.js +80 -0
- package/dist/esm/admin/notification.js.map +1 -1
- package/dist/esm/admin/order-edit.d.ts +166 -1
- package/dist/esm/admin/order-edit.d.ts.map +1 -1
- package/dist/esm/admin/order-edit.js +165 -0
- package/dist/esm/admin/order-edit.js.map +1 -1
- package/dist/esm/admin/order.d.ts +248 -22
- package/dist/esm/admin/order.d.ts.map +1 -1
- package/dist/esm/admin/order.js +240 -0
- package/dist/esm/admin/order.js.map +1 -1
- package/dist/esm/admin/payment-collection.d.ts +55 -0
- package/dist/esm/admin/payment-collection.d.ts.map +1 -1
- package/dist/esm/admin/payment-collection.js +55 -0
- package/dist/esm/admin/payment-collection.js.map +1 -1
- package/dist/esm/admin/payment.d.ts +162 -1
- package/dist/esm/admin/payment.d.ts.map +1 -1
- package/dist/esm/admin/payment.js +161 -0
- package/dist/esm/admin/payment.js.map +1 -1
- package/dist/esm/admin/price-list.d.ts +195 -1
- package/dist/esm/admin/price-list.d.ts.map +1 -1
- package/dist/esm/admin/price-list.js +194 -0
- package/dist/esm/admin/price-list.js.map +1 -1
- package/dist/esm/admin/price-preference.d.ts +133 -0
- package/dist/esm/admin/price-preference.d.ts.map +1 -1
- package/dist/esm/admin/price-preference.js +133 -0
- package/dist/esm/admin/price-preference.js.map +1 -1
- package/dist/esm/admin/product-category.d.ts +150 -0
- package/dist/esm/admin/product-category.d.ts.map +1 -1
- package/dist/esm/admin/product-category.js +150 -0
- package/dist/esm/admin/product-category.js.map +1 -1
- package/dist/esm/admin/product-collection.d.ts +149 -0
- package/dist/esm/admin/product-collection.d.ts.map +1 -1
- package/dist/esm/admin/product-collection.js +149 -0
- package/dist/esm/admin/product-collection.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/admin/order.js
CHANGED
@@ -14,6 +14,39 @@ export class Order {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method retrieves an order by its ID. It sends a request to the
|
19
|
+
* [Get Order](https://docs.medusajs.com/api/admin#orders_getordersid)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param id - The order's ID.
|
23
|
+
* @param query - Configure the fields to retrieve in the order.
|
24
|
+
* @param headers - Headers to pass in the request
|
25
|
+
* @returns The order's details.
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* To retrieve an order by its ID:
|
29
|
+
*
|
30
|
+
* ```ts
|
31
|
+
* sdk.admin.order.retrieve("order_123")
|
32
|
+
* .then(({ order }) => {
|
33
|
+
* console.log(order)
|
34
|
+
* })
|
35
|
+
* ```
|
36
|
+
*
|
37
|
+
* To specify the fields and relations to retrieve:
|
38
|
+
*
|
39
|
+
* ```ts
|
40
|
+
* sdk.admin.order.retrieve("order_123", {
|
41
|
+
* fields: "id,*items"
|
42
|
+
* })
|
43
|
+
* .then(({ order }) => {
|
44
|
+
* console.log(order)
|
45
|
+
* })
|
46
|
+
* ```
|
47
|
+
*
|
48
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
49
|
+
*/
|
17
50
|
retrieve(id, query, headers) {
|
18
51
|
return __awaiter(this, void 0, void 0, function* () {
|
19
52
|
return yield this.client.fetch(`/admin/orders/${id}`, {
|
@@ -22,6 +55,21 @@ export class Order {
|
|
22
55
|
});
|
23
56
|
});
|
24
57
|
}
|
58
|
+
/**
|
59
|
+
* This method retrieves the preview of an order based on its last associated change. It sends a request to the
|
60
|
+
* [Get Order Preview](https://docs.medusajs.com/api/admin#orders_getordersidpreview) API route.
|
61
|
+
*
|
62
|
+
* @param id - The order's ID.
|
63
|
+
* @param query - Query parameters.
|
64
|
+
* @param headers - Headers to pass in the request
|
65
|
+
* @returns The order preview's details.
|
66
|
+
*
|
67
|
+
* @example
|
68
|
+
* sdk.admin.order.retrievePreview("order_123")
|
69
|
+
* .then(({ order }) => {
|
70
|
+
* console.log(order)
|
71
|
+
* })
|
72
|
+
*/
|
25
73
|
retrievePreview(id, query, headers) {
|
26
74
|
return __awaiter(this, void 0, void 0, function* () {
|
27
75
|
return yield this.client.fetch(`/admin/orders/${id}/preview`, {
|
@@ -30,6 +78,52 @@ export class Order {
|
|
30
78
|
});
|
31
79
|
});
|
32
80
|
}
|
81
|
+
/**
|
82
|
+
* This method retrieves a paginated list of orders. It sends a request to the
|
83
|
+
* [List Orders](https://docs.medusajs.com/api/admin#orders_getorders) API route.
|
84
|
+
*
|
85
|
+
* @param queryParams - Filters and pagination configurations.
|
86
|
+
* @param headers - Headers to pass in the request.
|
87
|
+
* @returns The paginated list of orders.
|
88
|
+
*
|
89
|
+
* @example
|
90
|
+
* To retrieve the list of orders:
|
91
|
+
*
|
92
|
+
* ```ts
|
93
|
+
* sdk.admin.order.list()
|
94
|
+
* .then(({ orders, count, limit, offset }) => {
|
95
|
+
* console.log(orders)
|
96
|
+
* })
|
97
|
+
* ```
|
98
|
+
*
|
99
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
100
|
+
*
|
101
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
102
|
+
*
|
103
|
+
* ```ts
|
104
|
+
* sdk.admin.order.list({
|
105
|
+
* limit: 10,
|
106
|
+
* offset: 10
|
107
|
+
* })
|
108
|
+
* .then(({ orders, count, limit, offset }) => {
|
109
|
+
* console.log(orders)
|
110
|
+
* })
|
111
|
+
* ```
|
112
|
+
*
|
113
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
114
|
+
* in each order:
|
115
|
+
*
|
116
|
+
* ```ts
|
117
|
+
* sdk.admin.order.list({
|
118
|
+
* fields: "id,*items"
|
119
|
+
* })
|
120
|
+
* .then(({ orders, count, limit, offset }) => {
|
121
|
+
* console.log(orders)
|
122
|
+
* })
|
123
|
+
* ```
|
124
|
+
*
|
125
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
126
|
+
*/
|
33
127
|
list(queryParams, headers) {
|
34
128
|
return __awaiter(this, void 0, void 0, function* () {
|
35
129
|
return yield this.client.fetch(`/admin/orders`, {
|
@@ -38,6 +132,21 @@ export class Order {
|
|
38
132
|
});
|
39
133
|
});
|
40
134
|
}
|
135
|
+
/**
|
136
|
+
* This method cancels an order. It sends a request to the
|
137
|
+
* [Cancel Order](https://docs.medusajs.com/api/admin#orders_postordersidcancel)
|
138
|
+
* API route.
|
139
|
+
*
|
140
|
+
* @param id - The order's ID.
|
141
|
+
* @param headers - Headers to pass in the request.
|
142
|
+
* @returns The order's details.
|
143
|
+
*
|
144
|
+
* @example
|
145
|
+
* sdk.admin.order.cancel("order_123")
|
146
|
+
* .then(({ order }) => {
|
147
|
+
* console.log(order)
|
148
|
+
* })
|
149
|
+
*/
|
41
150
|
cancel(id, headers) {
|
42
151
|
return __awaiter(this, void 0, void 0, function* () {
|
43
152
|
return yield this.client.fetch(`/admin/orders/${id}/cancel`, {
|
@@ -46,6 +155,30 @@ export class Order {
|
|
46
155
|
});
|
47
156
|
});
|
48
157
|
}
|
158
|
+
/**
|
159
|
+
* This method creates a fulfillment for an order. It sends a request to the
|
160
|
+
* [Create Fulfillment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillments)
|
161
|
+
* API route.
|
162
|
+
*
|
163
|
+
* @param id - The order's ID.
|
164
|
+
* @param body - The fulfillment's details.
|
165
|
+
* @param query - Configure the fields to retrieve in the order.
|
166
|
+
* @param headers - Headers to pass in the request
|
167
|
+
* @returns The order's details.
|
168
|
+
*
|
169
|
+
* @example
|
170
|
+
* sdk.admin.order.createFulfillment("order_123", {
|
171
|
+
* items: [
|
172
|
+
* {
|
173
|
+
* id: "orli_123",
|
174
|
+
* quantity: 1
|
175
|
+
* }
|
176
|
+
* ]
|
177
|
+
* })
|
178
|
+
* .then(({ order }) => {
|
179
|
+
* console.log(order)
|
180
|
+
* })
|
181
|
+
*/
|
49
182
|
createFulfillment(id, body, query, headers) {
|
50
183
|
return __awaiter(this, void 0, void 0, function* () {
|
51
184
|
return yield this.client.fetch(`/admin/orders/${id}/fulfillments`, {
|
@@ -56,6 +189,29 @@ export class Order {
|
|
56
189
|
});
|
57
190
|
});
|
58
191
|
}
|
192
|
+
/**
|
193
|
+
* This method cancels an order's fulfillment. It sends a request to the
|
194
|
+
* [Cancel Fulfillment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idcancel)
|
195
|
+
* API route.
|
196
|
+
*
|
197
|
+
* @param id - The order's ID.
|
198
|
+
* @param fulfillmentId - The ID of the fulfillment to cancel.
|
199
|
+
* @param body - The cancelation's details.
|
200
|
+
* @param headers - Headers to pass in the request
|
201
|
+
* @returns The order's details.
|
202
|
+
*
|
203
|
+
* @example
|
204
|
+
* sdk.admin.order.cancelFulfillment(
|
205
|
+
* "order_123",
|
206
|
+
* "ful_123",
|
207
|
+
* {
|
208
|
+
* no_notification: false
|
209
|
+
* }
|
210
|
+
* )
|
211
|
+
* .then(({ order }) => {
|
212
|
+
* console.log(order)
|
213
|
+
* })
|
214
|
+
*/
|
59
215
|
cancelFulfillment(id, fulfillmentId, body, headers) {
|
60
216
|
return __awaiter(this, void 0, void 0, function* () {
|
61
217
|
return yield this.client.fetch(`/admin/orders/${id}/fulfillments/${fulfillmentId}/cancel`, {
|
@@ -65,6 +221,35 @@ export class Order {
|
|
65
221
|
});
|
66
222
|
});
|
67
223
|
}
|
224
|
+
/**
|
225
|
+
* This method creates a shipment for an order's fulfillment. It sends a request to the
|
226
|
+
* [Create Shipment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idshipments)
|
227
|
+
* API route.
|
228
|
+
*
|
229
|
+
* @param id - The order's ID.
|
230
|
+
* @param fulfillmentId - The ID of the fulfillment.
|
231
|
+
* @param body - The shipment's details.
|
232
|
+
* @param query - Configure the fields to retrieve in the order.
|
233
|
+
* @param headers - Headers to pass in the request
|
234
|
+
* @returns The order's details.
|
235
|
+
*
|
236
|
+
* @example
|
237
|
+
* sdk.admin.order.createShipment(
|
238
|
+
* "order_123",
|
239
|
+
* "ful_123",
|
240
|
+
* {
|
241
|
+
* items: [
|
242
|
+
* {
|
243
|
+
* id: "fulit_123",
|
244
|
+
* quantity: 1
|
245
|
+
* }
|
246
|
+
* ]
|
247
|
+
* }
|
248
|
+
* )
|
249
|
+
* .then(({ order }) => {
|
250
|
+
* console.log(order)
|
251
|
+
* })
|
252
|
+
*/
|
68
253
|
createShipment(id, fulfillmentId, body, query, headers) {
|
69
254
|
return __awaiter(this, void 0, void 0, function* () {
|
70
255
|
return yield this.client.fetch(`/admin/orders/${id}/fulfillments/${fulfillmentId}/shipments`, {
|
@@ -75,6 +260,28 @@ export class Order {
|
|
75
260
|
});
|
76
261
|
});
|
77
262
|
}
|
263
|
+
/**
|
264
|
+
* This method marks an order's fulfillment as delivered. It sends a request to the
|
265
|
+
* [Mark Delivered ](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idmarkasdelivered)
|
266
|
+
* API route.
|
267
|
+
*
|
268
|
+
* @param id - The order's ID.
|
269
|
+
* @param fulfillmentId - The fulfillment's ID.
|
270
|
+
* @param body - The delivery details.
|
271
|
+
* @param query - Configure the fields to retrieve in the order.
|
272
|
+
* @param headers - Headers to pass in the request
|
273
|
+
* @returns The order's details.
|
274
|
+
*
|
275
|
+
* @example
|
276
|
+
* sdk.admin.order.markAsDelivered(
|
277
|
+
* "order_123",
|
278
|
+
* "ful_123",
|
279
|
+
* {}
|
280
|
+
* )
|
281
|
+
* .then(({ order }) => {
|
282
|
+
* console.log(order)
|
283
|
+
* })
|
284
|
+
*/
|
78
285
|
markAsDelivered(id, fulfillmentId, body, query, headers) {
|
79
286
|
return __awaiter(this, void 0, void 0, function* () {
|
80
287
|
return yield this.client.fetch(`/admin/orders/${id}/fulfillments/${fulfillmentId}/mark-as-delivered`, {
|
@@ -85,6 +292,23 @@ export class Order {
|
|
85
292
|
});
|
86
293
|
});
|
87
294
|
}
|
295
|
+
/**
|
296
|
+
* This method retrieves a list of changes made on an order, including returns, exchanges, etc...
|
297
|
+
*
|
298
|
+
* This method sends a request to the [List Changes](https://docs.medusajs.com/api/admin#orders_getordersidchanges)
|
299
|
+
* API route.
|
300
|
+
*
|
301
|
+
* @param id - The order's ID.
|
302
|
+
* @param queryParams - Configure the fields to retrieve in each order change.
|
303
|
+
* @param headers - Headers to pass in the request
|
304
|
+
* @returns The list of order changes.
|
305
|
+
*
|
306
|
+
* @example
|
307
|
+
* sdk.admin.order.listChanges("order_123")
|
308
|
+
* .then(({ order_changes }) => {
|
309
|
+
* console.log(order_changes)
|
310
|
+
* })
|
311
|
+
*/
|
88
312
|
listChanges(id, queryParams, headers) {
|
89
313
|
return __awaiter(this, void 0, void 0, function* () {
|
90
314
|
return yield this.client.fetch(`/admin/orders/${id}/changes`, {
|
@@ -93,6 +317,22 @@ export class Order {
|
|
93
317
|
});
|
94
318
|
});
|
95
319
|
}
|
320
|
+
/**
|
321
|
+
* This method retrieves the order's line items. It sends a request to the
|
322
|
+
* [List Line Items](https://docs.medusajs.com/api/admin#orders_getordersidlineitems)
|
323
|
+
* API routes.
|
324
|
+
*
|
325
|
+
* @param id - The order's ID.
|
326
|
+
* @param queryParams - Configure the fields to retrieve in each line item.
|
327
|
+
* @param headers - Headers to pass in the request
|
328
|
+
* @returns The list of line items.
|
329
|
+
*
|
330
|
+
* @example
|
331
|
+
* sdk.admin.order.listLineItems("order_123")
|
332
|
+
* .then(({ order_items }) => {
|
333
|
+
* console.log(order_items)
|
334
|
+
* })
|
335
|
+
*/
|
96
336
|
listLineItems(id, queryParams, headers) {
|
97
337
|
return __awaiter(this, void 0, void 0, function* () {
|
98
338
|
return yield this.client.fetch(`/admin/orders/${id}/line-items`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/admin/order.ts"],"names":[],"mappings":";;;;;;;;;AAWA,MAAM,OAAO,KAAK;IAKhB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/admin/order.ts"],"names":[],"mappings":";;;;;;;;;AAWA,MAAM,OAAO,KAAK;IAKhB;;OAEG;IAC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2D,EAC3D,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE,aAAa,EAAE;gBAClC,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;KAAA;CACF"}
|
@@ -10,8 +10,63 @@ export declare class PaymentCollection {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method creates a payment collection. It sends a request to the
|
15
|
+
* [Create Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollections)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param body - The details of the payment collection to create.
|
19
|
+
* @param query - Configure the fields to retrieve in the payment collection.
|
20
|
+
* @param headers - Headers to pass in the request
|
21
|
+
* @returns The payment collection's details.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* sdk.admin.paymentCollection.create({
|
25
|
+
* order_id: "order_123"
|
26
|
+
* })
|
27
|
+
* .then(({ payment_collection }) => {
|
28
|
+
* console.log(payment_collection)
|
29
|
+
* })
|
30
|
+
*/
|
13
31
|
create(body: HttpTypes.AdminCreatePaymentCollection, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentCollectionResponse>;
|
32
|
+
/**
|
33
|
+
* This method deletes a payment collection. It sends a request to the
|
34
|
+
* [Delete Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_deletepaymentcollectionsid)
|
35
|
+
* API route.
|
36
|
+
*
|
37
|
+
* @param id - The payment collection's ID.
|
38
|
+
* @param headers - Headers to pass in the request
|
39
|
+
* @returns The deletion's details.
|
40
|
+
*
|
41
|
+
* @example
|
42
|
+
* sdk.admin.paymentCollection.delete("paycol_123")
|
43
|
+
* .then(({ deleted }) => {
|
44
|
+
* console.log(deleted)
|
45
|
+
* })
|
46
|
+
*/
|
14
47
|
delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminDeletePaymentCollectionResponse>;
|
48
|
+
/**
|
49
|
+
* This method marks a payment collection as paid. It sends a request to the
|
50
|
+
* [Mark as Paid](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollectionsidmarkaspaid)
|
51
|
+
* API route.
|
52
|
+
*
|
53
|
+
* The API route creates and authorizes a payment session, then capture its payment,
|
54
|
+
* using the manual payment provider.
|
55
|
+
*
|
56
|
+
* @param id - The payment collection to mark as paid.
|
57
|
+
* @param body - The details to mark the payment collection as paid.
|
58
|
+
* @param query - Configure the fields to retrieve in the payment collection.
|
59
|
+
* @param headers - Headers to pass in the request.
|
60
|
+
* @returns The payment collection's details.
|
61
|
+
*
|
62
|
+
* @example
|
63
|
+
* sdk.admin.paymentCollection.markAsPaid("paycol_123", {
|
64
|
+
* order_id: "order_123"
|
65
|
+
* })
|
66
|
+
* .then(({ payment_collection }) => {
|
67
|
+
* console.log(payment_collection)
|
68
|
+
* })
|
69
|
+
*/
|
15
70
|
markAsPaid(id: string, body: HttpTypes.AdminMarkPaymentCollectionAsPaid, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentCollectionResponse>;
|
16
71
|
}
|
17
72
|
//# sourceMappingURL=payment-collection.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment-collection.d.ts","sourceRoot":"","sources":["../../../src/admin/payment-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"payment-collection.d.ts","sourceRoot":"","sources":["../../../src/admin/payment-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,4BAA4B,EAC5C,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAUhD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,UAAU,CACd,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,gCAAgC,EAChD,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;CAY1B"}
|
@@ -14,6 +14,24 @@ export class PaymentCollection {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method creates a payment collection. It sends a request to the
|
19
|
+
* [Create Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollections)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param body - The details of the payment collection to create.
|
23
|
+
* @param query - Configure the fields to retrieve in the payment collection.
|
24
|
+
* @param headers - Headers to pass in the request
|
25
|
+
* @returns The payment collection's details.
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* sdk.admin.paymentCollection.create({
|
29
|
+
* order_id: "order_123"
|
30
|
+
* })
|
31
|
+
* .then(({ payment_collection }) => {
|
32
|
+
* console.log(payment_collection)
|
33
|
+
* })
|
34
|
+
*/
|
17
35
|
create(body, query, headers) {
|
18
36
|
return __awaiter(this, void 0, void 0, function* () {
|
19
37
|
return yield this.client.fetch(`/admin/payment-collections`, {
|
@@ -24,6 +42,21 @@ export class PaymentCollection {
|
|
24
42
|
});
|
25
43
|
});
|
26
44
|
}
|
45
|
+
/**
|
46
|
+
* This method deletes a payment collection. It sends a request to the
|
47
|
+
* [Delete Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_deletepaymentcollectionsid)
|
48
|
+
* API route.
|
49
|
+
*
|
50
|
+
* @param id - The payment collection's ID.
|
51
|
+
* @param headers - Headers to pass in the request
|
52
|
+
* @returns The deletion's details.
|
53
|
+
*
|
54
|
+
* @example
|
55
|
+
* sdk.admin.paymentCollection.delete("paycol_123")
|
56
|
+
* .then(({ deleted }) => {
|
57
|
+
* console.log(deleted)
|
58
|
+
* })
|
59
|
+
*/
|
27
60
|
delete(id, headers) {
|
28
61
|
return __awaiter(this, void 0, void 0, function* () {
|
29
62
|
return yield this.client.fetch(`/admin/payment-collections/${id}`, {
|
@@ -32,6 +65,28 @@ export class PaymentCollection {
|
|
32
65
|
});
|
33
66
|
});
|
34
67
|
}
|
68
|
+
/**
|
69
|
+
* This method marks a payment collection as paid. It sends a request to the
|
70
|
+
* [Mark as Paid](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollectionsidmarkaspaid)
|
71
|
+
* API route.
|
72
|
+
*
|
73
|
+
* The API route creates and authorizes a payment session, then capture its payment,
|
74
|
+
* using the manual payment provider.
|
75
|
+
*
|
76
|
+
* @param id - The payment collection to mark as paid.
|
77
|
+
* @param body - The details to mark the payment collection as paid.
|
78
|
+
* @param query - Configure the fields to retrieve in the payment collection.
|
79
|
+
* @param headers - Headers to pass in the request.
|
80
|
+
* @returns The payment collection's details.
|
81
|
+
*
|
82
|
+
* @example
|
83
|
+
* sdk.admin.paymentCollection.markAsPaid("paycol_123", {
|
84
|
+
* order_id: "order_123"
|
85
|
+
* })
|
86
|
+
* .then(({ payment_collection }) => {
|
87
|
+
* console.log(payment_collection)
|
88
|
+
* })
|
89
|
+
*/
|
35
90
|
markAsPaid(id, body, query, headers) {
|
36
91
|
return __awaiter(this, void 0, void 0, function* () {
|
37
92
|
return yield this.client.fetch(`/admin/payment-collections/${id}/mark-as-paid`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAA4C,EAC5C,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4BAA4B,EAC5B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,EAAE,EAClC;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,UAAU,CACd,EAAU,EACV,IAAgD,EAChD,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,eAAe,EAC/C;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
|
@@ -10,10 +10,171 @@ export declare class Payment {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method retrieves a paginated list of payments. It sends a request to the
|
15
|
+
* [List Payments](https://docs.medusajs.com/api/admin#payments_getpayments) API route.
|
16
|
+
*
|
17
|
+
* @param query - Filters and pagination configurations.
|
18
|
+
* @param headers - Headers to pass in the request.
|
19
|
+
* @returns The paginated list of payments.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* To retrieve the list of payments:
|
23
|
+
*
|
24
|
+
* ```ts
|
25
|
+
* sdk.admin.payment.list()
|
26
|
+
* .then(({ payments, count, limit, offset }) => {
|
27
|
+
* console.log(payments)
|
28
|
+
* })
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
32
|
+
*
|
33
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
34
|
+
*
|
35
|
+
* ```ts
|
36
|
+
* sdk.admin.payment.list({
|
37
|
+
* limit: 10,
|
38
|
+
* offset: 10
|
39
|
+
* })
|
40
|
+
* .then(({ payments, count, limit, offset }) => {
|
41
|
+
* console.log(payments)
|
42
|
+
* })
|
43
|
+
* ```
|
44
|
+
*
|
45
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
46
|
+
* in each payment:
|
47
|
+
*
|
48
|
+
* ```ts
|
49
|
+
* sdk.admin.payment.list({
|
50
|
+
* fields: "id,*payment_collection"
|
51
|
+
* })
|
52
|
+
* .then(({ payments, count, limit, offset }) => {
|
53
|
+
* console.log(payments)
|
54
|
+
* })
|
55
|
+
* ```
|
56
|
+
*
|
57
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
58
|
+
*/
|
13
59
|
list(query?: HttpTypes.AdminPaymentFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentsResponse>;
|
60
|
+
/**
|
61
|
+
* This method retrieves a paginated list of payment providers. It sends a request to the
|
62
|
+
* [List Payment Providers](https://docs.medusajs.com/api/admin#payments_getpaymentspaymentproviders) API route.
|
63
|
+
*
|
64
|
+
* @param query - Filters and pagination configurations.
|
65
|
+
* @param headers - Headers to pass in the request.
|
66
|
+
* @returns The paginated list of payment providers.
|
67
|
+
*
|
68
|
+
* @example
|
69
|
+
* To retrieve the list of payment providers:
|
70
|
+
*
|
71
|
+
* ```ts
|
72
|
+
* sdk.admin.payment.listPaymentProviders()
|
73
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
74
|
+
* console.log(payment_providers)
|
75
|
+
* })
|
76
|
+
* ```
|
77
|
+
*
|
78
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
79
|
+
*
|
80
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
81
|
+
*
|
82
|
+
* ```ts
|
83
|
+
* sdk.admin.payment.listPaymentProviders({
|
84
|
+
* limit: 10,
|
85
|
+
* offset: 10
|
86
|
+
* })
|
87
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
88
|
+
* console.log(payment_providers)
|
89
|
+
* })
|
90
|
+
* ```
|
91
|
+
*
|
92
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
93
|
+
* in each payment provider:
|
94
|
+
*
|
95
|
+
* ```ts
|
96
|
+
* sdk.admin.payment.listPaymentProviders({
|
97
|
+
* fields: "id,is_enabled"
|
98
|
+
* })
|
99
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
100
|
+
* console.log(payment_providers)
|
101
|
+
* })
|
102
|
+
* ```
|
103
|
+
*
|
104
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
105
|
+
*/
|
14
106
|
listPaymentProviders(query?: HttpTypes.AdminGetPaymentProvidersParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentProviderListResponse>;
|
15
|
-
|
107
|
+
/**
|
108
|
+
* This method retrieves a payment's details. It sends a request to the
|
109
|
+
* [Get Payment](https://docs.medusajs.com/api/admin#payments_getpaymentsid)
|
110
|
+
* API route.
|
111
|
+
*
|
112
|
+
* @param id - The payment's ID.
|
113
|
+
* @param query - Configure the fields to retrieve in the payment.
|
114
|
+
* @param headers - Headers to pass in the request
|
115
|
+
* @returns The payment's details.
|
116
|
+
*
|
117
|
+
* @example
|
118
|
+
* To retrieve a payment by its ID:
|
119
|
+
*
|
120
|
+
* ```ts
|
121
|
+
* sdk.admin.payment.retrieve("pay_123")
|
122
|
+
* .then(({ payment }) => {
|
123
|
+
* console.log(payment)
|
124
|
+
* })
|
125
|
+
* ```
|
126
|
+
*
|
127
|
+
* To specify the fields and relations to retrieve:
|
128
|
+
*
|
129
|
+
* ```ts
|
130
|
+
* sdk.admin.payment.retrieve("pay_123", {
|
131
|
+
* fields: "id,*payment_collection"
|
132
|
+
* })
|
133
|
+
* .then(({ payment }) => {
|
134
|
+
* console.log(payment)
|
135
|
+
* })
|
136
|
+
* ```
|
137
|
+
*
|
138
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
139
|
+
*/
|
140
|
+
retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
|
141
|
+
/**
|
142
|
+
* This method captures a payment. It sends a request to the
|
143
|
+
* [Capture Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidcapture) API route.
|
144
|
+
*
|
145
|
+
* The API route uses the `capturePayment` method of the payment provider associated with the payment's collection.
|
146
|
+
*
|
147
|
+
* @param id - The payment's ID.
|
148
|
+
* @param body - The capture's details.
|
149
|
+
* @param query - Configure the fields to retrieve in the payment.
|
150
|
+
* @param headers - Headers to pass in the request
|
151
|
+
* @returns The payment's details.
|
152
|
+
*
|
153
|
+
* @example
|
154
|
+
* sdk.admin.payment.capture("paycol_123", {})
|
155
|
+
* .then(({ payment }) => {
|
156
|
+
* console.log(payment)
|
157
|
+
* })
|
158
|
+
*/
|
16
159
|
capture(id: string, body: HttpTypes.AdminCapturePayment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
|
160
|
+
/**
|
161
|
+
* This method refunds a payment. It sends a request to the
|
162
|
+
* [Refund Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidrefund) API route.
|
163
|
+
*
|
164
|
+
* The API route uses the `refundPayment` method of the payment provider associated with the payment's collection.
|
165
|
+
*
|
166
|
+
* @param id - The payment's ID.
|
167
|
+
* @param body - The refund's details.
|
168
|
+
* @param query - Configure the fields to retrieve in the payment.
|
169
|
+
* @param headers - Headers to pass in the request
|
170
|
+
* @returns The payment's details.
|
171
|
+
*
|
172
|
+
* @example
|
173
|
+
* sdk.admin.payment.refund("paycol_123", {})
|
174
|
+
* .then(({ payment }) => {
|
175
|
+
* console.log(payment)
|
176
|
+
* })
|
177
|
+
*/
|
17
178
|
refund(id: string, body: HttpTypes.AdminRefundPayment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
|
18
179
|
}
|
19
180
|
//# sourceMappingURL=payment.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/admin/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,OAAO;IAClB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/admin/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,E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