@longvansoftware/storefront-js-client 1.2.3 → 1.2.4

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.
@@ -1,4 +1,4 @@
1
- import { LineItem } from "../../types/order";
1
+ import { LineItem, DiscountCampaign, CancelOrder, MemberDiscount, CampaignPromotion, OrderQuery } from "../../types/order";
2
2
  import { Service } from "../service";
3
3
  /**
4
4
  * Represents a service for managing orders.
@@ -86,7 +86,7 @@ export declare class OrderService extends Service {
86
86
  */
87
87
  addOrderLineItems(orderId: string, lineItems: LineItem[]): Promise<any>;
88
88
  /**
89
- * Creates a new order.
89
+ * Update Quantity in an order
90
90
  * @param orderId - The id of the order .
91
91
  * @param orderItemId - The id of order item.
92
92
  * @param quantity - Quantity of profuct in order.
@@ -95,25 +95,25 @@ export declare class OrderService extends Service {
95
95
  */
96
96
  updateQuantityProductInOrder(orderId: string, orderItemId: string, quantity: number): Promise<any>;
97
97
  /**
98
- * Updates the customer and shipping address for an order.
98
+ *Updates sale Employee
99
99
  * @param orderId - The ID of the order.
100
100
  * @param saleId - The Id of saler.
101
- * @param updateBy - Who update.
101
+ * @param updatedBy - Who update.
102
102
  * @returns A promise that resolves when the customer and shipping address are updated.
103
103
  * @throws If an error occurs while updating the customer and shipping address.
104
104
  */
105
- updateSaleEmployee(orderId: string, saleId: string, updateBy: string): Promise<any>;
105
+ updateSaleEmployee(orderId: string, saleId: string, updatedBy: string): Promise<any>;
106
106
  /**
107
- * Updates the customer and shipping address for an order.
107
+ *Update type of order
108
108
  * @param orderId - The ID of the order.
109
109
  * @param orderType - The type of order.
110
- * @param updateBy - Id of person update
110
+ * @param updatedBy - Id of person update
111
111
  * @returns A promise that resolves when the customer and shipping address are updated.
112
112
  * @throws If an error occurs while updating the customer and shipping address.
113
113
  */
114
- updateOrderType(orderId: string, orderType: string, updateBy: string): Promise<any>;
114
+ updateOrderType(orderId: string, orderType: string, updatedBy: string): Promise<any>;
115
115
  /**
116
- * Updates the customer and shipping address for an order.
116
+ * Update new price in order
117
117
  * @param orderId - The ID of the order.
118
118
  * @param orderItemId - The id of order.
119
119
  * @param priceNew - the new price after update
@@ -122,31 +122,24 @@ export declare class OrderService extends Service {
122
122
  */
123
123
  updatePriceInOrder(orderId: string, orderItemId: string, priceNew: number): Promise<any>;
124
124
  /**
125
- * Updates the customer and shipping address for an order.
125
+ * Update discount price in order
126
126
  * @param orderId - The ID of the order.
127
127
  * @param orderItemId - The id of order.
128
- * @param type_discount
129
- * @param discount_amount
130
- * @param campaign_id
131
- * @param campaign_action_id
132
- * @param campaign_action_type
128
+ * @param requestData - The request data
133
129
  * @returns A promise that resolves when the customer and shipping address are updated.
134
130
  * @throws If an error occurs while updating the customer and shipping address.
135
131
  */
136
- updateDiscountPriceInOrder(orderId: string, orderItemId: string, type_discount: string, discount_amount: 0, campaign_id: string, campaign_action_id: string, campaign_action_type: string): Promise<any>;
132
+ updateDiscountPriceInOrder(orderId: string, orderItemId: string, requestData: DiscountCampaign): Promise<any>;
137
133
  /**
138
- * Updates the customer and shipping address for an order.
134
+ * Update cancel order
139
135
  * @param orderId - The ID of the order.
140
- * @param reason
141
- * @param updatedBy
142
- * @param note
143
- * @param orderType
136
+ * @param requestData
144
137
  * @returns A promise that resolves when the customer and shipping address are updated.
145
138
  * @throws If an error occurs while updating the customer and shipping address.
146
139
  */
147
- updateCancelOrder(orderId: string, reason: "CUSTOMER", updatedBy: string, note: string, orderType: "SALES"): Promise<any>;
140
+ updateCancelOrder(orderId: string, requestData: CancelOrder): Promise<any>;
148
141
  /**
149
- * Updates the customer and shipping address for an order.
142
+ * Update status of return order
150
143
  * @param orderId - The ID of the order.
151
144
  * @param statusNew - the new status of order
152
145
  * @param updatedBy - Id of person update
@@ -155,16 +148,16 @@ export declare class OrderService extends Service {
155
148
  */
156
149
  updateStatusReturnOrder(orderId: string, statusNew: string, updatedBy: string): Promise<any>;
157
150
  /**
158
- * Updates the customer and shipping address for an order.
151
+ * Update Shipping service
159
152
  * @param orderId - The ID of the order.
160
153
  * @param shippingServiceId - the id of shipping service
161
- * @param updateBy - Id of person update
154
+ * @param updatedBy - Id of person update
162
155
  * @returns A promise that resolves when the customer and shipping address are updated.
163
156
  * @throws If an error occurs while updating the customer and shipping address.
164
157
  */
165
- updateShippngService(orderId: string, shippingServiceId: string, updateBy: string): Promise<any>;
158
+ updateShippngService(orderId: string, shippingServiceId: string, updatedBy: string): Promise<any>;
166
159
  /**
167
- * Updates the customer and shipping address for an order.
160
+ * Update shipping order
168
161
  * @param orderId - The ID of the order.
169
162
  * @param shippingId - the id of shipping
170
163
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -172,7 +165,7 @@ export declare class OrderService extends Service {
172
165
  */
173
166
  updateShippingOrder(orderId: string, shippingId: string): Promise<any>;
174
167
  /**
175
- * Updates the customer and shipping address for an order.
168
+ * Update shipping fee
176
169
  * @param orderId - The ID of the order.
177
170
  * @param shippingFee - the fee of shipping
178
171
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -180,16 +173,16 @@ export declare class OrderService extends Service {
180
173
  */
181
174
  updateShippingFee(orderId: string, shipingFee: Number): Promise<any>;
182
175
  /**
183
- * Updates the customer and shipping address for an order.
176
+ * Update Financial Status after payment success
184
177
  * @param orderId - The ID of the order.
185
178
  * @param financialStatus - the status of financial
186
- * @param updateBy - Id of person update
179
+ * @param updatedBy - Id of person update
187
180
  * @returns A promise that resolves when the customer and shipping address are updated.
188
181
  * @throws If an error occurs while updating the customer and shipping address.
189
182
  */
190
- updateFinancialStatus(orderId: string, financialStatus: string, updateBy: string): Promise<any>;
183
+ updateFinancialStatus(orderId: string, financialStatus: string, updatedBy: string): Promise<any>;
191
184
  /**
192
- * Updates the customer and shipping address for an order.
185
+ * Update warehouse of order
193
186
  * @param orderId - The ID of the order.
194
187
  * @param warehouseId - the status of warehouse
195
188
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -197,7 +190,7 @@ export declare class OrderService extends Service {
197
190
  */
198
191
  updateWareHouseOrder(orderId: String, warehouseId: string): Promise<any>;
