@longvansoftware/service-js-client 2.8.7 → 2.8.9
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/queries.d.ts +13 -11
- package/dist/src/graphql/campaign/queries.js +39 -111
- package/dist/src/graphql/cashbook/mutation.d.ts +5 -0
- package/dist/src/graphql/cashbook/mutation.js +94 -0
- package/dist/src/graphql/cashbook/query.d.ts +3 -0
- package/dist/src/graphql/cashbook/query.js +27 -0
- package/dist/src/graphql/cloudCloud/mutations.d.ts +2 -0
- package/dist/src/graphql/cloudCloud/mutations.js +101 -27
- package/dist/src/graphql/cloudCloud/queries.js +4 -0
- package/dist/src/graphql/orderCloud/mutations.d.ts +3 -1
- package/dist/src/graphql/orderCloud/mutations.js +21 -5
- package/dist/src/graphql/paymentV2/mutations.d.ts +1 -0
- package/dist/src/graphql/paymentV2/mutations.js +23 -37
- package/dist/src/graphql/paymentV2/queries.d.ts +2 -0
- package/dist/src/graphql/paymentV2/queries.js +58 -1
- package/dist/src/graphql/storefont/mutation.d.ts +4 -0
- package/dist/src/graphql/storefont/mutation.js +56 -0
- package/dist/src/graphql/storefont/queries.d.ts +5 -0
- package/dist/src/graphql/storefont/queries.js +106 -0
- package/dist/src/graphql/storefront/query.d.ts +3 -0
- package/dist/src/graphql/storefront/query.js +41 -0
- package/dist/src/graphql/tag/mutations.d.ts +2 -0
- package/dist/src/graphql/tag/mutations.js +44 -0
- package/dist/src/graphql/tag/queries.d.ts +1 -0
- package/dist/src/graphql/tag/queries.js +20 -0
- package/dist/src/lib/SDK.d.ts +3 -0
- package/dist/src/lib/SDK.js +4 -0
- package/dist/src/lib/campaign/index.d.ts +1 -0
- package/dist/src/lib/campaign/index.js +69 -12
- package/dist/src/lib/cashbook/index.d.ts +23 -3
- package/dist/src/lib/cashbook/index.js +90 -20
- package/dist/src/lib/cloudCloud/index.d.ts +1 -0
- package/dist/src/lib/cloudCloud/index.js +16 -0
- package/dist/src/lib/imageGateway/index.d.ts +6 -0
- package/dist/src/lib/imageGateway/index.js +18 -0
- package/dist/src/lib/orderCloud/index.d.ts +2 -0
- package/dist/src/lib/orderCloud/index.js +47 -1
- package/dist/src/lib/paymentV2/index.d.ts +11 -1
- package/dist/src/lib/paymentV2/index.js +55 -14
- package/dist/src/lib/portal/index.d.ts +10 -2
- package/dist/src/lib/portal/index.js +171 -11
- package/dist/src/lib/storefont/index.d.ts +23 -0
- package/dist/src/lib/storefont/index.js +160 -0
- package/dist/src/lib/storefront/index.d.ts +2 -0
- package/dist/src/lib/storefront/index.js +39 -0
- package/dist/src/lib/tag/index.d.ts +7 -0
- package/dist/src/lib/tag/index.js +61 -0
- package/package.json +1 -1
- package/dist/src/lib/service.d.ts +0 -14
- package/dist/src/lib/service.js +0 -101
- package/dist/src/utils/build-field-string.d.ts +0 -1
- package/dist/src/utils/build-field-string.js +0 -16
|
@@ -30,7 +30,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
30
30
|
partyId: this.orgId,
|
|
31
31
|
productStoreId: this.storeId,
|
|
32
32
|
customerId,
|
|
33
|
-
campaignActionType
|
|
33
|
+
campaignActionType
|
|
34
34
|
};
|
|
35
35
|
try {
|
|
36
36
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -54,7 +54,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
54
54
|
customerId,
|
|
55
55
|
excludeExpired,
|
|
56
56
|
pageNumber,
|
|
57
|
-
pageSize
|
|
57
|
+
pageSize
|
|
58
58
|
};
|
|
59
59
|
try {
|
|
60
60
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -73,7 +73,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
73
73
|
partyId: this.orgId,
|
|
74
74
|
productStoreId: this.storeId,
|
|
75
75
|
customerId,
|
|
76
|
-
voucherCode
|
|
76
|
+
voucherCode
|
|
77
77
|
};
|
|
78
78
|
try {
|
|
79
79
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -92,7 +92,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
92
92
|
partyId: this.orgId,
|
|
93
93
|
productStoreId: this.storeId,
|
|
94
94
|
campaignActionType,
|
|
95
|
-
customerId
|
|
95
|
+
customerId
|
|
96
96
|
};
|
|
97
97
|
try {
|
|
98
98
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -110,7 +110,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
110
110
|
partyId: this.orgId,
|
|
111
111
|
productStoreId: this.storeId,
|
|
112
112
|
productId,
|
|
113
|
-
productPrice
|
|
113
|
+
productPrice
|
|
114
114
|
};
|
|
115
115
|
try {
|
|
116
116
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -131,7 +131,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
131
131
|
campaignActionId,
|
|
132
132
|
customerId,
|
|
133
133
|
excludeExpired,
|
|
134
|
-
isPageAble
|
|
134
|
+
isPageAble
|
|
135
135
|
};
|
|
136
136
|
try {
|
|
137
137
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -149,7 +149,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
149
149
|
partyId: this.orgId,
|
|
150
150
|
voucherCode,
|
|
151
151
|
userId,
|
|
152
|
-
affiliateId
|
|
152
|
+
affiliateId
|
|
153
153
|
};
|
|
154
154
|
try {
|
|
155
155
|
const response = yield this.graphqlMutation(query, variables);
|
|
@@ -169,7 +169,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
169
169
|
campaignId: campaignId,
|
|
170
170
|
campaignActionId: campaignActionId,
|
|
171
171
|
excludeExpired: true,
|
|
172
|
-
isBirthday: isBirthday
|
|
172
|
+
isBirthday: isBirthday
|
|
173
173
|
};
|
|
174
174
|
try {
|
|
175
175
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -184,7 +184,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
184
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
185
185
|
const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
|
|
186
186
|
const variables = {
|
|
187
|
-
id
|
|
187
|
+
id
|
|
188
188
|
};
|
|
189
189
|
try {
|
|
190
190
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -203,7 +203,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
203
203
|
storeId: this.storeId,
|
|
204
204
|
productIds: productIds,
|
|
205
205
|
campaignActionId: campaignActionId,
|
|
206
|
-
sort: { asc: true, key: "createdStamp" }
|
|
206
|
+
sort: { asc: true, key: "createdStamp" }
|
|
207
207
|
};
|
|
208
208
|
try {
|
|
209
209
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -218,7 +218,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
218
218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
219
219
|
const query = queries_1.GET_CAMPAIGN;
|
|
220
220
|
const variables = {
|
|
221
|
-
id
|
|
221
|
+
id
|
|
222
222
|
};
|
|
223
223
|
try {
|
|
224
224
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -237,7 +237,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
237
237
|
campaignId,
|
|
238
238
|
campaignActionId,
|
|
239
239
|
statusActive,
|
|
240
|
-
sort: { asc: true, key: "productId" }
|
|
240
|
+
sort: { asc: true, key: "productId" }
|
|
241
241
|
};
|
|
242
242
|
try {
|
|
243
243
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -248,5 +248,62 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
+
voucherForUserRequest(orderId_1) {
|
|
252
|
+
return __awaiter(this, arguments, void 0, function* (orderId, customerId = "", paymentMethodId, shippingCompanyId, pageNumber = 0, pageSize = 20, fields = [
|
|
253
|
+
`content {
|
|
254
|
+
id
|
|
255
|
+
voucherCode
|
|
256
|
+
isBirthday
|
|
257
|
+
discountAmount
|
|
258
|
+
discountPercent
|
|
259
|
+
usageLimitPerVoucher
|
|
260
|
+
numberOfTimeUsed
|
|
261
|
+
maximumDiscount
|
|
262
|
+
maximumDiscountType
|
|
263
|
+
memberLevel
|
|
264
|
+
affiliateId
|
|
265
|
+
description
|
|
266
|
+
usageLimitType
|
|
267
|
+
minimumSpend
|
|
268
|
+
maximumSpend
|
|
269
|
+
expiryDate
|
|
270
|
+
isUsable
|
|
271
|
+
unusableReasons
|
|
272
|
+
remainingAmount
|
|
273
|
+
discountType
|
|
274
|
+
discountValue
|
|
275
|
+
ownerPartyId
|
|
276
|
+
rewardType
|
|
277
|
+
voucherType
|
|
278
|
+
}`,
|
|
279
|
+
"total",
|
|
280
|
+
"pageNumber",
|
|
281
|
+
"pageSize",
|
|
282
|
+
"totalPages",
|
|
283
|
+
"numberOfElements",
|
|
284
|
+
"first",
|
|
285
|
+
"last"
|
|
286
|
+
]) {
|
|
287
|
+
const query = (0, queries_1.GET_VOUCHER_FOR_USER)(fields);
|
|
288
|
+
const variables = {
|
|
289
|
+
voucherForUserRequest: {
|
|
290
|
+
orderId,
|
|
291
|
+
customerId,
|
|
292
|
+
storeId: this.storeId,
|
|
293
|
+
paymentMethodId,
|
|
294
|
+
shippingCompanyId,
|
|
295
|
+
pageNumber,
|
|
296
|
+
pageSize
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
try {
|
|
300
|
+
const res = yield this.graphqlQuery(query, variables);
|
|
301
|
+
return res.getVouchersForUser;
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
251
308
|
}
|
|
252
309
|
exports.CampaignService = CampaignService;
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { Service } from "../serviceSDK";
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class Cashbook extends Service {
|
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
setToken(token: string): void;
|
|
5
|
+
setStoreId(storeId: string): void;
|
|
6
|
+
getCashAccountCustomers(partyId: string, fields?: string[]): Promise<any>;
|
|
7
|
+
getBankCodes(fields?: string[]): Promise<any>;
|
|
8
|
+
createCashAccountCustomer(input: {
|
|
9
|
+
bankCode: string;
|
|
10
|
+
name: string;
|
|
11
|
+
accountNumber: string;
|
|
12
|
+
typeCard: string;
|
|
13
|
+
partyId: string;
|
|
14
|
+
}, fields?: string[]): Promise<any>;
|
|
15
|
+
updateCashAccountCustomer(input: {
|
|
16
|
+
id: string;
|
|
17
|
+
partyId: string;
|
|
18
|
+
bankCode?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
accountNumber?: string;
|
|
21
|
+
typeCard?: string;
|
|
22
|
+
isDefault?: boolean;
|
|
23
|
+
}, fields?: string[]): Promise<any>;
|
|
24
|
+
deleteCashAccountCustomer(id: string, partyId: string, fields?: string[]): Promise<any>;
|
|
25
|
+
confirmDeleteCashAccountCustomer(id: string, partyId: string, otp: string, fields?: string[]): Promise<any>;
|
|
6
26
|
}
|
|
@@ -9,48 +9,118 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.Cashbook = void 0;
|
|
13
|
+
const mutation_1 = require("../../graphql/cashbook/mutation");
|
|
14
|
+
const query_1 = require("../../graphql/cashbook/query");
|
|
13
15
|
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
-
|
|
15
|
-
class CashbookService extends serviceSDK_1.Service {
|
|
16
|
+
class Cashbook extends serviceSDK_1.Service {
|
|
16
17
|
constructor(endpoint, orgId, storeId) {
|
|
17
18
|
super(endpoint, orgId, storeId);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
setToken(token) {
|
|
21
|
+
this.token = token;
|
|
22
|
+
}
|
|
23
|
+
setStoreId(storeId) {
|
|
24
|
+
this.storeId = storeId;
|
|
25
|
+
}
|
|
26
|
+
getCashAccountCustomers(partyId_1) {
|
|
27
|
+
return __awaiter(this, arguments, void 0, function* (partyId, fields = ["id", "partnerId", "bankCode", "name", "accountNumber", "typeCard", "partyId", "isDefault", "customAttributes", "bankName"]) {
|
|
28
|
+
const query = (0, query_1.GET_CASH_ACCOUNT_CUSTOMERS)(fields);
|
|
29
|
+
const variables = { partnerId: this.orgId, partyId };
|
|
30
|
+
try {
|
|
31
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
32
|
+
return response.getCashAccountCustomers;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.log(`Error getCashAccountCustomers: ${error}`);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getBankCodes() {
|
|
41
|
+
return __awaiter(this, arguments, void 0, function* (fields = ["bankCode", "shortName", "description"]) {
|
|
42
|
+
const query = (0, query_1.GET_BANK_CODES)(fields);
|
|
43
|
+
try {
|
|
44
|
+
const response = yield this.graphqlQuery(query, {});
|
|
45
|
+
return response.getBankCodes;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.log(`Error getBankCodes: ${error}`);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
createCashAccountCustomer(input_1) {
|
|
54
|
+
return __awaiter(this, arguments, void 0, function* (input, fields = ["id", "partnerId", "bankCode", "name", "accountNumber", "typeCard", "partyId", "isDefault", "customAttributes"]) {
|
|
55
|
+
const mutation = (0, mutation_1.CREATE_CASH_ACCOUNT_CUSTOMER)(fields);
|
|
22
56
|
const variables = {
|
|
23
57
|
partnerId: this.orgId,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
58
|
+
partyId: input.partyId,
|
|
59
|
+
bankCode: input.bankCode,
|
|
60
|
+
name: input.name,
|
|
61
|
+
accountNumber: input.accountNumber,
|
|
62
|
+
typeCard: input.typeCard
|
|
29
63
|
};
|
|
30
64
|
try {
|
|
31
|
-
const response = yield this.
|
|
32
|
-
return response.
|
|
65
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
66
|
+
return response.createCashAccountCustomer;
|
|
33
67
|
}
|
|
34
68
|
catch (error) {
|
|
69
|
+
console.log(`Error createCashAccountCustomer: ${error}`);
|
|
35
70
|
throw error;
|
|
36
71
|
}
|
|
37
72
|
});
|
|
38
73
|
}
|
|
39
|
-
|
|
40
|
-
return __awaiter(this,
|
|
41
|
-
const
|
|
74
|
+
updateCashAccountCustomer(input_1) {
|
|
75
|
+
return __awaiter(this, arguments, void 0, function* (input, fields = ["id", "partnerId", "bankCode", "name", "accountNumber", "typeCard", "partyId", "isDefault", "customAttributes"]) {
|
|
76
|
+
const mutation = (0, mutation_1.UPDATE_CASH_ACCOUNT_CUSTOMER)(fields);
|
|
42
77
|
const variables = {
|
|
78
|
+
id: input.id,
|
|
43
79
|
partnerId: this.orgId,
|
|
44
|
-
|
|
80
|
+
partyId: input.partyId,
|
|
81
|
+
bankCode: input.bankCode,
|
|
82
|
+
name: input.name,
|
|
83
|
+
accountNumber: input.accountNumber,
|
|
84
|
+
typeCard: input.typeCard,
|
|
85
|
+
isDefault: input.isDefault
|
|
45
86
|
};
|
|
46
87
|
try {
|
|
47
|
-
const response = yield this.
|
|
48
|
-
return response.
|
|
88
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
89
|
+
return response.updateCashAccountCustomer;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.log(`Error updateCashAccountCustomer: ${error}`);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
deleteCashAccountCustomer(id_1, partyId_1) {
|
|
98
|
+
return __awaiter(this, arguments, void 0, function* (id, partyId, fields = ["message", "status", "otpRequired", "otpExpiresInSeconds", "otpMaxAttempts"]) {
|
|
99
|
+
const mutation = (0, mutation_1.DELETE_CASH_ACCOUNT_CUSTOMER)(fields);
|
|
100
|
+
const variables = { id, partnerId: this.orgId, partyId };
|
|
101
|
+
try {
|
|
102
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
103
|
+
return response.deleteCashAccountCustomer;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.log(`Error deleteCashAccountCustomer: ${error}`);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
confirmDeleteCashAccountCustomer(id_1, partyId_1, otp_1) {
|
|
112
|
+
return __awaiter(this, arguments, void 0, function* (id, partyId, otp, fields = ["message", "status", "otpRequired", "otpExpiresInSeconds", "otpMaxAttempts"]) {
|
|
113
|
+
const mutation = (0, mutation_1.CONFIRM_DELETE_CASH_ACCOUNT_CUSTOMER)(fields);
|
|
114
|
+
const variables = { id, partnerId: this.orgId, partyId, otp };
|
|
115
|
+
try {
|
|
116
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
117
|
+
return response.confirmDeleteCashAccountCustomer;
|
|
49
118
|
}
|
|
50
119
|
catch (error) {
|
|
120
|
+
console.log(`Error confirmDeleteCashAccountCustomer: ${error}`);
|
|
51
121
|
throw error;
|
|
52
122
|
}
|
|
53
123
|
});
|
|
54
124
|
}
|
|
55
125
|
}
|
|
56
|
-
exports.
|
|
126
|
+
exports.Cashbook = Cashbook;
|
|
@@ -9,4 +9,5 @@ export declare class CloudCloudService extends Service {
|
|
|
9
9
|
updateServiceResource(data: Record<string, any>): Promise<any>;
|
|
10
10
|
countAvailableBookings(serviceId: string): Promise<any>;
|
|
11
11
|
recountUsedBookings(serviceId: string, actorId: string): Promise<any>;
|
|
12
|
+
linkUserAccount(ownerId: string, serviceId: string): Promise<any>;
|
|
12
13
|
}
|
|
@@ -138,5 +138,21 @@ class CloudCloudService extends serviceSDK_1.Service {
|
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
+
linkUserAccount(ownerId, serviceId) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
const mutation = mutations_1.LINK_USER_ACCOUNT;
|
|
144
|
+
const variables = {
|
|
145
|
+
ownerId,
|
|
146
|
+
serviceId
|
|
147
|
+
};
|
|
148
|
+
try {
|
|
149
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
150
|
+
return response.linkUserAccount;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
141
157
|
}
|
|
142
158
|
exports.CloudCloudService = CloudCloudService;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class ImageGateService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
imageProduct(parentId: string, parentType: string, width?: number, height?: number): string;
|
|
5
|
+
imagesProduct(parentId: string, parentType: string, width?: number, height?: number): string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageGateService = void 0;
|
|
4
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
5
|
+
class ImageGateService extends serviceSDK_1.Service {
|
|
6
|
+
constructor(endpoint, orgId, storeId) {
|
|
7
|
+
super(endpoint, orgId, storeId);
|
|
8
|
+
}
|
|
9
|
+
imageProduct(parentId, parentType, width, height) {
|
|
10
|
+
const url = `${this.endpoint}/image-gateway/public/image/${parentType}/${parentId}${width ? `?w=${width}` : ``}${`${height ? `&h=${height}` : ``}`} `;
|
|
11
|
+
return url;
|
|
12
|
+
}
|
|
13
|
+
imagesProduct(parentId, parentType, width, height) {
|
|
14
|
+
const url = `${this.endpoint}/image-gateway/public/images/${parentType}/${parentId}?w=${width}&h=${height}`;
|
|
15
|
+
return url;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ImageGateService = ImageGateService;
|
|
@@ -2,4 +2,6 @@ import { Service } from "../serviceSDK";
|
|
|
2
2
|
export declare class OrderCloudService extends Service {
|
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
4
|
findOrderByOwnerPartyId(ownerPartyId: string): Promise<any>;
|
|
5
|
+
mergeOrderCart(oldCartId: string, newCartId: string, actorId: string, fields?: string[]): Promise<any>;
|
|
6
|
+
updateQuantityV2(orderId: string, updateItem: any, updateBy: string): Promise<any>;
|
|
5
7
|
}
|
|
@@ -12,6 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.OrderCloudService = void 0;
|
|
13
13
|
const serviceSDK_1 = require("../serviceSDK");
|
|
14
14
|
const queries_1 = require("../../graphql/orderCloud/queries");
|
|
15
|
+
const mutations_1 = require("../../graphql/orderCloud/mutations");
|
|
16
|
+
const mutations_2 = require("../../graphql/cloudCloud/mutations");
|
|
15
17
|
class OrderCloudService extends serviceSDK_1.Service {
|
|
16
18
|
constructor(endpoint, orgId, storeId) {
|
|
17
19
|
super(endpoint, orgId, storeId);
|
|
@@ -22,7 +24,7 @@ class OrderCloudService extends serviceSDK_1.Service {
|
|
|
22
24
|
const query = queries_1.FIND_ORDER_BY_OWNER_PARTYID;
|
|
23
25
|
const variables = {
|
|
24
26
|
partnerId: this.orgId,
|
|
25
|
-
ownerPartyId
|
|
27
|
+
ownerPartyId
|
|
26
28
|
};
|
|
27
29
|
try {
|
|
28
30
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -33,5 +35,49 @@ class OrderCloudService extends serviceSDK_1.Service {
|
|
|
33
35
|
}
|
|
34
36
|
});
|
|
35
37
|
}
|
|
38
|
+
mergeOrderCart(oldCartId_1, newCartId_1, actorId_1) {
|
|
39
|
+
return __awaiter(this, arguments, void 0, function* (oldCartId, newCartId, actorId, fields = ["success", "movedItemCount", "skippedItemCount", "oldCartCanceled", "message"]) {
|
|
40
|
+
const mutation = (0, mutations_1.MERGE_ORDER_CART)(fields);
|
|
41
|
+
const variables = {
|
|
42
|
+
oldCartId,
|
|
43
|
+
newCartId,
|
|
44
|
+
actorId
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
48
|
+
return response.mergeOrderCart;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
updateQuantityV2(orderId, updateItem, updateBy) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const mutation = mutations_2.UPDATE_QUANTITY_V2;
|
|
59
|
+
const variables = {
|
|
60
|
+
orderId,
|
|
61
|
+
partnerId: this.orgId,
|
|
62
|
+
updateItemInputs: {
|
|
63
|
+
orderItemId: updateItem.orderItemId,
|
|
64
|
+
price: updateItem.price,
|
|
65
|
+
quantity: updateItem.quantity,
|
|
66
|
+
unitPrice: updateItem.unitPrice,
|
|
67
|
+
unitType: updateItem.unitType,
|
|
68
|
+
campaignId: (_a = updateItem.campaignId) !== null && _a !== void 0 ? _a : null,
|
|
69
|
+
campaignActionId: (_b = updateItem.campaignActionId) !== null && _b !== void 0 ? _b : null
|
|
70
|
+
},
|
|
71
|
+
updateBy
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
const response = yield this.graphqlQuery(mutation, variables);
|
|
75
|
+
return response;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
36
82
|
}
|
|
37
83
|
exports.OrderCloudService = OrderCloudService;
|
|
@@ -2,7 +2,7 @@ import { Service } from "../serviceSDK";
|
|
|
2
2
|
export declare class PaymentServiceV2 extends Service {
|
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
4
|
paymentsByOrders(orderIds: [string]): Promise<any>;
|
|
5
|
-
cancelPayment(paymentId: string, reason: string): Promise<any>;
|
|
5
|
+
cancelPayment(paymentId: string, reason: string, safeMode?: boolean, createBy?: string): Promise<any>;
|
|
6
6
|
paymentMethods(): Promise<any>;
|
|
7
7
|
getPaymentMethodTypes(): Promise<any>;
|
|
8
8
|
paymentInfo(paymentId: string): Promise<any>;
|
|
@@ -16,4 +16,14 @@ export declare class PaymentServiceV2 extends Service {
|
|
|
16
16
|
getPaymentGatewaysByMethodCode(methodCode: string): Promise<any>;
|
|
17
17
|
getPaymentMethodTypesV2(storeActive: any, allMethodTypes: boolean): Promise<any>;
|
|
18
18
|
getTransferInfo(storeId: string, paymentId: string): Promise<any>;
|
|
19
|
+
createPayment(paymentData: {
|
|
20
|
+
totalAmount: number;
|
|
21
|
+
storeID: string;
|
|
22
|
+
partnerCode: string;
|
|
23
|
+
methodCode: string;
|
|
24
|
+
phone?: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
}): Promise<any>;
|
|
27
|
+
paymentMethodsByPartner(partnerCode?: string): Promise<any>;
|
|
28
|
+
getPaymentMethodTypesWithGatewayConfig(partnerId?: string, storeId?: string): Promise<any>;
|
|
19
29
|
}
|
|
@@ -21,7 +21,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const query = queries_1.PAYMENTS_BY_ORDERS;
|
|
23
23
|
const variables = {
|
|
24
|
-
orderIds: orderIds
|
|
24
|
+
orderIds: orderIds
|
|
25
25
|
};
|
|
26
26
|
try {
|
|
27
27
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -32,12 +32,14 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
cancelPayment(paymentId, reason) {
|
|
35
|
+
cancelPayment(paymentId, reason, safeMode, createBy) {
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
const mutation = mutations_1.CANCEL_PAYMENT;
|
|
38
38
|
const variables = {
|
|
39
39
|
paymentId: paymentId,
|
|
40
40
|
reason: reason,
|
|
41
|
+
safeMode: safeMode,
|
|
42
|
+
createBy: createBy
|
|
41
43
|
};
|
|
42
44
|
try {
|
|
43
45
|
const respone = yield this.graphqlMutationV3(mutation, variables);
|
|
@@ -66,7 +68,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
66
68
|
const query = queries_1.GET_PAYMENT_METHOD_TYPES;
|
|
67
69
|
const variables = {
|
|
68
70
|
partnerId: this.orgId,
|
|
69
|
-
storeId: this.storeId
|
|
71
|
+
storeId: this.storeId
|
|
70
72
|
};
|
|
71
73
|
try {
|
|
72
74
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -81,7 +83,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
81
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
84
|
const query = queries_1.PAYMENT_INFO;
|
|
83
85
|
const variables = {
|
|
84
|
-
paymentId
|
|
86
|
+
paymentId
|
|
85
87
|
};
|
|
86
88
|
try {
|
|
87
89
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -100,7 +102,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
100
102
|
storeId: this.storeId,
|
|
101
103
|
methodTypeCode,
|
|
102
104
|
methodCode,
|
|
103
|
-
returnUrl
|
|
105
|
+
returnUrl
|
|
104
106
|
};
|
|
105
107
|
try {
|
|
106
108
|
const response = yield this.graphqlMutationV3(mutation, variables);
|
|
@@ -115,7 +117,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
115
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
118
|
const query = queries_1.PAYMENT_STATUS;
|
|
117
119
|
const variables = {
|
|
118
|
-
paymentId
|
|
120
|
+
paymentId
|
|
119
121
|
};
|
|
120
122
|
try {
|
|
121
123
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -130,7 +132,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
130
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
133
|
const query = queries_1.GW_CONFIG_DETAIL;
|
|
132
134
|
const variables = {
|
|
133
|
-
configId
|
|
135
|
+
configId
|
|
134
136
|
};
|
|
135
137
|
try {
|
|
136
138
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -148,7 +150,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
148
150
|
paymentId: paymentId,
|
|
149
151
|
transactionNo: transactionNo,
|
|
150
152
|
note: note,
|
|
151
|
-
confirmBy: confirmBy
|
|
153
|
+
confirmBy: confirmBy
|
|
152
154
|
};
|
|
153
155
|
try {
|
|
154
156
|
const response = yield this.graphqlMutationV3(mutation, variables);
|
|
@@ -163,7 +165,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
163
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
166
|
const query = queries_1.GET_PAYMENT_METHOD_TITLES;
|
|
165
167
|
const variables = {
|
|
166
|
-
methodCode
|
|
168
|
+
methodCode
|
|
167
169
|
};
|
|
168
170
|
try {
|
|
169
171
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -180,7 +182,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
180
182
|
const data = Object.assign(Object.assign({}, input), { partnerCode: this.orgId });
|
|
181
183
|
const variable = {
|
|
182
184
|
input: data,
|
|
183
|
-
cassoApiKey
|
|
185
|
+
cassoApiKey
|
|
184
186
|
};
|
|
185
187
|
try {
|
|
186
188
|
const response = yield this.graphqlMutationV3(mutation, variable);
|
|
@@ -197,7 +199,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
197
199
|
const data = Object.assign(Object.assign({}, input), { partnerCode: this.orgId });
|
|
198
200
|
const variable = {
|
|
199
201
|
input: data,
|
|
200
|
-
cassoApiKey
|
|
202
|
+
cassoApiKey
|
|
201
203
|
};
|
|
202
204
|
try {
|
|
203
205
|
const response = yield this.graphqlMutationV3(mutation, variable);
|
|
@@ -214,7 +216,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
214
216
|
const variables = {
|
|
215
217
|
partnerId: this.orgId,
|
|
216
218
|
methodCode,
|
|
217
|
-
storeId: this.storeId
|
|
219
|
+
storeId: this.storeId
|
|
218
220
|
};
|
|
219
221
|
try {
|
|
220
222
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -232,7 +234,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
232
234
|
partnerId: this.orgId,
|
|
233
235
|
storeId: this.storeId,
|
|
234
236
|
storeActive: storeActive,
|
|
235
|
-
allMethodTypes: allMethodTypes
|
|
237
|
+
allMethodTypes: allMethodTypes
|
|
236
238
|
};
|
|
237
239
|
try {
|
|
238
240
|
const response = yield this.graphqlQueryV3(queries, variables);
|
|
@@ -249,7 +251,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
249
251
|
const variables = {
|
|
250
252
|
partnerId: this.orgId,
|
|
251
253
|
storeId,
|
|
252
|
-
paymentId
|
|
254
|
+
paymentId
|
|
253
255
|
};
|
|
254
256
|
try {
|
|
255
257
|
const response = yield this.graphqlMutationV3(queries, variables);
|
|
@@ -260,5 +262,44 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
260
262
|
}
|
|
261
263
|
});
|
|
262
264
|
}
|
|
265
|
+
createPayment(paymentData) {
|
|
266
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
267
|
+
const mutation = mutations_1.CREATE_PAYMENT;
|
|
268
|
+
const variables = { paymentData };
|
|
269
|
+
try {
|
|
270
|
+
const response = yield this.graphqlMutationV3(mutation, variables);
|
|
271
|
+
return response.createPayment;
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
paymentMethodsByPartner(partnerCode) {
|
|
279
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
const query = queries_1.PAYMENT_METHODS_BY_PARTNER;
|
|
281
|
+
const variables = { partnerCode };
|
|
282
|
+
try {
|
|
283
|
+
const response = yield this.graphqlQueryV3(query, variables);
|
|
284
|
+
return response.paymentMethods;
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
throw error;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
getPaymentMethodTypesWithGatewayConfig(partnerId, storeId) {
|
|
292
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
const query = queries_1.GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG;
|
|
294
|
+
const variables = { partnerId, storeId };
|
|
295
|
+
try {
|
|
296
|
+
const response = yield this.graphqlQueryV3(query, variables);
|
|
297
|
+
return response.getPaymentMethodTypes;
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
263
304
|
}
|
|
264
305
|
exports.PaymentServiceV2 = PaymentServiceV2;
|