@longvansoftware/storefront-js-client 1.1.9 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/lib/order/index.d.ts +59 -11
- package/dist/src/lib/order/index.js +158 -18
- package/dist/src/lib/service.js +1 -0
- package/package.json +1 -1
|
@@ -125,26 +125,35 @@ export declare class OrderService extends Service {
|
|
|
125
125
|
* Updates the customer and shipping address for an 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
133
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
129
134
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
130
135
|
*/
|
|
131
|
-
updateDiscountPriceInOrder(orderId: string, orderItemId: string): Promise<any>;
|
|
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
137
|
/**
|
|
133
138
|
* Updates the customer and shipping address for an order.
|
|
134
139
|
* @param orderId - The ID of the order.
|
|
140
|
+
* @param reason
|
|
141
|
+
* @param updatedBy
|
|
142
|
+
* @param note
|
|
143
|
+
* @param orderType
|
|
135
144
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
136
145
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
137
146
|
*/
|
|
138
|
-
updateCancelOrder(orderId: string): Promise<any>;
|
|
147
|
+
updateCancelOrder(orderId: string, reason: "CUSTOMER", updatedBy: string, note: string, orderType: "SALES"): Promise<any>;
|
|
139
148
|
/**
|
|
140
149
|
* Updates the customer and shipping address for an order.
|
|
141
150
|
* @param orderId - The ID of the order.
|
|
142
151
|
* @param statusNew - the new status of order
|
|
143
|
-
* @param
|
|
152
|
+
* @param updatedBy - Id of person update
|
|
144
153
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
145
154
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
146
155
|
*/
|
|
147
|
-
|
|
156
|
+
updateStatusReturnOrder(orderId: string, statusNew: string, updatedBy: string): Promise<any>;
|
|
148
157
|
/**
|
|
149
158
|
* Updates the customer and shipping address for an order.
|
|
150
159
|
* @param orderId - The ID of the order.
|
|
@@ -240,7 +249,7 @@ export declare class OrderService extends Service {
|
|
|
240
249
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
241
250
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
242
251
|
*/
|
|
243
|
-
updateMemberDiscount(orderId: string, type: string, amount:
|
|
252
|
+
updateMemberDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
|
|
244
253
|
/**
|
|
245
254
|
* Updates the customer and shipping address for an order.
|
|
246
255
|
* @param orderId - The ID of the order.
|
|
@@ -260,7 +269,7 @@ export declare class OrderService extends Service {
|
|
|
260
269
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
261
270
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
262
271
|
*/
|
|
263
|
-
updateDiscount(orderId: string, type: string, amount:
|
|
272
|
+
updateDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
|
|
264
273
|
/**
|
|
265
274
|
* Updates the customer and shipping address for an order.
|
|
266
275
|
* @param orderId - The ID of the order.
|
|
@@ -297,13 +306,13 @@ export declare class OrderService extends Service {
|
|
|
297
306
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
298
307
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
299
308
|
*/
|
|
300
|
-
|
|
309
|
+
getListTypeOrder(): Promise<any>;
|
|
301
310
|
/**
|
|
302
311
|
* Updates the customer and shipping address for an order.
|
|
303
312
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
304
313
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
305
314
|
*/
|
|
306
|
-
|
|
315
|
+
getListShippingCarrier(): Promise<any>;
|
|
307
316
|
/**
|
|
308
317
|
* Get list sell order
|
|
309
318
|
* @param orderId
|
|
@@ -359,7 +368,7 @@ export declare class OrderService extends Service {
|
|
|
359
368
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
360
369
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
361
370
|
*/
|
|
362
|
-
|
|
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>;
|
|
363
372
|
/**
|
|
364
373
|
* Get list sale order status
|
|
365
374
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
@@ -379,9 +388,48 @@ export declare class OrderService extends Service {
|
|
|
379
388
|
* Get list sale order status
|
|
380
389
|
* @param orderId - The id of order
|
|
381
390
|
* @param orderItemId - Thi id of item order
|
|
382
|
-
* @param reason - The reason of
|
|
391
|
+
* @param reason - The reason of cancel product in order
|
|
392
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
393
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
394
|
+
*/
|
|
395
|
+
cancelProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
|
|
396
|
+
/**
|
|
397
|
+
* Get list sale order status
|
|
398
|
+
* @param orderId - The id of order
|
|
399
|
+
* @param orderItemId - Thi id of item order
|
|
400
|
+
* @param reason - The reason of cancel product in order
|
|
401
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
402
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
403
|
+
*/
|
|
404
|
+
removeProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
|
|
405
|
+
/**
|
|
406
|
+
* Get list sale order status
|
|
407
|
+
* @param orderId - The id of order
|
|
408
|
+
* @param paymentMethod - Thi id of item order
|
|
409
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
410
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
411
|
+
*/
|
|
412
|
+
printOrderPdf(orderId: string, paymentMethod: string): Promise<any>;
|
|
413
|
+
/**
|
|
414
|
+
* Get list sale order status
|
|
415
|
+
* @param orderId - The id of order
|
|
416
|
+
* @param paymentMethod - Thi id of item order
|
|
417
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
418
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
419
|
+
*/
|
|
420
|
+
printOrderHtml(orderId: string, paymentMethod: string): Promise<any>;
|
|
421
|
+
/**
|
|
422
|
+
* Get list sale order status
|
|
423
|
+
* @param orderData - The id of order
|
|
424
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
425
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
426
|
+
*/
|
|
427
|
+
createOrderReturn(orderData: any): Promise<any>;
|
|
428
|
+
/**
|
|
429
|
+
* Get list sale order status
|
|
430
|
+
* @param orderData - The id of order
|
|
383
431
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
384
432
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
385
433
|
*/
|
|
386
|
-
|
|
434
|
+
calculateOrder(orderData: any): Promise<any>;
|
|
387
435
|
}
|
|
@@ -301,15 +301,27 @@ class OrderService extends service_1.Service {
|
|
|
301
301
|
* Updates the customer and shipping address for an 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
309
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
305
310
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
306
311
|
*/
|
|
307
|
-
updateDiscountPriceInOrder(orderId, orderItemId) {
|
|
312
|
+
updateDiscountPriceInOrder(orderId, orderItemId, type_discount, discount_amount, campaign_id, campaign_action_id, campaign_action_type) {
|
|
308
313
|
return __awaiter(this, void 0, void 0, function* () {
|
|
309
314
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/discount}`;
|
|
310
315
|
const method = "PUT";
|
|
316
|
+
const orderData = {
|
|
317
|
+
type_discount,
|
|
318
|
+
discount_amount,
|
|
319
|
+
campaign_id,
|
|
320
|
+
campaign_action_id,
|
|
321
|
+
campaign_action_type,
|
|
322
|
+
};
|
|
311
323
|
try {
|
|
312
|
-
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
324
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
313
325
|
return response;
|
|
314
326
|
}
|
|
315
327
|
catch (error) {
|
|
@@ -321,15 +333,25 @@ class OrderService extends service_1.Service {
|
|
|
321
333
|
/**
|
|
322
334
|
* Updates the customer and shipping address for an order.
|
|
323
335
|
* @param orderId - The ID of the order.
|
|
336
|
+
* @param reason
|
|
337
|
+
* @param updatedBy
|
|
338
|
+
* @param note
|
|
339
|
+
* @param orderType
|
|
324
340
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
325
341
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
326
342
|
*/
|
|
327
|
-
updateCancelOrder(orderId) {
|
|
343
|
+
updateCancelOrder(orderId, reason, updatedBy, note, orderType) {
|
|
328
344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
329
345
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/cancel`;
|
|
330
346
|
const method = "PUT";
|
|
347
|
+
const orderData = {
|
|
348
|
+
reason,
|
|
349
|
+
updatedBy,
|
|
350
|
+
note,
|
|
351
|
+
orderType,
|
|
352
|
+
};
|
|
331
353
|
try {
|
|
332
|
-
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
354
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
333
355
|
return response;
|
|
334
356
|
}
|
|
335
357
|
catch (error) {
|
|
@@ -342,20 +364,23 @@ class OrderService extends service_1.Service {
|
|
|
342
364
|
* Updates the customer and shipping address for an order.
|
|
343
365
|
* @param orderId - The ID of the order.
|
|
344
366
|
* @param statusNew - the new status of order
|
|
345
|
-
* @param
|
|
367
|
+
* @param updatedBy - Id of person update
|
|
346
368
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
347
369
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
348
370
|
*/
|
|
349
|
-
|
|
371
|
+
updateStatusReturnOrder(orderId, statusNew, updatedBy) {
|
|
350
372
|
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
-
|
|
373
|
+
if (!orderId || !statusNew || !updatedBy) {
|
|
374
|
+
throw new Error("Tham số đầu vào không hợp lệ.");
|
|
375
|
+
}
|
|
376
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/${statusNew}?updated_by=${updatedBy}`;
|
|
352
377
|
const method = "PUT";
|
|
353
378
|
try {
|
|
354
379
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
355
380
|
return response;
|
|
356
381
|
}
|
|
357
382
|
catch (error) {
|
|
358
|
-
console.log(`Error in
|
|
383
|
+
console.log(`Error in updateStatusReturnOrder: ${error}`);
|
|
359
384
|
throw error;
|
|
360
385
|
}
|
|
361
386
|
});
|
|
@@ -718,8 +743,8 @@ class OrderService extends service_1.Service {
|
|
|
718
743
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/sell_order`;
|
|
719
744
|
const method = "GET";
|
|
720
745
|
try {
|
|
721
|
-
const
|
|
722
|
-
return
|
|
746
|
+
const res = yield this.restApiCallWithToken(endpoint, method);
|
|
747
|
+
return res;
|
|
723
748
|
}
|
|
724
749
|
catch (error) {
|
|
725
750
|
console.log(`Error in getInfoSellOrder: ${error}`);
|
|
@@ -752,7 +777,7 @@ class OrderService extends service_1.Service {
|
|
|
752
777
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
753
778
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
754
779
|
*/
|
|
755
|
-
|
|
780
|
+
getListTypeOrder() {
|
|
756
781
|
return __awaiter(this, void 0, void 0, function* () {
|
|
757
782
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/type`;
|
|
758
783
|
const method = "GET";
|
|
@@ -771,7 +796,7 @@ class OrderService extends service_1.Service {
|
|
|
771
796
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
772
797
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
773
798
|
*/
|
|
774
|
-
|
|
799
|
+
getListShippingCarrier() {
|
|
775
800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
776
801
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/shippingCarrier`;
|
|
777
802
|
const method = "GET";
|
|
@@ -866,7 +891,7 @@ class OrderService extends service_1.Service {
|
|
|
866
891
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
867
892
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
868
893
|
*/
|
|
869
|
-
|
|
894
|
+
getListReturnOrder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
|
|
870
895
|
return __awaiter(this, void 0, void 0, function* () {
|
|
871
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}¤tPage=${currentPage}&maxResult=${maxResult}`;
|
|
872
897
|
const method = "GET";
|
|
@@ -875,7 +900,7 @@ class OrderService extends service_1.Service {
|
|
|
875
900
|
return response;
|
|
876
901
|
}
|
|
877
902
|
catch (error) {
|
|
878
|
-
console.log(`Error in
|
|
903
|
+
console.log(`Error in getListReturnOrder: ${error}`);
|
|
879
904
|
throw error;
|
|
880
905
|
}
|
|
881
906
|
});
|
|
@@ -910,7 +935,7 @@ class OrderService extends service_1.Service {
|
|
|
910
935
|
removeDraftOrder(storeId, orderId, updatedBy) {
|
|
911
936
|
return __awaiter(this, void 0, void 0, function* () {
|
|
912
937
|
const endpoint = `/orders/${this.orgId}/${storeId}/${orderId}/draft?updated_by=${updatedBy}`;
|
|
913
|
-
const method = "
|
|
938
|
+
const method = "DELETE";
|
|
914
939
|
try {
|
|
915
940
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
916
941
|
return response;
|
|
@@ -925,12 +950,127 @@ class OrderService extends service_1.Service {
|
|
|
925
950
|
* Get list sale order status
|
|
926
951
|
* @param orderId - The id of order
|
|
927
952
|
* @param orderItemId - Thi id of item order
|
|
928
|
-
* @param reason - The reason of
|
|
953
|
+
* @param reason - The reason of cancel product in order
|
|
929
954
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
930
955
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
931
956
|
*/
|
|
932
|
-
|
|
933
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
957
|
+
cancelProductInOrder(orderId, orderItemId, reason) {
|
|
958
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
959
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}?reason=${reason}`;
|
|
960
|
+
const method = "DELETE";
|
|
961
|
+
try {
|
|
962
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
963
|
+
return response;
|
|
964
|
+
}
|
|
965
|
+
catch (error) {
|
|
966
|
+
console.log(`Error in removeProductInOrder: ${error}`);
|
|
967
|
+
throw error;
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Get list sale order status
|
|
973
|
+
* @param orderId - The id of order
|
|
974
|
+
* @param orderItemId - Thi id of item order
|
|
975
|
+
* @param reason - The reason of cancel product in order
|
|
976
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
977
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
978
|
+
*/
|
|
979
|
+
removeProductInOrder(orderId, orderItemId, reason) {
|
|
980
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
981
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/delete?reason=${reason}`;
|
|
982
|
+
const method = "DELETE";
|
|
983
|
+
try {
|
|
984
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
985
|
+
return response;
|
|
986
|
+
}
|
|
987
|
+
catch (error) {
|
|
988
|
+
console.log(`Error in removeProductInOrder: ${error}`);
|
|
989
|
+
throw error;
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Get list sale order status
|
|
995
|
+
* @param orderId - The id of order
|
|
996
|
+
* @param paymentMethod - Thi id of item order
|
|
997
|
+
* @returns A promise 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
|
+
printOrderPdf(orderId, paymentMethod) {
|
|
1001
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1002
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/print.pdf?payment_method=${paymentMethod}`;
|
|
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 printOrderPdf: ${error}`);
|
|
1010
|
+
throw error;
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Get list sale order status
|
|
1016
|
+
* @param orderId - The id of order
|
|
1017
|
+
* @param paymentMethod - Thi id of item order
|
|
1018
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
1019
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
1020
|
+
*/
|
|
1021
|
+
printOrderHtml(orderId, paymentMethod) {
|
|
1022
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1023
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/print.html?payment_method=${paymentMethod}`;
|
|
1024
|
+
const method = "POST";
|
|
1025
|
+
try {
|
|
1026
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
1027
|
+
return response;
|
|
1028
|
+
}
|
|
1029
|
+
catch (error) {
|
|
1030
|
+
console.log(`Error in printOrderHtml: ${error}`);
|
|
1031
|
+
throw error;
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Get list sale order status
|
|
1037
|
+
* @param orderData - The id of order
|
|
1038
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
1039
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
1040
|
+
*/
|
|
1041
|
+
createOrderReturn(orderData) {
|
|
1042
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1043
|
+
const endpoint = `/orders/${this.orgId}/order_return`;
|
|
1044
|
+
const method = "POST";
|
|
1045
|
+
try {
|
|
1046
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
1047
|
+
return response;
|
|
1048
|
+
}
|
|
1049
|
+
catch (error) {
|
|
1050
|
+
console.log(`Error in createOrderReturn: ${error}`);
|
|
1051
|
+
throw error;
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Get list sale order status
|
|
1057
|
+
* @param orderData - The id of order
|
|
1058
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
1059
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
1060
|
+
*/
|
|
1061
|
+
calculateOrder(orderData) {
|
|
1062
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1063
|
+
const endpoint = `/orders/${this.orgId}/calculate`;
|
|
1064
|
+
const method = "POST";
|
|
1065
|
+
try {
|
|
1066
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
1067
|
+
return response;
|
|
1068
|
+
}
|
|
1069
|
+
catch (error) {
|
|
1070
|
+
console.log(`Error in calculateOrder: ${error}`);
|
|
1071
|
+
throw error;
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
934
1074
|
}
|
|
935
1075
|
}
|
|
936
1076
|
exports.OrderService = OrderService;
|
package/dist/src/lib/service.js
CHANGED
|
@@ -79,6 +79,7 @@ class Service {
|
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
try {
|
|
81
81
|
const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
|
|
82
|
+
console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
|
|
82
83
|
const response = yield (0, axios_1.default)({
|
|
83
84
|
url: this.endpoint + path,
|
|
84
85
|
method,
|