199
192
  /**
200
- * Updates the customer and shipping address for an order.
193
+ * Update voucher
201
194
  * @param orderId - The ID of the order.
202
195
  * @param voucherCode - the code of voucher
203
196
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -205,7 +198,7 @@ export declare class OrderService extends Service {
205
198
  */
206
199
  updateVoucher(orderId: string, voucherCode: string): Promise<any>;
207
200
  /**
208
- * Updates the customer and shipping address for an order.
201
+ * Update Vat
209
202
  * @param orderId - The ID of the order.
210
203
  * @param vatFee - The fee of VAT
211
204
  * @param vatType - The type of vat
@@ -214,7 +207,7 @@ export declare class OrderService extends Service {
214
207
  */
215
208
  updateVat(orderId: string, vatFee: number, vatType: string): Promise<any>;
216
209
  /**
217
- * Updates the customer and shipping address for an order.
210
+ * Update Status of l order
218
211
  * @param orderId - The ID of the order.
219
212
  * @param status - The status of sell order
220
213
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -222,36 +215,32 @@ export declare class OrderService extends Service {
222
215
  */
223
216
  updateStatusSellOrder(orderId: string, status: string): Promise<any>;
224
217
  /**
225
- * Updates the customer and shipping address for an order.
218
+ * Update date remain in total price
226
219
  * @param orderId - The ID of the order.
227
- * @param updateBy - Id of person update
220
+ * @param updatedBy - Id of person update
228
221
  * @returns A promise that resolves when the customer and shipping address are updated.
229
222
  * @throws If an error occurs while updating the customer and shipping address.
230
223
  */
231
- updateRemainToTalPrice(orderId: string, updateBy: string): Promise<any>;
224
+ updateRemainToTalPrice(orderId: string, updatedBy: string): Promise<any>;
232
225
  /**
233
- * Updates the customer and shipping address for an order.
226
+ * Update date create order
234
227
  * @param orderId - The ID of the order.
235
228
  * @param orderDate - The date of order
236
- * @param updateBy - Id of person update
229
+ * @param updatedBy - Id of person update
237
230
  * @returns A promise that resolves when the customer and shipping address are updated.
238
231
  * @throws If an error occurs while updating the customer and shipping address.
239
232
  */
240
- updateDateCreateOrder(orderId: string, orderDate: number, updateBy: string): Promise<any>;
233
+ updateDateCreateOrder(orderId: string, orderDate: number, updatedBy: string): Promise<any>;
241
234
  /**
242
- * Updates the customer and shipping address for an order.
235
+ * Update membership discount
243
236
  * @param orderId - The ID of the order.
244
- * @param type - The type of campaign promotion
245
- * @param amount - The amount of campaign promotion
246
- * @param campaignId - The id of the campaign promotion
247
- * @param campaignActionId - The id of action campaign promotion
248
- * @param campaignActionType - The type of action campaign promotion
237
+ * @param requestData
249
238
  * @returns A promise that resolves when the customer and shipping address are updated.
250
239
  * @throws If an error occurs while updating the customer and shipping address.
251
240
  */
252
- updateMemberDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
241
+ updateMemberDiscount(orderId: string, requestData: MemberDiscount): Promise<any>;
253
242
  /**
254
- * Updates the customer and shipping address for an order.
243
+ * Update status editable order
255
244
  * @param orderId - The ID of the order.
256
245
  * @param editable - The editable of
257
246
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -259,56 +248,50 @@ export declare class OrderService extends Service {
259
248
  */
260
249
  updateEditableOrder(orderId: string, editable: boolean): Promise<any>;
261
250
  /**
262
- * Updates the customer and shipping address for an order.
251
+ * Update discount
263
252
  * @param orderId - The ID of the order.
264
- * @param type - The type of campaign promotion
265
- * @param amount - The amount of campaign promotion
266
- * @param campaignId - The id of the campaign promotion
267
- * @param campaignActionId - The id of action campaign promotion
268
- * @param campaignActionType - The type of action campaign promotion
253
+ * @param requestData
269
254
  * @returns A promise that resolves when the customer and shipping address are updated.
270
255
  * @throws If an error occurs while updating the customer and shipping address.
271
256
  */
272
- updateDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
257
+ updateDiscount(orderId: string, requestData: MemberDiscount): Promise<any>;
273
258
  /**
274
- * Updates the customer and shipping address for an order.
259
+ * Update info campaign promotion
275
260
  * @param orderId - The ID of the order.
276
- * @param campaign_id - The ID of the campaign
277
- * @param campaign_action_id - The ID of the campaign action
278
- * @param campaign_action_type - The type of campaign action
261
+ * @param requestData
279
262
  * @returns A promise that resolves when the customer and shipping address are updated.
280
263
  * @throws If an error occurs while updating the customer and shipping address.
281
264
  */
282
- updateInfoCampaignPromotion(orderId: string, campaign_id: string, campaign_action_id: string, campaign_action_type: string): Promise<any>;
265
+ updateInfoCampaignPromotion(orderId: string, requestData: CampaignPromotion): Promise<any>;
283
266
  /**
284
- * Updates the customer and shipping address for an order.
267
+ * Get list shipping service
285
268
  * @param shippingCarrierId - The ID of the campaign
286
269
  * @returns A promise that resolves when the customer and shipping address are updated.
287
270
  * @throws If an error occurs while updating the customer and shipping address.
288
271
  */
289
272
  getListShippingService(shippingCarrierId: string): Promise<any>;
290
273
  /**
291
- * Updates the customer and shipping address for an order.
274
+ * Get info sell order
292
275
  * @param orderId - The ID of the order.
293
276
  * @returns A promise that resolves when the customer and shipping address are updated.
294
277
  * @throws If an error occurs while updating the customer and shipping address.
295
278
  */
296
279
  getInfoSellOrder(orderId: string): Promise<any>;
297
280
  /**
298
- * Updates the customer and shipping address for an order.
281
+ * Get info return order
299
282
  * @param orderId - The ID of the order.
300
283
  * @returns A promise that resolves when the customer and shipping address are updated.
301
284
  * @throws If an error occurs while updating the customer and shipping address.
302
285
  */
303
286
  getInfoReturnOrder(orderId: string): Promise<any>;
304
287
  /**
305
- * Updates the customer and shipping address for an order.
288
+ * Get list type order
306
289
  * @returns A promise that resolves when the customer and shipping address are updated.
307
290
  * @throws If an error occurs while updating the customer and shipping address.
308
291
  */
309
292
  getListTypeOrder(): Promise<any>;
310
293
  /**
311
- * Updates the customer and shipping address for an order.
294
+ * GEt list shipping carrier
312
295
  * @returns A promise that resolves when the customer and shipping address are updated.
313
296
  * @throws If an error occurs while updating the customer and shipping address.
314
297
  */
