@longvansoftware/storefront-js-client 1.5.0 → 1.5.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/config/config.d.ts +2 -0
- package/dist/config/config.js +4 -2
- package/dist/src/graphql/campaign/mutations.d.ts +0 -0
- package/dist/src/graphql/campaign/mutations.js +1 -0
- package/dist/src/graphql/campaign/queries.d.ts +3 -0
- package/dist/src/graphql/campaign/queries.js +91 -0
- package/dist/src/graphql/payment/mutations.js +2 -0
- package/dist/src/graphql/product/queries.js +11 -50
- package/dist/src/lib/SDK.d.ts +3 -0
- package/dist/src/lib/SDK.js +2 -0
- package/dist/src/lib/campaign/index.d.ts +13 -0
- package/dist/src/lib/campaign/index.js +80 -0
- package/dist/src/lib/order/index.d.ts +7 -6
- package/dist/src/lib/order/index.js +29 -11
- package/dist/src/lib/product/index.js +1 -1
- package/dist/src/lib/serviceSDK.js +1 -1
- package/dist/src/types/campaign.d.ts +14 -0
- package/dist/src/types/campaign.js +2 -0
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const environmentEndpoints: {
|
|
|
9
9
|
service: string;
|
|
10
10
|
warehouse: string;
|
|
11
11
|
computing: string;
|
|
12
|
+
campaign: string;
|
|
12
13
|
};
|
|
13
14
|
live: {
|
|
14
15
|
product: string;
|
|
@@ -20,5 +21,6 @@ export declare const environmentEndpoints: {
|
|
|
20
21
|
service: string;
|
|
21
22
|
warehouse: string;
|
|
22
23
|
computing: string;
|
|
24
|
+
campaign: string;
|
|
23
25
|
};
|
|
24
26
|
};
|
package/dist/config/config.js
CHANGED
|
@@ -10,8 +10,9 @@ exports.environmentEndpoints = {
|
|
|
10
10
|
user: "https://user.dev.longvan.vn/user-gateway/graphql",
|
|
11
11
|
payment: "https://portal.dev.longvan.vn/invoice-gateway/graphql",
|
|
12
12
|
service: "https://portal.dev.longvan.vn/service-api/graphql",
|
|
13
|
-
warehouse: "https://
|
|
13
|
+
warehouse: "https://portal.dev.longvan.vn/facility-api/public-facility/1.0.0",
|
|
14
14
|
computing: "https://api-gateway.dev.longvan.vn/computing-service/graphql",
|
|
15
|
+
campaign: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
|
|
15
16
|
},
|
|
16
17
|
live: {
|
|
17
18
|
product: "https://product-service.dev.longvan.vn/product-service/graphql",
|
|
@@ -21,7 +22,8 @@ exports.environmentEndpoints = {
|
|
|
21
22
|
user: "https://user.dev.longvan.vn/user-gateway/graphql",
|
|
22
23
|
payment: "https://portal.dev.longvan.vn/invoice-gateway/graphql",
|
|
23
24
|
service: "https://portal.dev.longvan.vn/service-api/graphql",
|
|
24
|
-
warehouse: "https://
|
|
25
|
+
warehouse: "https://portal.dev.longvan.vn/facility-api/public-facility/1.0.0",
|
|
25
26
|
computing: "https://api-gateway.longvan.vn/computing-service/graphql",
|
|
27
|
+
campaign: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
|
|
26
28
|
},
|
|
27
29
|
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHECK_VALID_VOUCHER = exports.GET_VOUCHERS = exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = (0, graphql_tag_1.gql) `
|
|
6
|
+
query GetCampaignActionActiveNow(
|
|
7
|
+
$partyId: String!
|
|
8
|
+
$customerId: String
|
|
9
|
+
$campaignActionType: String
|
|
10
|
+
$productStoreId: String
|
|
11
|
+
) {
|
|
12
|
+
getCampaignActionActiveNow(
|
|
13
|
+
checkCampaignActiveRequest: {
|
|
14
|
+
partyId: $partyId
|
|
15
|
+
customerId: $customerId
|
|
16
|
+
campaignActionType: $campaignActionType
|
|
17
|
+
productStoreId: $productStoreId
|
|
18
|
+
}
|
|
19
|
+
) {
|
|
20
|
+
campaignId
|
|
21
|
+
campaignName
|
|
22
|
+
statusCampaign
|
|
23
|
+
campaignDescription
|
|
24
|
+
fromDate
|
|
25
|
+
toDate
|
|
26
|
+
campaignActionId
|
|
27
|
+
campaignActionName
|
|
28
|
+
type
|
|
29
|
+
campaignActionDescription
|
|
30
|
+
priorityLevel
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
exports.GET_VOUCHERS = (0, graphql_tag_1.gql) `
|
|
35
|
+
query SearchVoucher($partyId: String, $customerId: String) {
|
|
36
|
+
searchVoucher(searchVoucherRequest: { partyId: $partyId, customerId: $customerId }) {
|
|
37
|
+
total
|
|
38
|
+
totalPages
|
|
39
|
+
totalElements
|
|
40
|
+
last
|
|
41
|
+
first
|
|
42
|
+
number
|
|
43
|
+
numberOfElements
|
|
44
|
+
size
|
|
45
|
+
empty
|
|
46
|
+
content {
|
|
47
|
+
campaignActionId
|
|
48
|
+
campaignId
|
|
49
|
+
partyId
|
|
50
|
+
voucherCode
|
|
51
|
+
voucherType
|
|
52
|
+
status
|
|
53
|
+
discountAmount
|
|
54
|
+
discountPercent
|
|
55
|
+
usageLimitPerVoucher
|
|
56
|
+
maximumDiscount
|
|
57
|
+
numberOfTimeUsed
|
|
58
|
+
id
|
|
59
|
+
createdStamp
|
|
60
|
+
updatedStamp
|
|
61
|
+
updatedBy
|
|
62
|
+
createdBy
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
exports.CHECK_VALID_VOUCHER = (0, graphql_tag_1.gql) `
|
|
68
|
+
query CheckValidVoucher($partyId: String, $customerId: String, $voucherCode: String!) {
|
|
69
|
+
checkValidVoucher(
|
|
70
|
+
checkValidVoucherRequest: { customerId: $customerId, voucherCode: $voucherCode }
|
|
71
|
+
partyId: $partyId
|
|
72
|
+
) {
|
|
73
|
+
campaignActionId
|
|
74
|
+
campaignId
|
|
75
|
+
partyId
|
|
76
|
+
voucherCode
|
|
77
|
+
voucherType
|
|
78
|
+
status
|
|
79
|
+
discountAmount
|
|
80
|
+
discountPercent
|
|
81
|
+
usageLimitPerVoucher
|
|
82
|
+
maximumDiscount
|
|
83
|
+
numberOfTimeUsed
|
|
84
|
+
id
|
|
85
|
+
createdStamp
|
|
86
|
+
updatedStamp
|
|
87
|
+
updatedBy
|
|
88
|
+
createdBy
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
@@ -14,6 +14,7 @@ exports.CREATE_PAYMENT_ORDER_MUTATION = (0, graphql_tag_1.gql) `
|
|
|
14
14
|
$returnUrl: String
|
|
15
15
|
$paymentType: String!
|
|
16
16
|
$createBy: String!
|
|
17
|
+
$paymentInfo: String
|
|
17
18
|
) {
|
|
18
19
|
createPaymentOrder(
|
|
19
20
|
orgId: $orgId
|
|
@@ -26,6 +27,7 @@ exports.CREATE_PAYMENT_ORDER_MUTATION = (0, graphql_tag_1.gql) `
|
|
|
26
27
|
returnUrl: $returnUrl
|
|
27
28
|
paymentType: $paymentType
|
|
28
29
|
createBy: $createBy
|
|
30
|
+
paymentInfo: $paymentInfo
|
|
29
31
|
) {
|
|
30
32
|
code
|
|
31
33
|
message
|
|
@@ -90,16 +90,8 @@ const graphql_tag_1 = require("graphql-tag");
|
|
|
90
90
|
// }
|
|
91
91
|
// `;
|
|
92
92
|
exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
93
|
-
query GetProductById(
|
|
94
|
-
$partnerId:
|
|
95
|
-
$storeChannel: String!
|
|
96
|
-
$productId: String!
|
|
97
|
-
) {
|
|
98
|
-
getProductById(
|
|
99
|
-
partnerId: $partnerId
|
|
100
|
-
storeChannel: $storeChannel
|
|
101
|
-
productId: $productId
|
|
102
|
-
) {
|
|
93
|
+
query GetProductById($partnerId: String!, $storeChannel: String!, $productId: String!) {
|
|
94
|
+
getProductById(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
|
|
103
95
|
id
|
|
104
96
|
title
|
|
105
97
|
description
|
|
@@ -152,16 +144,8 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
|
152
144
|
}
|
|
153
145
|
`;
|
|
154
146
|
exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
|
|
155
|
-
query GetProductByHandle(
|
|
156
|
-
$partnerId:
|
|
157
|
-
$storeChannel: String!
|
|
158
|
-
$handle: String!
|
|
159
|
-
) {
|
|
160
|
-
getProductByHandle(
|
|
161
|
-
partnerId: $partnerId
|
|
162
|
-
storeChannel: $storeChannel
|
|
163
|
-
handle: $handle
|
|
164
|
-
) {
|
|
147
|
+
query GetProductByHandle($partnerId: String!, $storeChannel: String!, $handle: String!) {
|
|
148
|
+
getProductByHandle(partnerId: $partnerId, storeChannel: $storeChannel, handle: $handle) {
|
|
165
149
|
id
|
|
166
150
|
title
|
|
167
151
|
description
|
|
@@ -260,6 +244,7 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
|
|
|
260
244
|
id
|
|
261
245
|
title
|
|
262
246
|
sku
|
|
247
|
+
subType
|
|
263
248
|
shortDescription
|
|
264
249
|
vat
|
|
265
250
|
subType
|
|
@@ -308,16 +293,8 @@ exports.GET_CATEGORIES_QUERY = (0, graphql_tag_1.gql) `
|
|
|
308
293
|
}
|
|
309
294
|
`;
|
|
310
295
|
exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
|
|
311
|
-
query GetCategoryByHandle(
|
|
312
|
-
$partnerId:
|
|
313
|
-
$storeChannel: String!
|
|
314
|
-
$handle: String!
|
|
315
|
-
) {
|
|
316
|
-
getCategoryByHandle(
|
|
317
|
-
partnerId: $partnerId
|
|
318
|
-
storeChannel: $storeChannel
|
|
319
|
-
handle: $handle
|
|
320
|
-
) {
|
|
296
|
+
query GetCategoryByHandle($partnerId: String!, $storeChannel: String!, $handle: String!) {
|
|
297
|
+
getCategoryByHandle(partnerId: $partnerId, storeChannel: $storeChannel, handle: $handle) {
|
|
321
298
|
id
|
|
322
299
|
title
|
|
323
300
|
image
|
|
@@ -338,16 +315,8 @@ exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
|
|
|
338
315
|
}
|
|
339
316
|
`;
|
|
340
317
|
exports.GET_CATEGORY_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
341
|
-
query GetCategoryById(
|
|
342
|
-
$partnerId:
|
|
343
|
-
$storeChannel: String!
|
|
344
|
-
$categoryId: String!
|
|
345
|
-
) {
|
|
346
|
-
getCategoryById(
|
|
347
|
-
partnerId: $partnerId
|
|
348
|
-
storeChannel: $storeChannel
|
|
349
|
-
categoryId: $categoryId
|
|
350
|
-
) {
|
|
318
|
+
query GetCategoryById($partnerId: String!, $storeChannel: String!, $categoryId: String!) {
|
|
319
|
+
getCategoryById(partnerId: $partnerId, storeChannel: $storeChannel, categoryId: $categoryId) {
|
|
351
320
|
id
|
|
352
321
|
title
|
|
353
322
|
image
|
|
@@ -398,16 +367,8 @@ exports.GET_BRAND_DETAIL_QUERY = `
|
|
|
398
367
|
}
|
|
399
368
|
`;
|
|
400
369
|
exports.GET_PRODUCT_OPTION = (0, graphql_tag_1.gql) `
|
|
401
|
-
query GetProductOption(
|
|
402
|
-
$partnerId:
|
|
403
|
-
$storeChannel: String!
|
|
404
|
-
$productId: String!
|
|
405
|
-
) {
|
|
406
|
-
getProductOption(
|
|
407
|
-
partnerId: $partnerId
|
|
408
|
-
storeChannel: $storeChannel
|
|
409
|
-
productId: $productId
|
|
410
|
-
) {
|
|
370
|
+
query GetProductOption($partnerId: String!, $storeChannel: String!, $productId: String!) {
|
|
371
|
+
getProductOption(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
|
|
411
372
|
id
|
|
412
373
|
name
|
|
413
374
|
subType
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { PaymentService } from "../lib/payment/index";
|
|
|
7
7
|
import { CrmService } from "../lib/crm/index";
|
|
8
8
|
import { WarehouseService } from "../lib/warehouse/index";
|
|
9
9
|
import { ComputingService } from "../lib/computing/index";
|
|
10
|
+
import { CampaignService } from "./campaign";
|
|
10
11
|
export interface Endpoints {
|
|
11
12
|
product: string;
|
|
12
13
|
crm: string;
|
|
@@ -17,6 +18,7 @@ export interface Endpoints {
|
|
|
17
18
|
service: string;
|
|
18
19
|
warehouse: string;
|
|
19
20
|
computing: string;
|
|
21
|
+
campaign: string;
|
|
20
22
|
}
|
|
21
23
|
export declare class SDK {
|
|
22
24
|
orgId: string;
|
|
@@ -31,6 +33,7 @@ export declare class SDK {
|
|
|
31
33
|
service: ServiceManagementService;
|
|
32
34
|
warehouse: WarehouseService;
|
|
33
35
|
computing: ComputingService;
|
|
36
|
+
campaign: CampaignService;
|
|
34
37
|
token: string | null;
|
|
35
38
|
constructor(orgId: string, storeId: string, storefrontAccessToken: string);
|
|
36
39
|
setToken(token: string): void;
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -13,6 +13,7 @@ const index_6 = require("../lib/payment/index");
|
|
|
13
13
|
const index_7 = require("../lib/crm/index");
|
|
14
14
|
const index_8 = require("../lib/warehouse/index");
|
|
15
15
|
const index_9 = require("../lib/computing/index");
|
|
16
|
+
const campaign_1 = require("./campaign");
|
|
16
17
|
class SDK {
|
|
17
18
|
constructor(orgId, storeId, storefrontAccessToken) {
|
|
18
19
|
this.orgId = orgId;
|
|
@@ -31,6 +32,7 @@ class SDK {
|
|
|
31
32
|
this.service = new index_4.ServiceManagementService(endpoints.service, orgId, storeId);
|
|
32
33
|
this.warehouse = new index_8.WarehouseService(endpoints.warehouse, orgId, storeId);
|
|
33
34
|
this.computing = new index_9.ComputingService(endpoints.computing, orgId, storeId);
|
|
35
|
+
this.campaign = new campaign_1.CampaignService(endpoints.campaign, orgId, storeId);
|
|
34
36
|
// Initialize other services here
|
|
35
37
|
}
|
|
36
38
|
setToken(token) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class CampaignService extends Service {
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a new CampaignService instance.
|
|
5
|
+
* @param endpoint - The endpoint URL for the service.
|
|
6
|
+
* @param orgId - The organization ID.
|
|
7
|
+
* @param storeId - The store ID.
|
|
8
|
+
*/
|
|
9
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
10
|
+
getCampaignActionActiveNow(customerId: string, campaignActionType: string): Promise<any>;
|
|
11
|
+
getVouchers(customerId: string): Promise<any>;
|
|
12
|
+
checkValidVoucher(customerId: string, voucherCode: string): Promise<any>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CampaignService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const queries_1 = require("../../graphql/campaign/queries");
|
|
15
|
+
class CampaignService extends serviceSDK_1.Service {
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new CampaignService instance.
|
|
18
|
+
* @param endpoint - The endpoint URL for the service.
|
|
19
|
+
* @param orgId - The organization ID.
|
|
20
|
+
* @param storeId - The store ID.
|
|
21
|
+
*/
|
|
22
|
+
constructor(endpoint, orgId, storeId) {
|
|
23
|
+
super(endpoint, orgId, storeId);
|
|
24
|
+
}
|
|
25
|
+
getCampaignActionActiveNow(customerId, campaignActionType) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const query = queries_1.GET_CAMPAIGN_ACTION_ACTIVE_NOW;
|
|
28
|
+
const variables = {
|
|
29
|
+
partyId: this.orgId,
|
|
30
|
+
productStoreId: this.storeId,
|
|
31
|
+
customerId,
|
|
32
|
+
campaignActionType,
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
36
|
+
return response.getCampaignActionActiveNow;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.log(`Error fetching getCampaignActionActiveNow: ${error}`);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getVouchers(customerId) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const query = queries_1.GET_VOUCHERS;
|
|
47
|
+
const variables = {
|
|
48
|
+
partyId: this.orgId,
|
|
49
|
+
customerId,
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
53
|
+
return response.searchVoucher;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.log(`Error fetching searchVoucher: ${error}`);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
checkValidVoucher(customerId, voucherCode) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const query = queries_1.CHECK_VALID_VOUCHER;
|
|
64
|
+
const variables = {
|
|
65
|
+
partyId: this.orgId,
|
|
66
|
+
customerId,
|
|
67
|
+
voucherCode,
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
71
|
+
return response.checkValidVoucher;
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.log(`Error fetching searchVoucher: ${error}`);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.CampaignService = CampaignService;
|
|
@@ -20,7 +20,7 @@ export declare class OrderService extends Service {
|
|
|
20
20
|
* @returns A promise that resolves with the created order.
|
|
21
21
|
* @throws If an error occurs while creating the order.
|
|
22
22
|
*/
|
|
23
|
-
createOrder(orderData: any, platform: string, createDraft: boolean): Promise<any>;
|
|
23
|
+
createOrder(orderData: any, platform: string, createDraft: boolean, created_by: string): Promise<any>;
|
|
24
24
|
/**
|
|
25
25
|
* Creates a temporary order.
|
|
26
26
|
*
|
|
@@ -70,7 +70,7 @@ export declare class OrderService extends Service {
|
|
|
70
70
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
71
71
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
72
72
|
*/
|
|
73
|
-
updateCustomerAndShippingAddress(orderId: string,
|
|
73
|
+
updateCustomerAndShippingAddress(orderId: string, customerId: string, shippingAddress: string): Promise<any>;
|
|
74
74
|
/**
|
|
75
75
|
* Retrieves the order line items for a specific order.
|
|
76
76
|
* @param partnerId - The partner ID.
|
|
@@ -254,7 +254,7 @@ export declare class OrderService extends Service {
|
|
|
254
254
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
255
255
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
256
256
|
*/
|
|
257
|
-
updateDiscount(orderId: string, requestData:
|
|
257
|
+
updateDiscount(orderId: string, updated_by: string, requestData: any): Promise<any>;
|
|
258
258
|
/**
|
|
259
259
|
* Update info campaign promotion
|
|
260
260
|
* @param orderId - The ID of the order.
|
|
@@ -269,7 +269,7 @@ export declare class OrderService extends Service {
|
|
|
269
269
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
270
270
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
271
271
|
*/
|
|
272
|
-
getListShippingService(
|
|
272
|
+
getListShippingService(): Promise<any>;
|
|
273
273
|
/**
|
|
274
274
|
* Get info sell order
|
|
275
275
|
* @param orderId - The ID of the order.
|
|
@@ -318,7 +318,7 @@ export declare class OrderService extends Service {
|
|
|
318
318
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
319
319
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
320
320
|
*/
|
|
321
|
-
getListReturnOrder(
|
|
321
|
+
getListReturnOrder(requestData: OrderQuery): Promise<any>;
|
|
322
322
|
/**
|
|
323
323
|
* Get list return order status
|
|
324
324
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
@@ -373,7 +373,7 @@ export declare class OrderService extends Service {
|
|
|
373
373
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
374
374
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
375
375
|
*/
|
|
376
|
-
createOrderReturn(orderData: any): Promise<any>;
|
|
376
|
+
createOrderReturn(orderData: any, created_by: any): Promise<any>;
|
|
377
377
|
/**
|
|
378
378
|
* Caculate the order
|
|
379
379
|
* @param orderData - The data from the order
|
|
@@ -438,6 +438,7 @@ export declare class OrderService extends Service {
|
|
|
438
438
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
439
439
|
*/
|
|
440
440
|
getListOrderRelationsWithoutLogin(orderIds: string[]): Promise<any>;
|
|
441
|
+
getOrderPromotion(level: string): Promise<any>;
|
|
441
442
|
/**
|
|
442
443
|
* get list order realation
|
|
443
444
|
* @param orderId - The id of order
|
|
@@ -35,9 +35,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
35
35
|
* @returns A promise that resolves with the created order.
|
|
36
36
|
* @throws If an error occurs while creating the order.
|
|
37
37
|
*/
|
|
38
|
-
createOrder(orderData, platform, createDraft) {
|
|
38
|
+
createOrder(orderData, platform, createDraft, created_by) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const endpoint = `/orders/${this.orgId}/${this.storeId}/${platform}?create_draft=${createDraft}`;
|
|
40
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/${platform}?create_draft=${createDraft}&created_by=${created_by}`;
|
|
41
41
|
const method = "POST";
|
|
42
42
|
try {
|
|
43
43
|
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
@@ -163,7 +163,7 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
163
163
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
164
164
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
165
165
|
*/
|
|
166
|
-
updateCustomerAndShippingAddress(orderId,
|
|
166
|
+
updateCustomerAndShippingAddress(orderId, customerId, shippingAddress) {
|
|
167
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
168
|
const endpoint = `/orders/FOX/${orderId}/customer`;
|
|
169
169
|
const method = "PUT";
|
|
@@ -624,9 +624,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
624
624
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
625
625
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
626
626
|
*/
|
|
627
|
-
updateDiscount(orderId, requestData) {
|
|
627
|
+
updateDiscount(orderId, updated_by, requestData) {
|
|
628
628
|
return __awaiter(this, void 0, void 0, function* () {
|
|
629
|
-
const endpoint = `/orders/${this.orgId}/${orderId}/discount`;
|
|
629
|
+
const endpoint = `/orders/${this.orgId}/${orderId}/discount?updated_by=${updated_by}`;
|
|
630
630
|
const method = "PUT";
|
|
631
631
|
try {
|
|
632
632
|
const response = yield this.restApiCallWithToken(endpoint, method, requestData);
|
|
@@ -665,9 +665,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
665
665
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
666
666
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
667
667
|
*/
|
|
668
|
-
getListShippingService(
|
|
668
|
+
getListShippingService() {
|
|
669
669
|
return __awaiter(this, void 0, void 0, function* () {
|
|
670
|
-
const endpoint = `/orders/${this.orgId}/${this.storeId}
|
|
670
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/shippingCarrier`;
|
|
671
671
|
const method = "GET";
|
|
672
672
|
try {
|
|
673
673
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
@@ -828,9 +828,13 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
828
828
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
829
829
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
830
830
|
*/
|
|
831
|
-
getListReturnOrder(
|
|
831
|
+
getListReturnOrder(requestData) {
|
|
832
832
|
return __awaiter(this, void 0, void 0, function* () {
|
|
833
|
-
const
|
|
833
|
+
const params = new URLSearchParams(Object.entries(requestData).reduce((acc, [key, value]) => {
|
|
834
|
+
acc[key] = Array.isArray(value) ? value.join(",") : value.toString();
|
|
835
|
+
return acc;
|
|
836
|
+
}, {})).toString();
|
|
837
|
+
const endpoint = `/orders/${this.orgId}/${this.storeId}/return_order?${params}`;
|
|
834
838
|
const method = "GET";
|
|
835
839
|
try {
|
|
836
840
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
@@ -975,9 +979,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
975
979
|
* @returns A promise that resolves when the customer and shipping address are updated.
|
|
976
980
|
* @throws If an error occurs while updating the customer and shipping address.
|
|
977
981
|
*/
|
|
978
|
-
createOrderReturn(orderData) {
|
|
982
|
+
createOrderReturn(orderData, created_by) {
|
|
979
983
|
return __awaiter(this, void 0, void 0, function* () {
|
|
980
|
-
const endpoint = `/orders/${this.orgId}/order_return`;
|
|
984
|
+
const endpoint = `/orders/${this.orgId}/order_return?created_by=${created_by}`;
|
|
981
985
|
const method = "POST";
|
|
982
986
|
try {
|
|
983
987
|
const response = yield this.restApiCallWithToken(endpoint, method, orderData);
|
|
@@ -1157,6 +1161,20 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
1157
1161
|
}
|
|
1158
1162
|
});
|
|
1159
1163
|
}
|
|
1164
|
+
getOrderPromotion(level) {
|
|
1165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1166
|
+
const endpoint = `/member-promotions/${this.orgId}/level/${level}/order-promotion`;
|
|
1167
|
+
const method = "GET";
|
|
1168
|
+
try {
|
|
1169
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
1170
|
+
return response;
|
|
1171
|
+
}
|
|
1172
|
+
catch (error) {
|
|
1173
|
+
console.log(`Error in getOrderPromotion: ${error}`);
|
|
1174
|
+
throw error;
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1160
1178
|
/**
|
|
1161
1179
|
* get list order realation
|
|
1162
1180
|
* @param orderId - The id of order
|
|
@@ -116,7 +116,7 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
116
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
const query = queries_1.GET_POLICY;
|
|
118
118
|
const variablesHandle = {
|
|
119
|
-
groupId
|
|
119
|
+
groupId,
|
|
120
120
|
};
|
|
121
121
|
try {
|
|
122
122
|
const response = yield this.graphqlQuery(query, variablesHandle);
|
|
@@ -89,7 +89,7 @@ class Service {
|
|
|
89
89
|
restApiCallWithToken(path, method, data, headers) {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
91
|
try {
|
|
92
|
-
const modifiedHeaders = Object.assign(Object.assign({}, headers), {
|
|
92
|
+
const modifiedHeaders = Object.assign(Object.assign({}, headers), { PartnerId: this.orgId, Authorization: "Bearer " + this.token });
|
|
93
93
|
const response = yield (0, axios_1.default)({
|
|
94
94
|
url: this.endpoint + path,
|
|
95
95
|
method,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SearchVoucherRequest {
|
|
2
|
+
partyId: String;
|
|
3
|
+
voucherCodes: [String];
|
|
4
|
+
voucherCode: String;
|
|
5
|
+
voucherType: String;
|
|
6
|
+
campaignId: String;
|
|
7
|
+
campaignActionId: String;
|
|
8
|
+
customerId: String;
|
|
9
|
+
campaignActionType: String;
|
|
10
|
+
isBirthday: Boolean;
|
|
11
|
+
isPageAble: Boolean;
|
|
12
|
+
pageNumber: number;
|
|
13
|
+
pageSize: number;
|
|
14
|
+
}
|