@longvansoftware/storefront-js-client 1.2.2 → 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.
@@ -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;