@@ -316,28 +299,11 @@ export declare class OrderService extends Service {
316
299
  /**
317
300
  * Get list sell order
318
301
  * @param orderId
319
- * @param status
320
- * @param statusIgnore
321
- * @param subStatus
322
- * @param ffmStatus
323
- * @param subType
324
- * @param paymentMethod
325
- * @param keyword
326
- * @param customerMultiValue
327
- * @param productMultiValue
328
- * @param customerId
329
- * @param createdBy
330
- * @param dateCreateFrom
331
- * @param dateCreateTo
332
- * @param dateUpdateFrom
333
- * @param dateUpdateTo
334
- * @param employeeAssign
335
- * @param currentPage
336
- * @param maxResult
302
+ * @param requestData
337
303
  * @returns A promise that resolves when the customer and shipping address are updated.
338
304
  * @throws If an error occurs while updating the customer and shipping address.
339
305
  */
340
- getListSellOrder(orderId: string, status: [number], statusIgnore: [number], subStatus: string, ffmStatus: string, subType: string, paymentMethod: string, keyword: string, customerMultiValue: string, productMultiValue: string, customerId: string, createdBy: string, dateCreateFrom: number, dateCreateTo: number, dateUpdateFrom: number, dateUpdateTo: number, employeeAssign: string, currentPage: 1, maxResult: 20): Promise<any>;
306
+ getListSellOrder(requestData: OrderQuery): Promise<any>;
341
307
  /**
342
308
  * Get list sale order status
343
309
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -346,46 +312,28 @@ export declare class OrderService extends Service {
346
312
  getListSaleOrderStatus(): Promise<any>;
347
313
  /**
348
314
  * Get list return order
349
- * @param orderId
350
- * @param status
351
- * @param statusIgnore
352
- * @param subStatus
353
- * @param ffmStatus
354
- * @param subType
355
- * @param paymentMethod
356
- * @param keyword
357
- * @param customerMultiValue
358
- * @param productMultiValue
359
- * @param customerId
360
- * @param createdBy
361
- * @param dateCreateFrom
362
- * @param dateCreateTo
363
- * @param dateUpdateFrom
364
- * @param dateUpdateTo
365
- * @param employeeAssign
366
- * @param currentPage
367
- * @param maxResult
315
+ * @param orderId - The id of the order
316
+ * @param requestData
368
317
  * @returns A promise that resolves when the customer and shipping address are updated.
369
318
  * @throws If an error occurs while updating the customer and shipping address.
370
319
  */
371
- getListReturnOrder(orderId: string, status: [number], statusIgnore: [number], subStatus: string, ffmStatus: string, subType: string, paymentMethod: string, keyword: string, customerMultiValue: string, productMultiValue: string, customerId: string, createdBy: string, dateCreateFrom: number, dateCreateTo: number, dateUpdateFrom: number, dateUpdateTo: number, employeeAssign: string, currentPage: 1, maxResult: 20): Promise<any>;
320
+ getListReturnOrder(orderId: string, requestData: OrderQuery): Promise<any>;
372
321
  /**
373
- * Get list sale order status
322
+ * Get list return order status
374
323
  * @returns A promise that resolves when the customer and shipping address are updated.
375
324
  * @throws If an error occurs while updating the customer and shipping address.
376
325
  */
377
326
  getListReturnOrderStatus(): Promise<any>;
378
327
  /**
379
- * Get list sale order status
380
- * @param storeId - The id of store
328
+ * remove draft order
381
329
  * @param orderId - The id of order
382
330
  * @param updatedBy - Thi id of person update
383
331
  * @returns A promise that resolves when the customer and shipping address are updated.
384
332
  * @throws If an error occurs while updating the customer and shipping address.
385
333
  */
386
- removeDraftOrder(storeId: string, orderId: string, updatedBy: string): Promise<any>;
334
+ removeDraftOrder(orderId: string, updatedBy: string): Promise<any>;
387
335
  /**
388
- * Get list sale order status
336
+ * Cancel product in order
389
337
  * @param orderId - The id of order
390
338
  * @param orderItemId - Thi id of item order
391
339
  * @param reason - The reason of cancel product in order
@@ -394,7 +342,7 @@ export declare class OrderService extends Service {
394
342
  */
395
343
  cancelProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
396
344
  /**
397
- * Get list sale order status
345
+ * Remove Product in order
398
346
  * @param orderId - The id of order
399
347
  * @param orderItemId - Thi id of item order
400
348
  * @param reason - The reason of cancel product in order
@@ -403,7 +351,7 @@ export declare class OrderService extends Service {
403
351
  */
404
352
  removeProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
405
353
  /**
406
- * Get list sale order status
354
+ * Print order pdf
407
355
  * @param orderId - The id of order
408
356
  * @param paymentMethod - Thi id of item order
409
357
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -411,7 +359,7 @@ export declare class OrderService extends Service {
411
359
  */
412
360
  printOrderPdf(orderId: string, paymentMethod: string): Promise<any>;
413
361
  /**
414
- * Get list sale order status
362
+ * Print order HTML
415
363
  * @param orderId - The id of order
416
364
  * @param paymentMethod - Thi id of item order
417
365
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -419,17 +367,83 @@ export declare class OrderService extends Service {
419
367
  */
420
368
  printOrderHtml(orderId: string, paymentMethod: string): Promise<any>;
421
369
  /**
422
- * Get list sale order status
370
+ * Create an orderReturn
423
371
  * @param orderData - The id of order
424
372
  * @returns A promise that resolves when the customer and shipping address are updated.
425
373
  * @throws If an error occurs while updating the customer and shipping address.
426
374
  */
427
375
  createOrderReturn(orderData: any): Promise<any>;
428
376
  /**
429
- * Get list sale order status
430
- * @param orderData - The id of order
377
+ * Caculate the order
378
+ * @param orderData - The data from the order
431
379
  * @returns A promise that resolves when the customer and shipping address are updated.
432
380
  * @throws If an error occurs while updating the customer and shipping address.
433
381
  */
434
382
  calculateOrder(orderData: any): Promise<any>;
383
+ /**
384
+ * get amount product able order
385
+ * @param productIds - The id of product
386
+ * @returns A prom that resolves when the customer and shipping address are updated.
387
+ * @throws If an error occurs while updating the customer and shipping address.
388
+ */
389
+ getQuantityAbleOrder(productIds: string[]): Promise<any>;
390
+ /**
391
+ * updatee note without login
392
+ * @param orderId - The id of the order
393
+ * @param noteId - The id of the note
394
+ * @param note - The content of the note
395
+ * @returns A prom that resolves when the customer and shipping address are updated.
396
+ * @throws If an error occurs while updating the customer and shipping address.
397
+ */
398
+ updateNoteWithoutLogin(orderId: string, noteId: string, note: string): Promise<any>;
399
+ /**
400
+ * add voucher without login
401
+ * @param orderId - The id of the order
402
+ * @param voucherCode - The code of voucher
403
+ * @param updatedBy
404
+ * @returns A prom that resolves when the customer and shipping address are updated.
405
+ * @throws If an error occurs while updating the customer and shipping address.
406
+ */
407
+ addVoucherWithoutLogin(orderId: string, voucherCode: string, updatedBy: "SYSTEM"): Promise<any>;
408
+ /**
409
+ * delete voucher without login
410
+ * @param orderId - The id of the order
411
+ * @param voucherCode - The code of voucher
412
+ * @param updatedBy
413
+ * @returns A prom that resolves when the customer and shipping address are updated.
414
+ * @throws If an error occurs while updating the customer and shipping address.
415
+ */
416
+ deleteVoucherLogin(orderId: string, voucherCode: string, updatedBy: "SYSTEM"): Promise<any>;
417
+ /**
418
+ * get list note without login
419
+ * @param orderId - The id of the order
420
+ * @returns A prom that resolves when the customer and shipping address are updated.
421
+ * @throws If an error occurs while updating the customer and shipping address.
422
+ */
423
+ getListNoteWithoutLogin(orderId: string): Promise<any>;
424
+ /**
425
+ * create note without login
426
+ * @param orderId - The id of the order
427
+ * @param createdBy
428
+ * @param note
429
+ * @returns A prom that resolves when the customer and shipping address are updated.
430
+ * @throws If an error occurs while updating the customer and shipping address.
431
+ */
432
+ createNoteWithoutLogin(orderId: string, createdBy: string, note: string): Promise<any>;
433
+ /**
434
+ * get list order realation
435
+ * @param orderIds
436
+ * @returns A prom that resolves when the customer and shipping address are updated.
437
+ * @throws If an error occurs while updating the customer and shipping address.
438
+ */
439
+ getListOrderRelationsWithoutLogin(orderIds: string[]): Promise<any>;
440
+ /**
441
+ * get list order realation
442
+ * @param orderId - The id of order
443
+ * @param noteId - The id of note
444
+ * @param deletedBy - The id of person delete
445
+ * @returns A prom that resolves when the customer and shipping address are updated.
446
+ * @throws If an error occurs while updating the customer and shipping address.
447
+ */
448
+ deleteNoteWithoutLogin(orderId: string, noteId: string, deletedBy: string): Promise<any>;
435
449
  }
