@medusajs/js-sdk 2.0.1 → 2.0.2-snapshot-20241104135243
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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
package/dist/admin/order.d.ts
CHANGED
@@ -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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C,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,eAAe,CACnB,EAAE,EAAE,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/admin/order.js
CHANGED
@@ -8,30 +8,163 @@ class Order {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method retrieves an order by its ID. It sends a request to the
|
13
|
+
* [Get Order](https://docs.medusajs.com/api/admin#orders_getordersid)
|
14
|
+
* API route.
|
15
|
+
*
|
16
|
+
* @param id - The order's ID.
|
17
|
+
* @param query - Configure the fields to retrieve in the order.
|
18
|
+
* @param headers - Headers to pass in the request
|
19
|
+
* @returns The order's details.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* To retrieve an order by its ID:
|
23
|
+
*
|
24
|
+
* ```ts
|
25
|
+
* sdk.admin.order.retrieve("order_123")
|
26
|
+
* .then(({ order }) => {
|
27
|
+
* console.log(order)
|
28
|
+
* })
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* To specify the fields and relations to retrieve:
|
32
|
+
*
|
33
|
+
* ```ts
|
34
|
+
* sdk.admin.order.retrieve("order_123", {
|
35
|
+
* fields: "id,*items"
|
36
|
+
* })
|
37
|
+
* .then(({ order }) => {
|
38
|
+
* console.log(order)
|
39
|
+
* })
|
40
|
+
* ```
|
41
|
+
*
|
42
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
43
|
+
*/
|
11
44
|
async retrieve(id, query, headers) {
|
12
45
|
return await this.client.fetch(`/admin/orders/${id}`, {
|
13
46
|
query,
|
14
47
|
headers,
|
15
48
|
});
|
16
49
|
}
|
50
|
+
/**
|
51
|
+
* This method retrieves the preview of an order based on its last associated change. It sends a request to the
|
52
|
+
* [Get Order Preview](https://docs.medusajs.com/api/admin#orders_getordersidpreview) API route.
|
53
|
+
*
|
54
|
+
* @param id - The order's ID.
|
55
|
+
* @param query - Query parameters.
|
56
|
+
* @param headers - Headers to pass in the request
|
57
|
+
* @returns The order preview's details.
|
58
|
+
*
|
59
|
+
* @example
|
60
|
+
* sdk.admin.order.retrievePreview("order_123")
|
61
|
+
* .then(({ order }) => {
|
62
|
+
* console.log(order)
|
63
|
+
* })
|
64
|
+
*/
|
17
65
|
async retrievePreview(id, query, headers) {
|
18
66
|
return await this.client.fetch(`/admin/orders/${id}/preview`, {
|
19
67
|
query,
|
20
68
|
headers,
|
21
69
|
});
|
22
70
|
}
|
71
|
+
/**
|
72
|
+
* This method retrieves a paginated list of orders. It sends a request to the
|
73
|
+
* [List Orders](https://docs.medusajs.com/api/admin#orders_getorders) API route.
|
74
|
+
*
|
75
|
+
* @param queryParams - Filters and pagination configurations.
|
76
|
+
* @param headers - Headers to pass in the request.
|
77
|
+
* @returns The paginated list of orders.
|
78
|
+
*
|
79
|
+
* @example
|
80
|
+
* To retrieve the list of orders:
|
81
|
+
*
|
82
|
+
* ```ts
|
83
|
+
* sdk.admin.order.list()
|
84
|
+
* .then(({ orders, count, limit, offset }) => {
|
85
|
+
* console.log(orders)
|
86
|
+
* })
|
87
|
+
* ```
|
88
|
+
*
|
89
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
90
|
+
*
|
91
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
92
|
+
*
|
93
|
+
* ```ts
|
94
|
+
* sdk.admin.order.list({
|
95
|
+
* limit: 10,
|
96
|
+
* offset: 10
|
97
|
+
* })
|
98
|
+
* .then(({ orders, count, limit, offset }) => {
|
99
|
+
* console.log(orders)
|
100
|
+
* })
|
101
|
+
* ```
|
102
|
+
*
|
103
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
104
|
+
* in each order:
|
105
|
+
*
|
106
|
+
* ```ts
|
107
|
+
* sdk.admin.order.list({
|
108
|
+
* fields: "id,*items"
|
109
|
+
* })
|
110
|
+
* .then(({ orders, count, limit, offset }) => {
|
111
|
+
* console.log(orders)
|
112
|
+
* })
|
113
|
+
* ```
|
114
|
+
*
|
115
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
116
|
+
*/
|
23
117
|
async list(queryParams, headers) {
|
24
118
|
return await this.client.fetch(`/admin/orders`, {
|
25
119
|
query: queryParams,
|
26
120
|
headers,
|
27
121
|
});
|
28
122
|
}
|
123
|
+
/**
|
124
|
+
* This method cancels an order. It sends a request to the
|
125
|
+
* [Cancel Order](https://docs.medusajs.com/api/admin#orders_postordersidcancel)
|
126
|
+
* API route.
|
127
|
+
*
|
128
|
+
* @param id - The order's ID.
|
129
|
+
* @param headers - Headers to pass in the request.
|
130
|
+
* @returns The order's details.
|
131
|
+
*
|
132
|
+
* @example
|
133
|
+
* sdk.admin.order.cancel("order_123")
|
134
|
+
* .then(({ order }) => {
|
135
|
+
* console.log(order)
|
136
|
+
* })
|
137
|
+
*/
|
29
138
|
async cancel(id, headers) {
|
30
139
|
return await this.client.fetch(`/admin/orders/${id}/cancel`, {
|
31
140
|
method: "POST",
|
32
141
|
headers,
|
33
142
|
});
|
34
143
|
}
|
144
|
+
/**
|
145
|
+
* This method creates a fulfillment for an order. It sends a request to the
|
146
|
+
* [Create Fulfillment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillments)
|
147
|
+
* API route.
|
148
|
+
*
|
149
|
+
* @param id - The order's ID.
|
150
|
+
* @param body - The fulfillment's details.
|
151
|
+
* @param query - Configure the fields to retrieve in the order.
|
152
|
+
* @param headers - Headers to pass in the request
|
153
|
+
* @returns The order's details.
|
154
|
+
*
|
155
|
+
* @example
|
156
|
+
* sdk.admin.order.createFulfillment("order_123", {
|
157
|
+
* items: [
|
158
|
+
* {
|
159
|
+
* id: "orli_123",
|
160
|
+
* quantity: 1
|
161
|
+
* }
|
162
|
+
* ]
|
163
|
+
* })
|
164
|
+
* .then(({ order }) => {
|
165
|
+
* console.log(order)
|
166
|
+
* })
|
167
|
+
*/
|
35
168
|
async createFulfillment(id, body, query, headers) {
|
36
169
|
return await this.client.fetch(`/admin/orders/${id}/fulfillments`, {
|
37
170
|
method: "POST",
|
@@ -40,6 +173,29 @@ class Order {
|
|
40
173
|
query,
|
41
174
|
});
|
42
175
|
}
|
176
|
+
/**
|
177
|
+
* This method cancels an order's fulfillment. It sends a request to the
|
178
|
+
* [Cancel Fulfillment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idcancel)
|
179
|
+
* API route.
|
180
|
+
*
|
181
|
+
* @param id - The order's ID.
|
182
|
+
* @param fulfillmentId - The ID of the fulfillment to cancel.
|
183
|
+
* @param body - The cancelation's details.
|
184
|
+
* @param headers - Headers to pass in the request
|
185
|
+
* @returns The order's details.
|
186
|
+
*
|
187
|
+
* @example
|
188
|
+
* sdk.admin.order.cancelFulfillment(
|
189
|
+
* "order_123",
|
190
|
+
* "ful_123",
|
191
|
+
* {
|
192
|
+
* no_notification: false
|
193
|
+
* }
|
194
|
+
* )
|
195
|
+
* .then(({ order }) => {
|
196
|
+
* console.log(order)
|
197
|
+
* })
|
198
|
+
*/
|
43
199
|
async cancelFulfillment(id, fulfillmentId, body, headers) {
|
44
200
|
return await this.client.fetch(`/admin/orders/${id}/fulfillments/${fulfillmentId}/cancel`, {
|
45
201
|
method: "POST",
|
@@ -47,6 +203,35 @@ class Order {
|
|
47
203
|
body,
|
48
204
|
});
|
49
205
|
}
|
206
|
+
/**
|
207
|
+
* This method creates a shipment for an order's fulfillment. It sends a request to the
|
208
|
+
* [Create Shipment](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idshipments)
|
209
|
+
* API route.
|
210
|
+
*
|
211
|
+
* @param id - The order's ID.
|
212
|
+
* @param fulfillmentId - The ID of the fulfillment.
|
213
|
+
* @param body - The shipment's details.
|
214
|
+
* @param query - Configure the fields to retrieve in the order.
|
215
|
+
* @param headers - Headers to pass in the request
|
216
|
+
* @returns The order's details.
|
217
|
+
*
|
218
|
+
* @example
|
219
|
+
* sdk.admin.order.createShipment(
|
220
|
+
* "order_123",
|
221
|
+
* "ful_123",
|
222
|
+
* {
|
223
|
+
* items: [
|
224
|
+
* {
|
225
|
+
* id: "fulit_123",
|
226
|
+
* quantity: 1
|
227
|
+
* }
|
228
|
+
* ]
|
229
|
+
* }
|
230
|
+
* )
|
231
|
+
* .then(({ order }) => {
|
232
|
+
* console.log(order)
|
233
|
+
* })
|
234
|
+
*/
|
50
235
|
async createShipment(id, fulfillmentId, body, query, headers) {
|
51
236
|
return await this.client.fetch(`/admin/orders/${id}/fulfillments/${fulfillmentId}/shipments`, {
|
52
237
|
method: "POST",
|
@@ -55,6 +240,28 @@ class Order {
|
|
55
240
|
query,
|
56
241
|
});
|
57
242
|
}
|
243
|
+
/**
|
244
|
+
* This method marks an order's fulfillment as delivered. It sends a request to the
|
245
|
+
* [Mark Delivered ](https://docs.medusajs.com/api/admin#orders_postordersidfulfillmentsfulfillment_idmarkasdelivered)
|
246
|
+
* API route.
|
247
|
+
*
|
248
|
+
* @param id - The order's ID.
|
249
|
+
* @param fulfillmentId - The fulfillment's ID.
|
250
|
+
* @param body - The delivery details.
|
251
|
+
* @param query - Configure the fields to retrieve in the order.
|
252
|
+
* @param headers - Headers to pass in the request
|
253
|
+
* @returns The order's details.
|
254
|
+
*
|
255
|
+
* @example
|
256
|
+
* sdk.admin.order.markAsDelivered(
|
257
|
+
* "order_123",
|
258
|
+
* "ful_123",
|
259
|
+
* {}
|
260
|
+
* )
|
261
|
+
* .then(({ order }) => {
|
262
|
+
* console.log(order)
|
263
|
+
* })
|
264
|
+
*/
|
58
265
|
async markAsDelivered(id, fulfillmentId, body, query, headers) {
|
59
266
|
return await this.client.fetch(`/admin/orders/${id}/fulfillments/${fulfillmentId}/mark-as-delivered`, {
|
60
267
|
method: "POST",
|
@@ -63,12 +270,45 @@ class Order {
|
|
63
270
|
query,
|
64
271
|
});
|
65
272
|
}
|
273
|
+
/**
|
274
|
+
* This method retrieves a list of changes made on an order, including returns, exchanges, etc...
|
275
|
+
*
|
276
|
+
* This method sends a request to the [List Changes](https://docs.medusajs.com/api/admin#orders_getordersidchanges)
|
277
|
+
* API route.
|
278
|
+
*
|
279
|
+
* @param id - The order's ID.
|
280
|
+
* @param queryParams - Configure the fields to retrieve in each order change.
|
281
|
+
* @param headers - Headers to pass in the request
|
282
|
+
* @returns The list of order changes.
|
283
|
+
*
|
284
|
+
* @example
|
285
|
+
* sdk.admin.order.listChanges("order_123")
|
286
|
+
* .then(({ order_changes }) => {
|
287
|
+
* console.log(order_changes)
|
288
|
+
* })
|
289
|
+
*/
|
66
290
|
async listChanges(id, queryParams, headers) {
|
67
291
|
return await this.client.fetch(`/admin/orders/${id}/changes`, {
|
68
292
|
query: queryParams,
|
69
293
|
headers,
|
70
294
|
});
|
71
295
|
}
|
296
|
+
/**
|
297
|
+
* This method retrieves the order's line items. It sends a request to the
|
298
|
+
* [List Line Items](https://docs.medusajs.com/api/admin#orders_getordersidlineitems)
|
299
|
+
* API routes.
|
300
|
+
*
|
301
|
+
* @param id - The order's ID.
|
302
|
+
* @param queryParams - Configure the fields to retrieve in each line item.
|
303
|
+
* @param headers - Headers to pass in the request
|
304
|
+
* @returns The list of line items.
|
305
|
+
*
|
306
|
+
* @example
|
307
|
+
* sdk.admin.order.listLineItems("order_123")
|
308
|
+
* .then(({ order_items }) => {
|
309
|
+
* console.log(order_items)
|
310
|
+
* })
|
311
|
+
*/
|
72
312
|
async listLineItems(id, queryParams, headers) {
|
73
313
|
return await this.client.fetch(`/admin/orders/${id}/line-items`, {
|
74
314
|
query: queryParams,
|
package/dist/admin/order.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/admin/order.ts"],"names":[],"mappings":";;;AAWA,MAAa,KAAK;IAKhB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;QACtE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,EAAE,EACrB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,EAAU,EACV,KAAmC,EACnC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,UAAU,EAC7B;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/admin/order.ts"],"names":[],"mappings":";;;AAWA,MAAa,KAAK;IAKhB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;QACtE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,EAAE,EACrB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,eAAe,C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;;;;OA4BG;IACH,KAAK,CAAC,cAAc,CAClB,EAAU,EACV,aAAqB,EACrB,IAAwC,EACxC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,YAAY,EAC7D;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,eAAe,CACnB,EAAU,EACV,aAAqB,EACrB,IAAoD,EACpD,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,oBAAoB,EACrE;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,WAAW,CACf,EAAU,EACV,WAA6D,EAC7D,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE,UAAU,EAAE;YAC/B,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,aAAa,CACjB,EAAU,EACV,WAA2D,EAC3D,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE,aAAa,EAAE;YAClC,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AAxYD,sBAwYC"}
|
@@ -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"}
|