@longvansoftware/storefront-js-client 1.1.9 → 1.2.1
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/graphql/user/queries.d.ts +0 -1
- package/dist/src/graphql/user/queries.js +1 -18
- package/dist/src/lib/crm/index.js +10 -10
- package/dist/src/lib/order/index.d.ts +59 -12
- package/dist/src/lib/order/index.js +158 -22
- package/dist/src/lib/user/index.d.ts +0 -1
- package/dist/src/lib/user/index.js +1 -19
- package/dist/src/types/crm.d.ts +0 -1
- package/dist/src/types/user.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GET_CUSTOMER_BY_ID = exports.GET_PERSON_BY_IDS_QUERY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetPersonByIds($partyIds: [String!]!) {
|
|
@@ -48,20 +48,3 @@ query GetCustomerById($id: String!){
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
`;
|
|
51
|
-
exports.SEARCH_COMPANY = (0, graphql_tag_1.gql) `
|
|
52
|
-
query SearchCompany($keyword: String, $orgId: String!, $limit: Int){
|
|
53
|
-
searchCompany(keyword: $keyword, orgId: $orgId, limit: $limit) {
|
|
54
|
-
id
|
|
55
|
-
name
|
|
56
|
-
address
|
|
57
|
-
gender
|
|
58
|
-
identityNumber
|
|
59
|
-
birthDate
|
|
60
|
-
email
|
|
61
|
-
phone
|
|
62
|
-
createdStamp
|
|
63
|
-
createdBy
|
|
64
|
-
memberLevel
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
@@ -89,14 +89,14 @@ class CrmService extends service_1.Service {
|
|
|
89
89
|
}
|
|
90
90
|
updateStatusAttachmentById(performerId, attachmentId, status) {
|
|
91
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const
|
|
92
|
+
const query = mutations_1.UPDATE_STATUS_ATTACHMENT_BY_ID;
|
|
93
93
|
const variables = {
|
|
94
94
|
performerId,
|
|
95
95
|
attachmentId,
|
|
96
96
|
status
|
|
97
97
|
};
|
|
98
98
|
try {
|
|
99
|
-
const response = yield this.
|
|
99
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
100
100
|
return response.updateStatusAttachmentById;
|
|
101
101
|
}
|
|
102
102
|
catch (error) {
|
|
@@ -107,14 +107,14 @@ class CrmService extends service_1.Service {
|
|
|
107
107
|
}
|
|
108
108
|
updateWorkEffortDescription(performerId, workEffortId, description) {
|
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
const
|
|
110
|
+
const query = mutations_1.UPDATE_WORK_EFFORT_DESCRIPTION;
|
|
111
111
|
const variables = {
|
|
112
112
|
performerId,
|
|
113
113
|
workEffortId,
|
|
114
114
|
description
|
|
115
115
|
};
|
|
116
116
|
try {
|
|
117
|
-
const response = yield this.
|
|
117
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
118
118
|
return response.updateWorkEffortDescription;
|
|
119
119
|
}
|
|
120
120
|
catch (error) {
|
|
@@ -125,7 +125,7 @@ class CrmService extends service_1.Service {
|
|
|
125
125
|
}
|
|
126
126
|
updateWorkEffortName(performerId, workEffortId, name) {
|
|
127
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
const
|
|
128
|
+
const query = mutations_1.UPDATE_WORK_EFFORT_NAME;
|
|
129
129
|
const variables = {
|
|
130
130
|
partyId: this.orgId,
|
|
131
131
|
performerId,
|
|
@@ -133,7 +133,7 @@ class CrmService extends service_1.Service {
|
|
|
133
133
|
newName: name
|
|
134
134
|
};
|
|
135
135
|
try {
|
|
136
|
-
const response = yield this.
|
|
136
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
137
137
|
return response.updateWorkEffortName;
|
|
138
138
|
}
|
|
139
139
|
catch (error) {
|
|
@@ -144,7 +144,7 @@ class CrmService extends service_1.Service {
|
|
|
144
144
|
}
|
|
145
145
|
updateWorkEffortStatus(performerId, workEffortId, source, status) {
|
|
146
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const
|
|
147
|
+
const query = mutations_1.UPDATE_WORK_EFFORT_STATUS;
|
|
148
148
|
const variables = {
|
|
149
149
|
partyId: this.orgId,
|
|
150
150
|
performerId,
|
|
@@ -153,7 +153,7 @@ class CrmService extends service_1.Service {
|
|
|
153
153
|
status
|
|
154
154
|
};
|
|
155
155
|
try {
|
|
156
|
-
const response = yield this.
|
|
156
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
157
157
|
return response.updateWorkEffortStatus;
|
|
158
158
|
}
|
|
159
159
|
catch (error) {
|
|
@@ -164,7 +164,7 @@ class CrmService extends service_1.Service {
|
|
|
164
164
|
}
|
|
165
165
|
addAttachmentForWorkEffort(performerId, workEffortId, attachments) {
|
|
166
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const
|
|
167
|
+
const query = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
|
|
168
168
|
const variables = {
|
|
169
169
|
partyId: this.orgId,
|
|
170
170
|
performerId,
|
|
@@ -172,7 +172,7 @@ class CrmService extends service_1.Service {
|
|
|
172
172
|
attachments,
|
|
173
173
|
};
|
|
174
174
|
try {
|
|
175
|
-
const response = yield this.
|
|
175
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
176
176
|
return response.addAttachmentForWorkEffort;
|
|
177
177
|
}
|
|
178
178
|
catch (error) {
|
|
@@ -11,7 +11,6 @@ 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;
|
|
15
14
|
/**
|
|
16
15
|
* Creates a new order.
|
|
17
16
|
* @param orderData - The data for the order.
|
|
@@ -125,26 +124,35 @@ export declare class OrderService extends Service {
|
|
|
125
124
|
* Updates the customer and shipping address for an order.
|
|
126
125
|
* @param orderId - The ID of the order.
|
|
127
126
|
* @param orderItemId - The id of order.
|
|
127
|
+
* @param type_discount
|
|
128
|
+
* @param discount_amount
|
|
129
|
+
* @param campaign_id
|
|
130
|
+
* @param campaign_action_id
|
|
131
|
+
* @param campaign_action_type
|
|
128
132
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
129
133
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
130
134
|
*/
|
|
131
|
-
updateDiscountPriceInOrder(orderId: string, orderItemId: string): Promise<any>;
|
|
135
|
+
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
136
|
/**
|
|
133
137
|
* Updates the customer and shipping address for an order.
|
|
134
138
|
* @param orderId - The ID of the order.
|
|
139
|
+
* @param reason
|
|
140
|
+
* @param updatedBy
|
|
141
|
+
* @param note
|
|
142
|
+
* @param orderType
|
|
135
143
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
136
144
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
137
145
|
*/
|
|
138
|
-
updateCancelOrder(orderId: string): Promise<any>;
|
|
146
|
+
updateCancelOrder(orderId: string, reason: "CUSTOMER", updatedBy: string, note: string, orderType: "SALES"): Promise<any>;
|
|
139
147
|
/**
|
|
140
148
|
* Updates the customer and shipping address for an order.
|
|
141
149
|
* @param orderId - The ID of the order.
|
|
142
150
|
* @param statusNew - the new status of order
|
|
143
|
-
* @param
|
|
151
|
+
* @param updatedBy - Id of person update
|
|
144
152
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
145
153
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
146
154
|
*/
|
|
147
|
-
|
|
155
|
+
updateStatusReturnOrder(orderId: string, statusNew: string, updatedBy: string): Promise<any>;
|
|
148
156
|
/**
|
|
149
157
|
* Updates the customer and shipping address for an order.
|
|
150
158
|
* @param orderId - The ID of the order.
|
|
@@ -240,7 +248,7 @@ export declare class OrderService extends Service {
|
|
|
240
248
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
241
249
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
242
250
|
*/
|
|
243
|
-
updateMemberDiscount(orderId: string, type: string, amount:
|
|
251
|
+
updateMemberDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
|
|
244
252
|
/**
|
|
245
253
|
* Updates the customer and shipping address for an order.
|
|
246
254
|
* @param orderId - The ID of the order.
|
|
@@ -260,7 +268,7 @@ export declare class OrderService extends Service {
|
|
|
260
268
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
261
269
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
262
270
|
*/
|
|
263
|
-
updateDiscount(orderId: string, type: string, amount:
|
|
271
|
+
updateDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
|
|
264
272
|
/**
|
|
265
273
|
* Updates the customer and shipping address for an order.
|
|
266
274
|
* @param orderId - The ID of the order.
|
|
@@ -297,13 +305,13 @@ export declare class OrderService extends Service {
|
|
|
297
305
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
298
306
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
299
307
|
*/
|
|
300
|
-
|
|
308
|
+
getListTypeOrder(): Promise<any>;
|
|
301
309
|
/**
|
|
302
310
|
* Updates the customer and shipping address for an order.
|
|
303
311
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
304
312
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
305
313
|
*/
|
|
306
|
-
|
|
314
|
+
getListShippingCarrier(): Promise<any>;
|
|
307
315
|
/**
|
|
308
316
|
* Get list sell order
|
|
309
317
|
* @param orderId
|
|
@@ -359,7 +367,7 @@ export declare class OrderService extends Service {
|
|
|
359
367
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
360
368
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
361
369
|
*/
|
|
362
|
-
|
|
370
|
+
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
371
|
/**
|
|
364
372
|
* Get list sale order status
|
|
365
373
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
@@ -379,9 +387,48 @@ export declare class OrderService extends Service {
|
|
|
379
387
|
* Get list sale order status
|
|
380
388
|
* @param orderId - The id of order
|
|
381
389
|
* @param orderItemId - Thi id of item order
|
|
382
|
-
* @param reason - The reason of
|
|
390
|
+
* @param reason - The reason of cancel product in order
|
|
391
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
392
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
393
|
+
*/
|
|
394
|
+
cancelProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
|
|
395
|
+
/**
|
|
396
|
+
* Get list sale order status
|
|
397
|
+
* @param orderId - The id of order
|
|
398
|
+
* @param orderItemId - Thi id of item order
|
|
399
|
+
* @param reason - The reason of cancel product in order
|
|
400
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
401
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
402
|
+
*/
|
|
403
|
+
removeProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
|
|
404
|
+
/**
|
|
405
|
+
* Get list sale order status
|
|
406
|
+
* @param orderId - The id of order
|
|
407
|
+
* @param paymentMethod - Thi id of item order
|
|
408
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
409
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
410
|
+
*/
|
|
411
|
+
printOrderPdf(orderId: string, paymentMethod: string): Promise<any>;
|
|
412
|
+
/**
|
|
413
|
+
* Get list sale order status
|
|
414
|
+
* @param orderId - The id of order
|
|
415
|
+
* @param paymentMethod - Thi id of item order
|
|
416
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
417
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
418
|
+
*/
|
|
419
|
+
printOrderHtml(orderId: string, paymentMethod: string): Promise<any>;
|
|
420
|
+
/**
|
|
421
|
+
* Get list sale order status
|
|
422
|
+
* @param orderData - The id of order
|
|
423
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
424
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
425
|
+
*/
|
|
426
|
+
createOrderReturn(orderData: any): Promise<any>;
|
|
427
|
+
/**
|
|
428
|
+
* Get list sale order status
|
|
429
|
+
* @param orderData - The id of order
|
|
383
430
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
384
431
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
385
432
|
*/
|
|
386
|
-
|
|
433
|
+
calculateOrder(orderData: any): Promise<any>;
|
|
387
434
|
}
|
|
@@ -24,10 +24,6 @@ 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
|
-
}
|
|
31
27
|
/**
|
|
32
28
|
* Creates a new order.
|
|
33
29
|
* @param orderData - The data for the order.
|
|
@@ -301,15 +297,27 @@ class OrderService extends service_1.Service {
|
|
|
301
297
|
* Updates the customer and shipping address for an order.
|
|
302
298
|
* @param orderId - The ID of the order.
|
|
303
299
|
* @param orderItemId - The id of order.
|
|
300
|
+
* @param type_discount
|
|
301
|
+
* @param discount_amount
|
|
302
|
+
* @param campaign_id
|
|
303
|
+
* @param campaign_action_id
|
|
304
|
+
* @param campaign_action_type
|
|
304
305
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
305
306
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
306
307
|
*/
|
|
307
|
-
updateDiscountPriceInOrder(orderId, orderItemId) {
|
|
308
|
+
updateDiscountPriceInOrder(orderId, orderItemId, type_discount, discount_amount, campaign_id, campaign_action_id, campaign_action_type) {
|
|
308
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
309
310
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/discount}`;
|
|
310
311
|
const method = "PUT";
|
|
312
|
+
const orderData = {
|
|
313
|
+
type_discount,
|
|
314
|
+
discount_amount,
|
|
315
|
+
campaign_id,
|
|
316
|
+
campaign_action_id,
|
|
317
|
+
campaign_action_type,
|
|
318
|
+
};
|
|
311
319
|
try {
|
|
312
|
-
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
320
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
313
321
|
return response;
|
|
314
322
|
}
|
|
315
323
|
catch (error) {
|
|
@@ -321,15 +329,25 @@ class OrderService extends service_1.Service {
|
|
|
321
329
|
/**
|
|
322
330
|
* Updates the customer and shipping address for an order.
|
|
323
331
|
* @param orderId - The ID of the order.
|
|
332
|
+
* @param reason
|
|
333
|
+
* @param updatedBy
|
|
334
|
+
* @param note
|
|
335
|
+
* @param orderType
|
|
324
336
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
325
337
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
326
338
|
*/
|
|
327
|
-
updateCancelOrder(orderId) {
|
|
339
|
+
updateCancelOrder(orderId, reason, updatedBy, note, orderType) {
|
|
328
340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
329
341
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/cancel`;
|
|
330
342
|
const method = "PUT";
|
|
343
|
+
const orderData = {
|
|
344
|
+
reason,
|
|
345
|
+
updatedBy,
|
|
346
|
+
note,
|
|
347
|
+
orderType,
|
|
348
|
+
};
|
|
331
349
|
try {
|
|
332
|
-
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
350
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
333
351
|
return response;
|
|
334
352
|
}
|
|
335
353
|
catch (error) {
|
|
@@ -342,20 +360,23 @@ class OrderService extends service_1.Service {
|
|
|
342
360
|
* Updates the customer and shipping address for an order.
|
|
343
361
|
* @param orderId - The ID of the order.
|
|
344
362
|
* @param statusNew - the new status of order
|
|
345
|
-
* @param
|
|
363
|
+
* @param updatedBy - Id of person update
|
|
346
364
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
347
365
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
348
366
|
*/
|
|
349
|
-
|
|
367
|
+
updateStatusReturnOrder(orderId, statusNew, updatedBy) {
|
|
350
368
|
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
-
|
|
369
|
+
if (!orderId || !statusNew || !updatedBy) {
|
|
370
|
+
throw new Error("Tham số đầu vào không hợp lệ.");
|
|
371
|
+
}
|
|
372
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/${statusNew}?updated_by=${updatedBy}`;
|
|
352
373
|
const method = "PUT";
|
|
353
374
|
try {
|
|
354
375
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
355
376
|
return response;
|
|
356
377
|
}
|
|
357
378
|
catch (error) {
|
|
358
|
-
console.log(`Error in
|
|
379
|
+
console.log(`Error in updateStatusReturnOrder: ${error}`);
|
|
359
380
|
throw error;
|
|
360
381
|
}
|
|
361
382
|
});
|
|
@@ -718,8 +739,8 @@ class OrderService extends service_1.Service {
|
|
|
718
739
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/sell_order`;
|
|
719
740
|
const method = "GET";
|
|
720
741
|
try {
|
|
721
|
-
const
|
|
722
|
-
return
|
|
742
|
+
const res = yield this.restApiCallWithToken(endpoint, method);
|
|
743
|
+
return res;
|
|
723
744
|
}
|
|
724
745
|
catch (error) {
|
|
725
746
|
console.log(`Error in getInfoSellOrder: ${error}`);
|
|
@@ -752,7 +773,7 @@ class OrderService extends service_1.Service {
|
|
|
752
773
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
753
774
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
754
775
|
*/
|
|
755
|
-
|
|
776
|
+
getListTypeOrder() {
|
|
756
777
|
return __awaiter(this, void 0, void 0, function* () {
|
|
757
778
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/type`;
|
|
758
779
|
const method = "GET";
|
|
@@ -771,7 +792,7 @@ class OrderService extends service_1.Service {
|
|
|
771
792
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
772
793
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
773
794
|
*/
|
|
774
|
-
|
|
795
|
+
getListShippingCarrier() {
|
|
775
796
|
return __awaiter(this, void 0, void 0, function* () {
|
|
776
797
|
const endpoint = `/orders/${this.orgId}/${this.storeId}/shippingCarrier`;
|
|
777
798
|
const method = "GET";
|
|
@@ -866,7 +887,7 @@ class OrderService extends service_1.Service {
|
|
|
866
887
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
867
888
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
868
889
|
*/
|
|
869
|
-
|
|
890
|
+
getListReturnOrder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
|
|
870
891
|
return __awaiter(this, void 0, void 0, function* () {
|
|
871
892
|
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
893
|
const method = "GET";
|
|
@@ -875,7 +896,7 @@ class OrderService extends service_1.Service {
|
|
|
875
896
|
return response;
|
|
876
897
|
}
|
|
877
898
|
catch (error) {
|
|
878
|
-
console.log(`Error in
|
|
899
|
+
console.log(`Error in getListReturnOrder: ${error}`);
|
|
879
900
|
throw error;
|
|
880
901
|
}
|
|
881
902
|
});
|
|
@@ -910,7 +931,7 @@ class OrderService extends service_1.Service {
|
|
|
910
931
|
removeDraftOrder(storeId, orderId, updatedBy) {
|
|
911
932
|
return __awaiter(this, void 0, void 0, function* () {
|
|
912
933
|
const endpoint = `/orders/${this.orgId}/${storeId}/${orderId}/draft?updated_by=${updatedBy}`;
|
|
913
|
-
const method = "
|
|
934
|
+
const method = "DELETE";
|
|
914
935
|
try {
|
|
915
936
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
916
937
|
return response;
|
|
@@ -925,12 +946,127 @@ class OrderService extends service_1.Service {
|
|
|
925
946
|
* Get list sale order status
|
|
926
947
|
* @param orderId - The id of order
|
|
927
948
|
* @param orderItemId - Thi id of item order
|
|
928
|
-
* @param reason - The reason of
|
|
949
|
+
* @param reason - The reason of cancel product in order
|
|
950
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
951
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
952
|
+
*/
|
|
953
|
+
cancelProductInOrder(orderId, orderItemId, reason) {
|
|
954
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
955
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}?reason=${reason}`;
|
|
956
|
+
const method = "DELETE";
|
|
957
|
+
try {
|
|
958
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
959
|
+
return response;
|
|
960
|
+
}
|
|
961
|
+
catch (error) {
|
|
962
|
+
console.log(`Error in removeProductInOrder: ${error}`);
|
|
963
|
+
throw error;
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Get list sale order status
|
|
969
|
+
* @param orderId - The id of order
|
|
970
|
+
* @param orderItemId - Thi id of item order
|
|
971
|
+
* @param reason - The reason of cancel product in order
|
|
972
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
973
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
974
|
+
*/
|
|
975
|
+
removeProductInOrder(orderId, orderItemId, reason) {
|
|
976
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
977
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/delete?reason=${reason}`;
|
|
978
|
+
const method = "DELETE";
|
|
979
|
+
try {
|
|
980
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
981
|
+
return response;
|
|
982
|
+
}
|
|
983
|
+
catch (error) {
|
|
984
|
+
console.log(`Error in removeProductInOrder: ${error}`);
|
|
985
|
+
throw error;
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Get list sale order status
|
|
991
|
+
* @param orderId - The id of order
|
|
992
|
+
* @param paymentMethod - Thi id of item order
|
|
993
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
994
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
995
|
+
*/
|
|
996
|
+
printOrderPdf(orderId, paymentMethod) {
|
|
997
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
998
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/print.pdf?payment_method=${paymentMethod}`;
|
|
999
|
+
const method = "POST";
|
|
1000
|
+
try {
|
|
1001
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
1002
|
+
return response;
|
|
1003
|
+
}
|
|
1004
|
+
catch (error) {
|
|
1005
|
+
console.log(`Error in printOrderPdf: ${error}`);
|
|
1006
|
+
throw error;
|
|
1007
|
+
}
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Get list sale order status
|
|
1012
|
+
* @param orderId - The id of order
|
|
1013
|
+
* @param paymentMethod - Thi id of item order
|
|
929
1014
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
930
1015
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
931
1016
|
*/
|
|
932
|
-
|
|
933
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1017
|
+
printOrderHtml(orderId, paymentMethod) {
|
|
1018
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1019
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/print.html?payment_method=${paymentMethod}`;
|
|
1020
|
+
const method = "POST";
|
|
1021
|
+
try {
|
|
1022
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
1023
|
+
return response;
|
|
1024
|
+
}
|
|
1025
|
+
catch (error) {
|
|
1026
|
+
console.log(`Error in printOrderHtml: ${error}`);
|
|
1027
|
+
throw error;
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Get list sale order status
|
|
1033
|
+
* @param orderData - The id of order
|
|
1034
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
1035
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
1036
|
+
*/
|
|
1037
|
+
createOrderReturn(orderData) {
|
|
1038
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1039
|
+
const endpoint = `/orders/${this.orgId}/order_return`;
|
|
1040
|
+
const method = "POST";
|
|
1041
|
+
try {
|
|
1042
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
1043
|
+
return response;
|
|
1044
|
+
}
|
|
1045
|
+
catch (error) {
|
|
1046
|
+
console.log(`Error in createOrderReturn: ${error}`);
|
|
1047
|
+
throw error;
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Get list sale order status
|
|
1053
|
+
* @param orderData - The id of order
|
|
1054
|
+
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
1055
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
|
1056
|
+
*/
|
|
1057
|
+
calculateOrder(orderData) {
|
|
1058
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1059
|
+
const endpoint = `/orders/${this.orgId}/calculate`;
|
|
1060
|
+
const method = "POST";
|
|
1061
|
+
try {
|
|
1062
|
+
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
1063
|
+
return response;
|
|
1064
|
+
}
|
|
1065
|
+
catch (error) {
|
|
1066
|
+
console.log(`Error in calculateOrder: ${error}`);
|
|
1067
|
+
throw error;
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
934
1070
|
}
|
|
935
1071
|
}
|
|
936
1072
|
exports.OrderService = OrderService;
|
|
@@ -7,5 +7,4 @@ export declare class UserService extends Service {
|
|
|
7
7
|
updateCompanyInfo(id: string, fieldName: string, valueUpdate: string, updatedBy: string): Promise<any>;
|
|
8
8
|
updateCustomerV2(id: string, customerItem: updateCustomerRequest, updatedBy: string): Promise<any>;
|
|
9
9
|
getCustomerById(id: string): Promise<any>;
|
|
10
|
-
searchCompany(keyword: string, limit: number): Promise<any>;
|
|
11
10
|
}
|
|
@@ -38,7 +38,7 @@ class UserService extends service_1.Service {
|
|
|
38
38
|
orgId: this.orgId,
|
|
39
39
|
createCompanyRequest: {
|
|
40
40
|
name: payload === null || payload === void 0 ? void 0 : payload.name,
|
|
41
|
-
phone: payload === null || payload === void 0 ? void 0 : payload.
|
|
41
|
+
phone: payload === null || payload === void 0 ? void 0 : payload.phone,
|
|
42
42
|
address: payload === null || payload === void 0 ? void 0 : payload.address,
|
|
43
43
|
},
|
|
44
44
|
createTaxCodeRequest: null,
|
|
@@ -113,23 +113,5 @@ class UserService extends service_1.Service {
|
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
searchCompany(keyword, limit) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const query = queries_1.SEARCH_COMPANY;
|
|
119
|
-
const variables = {
|
|
120
|
-
keyword,
|
|
121
|
-
orgId: this.orgId,
|
|
122
|
-
limit,
|
|
123
|
-
};
|
|
124
|
-
try {
|
|
125
|
-
const response = yield this.graphqlQuery(query, variables);
|
|
126
|
-
return response.searchCompany;
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
console.log(`Error in searchCompany: ${error}`);
|
|
130
|
-
throw error;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
116
|
}
|
|
135
117
|
exports.UserService = UserService;
|
package/dist/src/types/crm.d.ts
CHANGED
package/dist/src/types/user.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longvansoftware/storefront-js-client",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@apollo/client": "3.
|
|
22
|
+
"@apollo/client": "3.7.11",
|
|
23
23
|
"apollo-boost": "^0.4.9",
|
|
24
24
|
"axios": "^1.6.8",
|
|
25
25
|
"crypto-js": "^4.2.0",
|