@@ -210,7 +210,7 @@ class OrderService extends service_1.Service {
210
210
  });
211
211
  }
212
212
  /**
213
- * Creates a new order.
213
+ * Update Quantity in an order
214
214
  * @param orderId - The id of the order .
215
215
  * @param orderItemId - The id of order item.
216
216
  * @param quantity - Quantity of profuct in order.
@@ -232,16 +232,16 @@ class OrderService extends service_1.Service {
232
232
  });
233
233
  }
234
234
  /**
235
- * Updates the customer and shipping address for an order.
235
+ *Updates sale Employee
236
236
  * @param orderId - The ID of the order.
237
237
  * @param saleId - The Id of saler.
238
- * @param updateBy - Who update.
238
+ * @param updatedBy - Who update.
239
239
  * @returns A promise that resolves when the customer and shipping address are updated.
240
240
  * @throws If an error occurs while updating the customer and shipping address.
241
241
  */
242
- updateSaleEmployee(orderId, saleId, updateBy) {
242
+ updateSaleEmployee(orderId, saleId, updatedBy) {
243
243
  return __awaiter(this, void 0, void 0, function* () {
244
- const endpoint = `/orders/${this.orgId}/${orderId}/saleEmployee/${saleId}?updated_by=${updateBy}`;
244
+ const endpoint = `/orders/${this.orgId}/${orderId}/saleEmployee/${saleId}?updated_by=${updatedBy}`;
245
245
  const method = "PUT";
246
246
  try {
247
247
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -254,16 +254,16 @@ class OrderService extends service_1.Service {
254
254
  });
255
255
  }
256
256
  /**
257
- * Updates the customer and shipping address for an order.
257
+ *Update type of order
258
258
  * @param orderId - The ID of the order.
259
259
  * @param orderType - The type of order.
260
- * @param updateBy - Id of person update
260
+ * @param updatedBy - Id of person update
261
261
  * @returns A promise that resolves when the customer and shipping address are updated.
262
262
  * @throws If an error occurs while updating the customer and shipping address.
263
263
  */
264
- updateOrderType(orderId, orderType, updateBy) {
264
+ updateOrderType(orderId, orderType, updatedBy) {
265
265
  return __awaiter(this, void 0, void 0, function* () {
266
- const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderType}?updated_by=${updateBy}`;
266
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderType}?updated_by=${updatedBy}`;
267
267
  const method = "PUT";
268
268
  try {
269
269
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -276,7 +276,7 @@ class OrderService extends service_1.Service {
276
276
  });
277
277
  }
278
278
  /**
279
- * Updates the customer and shipping address for an order.
279
+ * Update new price in order
280
280
  * @param orderId - The ID of the order.
281
281
  * @param orderItemId - The id of order.
282
282
  * @param priceNew - the new price after update
@@ -298,30 +298,19 @@ class OrderService extends service_1.Service {
298
298
  });
299
299
  }
300
300
  /**
301
- * Updates the customer and shipping address for an order.
301
+ * Update discount price in order
302
302
  * @param orderId - The ID of the order.
303
303
  * @param orderItemId - The id of order.
304
- * @param type_discount
305
- * @param discount_amount
306
- * @param campaign_id
307
- * @param campaign_action_id
308
- * @param campaign_action_type
304
+ * @param requestData - The request data
309
305
  * @returns A promise that resolves when the customer and shipping address are updated.
310
306
  * @throws If an error occurs while updating the customer and shipping address.
311
307
  */
312
- updateDiscountPriceInOrder(orderId, orderItemId, type_discount, discount_amount, campaign_id, campaign_action_id, campaign_action_type) {
308
+ updateDiscountPriceInOrder(orderId, orderItemId, requestData) {
313
309
  return __awaiter(this, void 0, void 0, function* () {
314
- const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/discount}`;
310
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/discount`;
315
311
  const method = "PUT";
316
- const orderData = {
317
- type_discount,
318
- discount_amount,
319
- campaign_id,
320
- campaign_action_id,
321
- campaign_action_type,
322
- };
323
312
  try {
324
- const response = yield this.restApiCallWithToken(endpoint, method, orderData);
313
+ const response = yield this.restApiCallWithToken(endpoint, method, requestData);
325
314
  return response;
326
315
  }
327
316
  catch (error) {
@@ -331,27 +320,18 @@ class OrderService extends service_1.Service {
331
320
  });
332
321
  }
333
322
  /**
334
- * Updates the customer and shipping address for an order.
323
+ * Update cancel order
335
324
  * @param orderId - The ID of the order.
336
- * @param reason
337
- * @param updatedBy
338
- * @param note
339
- * @param orderType
325
+ * @param requestData
340
326
  * @returns A promise that resolves when the customer and shipping address are updated.
341
327
  * @throws If an error occurs while updating the customer and shipping address.
342
328
  */
343
- updateCancelOrder(orderId, reason, updatedBy, note, orderType) {
329
+ updateCancelOrder(orderId, requestData) {
344
330
  return __awaiter(this, void 0, void 0, function* () {
345
331
  const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/cancel`;
346
332
  const method = "PUT";
347
- const orderData = {
348
- reason,
349
- updatedBy,
350
- note,
351
- orderType,
352
- };
353
333
  try {
354
- const response = yield this.restApiCallWithToken(endpoint, method, orderData);
334
+ const response = yield this.restApiCallWithToken(endpoint, method, requestData);
355
335
  return response;
356
336
  }
357
337
  catch (error) {
@@ -361,7 +341,7 @@ class OrderService extends service_1.Service {
361
341
  });
362
342
  }
363
343
  /**
364
- * Updates the customer and shipping address for an order.
344
+ * Update status of return order
365
345
  * @param orderId - The ID of the order.
366
346
  * @param statusNew - the new status of order
367
347
  * @param updatedBy - Id of person update
@@ -370,9 +350,6 @@ class OrderService extends service_1.Service {
370
350
  */
371
351
  updateStatusReturnOrder(orderId, statusNew, updatedBy) {
372
352
  return __awaiter(this, void 0, void 0, function* () {
373
- if (!orderId || !statusNew || !updatedBy) {
374
- throw new Error("Tham số đầu vào không hợp lệ.");
375
- }
376
353
  const endpoint = `/orders/${this.orgId}/${orderId}/${statusNew}?updated_by=${updatedBy}`;
377
354
  const method = "PUT";
378
355
  try {
@@ -386,16 +363,16 @@ class OrderService extends service_1.Service {
386
363
  });
387
364
  }
388
365
  /**
389
- * Updates the customer and shipping address for an order.
366
+ * Update Shipping service
390
367
  * @param orderId - The ID of the order.
391
368
  * @param shippingServiceId - the id of shipping service
392
- * @param updateBy - Id of person update
369
+ * @param updatedBy - Id of person update
393
370
  * @returns A promise that resolves when the customer and shipping address are updated.
394
371
  * @throws If an error occurs while updating the customer and shipping address.
395
372
  */
396
- updateShippngService(orderId, shippingServiceId, updateBy) {
373
+ updateShippngService(orderId, shippingServiceId, updatedBy) {
397
374
  return __awaiter(this, void 0, void 0, function* () {
398
- const endpoint = `/orders/${this.orgId}/${orderId}/${shippingServiceId}/shippingService?updated_by=${updateBy}`;
375
+ const endpoint = `/orders/${this.orgId}/${orderId}/${shippingServiceId}/shippingService?updated_by=${updatedBy}`;
399
376
  const method = "PUT";
400
377
  try {
401
378
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -408,7 +385,7 @@ class OrderService extends service_1.Service {
408
385
  });
409
386
  }
410
387
  /**
411
- * Updates the customer and shipping address for an order.
388
+ * Update shipping order
412
389
  * @param orderId - The ID of the order.
413
390
  * @param shippingId - the id of shipping
414
391
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -429,7 +406,7 @@ class OrderService extends service_1.Service {
429
406
  });
430
407
  }
431
408
  /**
432
- * Updates the customer and shipping address for an order.
409
+ * Update shipping fee
433
410
  * @param orderId - The ID of the order.
434
411
  * @param shippingFee - the fee of shipping
435
412
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -450,16 +427,16 @@ class OrderService extends service_1.Service {
450
427
  });
451
428
  }
452
429
  /**
453
- * Updates the customer and shipping address for an order.
430
+ * Update Financial Status after payment success
454
431
  * @param orderId - The ID of the order.
455
432
  * @param financialStatus - the status of financial
456
- * @param updateBy - Id of person update
433
+ * @param updatedBy - Id of person update
457
434
  * @returns A promise that resolves when the customer and shipping address are updated.
458
435
  * @throws If an error occurs while updating the customer and shipping address.
459
436
  */
460
- updateFinancialStatus(orderId, financialStatus, updateBy) {
437
+ updateFinancialStatus(orderId, financialStatus, updatedBy) {
461
438
  return __awaiter(this, void 0, void 0, function* () {
462
- const endpoint = `/orders/${this.orgId}/${orderId}/${financialStatus}/financialStatus?updated_by=${updateBy}`;
439
+ const endpoint = `/orders/${this.orgId}/${orderId}/${financialStatus}/financialStatus?updated_by=${updatedBy}`;
463
440
  const method = "PUT";
464
441
  try {
465
442
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -472,7 +449,7 @@ class OrderService extends service_1.Service {
472
449
  });
473
450
  }
474
451
  /**
475
- * Updates the customer and shipping address for an order.
452
+ * Update warehouse of order
476
453
  * @param orderId - The ID of the order.
477
454
  * @param warehouseId - the status of warehouse
478
455
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -493,7 +470,7 @@ class OrderService extends service_1.Service {
493
470
  });
494
471
  }
495
472
  /**
496
- * Updates the customer and shipping address for an order.
473
+ * Update voucher
497
474
  * @param orderId - The ID of the order.
498
475
  * @param voucherCode - the code of voucher
499
476
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -514,7 +491,7 @@ class OrderService extends service_1.Service {
514
491
  });
515
492
  }
516
493
  /**
517
- * Updates the customer and shipping address for an order.
494
+ * Update Vat
518
495
  * @param orderId - The ID of the order.
519
496
  * @param vatFee - The fee of VAT
520
497
  * @param vatType - The type of vat
@@ -536,7 +513,7 @@ class OrderService extends service_1.Service {
536
513
  });
537
514
  }
538
515
  /**
539
- * Updates the customer and shipping address for an order.
516
+ * Update Status of l order
540
517
  * @param orderId - The ID of the order.
541
518
  * @param status - The status of sell order
542
519
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -557,15 +534,15 @@ class OrderService extends service_1.Service {
557
534
  });
558
535
  }
559
536
  /**
560
- * Updates the customer and shipping address for an order.
537
+ * Update date remain in total price
561
538
  * @param orderId - The ID of the order.
562
- * @param updateBy - Id of person update
539
+ * @param updatedBy - Id of person update
563
540
  * @returns A promise that resolves when the customer and shipping address are updated.
564
541
  * @throws If an error occurs while updating the customer and shipping address.
565
542
  */
566
- updateRemainToTalPrice(orderId, updateBy) {
543
+ updateRemainToTalPrice(orderId, updatedBy) {
567
544
  return __awaiter(this, void 0, void 0, function* () {
568
- const endpoint = `/orders/${this.orgId}/${orderId}/remainTotalPrice?updated_by=${updateBy}`;
545
+ const endpoint = `/orders/${this.orgId}/${orderId}/remainTotalPrice?updated_by=${updatedBy}`;
569
546
  const method = "PUT";
570
547
  try {
571
548
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -578,16 +555,16 @@ class OrderService extends service_1.Service {
578
555
  });
579
556
  }
580
557
  /**
581
- * Updates the customer and shipping address for an order.
558
+ * Update date create order
582
559
  * @param orderId - The ID of the order.
583
560
  * @param orderDate - The date of order
584
- * @param updateBy - Id of person update
561
+ * @param updatedBy - Id of person update
585
562
  * @returns A promise that resolves when the customer and shipping address are updated.
586
563
  * @throws If an error occurs while updating the customer and shipping address.
587
564
  */
588
- updateDateCreateOrder(orderId, orderDate, updateBy) {
565
+ updateDateCreateOrder(orderId, orderDate, updatedBy) {
589
566
  return __awaiter(this, void 0, void 0, function* () {
590
- const endpoint = `/orders/${this.orgId}/${orderId}/order-date/${orderDate}?updated_by=${updateBy}`;
567
+ const endpoint = `/orders/${this.orgId}/${orderId}/order-date/${orderDate}?updated_by=${updatedBy}`;
591
568
  const method = "PUT";
592
569
  try {
593
570
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -600,27 +577,16 @@ class OrderService extends service_1.Service {
600
577
  });
601
578
  }
602
579
  /**
603
- * Updates the customer and shipping address for an order.
580
+ * Update membership discount
604
581
  * @param orderId - The ID of the order.
605
- * @param type - The type of campaign promotion
606
- * @param amount - The amount of campaign promotion
607
- * @param campaignId - The id of the campaign promotion
608
- * @param campaignActionId - The id of action campaign promotion
609
- * @param campaignActionType - The type of action campaign promotion
582
+ * @param requestData
610
583
  * @returns A promise that resolves when the customer and shipping address are updated.
611
584
  * @throws If an error occurs while updating the customer and shipping address.
612
585
  */
613
- updateMemberDiscount(orderId, type, amount, campaignId, campaignActionId, campaignActionType) {
586
+ updateMemberDiscount(orderId, requestData) {
614
587
  return __awaiter(this, void 0, void 0, function* () {
615
588
  const endpoint = `/orders/${this.orgId}/${orderId}/memberDiscount`;
616
589
  const method = "PUT";
617
- const requestData = {
618
- type,
619
- amount,
620
- campaignId,
621
- campaignActionId,
622
- campaignActionType,
623
- };
624
590
  try {
625
591
  const response = yield this.restApiCallWithToken(endpoint, method, requestData);
626
592
  return response;
@@ -632,7 +598,7 @@ class OrderService extends service_1.Service {
632
598
  });
633
599
  }
634
600
  /**
635
- * Updates the customer and shipping address for an order.
601
+ * Update status editable order
636
602
  * @param orderId - The ID of the order.
637
603
  * @param editable - The editable of
638
604
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -653,27 +619,16 @@ class OrderService extends service_1.Service {
653
619
  });
654
620
  }
655
621
  /**
656
- * Updates the customer and shipping address for an order.
622
+ * Update discount
657
623
  * @param orderId - The ID of the order.
658
- * @param type - The type of campaign promotion
659
- * @param amount - The amount of campaign promotion
660
- * @param campaignId - The id of the campaign promotion
661
- * @param campaignActionId - The id of action campaign promotion
662
- * @param campaignActionType - The type of action campaign promotion
624
+ * @param requestData
663
625
  * @returns A promise that resolves when the customer and shipping address are updated.
664
626
  * @throws If an error occurs while updating the customer and shipping address.
665
627
  */
666
- updateDiscount(orderId, type, amount, campaignId, campaignActionId, campaignActionType) {
628
+ updateDiscount(orderId, requestData) {
667
629
  return __awaiter(this, void 0, void 0, function* () {
668
630
  const endpoint = `/orders/${this.orgId}/${orderId}/discount`;
669
631
  const method = "PUT";
670
- const requestData = {
671
- type,
672
- amount,
673
- campaignId,
674
- campaignActionId,
675
- campaignActionType,
676
- };
677
632
  try {
678
633
  const response = yield this.restApiCallWithToken(endpoint, method, requestData);
679
634
  return response;
@@ -685,23 +640,16 @@ class OrderService extends service_1.Service {
685
640
  });
686
641
  }
687
642
  /**
688
- * Updates the customer and shipping address for an order.
643
+ * Update info campaign promotion
689
644
  * @param orderId - The ID of the order.
690
- * @param campaign_id - The ID of the campaign
691
- * @param campaign_action_id - The ID of the campaign action
692
- * @param campaign_action_type - The type of campaign action
645
+ * @param requestData
693
646
  * @returns A promise that resolves when the customer and shipping address are updated.
694
647
  * @throws If an error occurs while updating the customer and shipping address.
695
648
  */
696
- updateInfoCampaignPromotion(orderId, campaign_id, campaign_action_id, campaign_action_type) {
649
+ updateInfoCampaignPromotion(orderId, requestData) {
697
650
  return __awaiter(this, void 0, void 0, function* () {
698
651
  const endpoint = `/orders/${this.orgId}/${orderId}/campaign-promotion`;
699
652
  const method = "PUT";
700
- const requestData = {
701
- campaign_id,
702
- campaign_action_id,
703
- campaign_action_type,
704
- };
705
653
  try {
706
654
  const response = yield this.restApiCallWithToken(endpoint, method, requestData);
707
655
  return response;
@@ -713,7 +661,7 @@ class OrderService extends service_1.Service {
713
661
  });
714
662
  }
715
663
  /**
716
- * Updates the customer and shipping address for an order.
664
+ * Get list shipping service
717
665
  * @param shippingCarrierId - The ID of the campaign
718
666
  * @returns A promise that resolves when the customer and shipping address are updated.
719
667
  * @throws If an error occurs while updating the customer and shipping address.
@@ -733,7 +681,7 @@ class OrderService extends service_1.Service {
733
681
  });
734
682
  }
735
683
  /**
736
- * Updates the customer and shipping address for an order.
684
+ * Get info sell order
737
685
  * @param orderId - The ID of the order.
738
686
  * @returns A promise that resolves when the customer and shipping address are updated.
739
687
  * @throws If an error occurs while updating the customer and shipping address.
@@ -753,7 +701,7 @@ class OrderService extends service_1.Service {
753
701
  });
754
702
  }
755
703
  /**
756
- * Updates the customer and shipping address for an order.
704
+ * Get info return order
757
705
  * @param orderId - The ID of the order.
758
706
  * @returns A promise that resolves when the customer and shipping address are updated.
759
707
  * @throws If an error occurs while updating the customer and shipping address.
@@ -773,7 +721,7 @@ class OrderService extends service_1.Service {
773
721
  });
774
722
  }
775
723
  /**
776
- * Updates the customer and shipping address for an order.
724
+ * Get list type order
777
725
  * @returns A promise that resolves when the customer and shipping address are updated.
778
726
  * @throws If an error occurs while updating the customer and shipping address.
779
727
  */
@@ -792,7 +740,7 @@ class OrderService extends service_1.Service {
792
740
  });
793
741
  }
794
742
  /**
795
- * Updates the customer and shipping address for an order.
743
+ * GEt list shipping carrier
796
744
  * @returns A promise that resolves when the customer and shipping address are updated.
797
745
  * @throws If an error occurs while updating the customer and shipping address.
798
746
  */
@@ -813,37 +761,25 @@ class OrderService extends service_1.Service {
813
761
  /**
814
762
  * Get list sell order
815
763
  * @param orderId
816
- * @param status
817
- * @param statusIgnore
818
- * @param subStatus
819
- * @param ffmStatus
820
- * @param subType
821
- * @param paymentMethod
822
- * @param keyword
823
- * @param customerMultiValue
824
- * @param productMultiValue
825
- * @param customerId
826
- * @param createdBy
827
- * @param dateCreateFrom
828
- * @param dateCreateTo
829
- * @param dateUpdateFrom
830
- * @param dateUpdateTo
831
- * @param employeeAssign
832
- * @param currentPage
833
- * @param maxResult
764
+ * @param requestData
834
765
  * @returns A promise that resolves when the customer and shipping address are updated.
835
766
  * @throws If an error occurs while updating the customer and shipping address.
836
767
  */
837
- getListSellOrder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
768
+ getListSellOrder(requestData) {
838
769
  return __awaiter(this, void 0, void 0, function* () {
839
- const endpoint = `/orders/${this.orgId}/${this.storeId}/sell_order?order_id=${orderId}&status=${status}&status_ignore=${statusIgnore}&sub_status=${subStatus}&ffm_status=${ffmStatus}&sub_type=${subType}&payment_method=${paymentMethod}&keyword=${keyword}&customer_multi_value=${customerMultiValue}&product_multi_value=${productMultiValue}&customer_id=${customerId}&created_by=${createdBy}&date_create_from=${dateCreateFrom}&date_create_to=${dateCreateTo}&date_update_from=${dateUpdateFrom}&date_update_to=${dateUpdateTo}&employee_assign=${employeeAssign}&currentPage=${currentPage}&maxResult=${maxResult}`;
770
+ // Convert requestData to a format suitable for URLSearchParams
771
+ const params = new URLSearchParams(Object.entries(requestData).reduce((acc, [key, value]) => {
772
+ acc[key] = Array.isArray(value) ? value.join(",") : value.toString();
773
+ return acc;
774
+ }, {})).toString();
775
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/sell_order?${params}`;
840
776
  const method = "GET";
841
777
  try {
842
778
  const response = yield this.restApiCallWithToken(endpoint, method);
843
779
  return response;
844
780
  }
845
781
  catch (error) {
846
- console.log(`Error in getListSellOrder: ${error}`);
782
+ console.error(`Error in getListSellOrder: ${error}`);
847
783
  throw error;
848
784
  }
849
785
  });
@@ -869,31 +805,14 @@ class OrderService extends service_1.Service {
869
805
  }
870
806
  /**
871
807
  * Get list return order
872
- * @param orderId
873
- * @param status
874
- * @param statusIgnore
875
- * @param subStatus
876
- * @param ffmStatus
877
- * @param subType
878
- * @param paymentMethod
879
- * @param keyword
880
- * @param customerMultiValue
881
- * @param productMultiValue
882
- * @param customerId
883
- * @param createdBy
884
- * @param dateCreateFrom
885
- * @param dateCreateTo
886
- * @param dateUpdateFrom
887
- * @param dateUpdateTo
888
- * @param employeeAssign
889
- * @param currentPage
890
- * @param maxResult
808
+ * @param orderId - The id of the order
809
+ * @param requestData
891
810
  * @returns A promise that resolves when the customer and shipping address are updated.
892
811
  * @throws If an error occurs while updating the customer and shipping address.
893
812
  */
894
- getListReturnOrder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
813
+ getListReturnOrder(orderId, requestData) {
895
814
  return __awaiter(this, void 0, void 0, function* () {
896
- const endpoint = `/orders/${this.orgId}/${this.storeId}/return_order?order_id=${orderId}&status=${status}&status_ignore=${statusIgnore}&sub_status=${subStatus}&ffm_status=${ffmStatus}&sub_type=${subType}&payment_method=${paymentMethod}&keyword=${keyword}&customer_multi_value=${customerMultiValue}&product_multi_value=${productMultiValue}&customer_id=${customerId}&created_by=${createdBy}&date_create_from=${dateCreateFrom}&date_create_to=${dateCreateTo}&date_update_from=${dateUpdateFrom}&date_update_to=${dateUpdateTo}&employee_assign=${employeeAssign}&currentPage=${currentPage}&maxResult=${maxResult}`;
815
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/return_order`;
897
816
  const method = "GET";
898
817
  try {
899
818
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -906,7 +825,7 @@ class OrderService extends service_1.Service {
906
825
  });
907
826
  }
908
827
  /**
909
- * Get list sale order status
828
+ * Get list return order status
910
829
  * @returns A promise that resolves when the customer and shipping address are updated.
911
830
  * @throws If an error occurs while updating the customer and shipping address.
912
831
  */
@@ -925,16 +844,15 @@ class OrderService extends service_1.Service {
925
844
  });
926
845
  }
927
846
  /**
928
- * Get list sale order status
929
- * @param storeId - The id of store
847
+ * remove draft order
930
848
  * @param orderId - The id of order
931
849
  * @param updatedBy - Thi id of person update
932
850
  * @returns A promise that resolves when the customer and shipping address are updated.
933
851
  * @throws If an error occurs while updating the customer and shipping address.
934
852
  */
935
- removeDraftOrder(storeId, orderId, updatedBy) {
853
+ removeDraftOrder(orderId, updatedBy) {
936
854
  return __awaiter(this, void 0, void 0, function* () {
937
- const endpoint = `/orders/${this.orgId}/${storeId}/${orderId}/draft?updated_by=${updatedBy}`;
855
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/draft?updated_by=${updatedBy}`;
938
856
  const method = "DELETE";
939
857
  try {
940
858
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -947,7 +865,7 @@ class OrderService extends service_1.Service {
947
865
  });
948
866
  }
949
867
  /**
950
- * Get list sale order status
868
+ * Cancel product in order
951
869
  * @param orderId - The id of order
952
870
  * @param orderItemId - Thi id of item order
953
871
  * @param reason - The reason of cancel product in order
@@ -969,7 +887,7 @@ class OrderService extends service_1.Service {
969
887
  });
970
888
  }
971
889
  /**
972
- * Get list sale order status
890
+ * Remove Product in order
973
891
  * @param orderId - The id of order
974
892
  * @param orderItemId - Thi id of item order
975
893
  * @param reason - The reason of cancel product in order
@@ -991,7 +909,7 @@ class OrderService extends service_1.Service {
991
909
  });
992
910
  }
993
911
  /**
994
- * Get list sale order status
912
+ * Print order pdf
995
913
  * @param orderId - The id of order
996
914
  * @param paymentMethod - Thi id of item order
997
915
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -1003,6 +921,7 @@ class OrderService extends service_1.Service {
1003
921
  const method = "POST";
1004
922
  try {
1005
923
  const response = yield this.restApiCallWithToken(endpoint, method);
924
+ console.log(response);
1006
925
  return response;
1007
926
  }
1008
927
  catch (error) {
@@ -1012,7 +931,7 @@ class OrderService extends service_1.Service {
1012
931
  });
1013
932
  }
1014
933
  /**
1015
- * Get list sale order status
934
+ * Print order HTML
1016
935
  * @param orderId - The id of order
1017
936
  * @param paymentMethod - Thi id of item order
1018
937
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -1033,7 +952,7 @@ class OrderService extends service_1.Service {
1033
952
  });
1034
953
  }
1035
954
  /**
1036
- * Get list sale order status
955
+ * Create an orderReturn
1037
956
  * @param orderData - The id of order
1038
957
  * @returns A promise that resolves when the customer and shipping address are updated.
1039
958
  * @throws If an error occurs while updating the customer and shipping address.
@@ -1053,8 +972,8 @@ class OrderService extends service_1.Service {
1053
972
  });
1054
973
  }
1055
974
  /**
1056
- * Get list sale order status
1057
- * @param orderData - The id of order
975
+ * Caculate the order
976
+ * @param orderData - The data from the order
1058
977
  * @returns A promise that resolves when the customer and shipping address are updated.
1059
978
  * @throws If an error occurs while updating the customer and shipping address.
1060
979
  */
@@ -1072,5 +991,175 @@ class OrderService extends service_1.Service {
1072
991
  }
1073
992
  });
1074
993
  }
994
+ /**
995
+ * get amount product able order
996
+ * @param productIds - The id of product
997
+ * @returns A prom that resolves when the customer and shipping address are updated.
998
+ * @throws If an error occurs while updating the customer and shipping address.
999
+ */
1000
+ getQuantityAbleOrder(productIds) {
1001
+ return __awaiter(this, void 0, void 0, function* () {
1002
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/quantity-future-able?product_ids=${productIds}`;
1003
+ const method = "POST";
1004
+ try {
1005
+ const response = yield this.restApiCallWithToken(endpoint, method);
1006
+ return response;
1007
+ }
1008
+ catch (error) {
1009
+ console.log(`Error in getQuantityAbleOrder: ${error}`);
1010
+ throw error;
1011
+ }
1012
+ });
1013
+ }
1014
+ /**
1015
+ * updatee note without login
1016
+ * @param orderId - The id of the order
1017
+ * @param noteId - The id of the note
1018
+ * @param note - The content of the note
1019
+ * @returns A prom that resolves when the customer and shipping address are updated.
1020
+ * @throws If an error occurs while updating the customer and shipping address.
1021
+ */
1022
+ updateNoteWithoutLogin(orderId, noteId, note) {
1023
+ return __awaiter(this, void 0, void 0, function* () {
1024
+ const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/${noteId}/note`;
1025
+ const method = "PUT";
1026
+ try {
1027
+ const response = yield this.restApiCallWithToken(endpoint, method, note);
1028
+ return response;
1029
+ }
1030
+ catch (error) {
1031
+ console.log(`Error in updateNoteWithout:${error}`);
1032
+ throw error;
1033
+ }
1034
+ });
1035
+ }
1036
+ /**
1037
+ * add voucher without login
1038
+ * @param orderId - The id of the order
1039
+ * @param voucherCode - The code of voucher
1040
+ * @param updatedBy
1041
+ * @returns A prom that resolves when the customer and shipping address are updated.
1042
+ * @throws If an error occurs while updating the customer and shipping address.
1043
+ */
1044
+ addVoucherWithoutLogin(orderId, voucherCode, updatedBy) {
1045
+ return __awaiter(this, void 0, void 0, function* () {
1046
+ const endpoint = `/front/orders/${this.orgId}/${orderId}/voucher/${voucherCode}?updated_by=${updatedBy}`;
1047
+ const method = "POST";
1048
+ try {
1049
+ const response = yield this.restApiCallWithToken(endpoint, method);
1050
+ return response;
1051
+ }
1052
+ catch (error) {
1053
+ console.log(`Error in addVoucherWithout: ${error}`);
1054
+ throw error;
1055
+ }
1056
+ });
1057
+ }
1058
+ /**
1059
+ * delete voucher without login
1060
+ * @param orderId - The id of the order
1061
+ * @param voucherCode - The code of voucher
1062
+ * @param updatedBy
1063
+ * @returns A prom that resolves when the customer and shipping address are updated.
1064
+ * @throws If an error occurs while updating the customer and shipping address.
1065
+ */
1066
+ deleteVoucherLogin(orderId, voucherCode, updatedBy) {
1067
+ return __awaiter(this, void 0, void 0, function* () {
1068
+ const endpoint = `/front/orders/${this.orgId}/${orderId}/voucher/${voucherCode}?updatedBy=${updatedBy}`;
1069
+ const method = "DELETE";
1070
+ try {
1071
+ const response = yield this.restApiCallWithToken(endpoint, method);
1072
+ return response;
1073
+ }
1074
+ catch (error) {
1075
+ console.log(`Error in deleteVoucher: ${error}`);
1076
+ throw error;
1077
+ }
1078
+ });
1079
+ }
1080
+ /**
1081
+ * get list note without login
1082
+ * @param orderId - The id of the order
1083
+ * @returns A prom that resolves when the customer and shipping address are updated.
1084
+ * @throws If an error occurs while updating the customer and shipping address.
1085
+ */
1086
+ getListNoteWithoutLogin(orderId) {
1087
+ return __awaiter(this, void 0, void 0, function* () {
1088
+ const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/note`;
1089
+ const method = "GET";
1090
+ try {
1091
+ const response = yield this.restApiCallWithToken(endpoint, method);
1092
+ return response;
1093
+ }
1094
+ catch (error) {
1095
+ console.log(`Error in getListNoteWithoutLogin:${error}`);
1096
+ throw error;
1097
+ }
1098
+ });
1099
+ }
1100
+ /**
1101
+ * create note without login
1102
+ * @param orderId - The id of the order
1103
+ * @param createdBy
1104
+ * @param note
1105
+ * @returns A prom that resolves when the customer and shipping address are updated.
1106
+ * @throws If an error occurs while updating the customer and shipping address.
1107
+ */
1108
+ createNoteWithoutLogin(orderId, createdBy, note) {
1109
+ return __awaiter(this, void 0, void 0, function* () {
1110
+ const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/note?created_by=${createdBy}`;
1111
+ const method = "POST";
1112
+ try {
1113
+ const response = yield this.restApiCallWithToken(endpoint, method, note);
1114
+ return response;
1115
+ }
1116
+ catch (error) {
1117
+ console.log(`Error in createNoteWithoutLogin: ${error}`);
1118
+ throw error;
1119
+ }
1120
+ });
1121
+ }
1122
+ /**
1123
+ * get list order realation
1124
+ * @param orderIds
1125
+ * @returns A prom that resolves when the customer and shipping address are updated.
1126
+ * @throws If an error occurs while updating the customer and shipping address.
1127
+ */
1128
+ getListOrderRelationsWithoutLogin(orderIds) {
1129
+ return __awaiter(this, void 0, void 0, function* () {
1130
+ const endpoint = `/front/orders/${this.orgId}/${this.storeId}/relations?order_ids=${orderIds.join()}`;
1131
+ const method = "GET";
1132
+ try {
1133
+ const response = yield this.restApiCallWithToken(endpoint, method);
1134
+ return response;
1135
+ }
1136
+ catch (error) {
1137
+ console.log(`Error in getListOrderRelationsWithoutLogin: ${error}`);
1138
+ throw error;
1139
+ }
1140
+ });
1141
+ }
1142
+ /**
1143
+ * get list order realation
1144
+ * @param orderId - The id of order
1145
+ * @param noteId - The id of note
1146
+ * @param deletedBy - The id of person delete
1147
+ * @returns A prom that resolves when the customer and shipping address are updated.
1148
+ * @throws If an error occurs while updating the customer and shipping address.
1149
+ */
1150
+ deleteNoteWithoutLogin(orderId, noteId, deletedBy) {
1151
+ return __awaiter(this, void 0, void 0, function* () {
1152
+ const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/${noteId}?deleted_by=${deletedBy}`;
1153
+ const method = "DELETE";
1154
+ try {
1155
+ const response = yield this.restApiCallWithToken(endpoint, method);
1156
+ return response;
1157
+ }
1158
+ catch (error) {
1159
+ console.log(`Error in deleteNoteWithoutLogin: ${error}`);
1160
+ throw error;
1161
+ }
1162
+ });
1163
+ }
1075
1164
  }
1076
1165
  exports.OrderService = OrderService;
@@ -35,6 +35,9 @@ class Service {
35
35
  setToken(token) {
36
36
  this.token = token;
37
37
  }
38
+ // setOrgId(orgId: string) {
39
+ // this.orgId = orgId;
40
+ // }
38
41
  graphqlQuery(query, variables) {
39
42
  return __awaiter(this, void 0, void 0, function* () {
40
43
  try {
@@ -5,3 +5,49 @@ export interface LineItem {
5
5
  input_price: number;
6
6
  discount_amount: number;
7
7
  }
8
+ export interface DiscountCampaign {
9
+ type_discount: string;
10
+ discount_amount: 0;
11
+ campaign_id: string;
12
+ campaign_action_id: string;
13
+ campaign_action_type: string;
14
+ }
15
+ export interface CancelOrder {
16
+ reason: "CUSTOMER";
17
+ updatedBy: string;
18
+ note: string;
19
+ orderType: "SALES";
20
+ }
21
+ export interface MemberDiscount {
22
+ type: string;
23
+ amount: 0;
24
+ campaignId: string;
25
+ campaignActionId: string;
26
+ campaignActionType: string;
27
+ }
28
+ export interface CampaignPromotion {
29
+ campaign_id: string;
30
+ campaign_action_id: string;
31
+ campaign_action_type: string;
32
+ }
33
+ export interface OrderQuery {
34
+ order_id: string;
35
+ status: [number];
36
+ statusIgnore: [number];
37
+ subStatus: string;
38
+ ffmStatus: string;
39
+ subType: string;
40
+ paymentMethod: string;
41
+ keyword: string;
42
+ customerMultiValue: string;
43
+ productMultiValue: string;
44
+ customerId: string;
45
+ createdBy: string;
46
+ dateCreateFrom: number;
47
+ dateCreateTo: number;
48
+ dateUpdateFrom: number;
49
+ dateUpdateTo: number;
50
+ employeeAssign: string;
51
+ currentPage: 1;
52
+ maxResult: 20;
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [