@longvansoftware/storefront-js-client 1.1.7 → 1.1.9

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.
@@ -11,6 +11,7 @@ export declare class OrderService extends Service {
11
11
  * @param storeId - The store ID.
12
12
  */
13
13
  constructor(endpoint: string, orgId: string, storeId: string);
14
+ setToken(token: string): void;
14
15
  /**
15
16
  * Creates a new order.
16
17
  * @param orderData - The data for the order.
@@ -304,7 +305,7 @@ export declare class OrderService extends Service {
304
305
  */
305
306
  updateListShippingCarrier(): Promise<any>;
306
307
  /**
307
- * Updates the customer and shipping address for an order.
308
+ * Get list sell order
308
309
  * @param orderId
309
310
  * @param status
310
311
  * @param statusIgnore
@@ -317,11 +318,70 @@ export declare class OrderService extends Service {
317
318
  * @param productMultiValue
318
319
  * @param customerId
319
320
  * @param createdBy
321
+ * @param dateCreateFrom
320
322
  * @param dateCreateTo
323
+ * @param dateUpdateFrom
324
+ * @param dateUpdateTo
325
+ * @param employeeAssign
326
+ * @param currentPage
327
+ * @param maxResult
328
+ * @returns A promise that resolves when the customer and shipping address are updated.
329
+ * @throws If an error occurs while updating the customer and shipping address.
330
+ */
331
+ 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>;
332
+ /**
333
+ * Get list sale order status
334
+ * @returns A promise that resolves when the customer and shipping address are updated.
335
+ * @throws If an error occurs while updating the customer and shipping address.
336
+ */
337
+ getListSaleOrderStatus(): Promise<any>;
338
+ /**
339
+ * Get list return order
340
+ * @param orderId
341
+ * @param status
342
+ * @param statusIgnore
343
+ * @param subStatus
344
+ * @param ffmStatus
345
+ * @param subType
346
+ * @param paymentMethod
347
+ * @param keyword
348
+ * @param customerMultiValue
349
+ * @param productMultiValue
350
+ * @param customerId
351
+ * @param createdBy
321
352
  * @param dateCreateFrom
322
- * @param dateC
353
+ * @param dateCreateTo
354
+ * @param dateUpdateFrom
355
+ * @param dateUpdateTo
356
+ * @param employeeAssign
357
+ * @param currentPage
358
+ * @param maxResult
359
+ * @returns A promise that resolves when the customer and shipping address are updated.
360
+ * @throws If an error occurs while updating the customer and shipping address.
361
+ */
362
+ 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>;
363
+ /**
364
+ * Get list sale order status
365
+ * @returns A promise that resolves when the customer and shipping address are updated.
366
+ * @throws If an error occurs while updating the customer and shipping address.
367
+ */
368
+ getListReturnOrderStatus(): Promise<any>;
369
+ /**
370
+ * Get list sale order status
371
+ * @param storeId - The id of store
372
+ * @param orderId - The id of order
373
+ * @param updatedBy - Thi id of person update
374
+ * @returns A promise that resolves when the customer and shipping address are updated.
375
+ * @throws If an error occurs while updating the customer and shipping address.
376
+ */
377
+ removeDraftOrder(storeId: string, orderId: string, updatedBy: string): Promise<any>;
378
+ /**
379
+ * Get list sale order status
380
+ * @param orderId - The id of order
381
+ * @param orderItemId - Thi id of item order
382
+ * @param reason - The reason of remove product in order
323
383
  * @returns A promise that resolves when the customer and shipping address are updated.
324
384
  * @throws If an error occurs while updating the customer and shipping address.
325
385
  */
326
- getListSellOrder(): Promise<void>;
386
+ removeProductInOrder(orderId: string, orderItemId: string): Promise<void>;
327
387
  }
