@medusajs/js-sdk 2.0.1 → 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/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/package.json +2 -2
@@ -10,29 +10,255 @@ export declare class Order {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
/**
|
14
|
+
* This method retrieves an order by its ID. It sends a request to the
|
15
|
+
* [Get Order](https://docs.medusajs.com/api/admin#orders_getordersid)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param id - The order's ID.
|
19
|
+
* @param query - Configure the fields to retrieve in the order.
|
20
|
+
* @param headers - Headers to pass in the request
|
21
|
+
* @returns The order's details.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* To retrieve an order by its ID:
|
25
|
+
*
|
26
|
+
* ```ts
|
27
|
+
* sdk.admin.order.retrieve("order_123")
|
28
|
+
* .then(({ order }) => {
|
29
|
+
* console.log(order)
|
30
|
+
* })
|
31
|
+
* ```
|
32
|
+
*
|
33
|
+
* To specify the fields and relations to retrieve:
|
34
|
+
*
|
35
|
+
* ```ts
|
36
|
+
* sdk.admin.order.retrieve("order_123", {
|
37
|
+
* fields: "id,*items"
|
38
|
+
* })
|
39
|
+
* .then(({ order }) => {
|
40
|
+
* console.log(order)
|
41
|
+
* })
|
42
|
+
* ```
|
43
|
+
*
|
44
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
45
|
+
*/
|
46
|
+
retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderResponse>;
|
47
|
+
/**
|
48
|
+
* This method retrieves the preview of an order based on its last associated change. It sends a request to the
|
49
|
+
* [Get Order Preview](https://docs.medusajs.com/api/admin#orders_getordersidpreview) API route.
|
50
|
+
*
|
51
|
+
* @param id - The order's ID.
|
52
|
+
* @param query - Query parameters.
|
53
|
+
* @param headers - Headers to pass in the request
|
54
|
+
* @returns The order preview's details.
|
55
|
+
*
|
56
|
+
* @example
|
57
|
+
* sdk.admin.order.retrievePreview("order_123")
|
58
|
+
* .then(({ order }) => {
|
59
|
+
* console.log(order)
|
60
|
+
* })
|
61
|
+
*/
|
16
62
|
retrievePreview(id: string, query?: HttpTypes.AdminOrderFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderPreviewResponse>;
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
63
|
+
/**
|
64
|
+
* This method retrieves a paginated list of orders. It sends a request to the
|
65
|
+
* [List Orders](https://docs.medusajs.com/api/admin#orders_getorders) API route.
|
66
|
+
*
|
67
|
+
* @param queryParams - Filters and pagination configurations.
|
68
|
+
* @param headers - Headers to pass in the request.
|
69
|
+
* @returns The paginated list of orders.
|
70
|
+
*
|
71
|
+
* @example
|
72
|
+
* To retrieve the list of orders:
|
73
|
+
*
|
74
|
+
* ```ts
|
75
|
+
* sdk.admin.order.list()
|
76
|
+
* .then(({ orders, count, limit, offset }) => {
|
77
|
+
* console.log(orders)
|
78
|
+
* })
|
79
|
+
* ```
|
80
|
+
*
|
81
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
82
|
+
*
|
83
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
84
|
+
*
|
85
|
+
* ```ts
|
86
|
+
* sdk.admin.order.list({
|
87
|
+
* limit: 10,
|
88
|
+
* offset: 10
|
89
|
+
* })
|
90
|
+
* .then(({ orders, count, limit, offset }) => {
|
91
|
+
* console.log(orders)
|
92
|
+
* })
|
93
|
+
* ```
|
94
|
+
*
|
95
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
96
|
+
* in each order:
|
97
|
+
*
|
98
|
+
* ```ts
|
99
|
+
* sdk.admin.order.list({
|
100
|
+
* fields: "id,*items"
|
101
|
+
* })
|
102
|
+
* .then(({ orders, count, limit, offset }) => {
|
103
|
+
* console.log(orders)
|
104
|
+
* })
|
105
|
+
* ```
|
106
|
+
*
|
107
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
108
|
+
*/
|
109
|
+
list(queryParams?: HttpTypes.AdminOrderFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderListResponse>;
|
110
|
+
/**
|
111
|
+
* This method cancels an order. It sends a request to the
|
112
|
+
* [Cancel Order](https://docs.medusajs.com/api/admin#orders_postordersidcancel)
|
113
|
+
* API route.
|
114
|
+
*
|
115
|
+
* @param id - The order's ID.
|
116
|
+
* @param headers - Headers to pass in the request.
|
117
|
+
* @returns The order's details.
|
118
|
+
*
|
119
|
+
* @example
|
120
|
+
* sdk.admin.order.cancel("order_123")
|
121
|
+
* .then(({ order }) => {
|
122
|
+
* console.log(order)
|
123
|
+
* })
|
124
|
+
*/
|
125
|
+
cancel(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderResponse>;
|
126
|
+
/**
|
127
|
+
* This method creates a fulfillment for an order. It sends a request to the
|
128
|
+
* [Create Fulfillment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillments)
|
129
|
+
* API route.
|
130
|
+
*
|
131
|
+
* @param id - The order's ID.
|
132
|
+
* @param body - The fulfillment's details.
|
133
|
+
* @param query - Configure the fields to retrieve in the order.
|
134
|
+
* @param headers - Headers to pass in the request
|
135
|
+
* @returns The order's details.
|
136
|
+
*
|
137
|
+
* @example
|
138
|
+
* sdk.admin.order.createFulfillment("order_123", {
|
139
|
+
* items: [
|
140
|
+
* {
|
141
|
+
* id: "orli_123",
|
142
|
+
* quantity: 1
|
143
|
+
* }
|
144
|
+
* ]
|
145
|
+
* })
|
146
|
+
* .then(({ order }) => {
|
147
|
+
* console.log(order)
|
148
|
+
* })
|
149
|
+
*/
|
150
|
+
createFulfillment(id: string, body: HttpTypes.AdminCreateOrderFulfillment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderResponse>;
|
151
|
+
/**
|
152
|
+
* This method cancels an order's fulfillment. It sends a request to the
|
153
|
+
* [Cancel Fulfillment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idcancel)
|
154
|
+
* API route.
|
155
|
+
*
|
156
|
+
* @param id - The order's ID.
|
157
|
+
* @param fulfillmentId - The ID of the fulfillment to cancel.
|
158
|
+
* @param body - The cancelation's details.
|
159
|
+
* @param headers - Headers to pass in the request
|
160
|
+
* @returns The order's details.
|
161
|
+
*
|
162
|
+
* @example
|
163
|
+
* sdk.admin.order.cancelFulfillment(
|
164
|
+
* "order_123",
|
165
|
+
* "ful_123",
|
166
|
+
* {
|
167
|
+
* no_notification: false
|
168
|
+
* }
|
169
|
+
* )
|
170
|
+
* .then(({ order }) => {
|
171
|
+
* console.log(order)
|
172
|
+
* })
|
173
|
+
*/
|
174
|
+
cancelFulfillment(id: string, fulfillmentId: string, body: HttpTypes.AdminCancelOrderFulfillment, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderResponse>;
|
175
|
+
/**
|
176
|
+
* This method creates a shipment for an order's fulfillment. It sends a request to the
|
177
|
+
* [Create Shipment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idshipments)
|
178
|
+
* API route.
|
179
|
+
*
|
180
|
+
* @param id - The order's ID.
|
181
|
+
* @param fulfillmentId - The ID of the fulfillment.
|
182
|
+
* @param body - The shipment's details.
|
183
|
+
* @param query - Configure the fields to retrieve in the order.
|
184
|
+
* @param headers - Headers to pass in the request
|
185
|
+
* @returns The order's details.
|
186
|
+
*
|
187
|
+
* @example
|
188
|
+
* sdk.admin.order.createShipment(
|
189
|
+
* "order_123",
|
190
|
+
* "ful_123",
|
191
|
+
* {
|
192
|
+
* items: [
|
193
|
+
* {
|
194
|
+
* id: "fulit_123",
|
195
|
+
* quantity: 1
|
196
|
+
* }
|
197
|
+
* ]
|
198
|
+
* }
|
199
|
+
* )
|
200
|
+
* .then(({ order }) => {
|
201
|
+
* console.log(order)
|
202
|
+
* })
|
203
|
+
*/
|
204
|
+
createShipment(id: string, fulfillmentId: string, body: HttpTypes.AdminCreateOrderShipment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderResponse>;
|
205
|
+
/**
|
206
|
+
* This method marks an order's fulfillment as delivered. It sends a request to the
|
207
|
+
* [Mark Delivered ](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idmarkasdelivered)
|
208
|
+
* API route.
|
209
|
+
*
|
210
|
+
* @param id - The order's ID.
|
211
|
+
* @param fulfillmentId - The fulfillment's ID.
|
212
|
+
* @param body - The delivery details.
|
213
|
+
* @param query - Configure the fields to retrieve in the order.
|
214
|
+
* @param headers - Headers to pass in the request
|
215
|
+
* @returns The order's details.
|
216
|
+
*
|
217
|
+
* @example
|
218
|
+
* sdk.admin.order.markAsDelivered(
|
219
|
+
* "order_123",
|
220
|
+
* "ful_123",
|
221
|
+
* {}
|
222
|
+
* )
|
223
|
+
* .then(({ order }) => {
|
224
|
+
* console.log(order)
|
225
|
+
* })
|
226
|
+
*/
|
227
|
+
markAsDelivered(id: string, fulfillmentId: string, body: HttpTypes.AdminMarkOrderFulfillmentAsDelivered, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderResponse>;
|
228
|
+
/**
|
229
|
+
* This method retrieves a list of changes made on an order, including returns, exchanges, etc...
|
230
|
+
*
|
231
|
+
* This method sends a request to the [List Changes](https://docs.medusajs.com/api/admin#orders_getordersidchanges)
|
232
|
+
* API route.
|
233
|
+
*
|
234
|
+
* @param id - The order's ID.
|
235
|
+
* @param queryParams - Configure the fields to retrieve in each order change.
|
236
|
+
* @param headers - Headers to pass in the request
|
237
|
+
* @returns The list of order changes.
|
238
|
+
*
|
239
|
+
* @example
|
240
|
+
* sdk.admin.order.listChanges("order_123")
|
241
|
+
* .then(({ order_changes }) => {
|
242
|
+
* console.log(order_changes)
|
243
|
+
* })
|
244
|
+
*/
|
35
245
|
listChanges(id: string, queryParams?: FindParams & HttpTypes.AdminOrderChangesFilters, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<HttpTypes.AdminOrderChangesResponse>>;
|
36
|
-
|
246
|
+
/**
|
247
|
+
* This method retrieves the order's line items. It sends a request to the
|
248
|
+
* [List Line Items](https://docs.medusajs.com/api/admin#orders_getordersidlineitems)
|
249
|
+
* API routes.
|
250
|
+
*
|
251
|
+
* @param id - The order's ID.
|
252
|
+
* @param queryParams - Configure the fields to retrieve in each line item.
|
253
|
+
* @param headers - Headers to pass in the request
|
254
|
+
* @returns The list of line items.
|
255
|
+
*
|
256
|
+
* @example
|
257
|
+
* sdk.admin.order.listLineItems("order_123")
|
258
|
+
* .then(({ order_items }) => {
|
259
|
+
* console.log(order_items)
|
260
|
+
* })
|
261
|
+
*/
|
262
|
+
listLineItems(id: string, queryParams?: FindParams & HttpTypes.AdminOrderItemsFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderLineItemsListResponse>;
|
37
263
|
}
|
38
264
|
//# sourceMappingURL=order.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/admin/order.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,YAAY,EACb,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,KAAK;IAChB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/admin/order.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,YAAY,EACb,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAA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E,MAAM,EACV,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,CAAC,oCAAoC,EACpD,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;OAgBG;IACG,WAAW,CACf,EAAE,EAAE,MAAM,EACV,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,wBAAwB,EAC7D,OAAO,CAAC,EAAE,aAAa;IAUzB;;;;;;;;;;;;;;;OAeG;IACG,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,sBAAsB,EAC3D,OAAO,CAAC,EAAE,aAAa;CAS1B"}
|
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;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;;YACtE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,EAAE,EACrB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACG,eAAe,CACnB,EAAU,EACV,KAAmC,EACnC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,UAAU,EAC7B;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH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AAiB,aAAa,YAAY,EAC7D;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,eAAe,CACnB,EAAU,EACV,aAAqB,EACrB,IAAoD,EACpD,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,oBAAoB,EACrE;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,WAAW,CACf,EAAU,EACV,WAA6D,EAC7D,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE,UAAU,EAAE;gBAC/B,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;KAAA;IAED;;;;;;;;;;;;;;;OAeG;IACG,aAAa,CACjB,EAAU,EACV,WAA2D,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"}
|