@longvansoftware/storefront-js-client 1.1.6 → 1.1.7
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 +240 -0
- package/dist/src/lib/order/index.js +601 -0
- package/package.json +1 -1
|
@@ -84,4 +84,244 @@ export declare class OrderService extends Service {
|
|
|
84
84
|
* @throws If an error occurs while adding the line items.
|
|
85
85
|
*/
|
|
86
86
|
addOrderLineItems(orderId: string, lineItems: LineItem[]): Promise<any>;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a new order.
|
|
89
|
+
* @param orderId - The id of the order .
|
|
90
|
+
* @param orderItemId - The id of order item.
|
|
91
|
+
* @param quantity - Quantity of profuct in order.
|
|
92
|
+
* @returns A promise that resolves with the created order.
|
|
93
|
+
* @throws If an error occurs while creating the order.
|
|
94
|
+
*/
|
|
95
|
+
updateQuantityProductInOrder(orderId: string, orderItemId: string, quantity: number): Promise<any>;
|
|
96
|
+
/**
|
|
97
|
+
* Updates the customer and shipping address for an order.
|
|
98
|
+
* @param orderId - The ID of the order.
|
|
99
|
+
* @param saleId - The Id of saler.
|
|
100
|
+
* @param updateBy - Who update.
|
|
101
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
102
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
103
|
+
*/
|
|
104
|
+
updateSaleEmployee(orderId: string, saleId: string, updateBy: string): Promise<any>;
|
|
105
|
+
/**
|
|
106
|
+
* Updates the customer and shipping address for an order.
|
|
107
|
+
* @param orderId - The ID of the order.
|
|
108
|
+
* @param orderType - The type of order.
|
|
109
|
+
* @param updateBy - Id of person update
|
|
110
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
111
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
112
|
+
*/
|
|
113
|
+
updateOrderType(orderId: string, orderType: string, updateBy: string): Promise<any>;
|
|
114
|
+
/**
|
|
115
|
+
* Updates the customer and shipping address for an order.
|
|
116
|
+
* @param orderId - The ID of the order.
|
|
117
|
+
* @param orderItemId - The id of order.
|
|
118
|
+
* @param priceNew - the new price after update
|
|
119
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
120
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
121
|
+
*/
|
|
122
|
+
updatePriceInOrder(orderId: string, orderItemId: string, priceNew: number): Promise<any>;
|
|
123
|
+
/**
|
|
124
|
+
* Updates the customer and shipping address for an order.
|
|
125
|
+
* @param orderId - The ID of the order.
|
|
126
|
+
* @param orderItemId - The id of order.
|
|
127
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
128
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
129
|
+
*/
|
|
130
|
+
updateDiscountPriceInOrder(orderId: string, orderItemId: string): Promise<any>;
|
|
131
|
+
/**
|
|
132
|
+
* Updates the customer and shipping address for an order.
|
|
133
|
+
* @param orderId - The ID of the order.
|
|
134
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
135
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
136
|
+
*/
|
|
137
|
+
updateCancelOrder(orderId: string): Promise<any>;
|
|
138
|
+
/**
|
|
139
|
+
* Updates the customer and shipping address for an order.
|
|
140
|
+
* @param orderId - The ID of the order.
|
|
141
|
+
* @param statusNew - the new status of order
|
|
142
|
+
* @param updateBy - Id of person update
|
|
143
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
144
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
145
|
+
*/
|
|
146
|
+
updateStatusOrder(orderId: string, statusNew: string, updateBy: string): Promise<any>;
|
|
147
|
+
/**
|
|
148
|
+
* Updates the customer and shipping address for an order.
|
|
149
|
+
* @param orderId - The ID of the order.
|
|
150
|
+
* @param shippingServiceId - the id of shipping service
|
|
151
|
+
* @param updateBy - Id of person update
|
|
152
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
153
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
154
|
+
*/
|
|
155
|
+
updateShippngService(orderId: string, shippingServiceId: string, updateBy: string): Promise<any>;
|
|
156
|
+
/**
|
|
157
|
+
* Updates the customer and shipping address for an order.
|
|
158
|
+
* @param orderId - The ID of the order.
|
|
159
|
+
* @param shippingId - the id of shipping
|
|
160
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
161
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
162
|
+
*/
|
|
163
|
+
updateShippingOrder(orderId: string, shippingId: string): Promise<any>;
|
|
164
|
+
/**
|
|
165
|
+
* Updates the customer and shipping address for an order.
|
|
166
|
+
* @param orderId - The ID of the order.
|
|
167
|
+
* @param shippingFee - the fee of shipping
|
|
168
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
169
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
170
|
+
*/
|
|
171
|
+
updateShippingFee(orderId: string, shipingFee: Number): Promise<any>;
|
|
172
|
+
/**
|
|
173
|
+
* Updates the customer and shipping address for an order.
|
|
174
|
+
* @param orderId - The ID of the order.
|
|
175
|
+
* @param financialStatus - the status of financial
|
|
176
|
+
* @param updateBy - Id of person update
|
|
177
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
178
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
179
|
+
*/
|
|
180
|
+
updateFinancialStatus(orderId: string, financialStatus: string, updateBy: string): Promise<any>;
|
|
181
|
+
/**
|
|
182
|
+
* Updates the customer and shipping address for an order.
|
|
183
|
+
* @param orderId - The ID of the order.
|
|
184
|
+
* @param warehouseId - the status of warehouse
|
|
185
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
186
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
187
|
+
*/
|
|
188
|
+
updateWareHouseOrder(orderId: String, warehouseId: string): Promise<any>;
|
|
189
|
+
/**
|
|
190
|
+
* Updates the customer and shipping address for an order.
|
|
191
|
+
* @param orderId - The ID of the order.
|
|
192
|
+
* @param voucherCode - the code of voucher
|
|
193
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
194
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
195
|
+
*/
|
|
196
|
+
updateVoucher(orderId: string, voucherCode: string): Promise<any>;
|
|
197
|
+
/**
|
|
198
|
+
* Updates the customer and shipping address for an order.
|
|
199
|
+
* @param orderId - The ID of the order.
|
|
200
|
+
* @param vatFee - The fee of VAT
|
|
201
|
+
* @param vatType - The type of vat
|
|
202
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
203
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
204
|
+
*/
|
|
205
|
+
updateVat(orderId: string, vatFee: number, vatType: string): Promise<any>;
|
|
206
|
+
/**
|
|
207
|
+
* Updates the customer and shipping address for an order.
|
|
208
|
+
* @param orderId - The ID of the order.
|
|
209
|
+
* @param status - The status of sell order
|
|
210
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
211
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
212
|
+
*/
|
|
213
|
+
updateStatusSellOrder(orderId: string, status: string): Promise<any>;
|
|
214
|
+
/**
|
|
215
|
+
* Updates the customer and shipping address for an order.
|
|
216
|
+
* @param orderId - The ID of the order.
|
|
217
|
+
* @param updateBy - Id of person update
|
|
218
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
219
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
220
|
+
*/
|
|
221
|
+
updateRemainToTalPrice(orderId: string, updateBy: string): Promise<any>;
|
|
222
|
+
/**
|
|
223
|
+
* Updates the customer and shipping address for an order.
|
|
224
|
+
* @param orderId - The ID of the order.
|
|
225
|
+
* @param orderDate - The date of order
|
|
226
|
+
* @param updateBy - Id of person update
|
|
227
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
228
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
229
|
+
*/
|
|
230
|
+
updateDateCreateOrder(orderId: string, orderDate: number, updateBy: string): Promise<any>;
|
|
231
|
+
/**
|
|
232
|
+
* Updates the customer and shipping address for an order.
|
|
233
|
+
* @param orderId - The ID of the order.
|
|
234
|
+
* @param type - The type of campaign promotion
|
|
235
|
+
* @param amount - The amount of campaign promotion
|
|
236
|
+
* @param campaignId - The id of the campaign promotion
|
|
237
|
+
* @param campaignActionId - The id of action campaign promotion
|
|
238
|
+
* @param campaignActionType - The type of action campaign promotion
|
|
239
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
240
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
241
|
+
*/
|
|
242
|
+
updateMemberDiscount(orderId: string, type: string, amount: number, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
|
|
243
|
+
/**
|
|
244
|
+
* Updates the customer and shipping address for an order.
|
|
245
|
+
* @param orderId - The ID of the order.
|
|
246
|
+
* @param editable - The editable of
|
|
247
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
248
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
249
|
+
*/
|
|
250
|
+
updateEditableOrder(orderId: string, editable: boolean): Promise<any>;
|
|
251
|
+
/**
|
|
252
|
+
* Updates the customer and shipping address for an order.
|
|
253
|
+
* @param orderId - The ID of the order.
|
|
254
|
+
* @param type - The type of campaign promotion
|
|
255
|
+
* @param amount - The amount of campaign promotion
|
|
256
|
+
* @param campaignId - The id of the campaign promotion
|
|
257
|
+
* @param campaignActionId - The id of action campaign promotion
|
|
258
|
+
* @param campaignActionType - The type of action campaign promotion
|
|
259
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
260
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
261
|
+
*/
|
|
262
|
+
updateDiscount(orderId: string, type: string, amount: number, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
|
|
263
|
+
/**
|
|
264
|
+
* Updates the customer and shipping address for an order.
|
|
265
|
+
* @param orderId - The ID of the order.
|
|
266
|
+
* @param campaign_id - The ID of the campaign
|
|
267
|
+
* @param campaign_action_id - The ID of the campaign action
|
|
268
|
+
* @param campaign_action_type - The type of campaign action
|
|
269
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
270
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
271
|
+
*/
|
|
272
|
+
updateInfoCampaignPromotion(orderId: string, campaign_id: string, campaign_action_id: string, campaign_action_type: string): Promise<any>;
|
|
273
|
+
/**
|
|
274
|
+
* Updates the customer and shipping address for an order.
|
|
275
|
+
* @param shippingCarrierId - The ID of the campaign
|
|
276
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
277
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
278
|
+
*/
|
|
279
|
+
getListShippingService(shippingCarrierId: string): Promise<any>;
|
|
280
|
+
/**
|
|
281
|
+
* Updates the customer and shipping address for an order.
|
|
282
|
+
* @param orderId - The ID of the order.
|
|
283
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
284
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
285
|
+
*/
|
|
286
|
+
getInfoSellOrder(orderId: string): Promise<any>;
|
|
287
|
+
/**
|
|
288
|
+
* Updates the customer and shipping address for an order.
|
|
289
|
+
* @param orderId - The ID of the order.
|
|
290
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
291
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
292
|
+
*/
|
|
293
|
+
getInfoReturnOrder(orderId: string): Promise<any>;
|
|
294
|
+
/**
|
|
295
|
+
* Updates the customer and shipping address for an order.
|
|
296
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
297
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
298
|
+
*/
|
|
299
|
+
updateListTypeOrder(): Promise<any>;
|
|
300
|
+
/**
|
|
301
|
+
* Updates the customer and shipping address for an order.
|
|
302
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
303
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
304
|
+
*/
|
|
305
|
+
updateListShippingCarrier(): Promise<any>;
|
|
306
|
+
/**
|
|
307
|
+
* Updates the customer and shipping address for an order.
|
|
308
|
+
* @param orderId
|
|
309
|
+
* @param status
|
|
310
|
+
* @param statusIgnore
|
|
311
|
+
* @param subStatus
|
|
312
|
+
* @param ffmStatus
|
|
313
|
+
* @param subType
|
|
314
|
+
* @param paymentMethod
|
|
315
|
+
* @param keyword
|
|
316
|
+
* @param customerMultiValue
|
|
317
|
+
* @param productMultiValue
|
|
318
|
+
* @param customerId
|
|
319
|
+
* @param createdBy
|
|
320
|
+
* @param dateCreateTo
|
|
321
|
+
* @param dateCreateFrom
|
|
322
|
+
* @param dateC
|
|
323
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
324
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
325
|
+
*/
|
|
326
|
+
getListSellOrder(): Promise<void>;
|
|
87
327
|
}
|
|
@@ -205,5 +205,606 @@ class OrderService extends service_1.Service {
|
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Creates a new order.
|
|
210
|
+
* @param orderId - The id of the order .
|
|
211
|
+
* @param orderItemId - The id of order item.
|
|
212
|
+
* @param quantity - Quantity of profuct in order.
|
|
213
|
+
* @returns A promise that resolves with the created order.
|
|
214
|
+
* @throws If an error occurs while creating the order.
|
|
215
|
+
*/
|
|
216
|
+
updateQuantityProductInOrder(orderId, orderItemId, quantity) {
|
|
217
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/quantity?quantity_new=${quantity}`;
|
|
219
|
+
const method = "PUT";
|
|
220
|
+
try {
|
|
221
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
222
|
+
return response;
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
console.log(`Error in update quantity product in order: ${error}`);
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Updates the customer and shipping address for an order.
|
|
232
|
+
* @param orderId - The ID of the order.
|
|
233
|
+
* @param saleId - The Id of saler.
|
|
234
|
+
* @param updateBy - Who update.
|
|
235
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
236
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
237
|
+
*/
|
|
238
|
+
updateSaleEmployee(orderId, saleId, updateBy) {
|
|
239
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
240
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/saleEmployee/${saleId}?updated_by=${updateBy}`;
|
|
241
|
+
const method = "PUT";
|
|
242
|
+
try {
|
|
243
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
244
|
+
return response;
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
console.log(`Error in updateSaleEmployee: ${error}`);
|
|
248
|
+
throw error;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Updates the customer and shipping address for an order.
|
|
254
|
+
* @param orderId - The ID of the order.
|
|
255
|
+
* @param orderType - The type of order.
|
|
256
|
+
* @param updateBy - Id of person update
|
|
257
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
258
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
259
|
+
*/
|
|
260
|
+
updateOrderType(orderId, orderType, updateBy) {
|
|
261
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderType}?updated_by=${updateBy}`;
|
|
263
|
+
const method = "PUT";
|
|
264
|
+
try {
|
|
265
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
266
|
+
return response;
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
console.log(`Error in updateOrderType: ${error}`);
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Updates the customer and shipping address for an order.
|
|
276
|
+
* @param orderId - The ID of the order.
|
|
277
|
+
* @param orderItemId - The id of order.
|
|
278
|
+
* @param priceNew - the new price after update
|
|
279
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
280
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
281
|
+
*/
|
|
282
|
+
updatePriceInOrder(orderId, orderItemId, priceNew) {
|
|
283
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/price?price_new=${priceNew}`;
|
|
285
|
+
const method = "PUT";
|
|
286
|
+
try {
|
|
287
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
288
|
+
return response;
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
console.log(`Error in updatePriceInOrder: ${error}`);
|
|
292
|
+
throw error;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Updates the customer and shipping address for an order.
|
|
298
|
+
* @param orderId - The ID of the order.
|
|
299
|
+
* @param orderItemId - The id of order.
|
|
300
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
301
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
302
|
+
*/
|
|
303
|
+
updateDiscountPriceInOrder(orderId, orderItemId) {
|
|
304
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
305
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/discount}`;
|
|
306
|
+
const method = "PUT";
|
|
307
|
+
try {
|
|
308
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
309
|
+
return response;
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
console.log(`Error in updateDiscountPriceInOrder: ${error}`);
|
|
313
|
+
throw error;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Updates the customer and shipping address for an order.
|
|
319
|
+
* @param orderId - The ID of the order.
|
|
320
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
321
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
322
|
+
*/
|
|
323
|
+
updateCancelOrder(orderId) {
|
|
324
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/cancel`;
|
|
326
|
+
const method = "PUT";
|
|
327
|
+
try {
|
|
328
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
329
|
+
return response;
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
console.log(`Error in updateCancelOrder: ${error}`);
|
|
333
|
+
throw error;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Updates the customer and shipping address for an order.
|
|
339
|
+
* @param orderId - The ID of the order.
|
|
340
|
+
* @param statusNew - the new status of order
|
|
341
|
+
* @param updateBy - Id of person update
|
|
342
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
343
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
344
|
+
*/
|
|
345
|
+
updateStatusOrder(orderId, statusNew, updateBy) {
|
|
346
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/${statusNew}?updated_by=${updateBy}`;
|
|
348
|
+
const method = "PUT";
|
|
349
|
+
try {
|
|
350
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
351
|
+
return response;
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
console.log(`Error in updateStatusOrder: ${error}`);
|
|
355
|
+
throw error;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Updates the customer and shipping address for an order.
|
|
361
|
+
* @param orderId - The ID of the order.
|
|
362
|
+
* @param shippingServiceId - the id of shipping service
|
|
363
|
+
* @param updateBy - Id of person update
|
|
364
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
365
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
366
|
+
*/
|
|
367
|
+
updateShippngService(orderId, shippingServiceId, updateBy) {
|
|
368
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
369
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/${shippingServiceId}/shippingService?updated_by=${updateBy}`;
|
|
370
|
+
const method = "PUT";
|
|
371
|
+
try {
|
|
372
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
373
|
+
return response;
|
|
374
|
+
}
|
|
375
|
+
catch (error) {
|
|
376
|
+
console.log(`Error in updateShippngService: ${error}`);
|
|
377
|
+
throw error;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Updates the customer and shipping address for an order.
|
|
383
|
+
* @param orderId - The ID of the order.
|
|
384
|
+
* @param shippingId - the id of shipping
|
|
385
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
386
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
387
|
+
*/
|
|
388
|
+
updateShippingOrder(orderId, shippingId) {
|
|
389
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
390
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/${shippingId}/orderShipping`;
|
|
391
|
+
const method = "PUT";
|
|
392
|
+
try {
|
|
393
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
394
|
+
return response;
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
console.log(`Error in updateShippingOrder: ${error}`);
|
|
398
|
+
throw error;
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Updates the customer and shipping address for an order.
|
|
404
|
+
* @param orderId - The ID of the order.
|
|
405
|
+
* @param shippingFee - the fee of shipping
|
|
406
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
407
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
408
|
+
*/
|
|
409
|
+
updateShippingFee(orderId, shipingFee) {
|
|
410
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
411
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/${shipingFee}/shippingFee`;
|
|
412
|
+
const method = "PUT";
|
|
413
|
+
try {
|
|
414
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
415
|
+
return response;
|
|
416
|
+
}
|
|
417
|
+
catch (error) {
|
|
418
|
+
console.log(`Error in updateShippingFee: ${error}`);
|
|
419
|
+
throw error;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Updates the customer and shipping address for an order.
|
|
425
|
+
* @param orderId - The ID of the order.
|
|
426
|
+
* @param financialStatus - the status of financial
|
|
427
|
+
* @param updateBy - Id of person update
|
|
428
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
429
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
430
|
+
*/
|
|
431
|
+
updateFinancialStatus(orderId, financialStatus, updateBy) {
|
|
432
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/${financialStatus}/financialStatus?updated_by=${updateBy}`;
|
|
434
|
+
const method = "PUT";
|
|
435
|
+
try {
|
|
436
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
437
|
+
return response;
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
console.log(`Error in updateFinancialStatus: ${error}`);
|
|
441
|
+
throw error;
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Updates the customer and shipping address for an order.
|
|
447
|
+
* @param orderId - The ID of the order.
|
|
448
|
+
* @param warehouseId - the status of warehouse
|
|
449
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
450
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
451
|
+
*/
|
|
452
|
+
updateWareHouseOrder(orderId, warehouseId) {
|
|
453
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
454
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/warehouse/${warehouseId}`;
|
|
455
|
+
const method = "PUT";
|
|
456
|
+
try {
|
|
457
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
458
|
+
return response;
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
console.log(`Error in updateWareHouseOrder: ${error}`);
|
|
462
|
+
throw error;
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Updates the customer and shipping address for an order.
|
|
468
|
+
* @param orderId - The ID of the order.
|
|
469
|
+
* @param voucherCode - the code of voucher
|
|
470
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
471
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
472
|
+
*/
|
|
473
|
+
updateVoucher(orderId, voucherCode) {
|
|
474
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
475
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/voucher/${voucherCode}`;
|
|
476
|
+
const method = "PUT";
|
|
477
|
+
try {
|
|
478
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
479
|
+
return response;
|
|
480
|
+
}
|
|
481
|
+
catch (error) {
|
|
482
|
+
console.log(`Error in updateVoucher: ${error}`);
|
|
483
|
+
throw error;
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Updates the customer and shipping address for an order.
|
|
489
|
+
* @param orderId - The ID of the order.
|
|
490
|
+
* @param vatFee - The fee of VAT
|
|
491
|
+
* @param vatType - The type of vat
|
|
492
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
493
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
494
|
+
*/
|
|
495
|
+
updateVat(orderId, vatFee, vatType) {
|
|
496
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
497
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/vat?vat_fee=${vatFee}&vat_type=${vatType}`;
|
|
498
|
+
const method = "PUT";
|
|
499
|
+
try {
|
|
500
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
501
|
+
return response;
|
|
502
|
+
}
|
|
503
|
+
catch (error) {
|
|
504
|
+
console.log(`Error in updateVat: ${error}`);
|
|
505
|
+
throw error;
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Updates the customer and shipping address for an order.
|
|
511
|
+
* @param orderId - The ID of the order.
|
|
512
|
+
* @param status - The status of sell order
|
|
513
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
514
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
515
|
+
*/
|
|
516
|
+
updateStatusSellOrder(orderId, status) {
|
|
517
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
518
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/status/${status}`;
|
|
519
|
+
const method = "PUT";
|
|
520
|
+
try {
|
|
521
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
522
|
+
return response;
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
console.log(`Error in updateStatusSellOrder: ${error}`);
|
|
526
|
+
throw error;
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Updates the customer and shipping address for an order.
|
|
532
|
+
* @param orderId - The ID of the order.
|
|
533
|
+
* @param updateBy - Id of person update
|
|
534
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
535
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
536
|
+
*/
|
|
537
|
+
updateRemainToTalPrice(orderId, updateBy) {
|
|
538
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
539
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/remainTotalPrice?updated_by=${updateBy}`;
|
|
540
|
+
const method = "PUT";
|
|
541
|
+
try {
|
|
542
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
543
|
+
return response;
|
|
544
|
+
}
|
|
545
|
+
catch (error) {
|
|
546
|
+
console.log(`Error in update updateRemainToTalPrice: ${error}`);
|
|
547
|
+
throw error;
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Updates the customer and shipping address for an order.
|
|
553
|
+
* @param orderId - The ID of the order.
|
|
554
|
+
* @param orderDate - The date of order
|
|
555
|
+
* @param updateBy - Id of person update
|
|
556
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
557
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
558
|
+
*/
|
|
559
|
+
updateDateCreateOrder(orderId, orderDate, updateBy) {
|
|
560
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
561
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/order-date/${orderDate}?updated_by=${updateBy}`;
|
|
562
|
+
const method = "PUT";
|
|
563
|
+
try {
|
|
564
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
565
|
+
return response;
|
|
566
|
+
}
|
|
567
|
+
catch (error) {
|
|
568
|
+
console.log(`Error in updateDateCreateOrder:${error} `);
|
|
569
|
+
throw error;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Updates the customer and shipping address for an order.
|
|
575
|
+
* @param orderId - The ID of the order.
|
|
576
|
+
* @param type - The type of campaign promotion
|
|
577
|
+
* @param amount - The amount of campaign promotion
|
|
578
|
+
* @param campaignId - The id of the campaign promotion
|
|
579
|
+
* @param campaignActionId - The id of action campaign promotion
|
|
580
|
+
* @param campaignActionType - The type of action campaign promotion
|
|
581
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
582
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
583
|
+
*/
|
|
584
|
+
updateMemberDiscount(orderId, type, amount, campaignId, campaignActionId, campaignActionType) {
|
|
585
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
586
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/memberDiscount`;
|
|
587
|
+
const method = "PUT";
|
|
588
|
+
const requestData = {
|
|
589
|
+
type,
|
|
590
|
+
amount,
|
|
591
|
+
campaignId,
|
|
592
|
+
campaignActionId,
|
|
593
|
+
campaignActionType,
|
|
594
|
+
};
|
|
595
|
+
try {
|
|
596
|
+
const response = yield this.restApiCallWithToken(endpoint, method, requestData);
|
|
597
|
+
return response;
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
console.log(`Error in updateMemberDiscount: ${error}`);
|
|
601
|
+
throw error;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Updates the customer and shipping address for an order.
|
|
607
|
+
* @param orderId - The ID of the order.
|
|
608
|
+
* @param editable - The editable of
|
|
609
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
610
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
611
|
+
*/
|
|
612
|
+
updateEditableOrder(orderId, editable) {
|
|
613
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
614
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/editable/${editable}`;
|
|
615
|
+
const method = "PUT";
|
|
616
|
+
try {
|
|
617
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
618
|
+
return response;
|
|
619
|
+
}
|
|
620
|
+
catch (error) {
|
|
621
|
+
console.log(`Error in updateEditableOrder: ${error}`);
|
|
622
|
+
throw error;
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Updates the customer and shipping address for an order.
|
|
628
|
+
* @param orderId - The ID of the order.
|
|
629
|
+
* @param type - The type of campaign promotion
|
|
630
|
+
* @param amount - The amount of campaign promotion
|
|
631
|
+
* @param campaignId - The id of the campaign promotion
|
|
632
|
+
* @param campaignActionId - The id of action campaign promotion
|
|
633
|
+
* @param campaignActionType - The type of action campaign promotion
|
|
634
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
635
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
636
|
+
*/
|
|
637
|
+
updateDiscount(orderId, type, amount, campaignId, campaignActionId, campaignActionType) {
|
|
638
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
639
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/discount`;
|
|
640
|
+
const method = "PUT";
|
|
641
|
+
const requestData = {
|
|
642
|
+
type,
|
|
643
|
+
amount,
|
|
644
|
+
campaignId,
|
|
645
|
+
campaignActionId,
|
|
646
|
+
campaignActionType,
|
|
647
|
+
};
|
|
648
|
+
try {
|
|
649
|
+
const response = yield this.restApiCallWithToken(endpoint, method, requestData);
|
|
650
|
+
return response;
|
|
651
|
+
}
|
|
652
|
+
catch (error) {
|
|
653
|
+
console.log(`Error in updateDiscount: ${error}`);
|
|
654
|
+
throw error;
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Updates the customer and shipping address for an order.
|
|
660
|
+
* @param orderId - The ID of the order.
|
|
661
|
+
* @param campaign_id - The ID of the campaign
|
|
662
|
+
* @param campaign_action_id - The ID of the campaign action
|
|
663
|
+
* @param campaign_action_type - The type of campaign action
|
|
664
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
665
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
666
|
+
*/
|
|
667
|
+
updateInfoCampaignPromotion(orderId, campaign_id, campaign_action_id, campaign_action_type) {
|
|
668
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
669
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/campaign-promotion`;
|
|
670
|
+
const method = "PUT";
|
|
671
|
+
const requestData = {
|
|
672
|
+
campaign_id,
|
|
673
|
+
campaign_action_id,
|
|
674
|
+
campaign_action_type,
|
|
675
|
+
};
|
|
676
|
+
try {
|
|
677
|
+
const response = yield this.restApiCallWithToken(endpoint, method, requestData);
|
|
678
|
+
return response;
|
|
679
|
+
}
|
|
680
|
+
catch (error) {
|
|
681
|
+
console.log(`Error in updateInfoCampaignPromotion: ${error}`);
|
|
682
|
+
throw error;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Updates the customer and shipping address for an order.
|
|
688
|
+
* @param shippingCarrierId - The ID of the campaign
|
|
689
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
690
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
691
|
+
*/
|
|
692
|
+
getListShippingService(shippingCarrierId) {
|
|
693
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
694
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${shippingCarrierId}/shippingService`;
|
|
695
|
+
const method = "GET";
|
|
696
|
+
try {
|
|
697
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
698
|
+
return response;
|
|
699
|
+
}
|
|
700
|
+
catch (error) {
|
|
701
|
+
console.log(`Error in getListShippingService: ${error}`);
|
|
702
|
+
throw error;
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Updates the customer and shipping address for an order.
|
|
708
|
+
* @param orderId - The ID of the order.
|
|
709
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
710
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
711
|
+
*/
|
|
712
|
+
getInfoSellOrder(orderId) {
|
|
713
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
714
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/sell_order`;
|
|
715
|
+
const method = "GET";
|
|
716
|
+
try {
|
|
717
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
718
|
+
return response;
|
|
719
|
+
}
|
|
720
|
+
catch (error) {
|
|
721
|
+
console.log(`Error in getInfoSellOrder: ${error}`);
|
|
722
|
+
throw error;
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Updates the customer and shipping address for an order.
|
|
728
|
+
* @param orderId - The ID of the order.
|
|
729
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
730
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
731
|
+
*/
|
|
732
|
+
getInfoReturnOrder(orderId) {
|
|
733
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
734
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/return_order`;
|
|
735
|
+
const method = "GET";
|
|
736
|
+
try {
|
|
737
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
738
|
+
return response;
|
|
739
|
+
}
|
|
740
|
+
catch (error) {
|
|
741
|
+
console.log(`Error in getReturnOrder:${error}`);
|
|
742
|
+
throw error;
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Updates the customer and shipping address for an order.
|
|
748
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
749
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
750
|
+
*/
|
|
751
|
+
updateListTypeOrder() {
|
|
752
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
753
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/type`;
|
|
754
|
+
const method = "GET";
|
|
755
|
+
try {
|
|
756
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
757
|
+
return response;
|
|
758
|
+
}
|
|
759
|
+
catch (error) {
|
|
760
|
+
console.log(`Error in updateListTypeOrder`);
|
|
761
|
+
throw error;
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Updates the customer and shipping address for an order.
|
|
767
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
768
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
769
|
+
*/
|
|
770
|
+
updateListShippingCarrier() {
|
|
771
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
772
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/shippingCarrier`;
|
|
773
|
+
const method = "GET";
|
|
774
|
+
try {
|
|
775
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
776
|
+
return response;
|
|
777
|
+
}
|
|
778
|
+
catch (error) {
|
|
779
|
+
console.log(`Error in updateListShippingCarrier:${error}`);
|
|
780
|
+
throw error;
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Updates the customer and shipping address for an order.
|
|
786
|
+
* @param orderId
|
|
787
|
+
* @param status
|
|
788
|
+
* @param statusIgnore
|
|
789
|
+
* @param subStatus
|
|
790
|
+
* @param ffmStatus
|
|
791
|
+
* @param subType
|
|
792
|
+
* @param paymentMethod
|
|
793
|
+
* @param keyword
|
|
794
|
+
* @param customerMultiValue
|
|
795
|
+
* @param productMultiValue
|
|
796
|
+
* @param customerId
|
|
797
|
+
* @param createdBy
|
|
798
|
+
* @param dateCreateTo
|
|
799
|
+
* @param dateCreateFrom
|
|
800
|
+
* @param dateC
|
|
801
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
802
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
803
|
+
*/
|
|
804
|
+
getListSellOrder() {
|
|
805
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
806
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/sell_order`;
|
|
807
|
+
});
|
|
808
|
+
}
|
|
208
809
|
}
|
|
209
810
|
exports.OrderService = OrderService;
|