@@ -24,6 +24,10 @@ class OrderService extends service_1.Service {
24
24
  constructor(endpoint, orgId, storeId) {
25
25
  super(endpoint, orgId, storeId);
26
26
  }
27
+ setToken(token) {
28
+ console.log("🚀 ~ OrderService ~ setToken ~ token:", token);
29
+ this.token = token;
30
+ }
27
31
  /**
28
32
  * Creates a new order.
29
33
  * @param orderData - The data for the order.
@@ -140,7 +144,7 @@ class OrderService extends service_1.Service {
140
144
  */
141
145
  updateVAT(orderId, vatFee, vatType) {
142
146
  return __awaiter(this, void 0, void 0, function* () {
143
- const endpoint = `/v2/orders/${this.orgId}/${orderId}/vat?vat_fee=${vatFee}&vat_type=${vatType}`;
147
+ const endpoint = `/orders/${this.orgId}/${orderId}/vat?vat_fee=${vatFee}&vat_type=${vatType}`;
144
148
  const method = "PUT";
145
149
  try {
146
150
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -193,7 +197,7 @@ class OrderService extends service_1.Service {
193
197
  */
194
198
  addOrderLineItems(orderId, lineItems) {
195
199
  return __awaiter(this, void 0, void 0, function* () {
196
- const endpoint = `/v2/orders/${this.orgId}/${this.storeId}/${orderId}/orderLineItem`;
200
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/orderLineItem`;
197
201
  const method = "POST";
198
202
  try {
199
203
  const response = yield this.restApiCallWithToken(endpoint, method, lineItems);
@@ -782,7 +786,7 @@ class OrderService extends service_1.Service {
782
786
  });
783
787
  }
784
788
  /**
785
- * Updates the customer and shipping address for an order.
789
+ * Get list sell order
786
790
  * @param orderId
787
791
  * @param status
788
792
  * @param statusIgnore
@@ -795,16 +799,138 @@ class OrderService extends service_1.Service {
795
799
  * @param productMultiValue
796
800
  * @param customerId
797
801
  * @param createdBy
802
+ * @param dateCreateFrom
798
803
  * @param dateCreateTo
804
+ * @param dateUpdateFrom
805
+ * @param dateUpdateTo
806
+ * @param employeeAssign
807
+ * @param currentPage
808
+ * @param maxResult
809
+ * @returns A promise that resolves when the customer and shipping address are updated.
810
+ * @throws If an error occurs while updating the customer and shipping address.
811
+ */
812
+ getListSellOrder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
813
+ return __awaiter(this, void 0, void 0, function* () {
814
+ 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}`;
815
+ const method = "GET";
816
+ try {
817
+ const response = yield this.restApiCallWithToken(endpoint, method);
818
+ return response;
819
+ }
820
+ catch (error) {
821
+ console.log(`Error in getListSellOrder: ${error}`);
822
+ throw error;
823
+ }
824
+ });
825
+ }
826
+ /**
827
+ * Get list sale order status
828
+ * @returns A promise that resolves when the customer and shipping address are updated.
829
+ * @throws If an error occurs while updating the customer and shipping address.
830
+ */
831
+ getListSaleOrderStatus() {
832
+ return __awaiter(this, void 0, void 0, function* () {
833
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/saleOrderStatus`;
834
+ const method = "GET";
835
+ try {
836
+ const response = yield this.restApiCallWithToken(endpoint, method);
837
+ return response;
838
+ }
839
+ catch (error) {
840
+ console.log(`Error in getListSaleOrderStatus:${error}`);
841
+ throw error;
842
+ }
843
+ });
844
+ }
845
+ /**
846
+ * Get list return order
847
+ * @param orderId
848
+ * @param status
849
+ * @param statusIgnore
850
+ * @param subStatus
851
+ * @param ffmStatus
852
+ * @param subType
853
+ * @param paymentMethod
854
+ * @param keyword
855
+ * @param customerMultiValue
856
+ * @param productMultiValue
857
+ * @param customerId
858
+ * @param createdBy
799
859
  * @param dateCreateFrom
800
- * @param dateC
860
+ * @param dateCreateTo
861
+ * @param dateUpdateFrom
862
+ * @param dateUpdateTo
863
+ * @param employeeAssign
864
+ * @param currentPage
865
+ * @param maxResult
801
866
  * @returns A promise that resolves when the customer and shipping address are updated.
802
867
  * @throws If an error occurs while updating the customer and shipping address.
803
868
  */
804
- getListSellOrder() {
869
+ getListReturnorder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
805
870
  return __awaiter(this, void 0, void 0, function* () {
806
- const endpoint = `/orders/${this.orgId}/${this.storeId}/sell_order`;
871
+ 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}`;
872
+ const method = "GET";
873
+ try {
874
+ const response = yield this.restApiCallWithToken(endpoint, method);
875
+ return response;
876
+ }
877
+ catch (error) {
878
+ console.log(`Error in getListReturnorder: ${error}`);
879
+ throw error;
880
+ }
807
881
  });
808
882
  }
883
+ /**
884
+ * Get list sale order status
885
+ * @returns A promise that resolves when the customer and shipping address are updated.
886
+ * @throws If an error occurs while updating the customer and shipping address.
887
+ */
888
+ getListReturnOrderStatus() {
889
+ return __awaiter(this, void 0, void 0, function* () {
890
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/returnOrderStatus`;
891
+ const method = "GET";
892
+ try {
893
+ const response = yield this.restApiCallWithToken(endpoint, method);
894
+ return response;
895
+ }
896
+ catch (error) {
897
+ console.log(`Error in getListReturnOrderStatus: ${error}`);
898
+ throw error;
899
+ }
900
+ });
901
+ }
902
+ /**
903
+ * Get list sale order status
904
+ * @param storeId - The id of store
905
+ * @param orderId - The id of order
906
+ * @param updatedBy - Thi id of person update
907
+ * @returns A promise that resolves when the customer and shipping address are updated.
908
+ * @throws If an error occurs while updating the customer and shipping address.
909
+ */
910
+ removeDraftOrder(storeId, orderId, updatedBy) {
911
+ return __awaiter(this, void 0, void 0, function* () {
912
+ const endpoint = `/orders/${this.orgId}/${storeId}/${orderId}/draft?updated_by=${updatedBy}`;
913
+ const method = "GET";
914
+ try {
915
+ const response = yield this.restApiCallWithToken(endpoint, method);
916
+ return response;
917
+ }
918
+ catch (error) {
919
+ console.log(`Error in removeDraftOrder: ${error}`);
920
+ throw error;
921
+ }
922
+ });
923
+ }
924
+ /**
925
+ * Get list sale order status
926
+ * @param orderId - The id of order
927
+ * @param orderItemId - Thi id of item order
928
+ * @param reason - The reason of remove product in order
929
+ * @returns A promise that resolves when the customer and shipping address are updated.
930
+ * @throws If an error occurs while updating the customer and shipping address.
931
+ */
932
+ removeProductInOrder(orderId, orderItemId) {
933
+ return __awaiter(this, void 0, void 0, function* () { });
934
+ }
809
935
  }
810
936
  exports.OrderService = OrderService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [