@longvansoftware/service-js-client 2.6.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/graphql/campaign/mutations.d.ts +1 -0
- package/dist/src/graphql/campaign/mutations.js +34 -0
- package/dist/src/graphql/campaign/queries.d.ts +11 -0
- package/dist/src/graphql/campaign/queries.js +496 -0
- package/dist/src/graphql/cashbook/queries.d.ts +2 -0
- package/dist/src/graphql/cashbook/queries.js +99 -0
- package/dist/src/graphql/cloudCloud/mutations.d.ts +3 -0
- package/dist/src/graphql/cloudCloud/mutations.js +41 -0
- package/dist/src/graphql/cloudCloud/queries.d.ts +5 -0
- package/dist/src/graphql/cloudCloud/queries.js +185 -0
- package/dist/src/graphql/orderCloud/mutations.d.ts +1 -0
- package/dist/src/graphql/orderCloud/mutations.js +12 -0
- package/dist/src/graphql/orderCloud/queries.d.ts +1 -0
- package/dist/src/graphql/orderCloud/queries.js +12 -0
- package/dist/src/graphql/orderGraphQL/mutations.d.ts +2 -0
- package/dist/src/graphql/orderGraphQL/mutations.js +11 -1
- package/dist/src/graphql/paymentV2/mutations.d.ts +5 -0
- package/dist/src/graphql/paymentV2/mutations.js +124 -0
- package/dist/src/graphql/paymentV2/queries.d.ts +10 -0
- package/dist/src/graphql/paymentV2/queries.js +277 -0
- package/dist/src/graphql/store/mutations.d.ts +1 -0
- package/dist/src/graphql/store/mutations.js +29 -0
- package/dist/src/graphql/store/queries.d.ts +1 -0
- package/dist/src/graphql/store/queries.js +29 -0
- package/dist/src/graphql/truedoc/queries.d.ts +1 -0
- package/dist/src/graphql/truedoc/queries.js +18 -0
- package/dist/src/graphql/user/mutations.d.ts +13 -11
- package/dist/src/graphql/user/mutations.js +12 -1
- package/dist/src/lib/accounting/index.d.ts +5 -0
- package/dist/src/lib/accounting/index.js +32 -0
- package/dist/src/lib/campaign/index.d.ts +22 -0
- package/dist/src/lib/campaign/index.js +252 -0
- package/dist/src/lib/cashbook/index.d.ts +6 -0
- package/dist/src/lib/cashbook/index.js +56 -0
- package/dist/src/lib/cloudCloud/index.d.ts +12 -0
- package/dist/src/lib/cloudCloud/index.js +142 -0
- package/dist/src/lib/comhub/index.d.ts +6 -0
- package/dist/src/lib/comhub/index.js +50 -0
- package/dist/src/lib/deepLinkVietQr/index.d.ts +7 -0
- package/dist/src/lib/deepLinkVietQr/index.js +58 -0
- package/dist/src/lib/fileService/index.d.ts +34 -0
- package/dist/src/lib/fileService/index.js +80 -0
- package/dist/src/lib/getImage/index.d.ts +4 -0
- package/dist/src/lib/getImage/index.js +10 -0
- package/dist/src/lib/image/index.d.ts +7 -0
- package/dist/src/lib/image/index.js +49 -0
- package/dist/src/lib/omnigateway/index.d.ts +7 -0
- package/dist/src/lib/omnigateway/index.js +58 -0
- package/dist/src/lib/orderCloud/index.d.ts +5 -0
- package/dist/src/lib/orderCloud/index.js +37 -0
- package/dist/src/lib/orderGraphQL/index.d.ts +2 -0
- package/dist/src/lib/orderGraphQL/index.js +32 -0
- package/dist/src/lib/paymentV2/index.d.ts +19 -0
- package/dist/src/lib/paymentV2/index.js +264 -0
- package/dist/src/lib/portal/index.d.ts +33 -0
- package/dist/src/lib/portal/index.js +456 -0
- package/dist/src/lib/store/index.d.ts +30 -0
- package/dist/src/lib/store/index.js +74 -0
- package/dist/src/lib/token/index.d.ts +5 -0
- package/dist/src/lib/token/index.js +32 -0
- package/dist/src/lib/truedoc/index.d.ts +5 -0
- package/dist/src/lib/truedoc/index.js +35 -0
- package/dist/src/lib/upload/index.d.ts +5 -0
- package/dist/src/lib/upload/index.js +35 -0
- package/dist/src/lib/user/index.d.ts +1 -0
- package/dist/src/lib/user/index.js +20 -0
- package/dist/src/lib/warehouseV2/index.d.ts +13 -0
- package/dist/src/lib/warehouseV2/index.js +54 -0
- package/dist/src/lib/zca/index.d.ts +12 -0
- package/dist/src/lib/zca/index.js +41 -0
- package/dist/src/types/campaign.d.ts +14 -0
- package/dist/src/types/campaign.js +2 -0
- package/dist/src/types/invoice.d.ts +14 -0
- package/dist/src/types/invoice.js +2 -0
- package/dist/src/types/portal.d.ts +7 -0
- package/dist/src/types/portal.js +2 -0
- package/dist/src/types/store.d.ts +158 -0
- package/dist/src/types/store.js +3 -0
- package/dist/src/utils/validatePhoneNumber.d.ts +1 -0
- package/dist/src/utils/validatePhoneNumber.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_STORE_CHANNEL_BY_EMP_ID_QUERY = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.GET_STORE_CHANNEL_BY_EMP_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
6
|
+
query GetStoreChannelByEmpId($saleId: String) {
|
|
7
|
+
getStoreChannelByEmpId(saleId: $saleId) {
|
|
8
|
+
id
|
|
9
|
+
createdStamp
|
|
10
|
+
name
|
|
11
|
+
type
|
|
12
|
+
enable
|
|
13
|
+
partyId
|
|
14
|
+
warehouses
|
|
15
|
+
warehouseIdDefault
|
|
16
|
+
enableOrderAbleFuture
|
|
17
|
+
enableOrderNegativeQuantity
|
|
18
|
+
storeEcommerceName
|
|
19
|
+
shippingCompanies
|
|
20
|
+
shippingCompanyIdPrimary
|
|
21
|
+
customerIdPrimary
|
|
22
|
+
paymentMethodIdPrimary
|
|
23
|
+
enableCustomProductPrice
|
|
24
|
+
enablePaymentPartial
|
|
25
|
+
paymentPartialPercent
|
|
26
|
+
productStoreLink
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GET_CUSTOMER_INFOR: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_CUSTOMER_INFOR = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.GET_CUSTOMER_INFOR = (0, graphql_tag_1.gql) `
|
|
6
|
+
query GetCustomerInfo($bmlToken: String!) {
|
|
7
|
+
getCustomerInfo(bmlToken: $bmlToken) {
|
|
8
|
+
id
|
|
9
|
+
name
|
|
10
|
+
email
|
|
11
|
+
phone
|
|
12
|
+
tier
|
|
13
|
+
gender
|
|
14
|
+
tdAccessToken
|
|
15
|
+
dob
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
1
|
+
import { DocumentNode } from "graphql";
|
|
2
|
+
export declare const CREATE_COMPANY: DocumentNode;
|
|
3
|
+
export declare const UPDATE_COMPANY_INFOR: DocumentNode;
|
|
4
|
+
export declare const UPDATE_CUSTOMER_V2: DocumentNode;
|
|
5
|
+
export declare const CREATE_CUSTOMER_V2: DocumentNode;
|
|
6
|
+
export declare const CREATE_VAT_INFO: DocumentNode;
|
|
7
|
+
export declare const UPDATE_VAT_INFO: DocumentNode;
|
|
8
|
+
export declare const DELETE_VAT_INFO: DocumentNode;
|
|
9
|
+
export declare const CREATE_TEAM: DocumentNode;
|
|
10
|
+
export declare const ADD_USER_TO_TEAM: DocumentNode;
|
|
11
|
+
export declare const REMOVE_USER_FROM_TEAM: DocumentNode;
|
|
12
|
+
export declare const UPDATE_TEAM_NAME: DocumentNode;
|
|
13
|
+
export declare const UPDATE_CUSTOMER_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UPDATE_TEAM_NAME = exports.REMOVE_USER_FROM_TEAM = exports.ADD_USER_TO_TEAM = exports.CREATE_TEAM = exports.DELETE_VAT_INFO = exports.UPDATE_VAT_INFO = exports.CREATE_VAT_INFO = exports.CREATE_CUSTOMER_V2 = exports.UPDATE_CUSTOMER_V2 = exports.UPDATE_COMPANY_INFOR = exports.CREATE_COMPANY = void 0;
|
|
3
|
+
exports.UPDATE_CUSTOMER_DYNAMIC = exports.UPDATE_TEAM_NAME = exports.REMOVE_USER_FROM_TEAM = exports.ADD_USER_TO_TEAM = exports.CREATE_TEAM = exports.DELETE_VAT_INFO = exports.UPDATE_VAT_INFO = exports.CREATE_VAT_INFO = exports.CREATE_CUSTOMER_V2 = exports.UPDATE_CUSTOMER_V2 = exports.UPDATE_COMPANY_INFOR = exports.CREATE_COMPANY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.CREATE_COMPANY = (0, graphql_tag_1.gql) `
|
|
6
6
|
mutation CreateCompany(
|
|
@@ -227,3 +227,14 @@ exports.UPDATE_TEAM_NAME = (0, graphql_tag_1.gql) `
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
`;
|
|
230
|
+
const UPDATE_CUSTOMER_DYNAMIC = (fields = []) => {
|
|
231
|
+
const fieldStr = fields.join("\n ");
|
|
232
|
+
const hasFields = fields.length > 0;
|
|
233
|
+
return (0, graphql_tag_1.gql) `mutation updateCustomer($id: String! $fieldName: String! $valueUpdate: String! $partnerId: String! $updatedBy: String!) {
|
|
234
|
+
updateCustomer(id: $id, fieldName: $fieldName, valueUpdate: $valueUpdate, partnerId: $partnerId, updatedBy: $updatedBy) {
|
|
235
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
`;
|
|
239
|
+
};
|
|
240
|
+
exports.UPDATE_CUSTOMER_DYNAMIC = UPDATE_CUSTOMER_DYNAMIC;
|
|
@@ -0,0 +1,32 @@
|
|
|
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.AccountingService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
class AccountingService extends serviceSDK_1.Service {
|
|
15
|
+
constructor(endpoint, orgId, storeId) {
|
|
16
|
+
super(endpoint, orgId, storeId);
|
|
17
|
+
}
|
|
18
|
+
getCustomerWallet(customerId, type) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const endpoint = `/${this.orgId}/get_gl_account?partyId=${customerId}&type=${type}`;
|
|
21
|
+
const method = "GET";
|
|
22
|
+
try {
|
|
23
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.AccountingService = AccountingService;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
searchVouchers(campaignId: String, campaignActionId: String, campaignActionType: String, customerId: String, excludeExpired: Boolean, pageNumber: number, pageSize: number): Promise<any>;
|
|
12
|
+
checkValidVoucher(customerId: string, voucherCode: string): Promise<any>;
|
|
13
|
+
getCampaignActiveNow(campaignActionType: string, customerId: string): Promise<any>;
|
|
14
|
+
getPromotionProductPrice(productId: String, productPrice: number): Promise<any>;
|
|
15
|
+
getVoucherAvailableForCustomer(campaignId: string, campaignActionId: string, customerId: string, excludeExpired: Boolean, isPageAble: Boolean): Promise<any>;
|
|
16
|
+
addCustomerToVoucher(voucherCode: string, userId: string, affiliateId: string): Promise<any>;
|
|
17
|
+
suggestVoucher(customerId: string, campaignId: string, campaignActionId: string, isBirthday: Boolean): Promise<any>;
|
|
18
|
+
getCampaignActionById(id: string): Promise<any>;
|
|
19
|
+
searchProductGiftPromotionResponse(productIds: string[], campaignActionId: string): Promise<any>;
|
|
20
|
+
getCampaign(id: string): Promise<any>;
|
|
21
|
+
searchProductPricePromotionResponse(campaignId: string, campaignActionId: string, statusActive: string): Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
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
|
+
const mutations_1 = require("../../graphql/campaign/mutations");
|
|
16
|
+
class CampaignService extends serviceSDK_1.Service {
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a new CampaignService instance.
|
|
19
|
+
* @param endpoint - The endpoint URL for the service.
|
|
20
|
+
* @param orgId - The organization ID.
|
|
21
|
+
* @param storeId - The store ID.
|
|
22
|
+
*/
|
|
23
|
+
constructor(endpoint, orgId, storeId) {
|
|
24
|
+
super(endpoint, orgId, storeId);
|
|
25
|
+
}
|
|
26
|
+
getCampaignActionActiveNow(customerId, campaignActionType) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const query = queries_1.GET_CAMPAIGN_ACTION_ACTIVE_NOW;
|
|
29
|
+
const variables = {
|
|
30
|
+
partyId: this.orgId,
|
|
31
|
+
productStoreId: this.storeId,
|
|
32
|
+
customerId,
|
|
33
|
+
campaignActionType,
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
37
|
+
return response.getCampaignActionActiveNow;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.log(`Error fetching getCampaignActionActiveNow: ${error}`);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
searchVouchers(campaignId, campaignActionId, campaignActionType, customerId, excludeExpired, pageNumber, pageSize) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const query = queries_1.GET_VOUCHERS;
|
|
48
|
+
const variables = {
|
|
49
|
+
partyId: this.orgId,
|
|
50
|
+
storeId: this.storeId,
|
|
51
|
+
campaignId,
|
|
52
|
+
campaignActionId,
|
|
53
|
+
campaignActionType,
|
|
54
|
+
customerId,
|
|
55
|
+
excludeExpired,
|
|
56
|
+
pageNumber,
|
|
57
|
+
pageSize,
|
|
58
|
+
};
|
|
59
|
+
try {
|
|
60
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
61
|
+
return response.searchVoucher;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.log(`Error fetching searchVoucher: ${error}`);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
checkValidVoucher(customerId, voucherCode) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const query = queries_1.CHECK_VALID_VOUCHER;
|
|
72
|
+
const variables = {
|
|
73
|
+
partyId: this.orgId,
|
|
74
|
+
productStoreId: this.storeId,
|
|
75
|
+
customerId,
|
|
76
|
+
voucherCode,
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
80
|
+
return response.checkValidVoucher;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.log(`Error fetching searchVoucher: ${error}`);
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getCampaignActiveNow(campaignActionType, customerId) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const query = queries_1.GET_CAMPAIGN_ACTIVE_NOW;
|
|
91
|
+
const variables = {
|
|
92
|
+
partyId: this.orgId,
|
|
93
|
+
productStoreId: this.storeId,
|
|
94
|
+
campaignActionType,
|
|
95
|
+
customerId,
|
|
96
|
+
};
|
|
97
|
+
try {
|
|
98
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
99
|
+
return response.getCampaignActiveNow;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
getPromotionProductPrice(productId, productPrice) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const query = queries_1.GET_PROMOTION_PRODUCT_PRICE;
|
|
109
|
+
const variables = {
|
|
110
|
+
partyId: this.orgId,
|
|
111
|
+
productStoreId: this.storeId,
|
|
112
|
+
productId,
|
|
113
|
+
productPrice,
|
|
114
|
+
};
|
|
115
|
+
try {
|
|
116
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
117
|
+
return response.getPromotionProductPrice;
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
getVoucherAvailableForCustomer(campaignId, campaignActionId, customerId, excludeExpired, isPageAble) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const query = queries_1.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER;
|
|
127
|
+
const variables = {
|
|
128
|
+
partyId: this.orgId,
|
|
129
|
+
storeId: this.storeId,
|
|
130
|
+
campaignId,
|
|
131
|
+
campaignActionId,
|
|
132
|
+
customerId,
|
|
133
|
+
excludeExpired,
|
|
134
|
+
isPageAble,
|
|
135
|
+
};
|
|
136
|
+
try {
|
|
137
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
138
|
+
return response.getVoucherAvailableForCustomer;
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
addCustomerToVoucher(voucherCode, userId, affiliateId) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const query = mutations_1.ADD_CUSTOMER_ID_INTO_VOUCHER;
|
|
148
|
+
const variables = {
|
|
149
|
+
partyId: this.orgId,
|
|
150
|
+
voucherCode,
|
|
151
|
+
userId,
|
|
152
|
+
affiliateId,
|
|
153
|
+
};
|
|
154
|
+
try {
|
|
155
|
+
const response = yield this.graphqlMutation(query, variables);
|
|
156
|
+
return response.addCustomerIdIntoVoucher;
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
suggestVoucher(customerId, campaignId, campaignActionId, isBirthday) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
const query = queries_1.SUGGEST_VOUCHER;
|
|
166
|
+
const variables = {
|
|
167
|
+
partyId: this.orgId,
|
|
168
|
+
customerId: customerId,
|
|
169
|
+
campaignId: campaignId,
|
|
170
|
+
campaignActionId: campaignActionId,
|
|
171
|
+
excludeExpired: true,
|
|
172
|
+
isBirthday: isBirthday,
|
|
173
|
+
};
|
|
174
|
+
try {
|
|
175
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
176
|
+
return response.suggestVoucher;
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
getCampaignActionById(id) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
|
|
186
|
+
const variables = {
|
|
187
|
+
id,
|
|
188
|
+
};
|
|
189
|
+
try {
|
|
190
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
191
|
+
return response.getCampaignActionById;
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
searchProductGiftPromotionResponse(productIds, campaignActionId) {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
const query = queries_1.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE;
|
|
201
|
+
const variables = {
|
|
202
|
+
partyId: this.orgId,
|
|
203
|
+
storeId: this.storeId,
|
|
204
|
+
productIds: productIds,
|
|
205
|
+
campaignActionId: campaignActionId,
|
|
206
|
+
sort: { asc: true, key: "createdStamp" },
|
|
207
|
+
};
|
|
208
|
+
try {
|
|
209
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
210
|
+
return response.searchProductGiftPromotionResponse;
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
getCampaign(id) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
const query = queries_1.GET_CAMPAIGN;
|
|
220
|
+
const variables = {
|
|
221
|
+
id,
|
|
222
|
+
};
|
|
223
|
+
try {
|
|
224
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
225
|
+
return response.getCampaign;
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
searchProductPricePromotionResponse(campaignId, campaignActionId, statusActive) {
|
|
233
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
const query = queries_1.SEARCH_PRODUCT_PRICE_PROMOTION_RESPONSE;
|
|
235
|
+
const variables = {
|
|
236
|
+
partyId: this.orgId,
|
|
237
|
+
campaignId,
|
|
238
|
+
campaignActionId,
|
|
239
|
+
statusActive,
|
|
240
|
+
sort: { asc: true, key: "productId" },
|
|
241
|
+
};
|
|
242
|
+
try {
|
|
243
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
244
|
+
return response.searchProductPricePromotionResponse;
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.CampaignService = CampaignService;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class CashbookService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
searchTransactions(keyword: string, dateFrom: number, dateTo: number, currentPage: number, pageSize: number): Promise<any>;
|
|
5
|
+
getCashbookTransactionDetail(cashTransactionId: string): Promise<any>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.CashbookService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const queries_1 = require("../../graphql/cashbook/queries");
|
|
15
|
+
class CashbookService extends serviceSDK_1.Service {
|
|
16
|
+
constructor(endpoint, orgId, storeId) {
|
|
17
|
+
super(endpoint, orgId, storeId);
|
|
18
|
+
}
|
|
19
|
+
searchTransactions(keyword, dateFrom, dateTo, currentPage, pageSize) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const query = queries_1.SEARCH_TRANSACTIONS;
|
|
22
|
+
const variables = {
|
|
23
|
+
partnerId: this.orgId,
|
|
24
|
+
keyword,
|
|
25
|
+
dateFrom,
|
|
26
|
+
dateTo,
|
|
27
|
+
currentPage,
|
|
28
|
+
pageSize,
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
const response = yield this.graphqlQueryV3(query, variables);
|
|
32
|
+
return response.searchTransactions;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
getCashbookTransactionDetail(cashTransactionId) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const query = queries_1.GET_CASHBOOK_TRANSACTION_DETAIL;
|
|
42
|
+
const variables = {
|
|
43
|
+
partnerId: this.orgId,
|
|
44
|
+
cashTransactionId,
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
const response = yield this.graphqlQueryV3(query, variables);
|
|
48
|
+
return response.getCashbookTransactionDetail;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.CashbookService = CashbookService;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class CloudCloudService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
searchService(data: any): Promise<any>;
|
|
5
|
+
serviceDetail(serviceId: string): Promise<any>;
|
|
6
|
+
updateDescription(serviceId: string, description: string, updatedBy: string): Promise<any>;
|
|
7
|
+
searchServiceByPhone(phone: string, serviceScope: string): Promise<any>;
|
|
8
|
+
getListLabService(productId: string): Promise<any>;
|
|
9
|
+
updateServiceResource(data: Record<string, any>): Promise<any>;
|
|
10
|
+
countAvailableBookings(serviceId: string): Promise<any>;
|
|
11
|
+
recountUsedBookings(serviceId: string, actorId: string): Promise<any>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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.CloudCloudService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const queries_1 = require("../../graphql/cloudCloud/queries");
|
|
15
|
+
const mutations_1 = require("../../graphql/cloudCloud/mutations");
|
|
16
|
+
class CloudCloudService extends serviceSDK_1.Service {
|
|
17
|
+
constructor(endpoint, orgId, storeId) {
|
|
18
|
+
super(endpoint, orgId, storeId);
|
|
19
|
+
}
|
|
20
|
+
searchService(data) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const query = queries_1.SEARCH_SERVICE;
|
|
23
|
+
const variables = {
|
|
24
|
+
filter: data,
|
|
25
|
+
};
|
|
26
|
+
try {
|
|
27
|
+
const response = yield this.graphqlQueryV4(query, variables);
|
|
28
|
+
return response.searchService;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
serviceDetail(serviceId) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const query = queries_1.SERVICE_DETAIL;
|
|
38
|
+
const variables = {
|
|
39
|
+
serviceId,
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const response = yield this.graphqlQueryV4(query, variables);
|
|
43
|
+
return response.serviceDetail;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
updateDescription(serviceId, description, updatedBy) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const mutation = mutations_1.UPDATE_DESCRIPTION;
|
|
53
|
+
const variables = {
|
|
54
|
+
serviceId,
|
|
55
|
+
description,
|
|
56
|
+
updatedBy,
|
|
57
|
+
};
|
|
58
|
+
try {
|
|
59
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
60
|
+
return response.updateDescription;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
searchServiceByPhone(phone, serviceScope) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const query = queries_1.SEARCH_SERVICE_BY_PHONE;
|
|
70
|
+
const variables = {
|
|
71
|
+
phone,
|
|
72
|
+
serviceScope,
|
|
73
|
+
};
|
|
74
|
+
try {
|
|
75
|
+
const response = yield this.graphqlQueryV4(query, variables);
|
|
76
|
+
return response.searchServiceByPhone;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
getListLabService(productId) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const query = queries_1.GET_LIST_LAB_SERVICE;
|
|
86
|
+
const variables = {
|
|
87
|
+
productId,
|
|
88
|
+
};
|
|
89
|
+
try {
|
|
90
|
+
const response = yield this.graphqlQueryV4(query, variables);
|
|
91
|
+
return response.getListLabService;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
updateServiceResource(data) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const mutation = mutations_1.UPDATE_SERVICE_RESOURCE;
|
|
101
|
+
try {
|
|
102
|
+
const response = yield this.graphqlMutationV2(mutation, data);
|
|
103
|
+
return response.updateServiceResource;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
countAvailableBookings(serviceId) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const queries = queries_1.COUNT_AVAILABLE_BOOKING;
|
|
113
|
+
const variables = {
|
|
114
|
+
serviceId,
|
|
115
|
+
};
|
|
116
|
+
try {
|
|
117
|
+
const response = yield this.graphqlQueryV4(queries, variables);
|
|
118
|
+
return response.countAvailableBookings;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
recountUsedBookings(serviceId, actorId) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const mutation = mutations_1.RECOUNT_USED_BOOKING;
|
|
128
|
+
const variables = {
|
|
129
|
+
serviceId,
|
|
130
|
+
actorId,
|
|
131
|
+
};
|
|
132
|
+
try {
|
|
133
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
134
|
+
return response.recountUsedBookings;
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.CloudCloudService = CloudCloudService;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class ComhubService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
sendZns(dataTemplate: any, appId: string, messageType: string): Promise<any>;
|
|
5
|
+
sendMessage(OAId: string, content: string, contentType: string, senderPartyId: string, receivePartyIds: [string]): Promise<any>;
|
|
6
|
+
}
|