@longvansoftware/service-js-client 2.8.5 → 2.8.6
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 +11 -13
- package/dist/src/graphql/campaign/queries.js +111 -39
- package/dist/src/graphql/cloudCloud/mutations.d.ts +0 -2
- package/dist/src/graphql/cloudCloud/mutations.js +27 -101
- package/dist/src/graphql/cloudCloud/queries.js +0 -4
- package/dist/src/graphql/dynamic_collection/mutations.d.ts +0 -0
- package/dist/src/graphql/dynamic_collection/mutations.js +1 -0
- package/dist/src/graphql/dynamic_collection/queries.d.ts +0 -0
- package/dist/src/graphql/dynamic_collection/queries.js +1 -0
- package/dist/src/graphql/orderCloud/mutations.d.ts +1 -3
- package/dist/src/graphql/orderCloud/mutations.js +5 -21
- package/dist/src/graphql/paymentV2/mutations.d.ts +0 -1
- package/dist/src/graphql/paymentV2/mutations.js +37 -23
- package/dist/src/graphql/paymentV2/queries.d.ts +0 -2
- package/dist/src/graphql/paymentV2/queries.js +1 -58
- 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 +0 -1
- package/dist/src/lib/campaign/index.js +12 -69
- package/dist/src/lib/cloudCloud/index.d.ts +0 -1
- package/dist/src/lib/cloudCloud/index.js +0 -16
- package/dist/src/lib/dynamic_collection/index.d.ts +13 -0
- package/dist/src/lib/{storefont → dynamic_collection}/index.js +19 -15
- package/dist/src/lib/orderCloud/index.d.ts +0 -2
- package/dist/src/lib/orderCloud/index.js +1 -47
- package/dist/src/lib/paymentV2/index.d.ts +1 -11
- package/dist/src/lib/paymentV2/index.js +14 -55
- package/dist/src/lib/portal/index.d.ts +2 -10
- package/dist/src/lib/portal/index.js +11 -171
- package/dist/src/lib/service.d.ts +14 -0
- package/dist/src/lib/service.js +101 -0
- package/dist/src/utils/build-field-string.d.ts +1 -0
- package/dist/src/utils/build-field-string.js +16 -0
- package/package.json +1 -1
- package/dist/src/graphql/storefont/mutation.d.ts +0 -2
- package/dist/src/graphql/storefont/mutation.js +0 -28
- package/dist/src/graphql/storefont/queries.d.ts +0 -5
- package/dist/src/graphql/storefont/queries.js +0 -99
- package/dist/src/graphql/tag/mutations.d.ts +0 -2
- package/dist/src/graphql/tag/mutations.js +0 -44
- package/dist/src/graphql/tag/queries.d.ts +0 -1
- package/dist/src/graphql/tag/queries.js +0 -20
- package/dist/src/lib/imageGateway/index.d.ts +0 -6
- package/dist/src/lib/imageGateway/index.js +0 -18
- package/dist/src/lib/storefont/index.d.ts +0 -6
- package/dist/src/lib/tag/index.d.ts +0 -7
- package/dist/src/lib/tag/index.js +0 -61
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GET_TRANSFER_INFO = exports.GET_PAYMENT_METHOD_TYPES_V2 = exports.GET_PAYEMNT_GATEWAYS_BY_METHOD_CODE = exports.GET_PAYMENT_METHOD_TITLES = exports.GW_CONFIG_DETAIL = exports.PAYMENT_STATUS = exports.PAYMENT_INFO = exports.GET_PAYMENT_METHOD_TYPES = exports.PAYMENT_METHODS = exports.PAYMENTS_BY_ORDERS = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.PAYMENTS_BY_ORDERS = (0, graphql_tag_1.gql) `
|
|
6
6
|
query PaymentsByOrders($orderIds: [String!]!) {
|
|
@@ -255,44 +255,6 @@ exports.GET_PAYMENT_METHOD_TYPES_V2 = (0, graphql_tag_1.gql) `
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
`;
|
|
258
|
-
exports.GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
|
|
259
|
-
query GetPaymentMethodTypesWithGatewayConfig(
|
|
260
|
-
$partnerId: String!
|
|
261
|
-
$storeId: String!
|
|
262
|
-
) {
|
|
263
|
-
getPaymentMethodTypes(partnerId: $partnerId, storeId: $storeId) {
|
|
264
|
-
code
|
|
265
|
-
name
|
|
266
|
-
description
|
|
267
|
-
image
|
|
268
|
-
storeActive
|
|
269
|
-
paymentGatewayConfig {
|
|
270
|
-
id
|
|
271
|
-
methodCode
|
|
272
|
-
partnerCode
|
|
273
|
-
subMethodCode
|
|
274
|
-
gwPartnerCode
|
|
275
|
-
gwPartnerName
|
|
276
|
-
gwPaymentMethod
|
|
277
|
-
gwSubChannel
|
|
278
|
-
gwMethodVersion
|
|
279
|
-
hashAlgorithm
|
|
280
|
-
accessKey
|
|
281
|
-
secretKey
|
|
282
|
-
responseUrl
|
|
283
|
-
requestUrl
|
|
284
|
-
methodType
|
|
285
|
-
publicKey
|
|
286
|
-
redirectUrl
|
|
287
|
-
activated
|
|
288
|
-
paymentRecordingMethod
|
|
289
|
-
userId
|
|
290
|
-
name
|
|
291
|
-
description
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
`;
|
|
296
258
|
exports.GET_TRANSFER_INFO = (0, graphql_tag_1.gql) `
|
|
297
259
|
query GetTransferInfo(
|
|
298
260
|
$partnerId: String!
|
|
@@ -313,22 +275,3 @@ exports.GET_TRANSFER_INFO = (0, graphql_tag_1.gql) `
|
|
|
313
275
|
}
|
|
314
276
|
}
|
|
315
277
|
`;
|
|
316
|
-
exports.PAYMENT_METHODS_BY_PARTNER = (0, graphql_tag_1.gql) `
|
|
317
|
-
query PaymentMethodsByPartner($partnerCode: String) {
|
|
318
|
-
paymentMethods(partnerCode: $partnerCode ) {
|
|
319
|
-
id
|
|
320
|
-
code
|
|
321
|
-
description
|
|
322
|
-
image
|
|
323
|
-
name
|
|
324
|
-
titles {
|
|
325
|
-
id
|
|
326
|
-
code
|
|
327
|
-
name
|
|
328
|
-
lang
|
|
329
|
-
showField
|
|
330
|
-
required
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
`;
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { StorageS3Service } from "./storage_s3";
|
|
|
22
22
|
import { ContentApiService } from "./content_api";
|
|
23
23
|
import { MarketPlaceService } from "./marketplace";
|
|
24
24
|
import { StorefrontService } from "./storefront";
|
|
25
|
+
import { DynamicCollectionService } from "./dynamic_collection";
|
|
25
26
|
export interface Endpoints {
|
|
26
27
|
product: string;
|
|
27
28
|
crm: string;
|
|
@@ -47,6 +48,7 @@ export interface Endpoints {
|
|
|
47
48
|
content_api: string;
|
|
48
49
|
marketplace: string;
|
|
49
50
|
storefront: string;
|
|
51
|
+
dynamic_collection: string;
|
|
50
52
|
}
|
|
51
53
|
export declare class SDK {
|
|
52
54
|
orgId: string;
|
|
@@ -77,6 +79,7 @@ export declare class SDK {
|
|
|
77
79
|
marketplace: MarketPlaceService;
|
|
78
80
|
storefront: StorefrontService;
|
|
79
81
|
content_api: ContentApiService;
|
|
82
|
+
dynamic_collection: DynamicCollectionService;
|
|
80
83
|
token: string | null;
|
|
81
84
|
private endpoints;
|
|
82
85
|
constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -28,6 +28,7 @@ const storage_s3_1 = require("./storage_s3");
|
|
|
28
28
|
const content_api_1 = require("./content_api");
|
|
29
29
|
const marketplace_1 = require("./marketplace");
|
|
30
30
|
const storefront_1 = require("./storefront");
|
|
31
|
+
const dynamic_collection_1 = require("./dynamic_collection");
|
|
31
32
|
class SDK {
|
|
32
33
|
constructor(orgId, storeId, storefrontAccessToken, environment) {
|
|
33
34
|
this.orgId = orgId;
|
|
@@ -62,6 +63,7 @@ class SDK {
|
|
|
62
63
|
this.storage_s3 = new storage_s3_1.StorageS3Service(this.endpoints.storage_s3, orgId, storeId);
|
|
63
64
|
this.content_api = new content_api_1.ContentApiService(this.endpoints.content_api, orgId, storeId);
|
|
64
65
|
this.marketplace = new marketplace_1.MarketPlaceService(this.endpoints.marketplace, orgId, storeId);
|
|
66
|
+
this.dynamic_collection = new dynamic_collection_1.DynamicCollectionService(this.endpoints.dynamic_collection, orgId, storeId);
|
|
65
67
|
// Initialize other services here
|
|
66
68
|
this.storefront = new storefront_1.StorefrontService(this.endpoints.storefront, orgId, storeId);
|
|
67
69
|
}
|
|
@@ -92,6 +94,7 @@ class SDK {
|
|
|
92
94
|
this.content_api.setToken(token);
|
|
93
95
|
this.marketplace.setToken(token);
|
|
94
96
|
this.storefront.setToken(token);
|
|
97
|
+
this.dynamic_collection.setToken(token);
|
|
95
98
|
// Set token for other services here
|
|
96
99
|
}
|
|
97
100
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
|
@@ -123,6 +126,7 @@ class SDK {
|
|
|
123
126
|
this.content_api = new content_api_1.ContentApiService(this.endpoints.content_api, this.orgId, storeId);
|
|
124
127
|
this.marketplace = new marketplace_1.MarketPlaceService(this.endpoints.marketplace, this.orgId, storeId);
|
|
125
128
|
this.storefront = new storefront_1.StorefrontService(this.endpoints.storefront, this.orgId, storeId);
|
|
129
|
+
this.dynamic_collection = new dynamic_collection_1.DynamicCollectionService(this.endpoints.dynamic_collection, this.orgId, storeId);
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
exports.SDK = SDK;
|
|
@@ -19,5 +19,4 @@ export declare class CampaignService extends Service {
|
|
|
19
19
|
searchProductGiftPromotionResponse(productIds: string[], campaignActionId: string): Promise<any>;
|
|
20
20
|
getCampaign(id: string): Promise<any>;
|
|
21
21
|
searchProductPricePromotionResponse(campaignId: string, campaignActionId: string, statusActive: string): Promise<any>;
|
|
22
|
-
voucherForUserRequest(orderId: string, customerId?: string, paymentMethodId?: string, shippingCompanyId?: string, pageNumber?: number, pageSize?: number, fields?: string[]): Promise<any>;
|
|
23
22
|
}
|
|
@@ -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,62 +248,5 @@ 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
|
-
}
|
|
308
251
|
}
|
|
309
252
|
exports.CampaignService = CampaignService;
|
|
@@ -9,5 +9,4 @@ 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>;
|
|
13
12
|
}
|
|
@@ -138,21 +138,5 @@ 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
|
-
}
|
|
157
141
|
}
|
|
158
142
|
exports.CloudCloudService = CloudCloudService;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class DynamicCollectionService extends Service {
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a new ProductService 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
|
+
setToken(token: string): void;
|
|
11
|
+
setStoreId(storeId: string): void;
|
|
12
|
+
getSlugPathView(slug: string, type: string): Promise<any>;
|
|
13
|
+
}
|
|
@@ -9,33 +9,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const mutation_1 = require("../../graphql/storefont/mutation");
|
|
12
|
+
exports.DynamicCollectionService = void 0;
|
|
14
13
|
const serviceSDK_1 = require("../serviceSDK");
|
|
15
|
-
class
|
|
14
|
+
class DynamicCollectionService extends serviceSDK_1.Service {
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new ProductService instance.
|
|
17
|
+
* @param endpoint - The endpoint URL for the service.
|
|
18
|
+
* @param orgId - The organization ID.
|
|
19
|
+
* @param storeId - The store ID.
|
|
20
|
+
*/
|
|
16
21
|
constructor(endpoint, orgId, storeId) {
|
|
17
22
|
super(endpoint, orgId, storeId);
|
|
18
23
|
}
|
|
19
24
|
setToken(token) {
|
|
20
25
|
this.token = token;
|
|
21
26
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
isAllowedToMergeItem
|
|
30
|
-
};
|
|
27
|
+
setStoreId(storeId) {
|
|
28
|
+
this.storeId = storeId;
|
|
29
|
+
}
|
|
30
|
+
getSlugPathView(slug, type) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const endpoint = `/public/v2/records/slug_path/slug_path_view?slug=${slug}&type=${type}&platform=${this.storeId}`;
|
|
33
|
+
const method = "GET";
|
|
31
34
|
try {
|
|
32
|
-
const response = yield this.
|
|
33
|
-
return response
|
|
35
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
36
|
+
return response;
|
|
34
37
|
}
|
|
35
38
|
catch (error) {
|
|
39
|
+
console.log(`Error in getSlugPathView: ${error}`);
|
|
36
40
|
throw error;
|
|
37
41
|
}
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
exports.
|
|
45
|
+
exports.DynamicCollectionService = DynamicCollectionService;
|
|
@@ -2,6 +2,4 @@ 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>;
|
|
7
5
|
}
|
|
@@ -12,8 +12,6 @@ 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");
|
|
17
15
|
class OrderCloudService extends serviceSDK_1.Service {
|
|
18
16
|
constructor(endpoint, orgId, storeId) {
|
|
19
17
|
super(endpoint, orgId, storeId);
|
|
@@ -24,7 +22,7 @@ class OrderCloudService extends serviceSDK_1.Service {
|
|
|
24
22
|
const query = queries_1.FIND_ORDER_BY_OWNER_PARTYID;
|
|
25
23
|
const variables = {
|
|
26
24
|
partnerId: this.orgId,
|
|
27
|
-
ownerPartyId
|
|
25
|
+
ownerPartyId,
|
|
28
26
|
};
|
|
29
27
|
try {
|
|
30
28
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -35,49 +33,5 @@ class OrderCloudService extends serviceSDK_1.Service {
|
|
|
35
33
|
}
|
|
36
34
|
});
|
|
37
35
|
}
|
|
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
|
-
}
|
|
82
36
|
}
|
|
83
37
|
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
|
|
5
|
+
cancelPayment(paymentId: string, reason: string): Promise<any>;
|
|
6
6
|
paymentMethods(): Promise<any>;
|
|
7
7
|
getPaymentMethodTypes(): Promise<any>;
|
|
8
8
|
paymentInfo(paymentId: string): Promise<any>;
|
|
@@ -16,14 +16,4 @@ 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>;
|
|
29
19
|
}
|
|
@@ -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,14 +32,12 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
cancelPayment(paymentId, reason
|
|
35
|
+
cancelPayment(paymentId, reason) {
|
|
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
|
|
43
41
|
};
|
|
44
42
|
try {
|
|
45
43
|
const respone = yield this.graphqlMutationV3(mutation, variables);
|
|
@@ -68,7 +66,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
68
66
|
const query = queries_1.GET_PAYMENT_METHOD_TYPES;
|
|
69
67
|
const variables = {
|
|
70
68
|
partnerId: this.orgId,
|
|
71
|
-
storeId: this.storeId
|
|
69
|
+
storeId: this.storeId,
|
|
72
70
|
};
|
|
73
71
|
try {
|
|
74
72
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -83,7 +81,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
83
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
82
|
const query = queries_1.PAYMENT_INFO;
|
|
85
83
|
const variables = {
|
|
86
|
-
paymentId
|
|
84
|
+
paymentId,
|
|
87
85
|
};
|
|
88
86
|
try {
|
|
89
87
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -102,7 +100,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
102
100
|
storeId: this.storeId,
|
|
103
101
|
methodTypeCode,
|
|
104
102
|
methodCode,
|
|
105
|
-
returnUrl
|
|
103
|
+
returnUrl,
|
|
106
104
|
};
|
|
107
105
|
try {
|
|
108
106
|
const response = yield this.graphqlMutationV3(mutation, variables);
|
|
@@ -117,7 +115,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
117
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
116
|
const query = queries_1.PAYMENT_STATUS;
|
|
119
117
|
const variables = {
|
|
120
|
-
paymentId
|
|
118
|
+
paymentId,
|
|
121
119
|
};
|
|
122
120
|
try {
|
|
123
121
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -132,7 +130,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
132
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
131
|
const query = queries_1.GW_CONFIG_DETAIL;
|
|
134
132
|
const variables = {
|
|
135
|
-
configId
|
|
133
|
+
configId,
|
|
136
134
|
};
|
|
137
135
|
try {
|
|
138
136
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -150,7 +148,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
150
148
|
paymentId: paymentId,
|
|
151
149
|
transactionNo: transactionNo,
|
|
152
150
|
note: note,
|
|
153
|
-
confirmBy: confirmBy
|
|
151
|
+
confirmBy: confirmBy,
|
|
154
152
|
};
|
|
155
153
|
try {
|
|
156
154
|
const response = yield this.graphqlMutationV3(mutation, variables);
|
|
@@ -165,7 +163,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
165
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
164
|
const query = queries_1.GET_PAYMENT_METHOD_TITLES;
|
|
167
165
|
const variables = {
|
|
168
|
-
methodCode
|
|
166
|
+
methodCode,
|
|
169
167
|
};
|
|
170
168
|
try {
|
|
171
169
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -182,7 +180,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
182
180
|
const data = Object.assign(Object.assign({}, input), { partnerCode: this.orgId });
|
|
183
181
|
const variable = {
|
|
184
182
|
input: data,
|
|
185
|
-
cassoApiKey
|
|
183
|
+
cassoApiKey,
|
|
186
184
|
};
|
|
187
185
|
try {
|
|
188
186
|
const response = yield this.graphqlMutationV3(mutation, variable);
|
|
@@ -199,7 +197,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
199
197
|
const data = Object.assign(Object.assign({}, input), { partnerCode: this.orgId });
|
|
200
198
|
const variable = {
|
|
201
199
|
input: data,
|
|
202
|
-
cassoApiKey
|
|
200
|
+
cassoApiKey,
|
|
203
201
|
};
|
|
204
202
|
try {
|
|
205
203
|
const response = yield this.graphqlMutationV3(mutation, variable);
|
|
@@ -216,7 +214,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
216
214
|
const variables = {
|
|
217
215
|
partnerId: this.orgId,
|
|
218
216
|
methodCode,
|
|
219
|
-
storeId: this.storeId
|
|
217
|
+
storeId: this.storeId,
|
|
220
218
|
};
|
|
221
219
|
try {
|
|
222
220
|
const response = yield this.graphqlQueryV3(query, variables);
|
|
@@ -234,7 +232,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
234
232
|
partnerId: this.orgId,
|
|
235
233
|
storeId: this.storeId,
|
|
236
234
|
storeActive: storeActive,
|
|
237
|
-
allMethodTypes: allMethodTypes
|
|
235
|
+
allMethodTypes: allMethodTypes,
|
|
238
236
|
};
|
|
239
237
|
try {
|
|
240
238
|
const response = yield this.graphqlQueryV3(queries, variables);
|
|
@@ -251,7 +249,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
251
249
|
const variables = {
|
|
252
250
|
partnerId: this.orgId,
|
|
253
251
|
storeId,
|
|
254
|
-
paymentId
|
|
252
|
+
paymentId,
|
|
255
253
|
};
|
|
256
254
|
try {
|
|
257
255
|
const response = yield this.graphqlMutationV3(queries, variables);
|
|
@@ -262,44 +260,5 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
262
260
|
}
|
|
263
261
|
});
|
|
264
262
|
}
|
|
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
|
-
}
|
|
304
263
|
}
|
|
305
264
|
exports.PaymentServiceV2 = PaymentServiceV2;
|