@longvansoftware/storefront-js-client 3.9.0 → 3.9.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.
|
@@ -10,7 +10,7 @@ export declare class OrderService extends Service {
|
|
|
10
10
|
* @param orgId - The organization ID.
|
|
11
11
|
* @param storeId - The store ID.
|
|
12
12
|
*/
|
|
13
|
-
constructor(endpoint: string, orgId: string, storeId: string, environment
|
|
13
|
+
constructor(endpoint: string, orgId: string, storeId: string, environment: "dev" | "live");
|
|
14
14
|
setToken(token: string): void;
|
|
15
15
|
/**
|
|
16
16
|
* Override restApiCallWithToken to use default token if no token is set
|
|
@@ -75,6 +75,17 @@ export declare class OrderService extends Service {
|
|
|
75
75
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
76
76
|
*/
|
|
77
77
|
updateCustomerAndShippingAddress(orderId: string, customerId: string, shippingAddress: string): Promise<any>;
|
|
78
|
+
updateShippingAddressWithoutLogin(orderId: string, shippingData: {
|
|
79
|
+
name: string;
|
|
80
|
+
phone: string;
|
|
81
|
+
address: string;
|
|
82
|
+
province: string;
|
|
83
|
+
district: string;
|
|
84
|
+
ward: string;
|
|
85
|
+
province_code: string;
|
|
86
|
+
district_code: string;
|
|
87
|
+
ward_code: string;
|
|
88
|
+
}): Promise<any>;
|
|
78
89
|
/**
|
|
79
90
|
* Retrieves the order line items for a specific order.
|
|
80
91
|
* @param partnerId - The partner ID.
|
|
@@ -538,4 +549,5 @@ export declare class OrderService extends Service {
|
|
|
538
549
|
removeGiftInOrder(orderId: string, orderItemId: string): Promise<any>;
|
|
539
550
|
tooglePaymentMethod(methodCode: string, status: boolean): Promise<any>;
|
|
540
551
|
choosePaymentGatewayForPaymentMethod(methodCode: string, gatewayId: string): Promise<any>;
|
|
552
|
+
addCustomerToOder(orderId: string, customerData: any): Promise<any>;
|
|
541
553
|
}
|
|
@@ -27,7 +27,7 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
27
27
|
* @param orgId - The organization ID.
|
|
28
28
|
* @param storeId - The store ID.
|
|
29
29
|
*/
|
|
30
|
-
constructor(endpoint, orgId, storeId, environment
|
|
30
|
+
constructor(endpoint, orgId, storeId, environment) {
|
|
31
31
|
super(endpoint, orgId, storeId, environment);
|
|
32
32
|
}
|
|
33
33
|
setToken(token) {
|
|
@@ -208,6 +208,23 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
+
updateShippingAddressWithoutLogin(orderId, shippingData) {
|
|
212
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
const endpoint = `/front/orders/express/${this.orgId}/${this.storeId}/${orderId}/shipping-address`;
|
|
214
|
+
const method = "PUT";
|
|
215
|
+
try {
|
|
216
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, shippingData);
|
|
217
|
+
console.log("RESPONSE:", response);
|
|
218
|
+
return response;
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
if (error.response && error.response.data) {
|
|
222
|
+
console.error("Backend Error Detail:", JSON.stringify(error.response.data, null, 2));
|
|
223
|
+
}
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
211
228
|
/**
|
|
212
229
|
* Retrieves the order line items for a specific order.
|
|
213
230
|
* @param partnerId - The partner ID.
|
|
@@ -1695,5 +1712,19 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
1695
1712
|
}
|
|
1696
1713
|
});
|
|
1697
1714
|
}
|
|
1715
|
+
addCustomerToOder(orderId, customerData) {
|
|
1716
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1717
|
+
const endpoint = `/front/orders/${this.orgId}/${orderId}/customerInfo`;
|
|
1718
|
+
const method = "PUT";
|
|
1719
|
+
const requestData = Object.assign({}, customerData);
|
|
1720
|
+
try {
|
|
1721
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, requestData);
|
|
1722
|
+
return response;
|
|
1723
|
+
}
|
|
1724
|
+
catch (error) {
|
|
1725
|
+
throw error;
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1698
1729
|
}
|
|
1699
1730
|
exports.OrderService = OrderService;
|