@longvansoftware/service-js-client 2.8.8 → 2.9.0

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.
Files changed (58) hide show
  1. package/dist/config/config.d.ts +2 -0
  2. package/dist/config/config.js +4 -2
  3. package/dist/src/graphql/campaign/queries.d.ts +11 -13
  4. package/dist/src/graphql/campaign/queries.js +111 -39
  5. package/dist/src/graphql/cashbook/mutation.d.ts +5 -0
  6. package/dist/src/graphql/cashbook/mutation.js +94 -0
  7. package/dist/src/graphql/cashbook/query.d.ts +3 -0
  8. package/dist/src/graphql/cashbook/query.js +27 -0
  9. package/dist/src/graphql/cloudCloud/mutations.d.ts +0 -2
  10. package/dist/src/graphql/cloudCloud/mutations.js +27 -101
  11. package/dist/src/graphql/cloudCloud/queries.js +0 -4
  12. package/dist/src/graphql/computing/queries.d.ts +1 -0
  13. package/dist/src/graphql/computing/queries.js +6 -1
  14. package/dist/src/graphql/crm/queries.d.ts +1 -0
  15. package/dist/src/graphql/crm/queries.js +20 -1
  16. package/dist/src/graphql/orderCloud/mutations.d.ts +1 -3
  17. package/dist/src/graphql/orderCloud/mutations.js +5 -21
  18. package/dist/src/graphql/paymentV2/mutations.d.ts +0 -1
  19. package/dist/src/graphql/paymentV2/mutations.js +37 -23
  20. package/dist/src/graphql/paymentV2/queries.d.ts +0 -2
  21. package/dist/src/graphql/paymentV2/queries.js +1 -58
  22. package/dist/src/lib/SDK.d.ts +3 -0
  23. package/dist/src/lib/SDK.js +4 -0
  24. package/dist/src/lib/campaign/index.d.ts +0 -1
  25. package/dist/src/lib/campaign/index.js +12 -69
  26. package/dist/src/lib/cashbook/index.d.ts +23 -3
  27. package/dist/src/lib/cashbook/index.js +90 -20
  28. package/dist/src/lib/cloudCloud/index.d.ts +0 -1
  29. package/dist/src/lib/cloudCloud/index.js +0 -16
  30. package/dist/src/lib/computing/index.d.ts +1 -0
  31. package/dist/src/lib/computing/index.js +16 -0
  32. package/dist/src/lib/crm/index.d.ts +1 -0
  33. package/dist/src/lib/crm/index.js +17 -0
  34. package/dist/src/lib/orderCloud/index.d.ts +0 -2
  35. package/dist/src/lib/orderCloud/index.js +1 -47
  36. package/dist/src/lib/paymentV2/index.d.ts +1 -11
  37. package/dist/src/lib/paymentV2/index.js +14 -55
  38. package/dist/src/lib/portal/index.d.ts +2 -10
  39. package/dist/src/lib/portal/index.js +11 -171
  40. package/dist/src/lib/service.d.ts +14 -0
  41. package/dist/src/lib/service.js +101 -0
  42. package/dist/src/utils/build-field-string.d.ts +1 -0
  43. package/dist/src/utils/build-field-string.js +16 -0
  44. package/package.json +1 -1
  45. package/dist/src/graphql/storefont/mutation.d.ts +0 -4
  46. package/dist/src/graphql/storefont/mutation.js +0 -56
  47. package/dist/src/graphql/storefont/queries.d.ts +0 -5
  48. package/dist/src/graphql/storefont/queries.js +0 -106
  49. package/dist/src/graphql/tag/mutations.d.ts +0 -2
  50. package/dist/src/graphql/tag/mutations.js +0 -44
  51. package/dist/src/graphql/tag/queries.d.ts +0 -1
  52. package/dist/src/graphql/tag/queries.js +0 -20
  53. package/dist/src/lib/imageGateway/index.d.ts +0 -6
  54. package/dist/src/lib/imageGateway/index.js +0 -18
  55. package/dist/src/lib/storefont/index.d.ts +0 -23
  56. package/dist/src/lib/storefont/index.js +0 -160
  57. package/dist/src/lib/tag/index.d.ts +0 -7
  58. package/dist/src/lib/tag/index.js +0 -61
@@ -1,28 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MERGE_ORDER_CART = exports.FIND_ORDER_BY_OWNER_PARTYID = void 0;
3
+ exports.FIND_ORDER_BY_OWNER_PARTYID = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
- const helpers_1 = require("../../utils/helpers");
6
5
  exports.FIND_ORDER_BY_OWNER_PARTYID = (0, graphql_tag_1.gql) `
7
- mutation FindOrderByOwnerPartyId($partnerId: String!, $ownerPartyId: String!) {
6
+ mutation FindOrderByOwnerPartyId(
7
+ $partnerId: String!
8
+ $ownerPartyId: String!
9
+ ) {
8
10
  findOrderByOwnerPartyId(partnerId: $partnerId, ownerPartyId: $ownerPartyId)
9
11
  }
10
12
  `;
11
- const MERGE_ORDER_CART = (fields = []) => {
12
- return (0, graphql_tag_1.gql) `
13
- mutation MergeOrderCart(
14
- $oldCartId: String!
15
- $newCartId: String!
16
- $actorId: String!
17
- ) {
18
- mergeOrderCart(
19
- input: {
20
- oldCartId: $oldCartId
21
- newCartId: $newCartId
22
- actorId: $actorId
23
- }
24
- ) ${(0, helpers_1.hasFields)(fields) ? `{ ${(0, helpers_1.joinField)(fields)} }` : ""}
25
- }
26
- `;
27
- };
28
- exports.MERGE_ORDER_CART = MERGE_ORDER_CART;
@@ -2,5 +2,4 @@ export declare const CANCEL_PAYMENT: import("graphql").DocumentNode;
2
2
  export declare const CONFIRM_TO_GATEWAY: import("graphql").DocumentNode;
3
3
  export declare const CONFIRM_PAYMENT_SUCCESS_MANUAL: import("graphql").DocumentNode;
4
4
  export declare const HANDLE_UPDATE_GATEWAY_CONFIG: import("graphql").DocumentNode;
5
- export declare const CREATE_PAYMENT: import("graphql").DocumentNode;
6
5
  export declare const HANDLE_CREATE_GATEWAY_CONFIG: import("graphql").DocumentNode;
@@ -1,15 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HANDLE_CREATE_GATEWAY_CONFIG = exports.CREATE_PAYMENT = exports.HANDLE_UPDATE_GATEWAY_CONFIG = exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = exports.CONFIRM_TO_GATEWAY = exports.CANCEL_PAYMENT = void 0;
3
+ exports.HANDLE_CREATE_GATEWAY_CONFIG = exports.HANDLE_UPDATE_GATEWAY_CONFIG = exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = exports.CONFIRM_TO_GATEWAY = exports.CANCEL_PAYMENT = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CANCEL_PAYMENT = (0, graphql_tag_1.gql) `
6
- mutation CancelPayment($paymentId: String!, $reason: String!, $safeMode: Boolean, $createBy: String) {
7
- cancelPayment(paymentId: $paymentId, reason: $reason, safeMode: $safeMode, createBy: $createBy)
6
+ mutation CancelPayment($paymentId: String!, $reason: String!) {
7
+ cancelPayment(paymentId: $paymentId, reason: $reason)
8
8
  }
9
9
  `;
10
10
  exports.CONFIRM_TO_GATEWAY = (0, graphql_tag_1.gql) `
11
- mutation ConfirmToGateWay($paymentId: String!, $storeId: String, $methodTypeCode: String, $methodCode: String, $returnUrl: String) {
12
- confirmToGateway(paymentId: $paymentId, storeId: $storeId, methodTypeCode: $methodTypeCode, methodCode: $methodCode, returnUrl: $returnUrl) {
11
+ mutation ConfirmToGateWay(
12
+ $paymentId: String!
13
+ $storeId: String
14
+ $methodTypeCode: String
15
+ $methodCode: String
16
+ $returnUrl: String
17
+ ) {
18
+ confirmToGateway(
19
+ paymentId: $paymentId
20
+ storeId: $storeId
21
+ methodTypeCode: $methodTypeCode
22
+ methodCode: $methodCode
23
+ returnUrl: $returnUrl
24
+ ) {
13
25
  code
14
26
  message
15
27
  data
@@ -22,8 +34,18 @@ exports.CONFIRM_TO_GATEWAY = (0, graphql_tag_1.gql) `
22
34
  }
23
35
  `;
24
36
  exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = (0, graphql_tag_1.gql) `
25
- mutation ConfirmPaymentSuccessManual($paymentId: String!, $transactionNo: String!, $note: String, $confirmBy: String!) {
26
- confirmPaymentSuccessManual(paymentId: $paymentId, transactionNo: $transactionNo, note: $note, confirmBy: $confirmBy) {
37
+ mutation ConfirmPaymentSuccessManual(
38
+ $paymentId: String!
39
+ $transactionNo: String!
40
+ $note: String
41
+ $confirmBy: String!
42
+ ) {
43
+ confirmPaymentSuccessManual(
44
+ paymentId: $paymentId
45
+ transactionNo: $transactionNo
46
+ note: $note
47
+ confirmBy: $confirmBy
48
+ ) {
27
49
  code
28
50
  message
29
51
  data
@@ -35,7 +57,10 @@ exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = (0, graphql_tag_1.gql) `
35
57
  }
36
58
  `;
37
59
  exports.HANDLE_UPDATE_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
38
- mutation HandleUpdateGatewayConfig($input: PaymentGatewayConfigInput!, $cassoApiKey: String) {
60
+ mutation HandleUpdateGatewayConfig(
61
+ $input: PaymentGatewayConfigInput!
62
+ $cassoApiKey: String
63
+ ) {
39
64
  handleUpdateGatewayConfig(input: $input, cassoApiKey: $cassoApiKey) {
40
65
  id
41
66
  methodCode
@@ -64,22 +89,11 @@ exports.HANDLE_UPDATE_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
64
89
  }
65
90
  }
66
91
  `;
67
- exports.CREATE_PAYMENT = (0, graphql_tag_1.gql) `
68
- mutation CreatePayment($paymentData: Payment) {
69
- createPayment(paymentData: $paymentData) {
70
- code
71
- message
72
- data
73
- qrCodeUrl
74
- deeplink
75
- deeplinkMiniApp
76
- paymentId
77
- gwConfigId
78
- }
79
- }
80
- `;
81
92
  exports.HANDLE_CREATE_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
82
- mutation HandleCreateGatewayConfig($input: PaymentGatewayConfigInput!, $cassoApiKey: String) {
93
+ mutation HandleCreateGatewayConfig(
94
+ $input: PaymentGatewayConfigInput!
95
+ $cassoApiKey: String
96
+ ) {
83
97
  handleCreateGatewayConfig(input: $input, cassoApiKey: $cassoApiKey) {
84
98
  id
85
99
  methodCode
@@ -7,6 +7,4 @@ export declare const GW_CONFIG_DETAIL: import("graphql").DocumentNode;
7
7
  export declare const GET_PAYMENT_METHOD_TITLES: import("graphql").DocumentNode;
8
8
  export declare const GET_PAYEMNT_GATEWAYS_BY_METHOD_CODE: import("graphql").DocumentNode;
9
9
  export declare const GET_PAYMENT_METHOD_TYPES_V2: import("graphql").DocumentNode;
10
- export declare const GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG: import("graphql").DocumentNode;
11
10
  export declare const GET_TRANSFER_INFO: import("graphql").DocumentNode;
12
- export declare const PAYMENT_METHODS_BY_PARTNER: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PAYMENT_METHODS_BY_PARTNER = exports.GET_TRANSFER_INFO = exports.GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG = 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;
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
- `;
@@ -23,6 +23,7 @@ import { ContentApiService } from "./content_api";
23
23
  import { MarketPlaceService } from "./marketplace";
24
24
  import { StorefrontService } from "./storefront";
25
25
  import { DynamicCollectionService } from "./dynamic_collection";
26
+ import { Cashbook } from "./cashbook";
26
27
  export interface Endpoints {
27
28
  product: string;
28
29
  crm: string;
@@ -49,6 +50,7 @@ export interface Endpoints {
49
50
  marketplace: string;
50
51
  storefront: string;
51
52
  dynamic_collection: string;
53
+ cashbook: string;
52
54
  }
53
55
  export declare class SDK {
54
56
  orgId: string;
@@ -80,6 +82,7 @@ export declare class SDK {
80
82
  storefront: StorefrontService;
81
83
  content_api: ContentApiService;
82
84
  dynamic_collection: DynamicCollectionService;
85
+ cashbook: Cashbook;
83
86
  token: string | null;
84
87
  private endpoints;
85
88
  constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
@@ -29,6 +29,7 @@ const content_api_1 = require("./content_api");
29
29
  const marketplace_1 = require("./marketplace");
30
30
  const storefront_1 = require("./storefront");
31
31
  const dynamic_collection_1 = require("./dynamic_collection");
32
+ const cashbook_1 = require("./cashbook");
32
33
  class SDK {
33
34
  constructor(orgId, storeId, storefrontAccessToken, environment) {
34
35
  this.orgId = orgId;
@@ -66,6 +67,7 @@ class SDK {
66
67
  this.dynamic_collection = new dynamic_collection_1.DynamicCollectionService(this.endpoints.dynamic_collection, orgId, storeId);
67
68
  // Initialize other services here
68
69
  this.storefront = new storefront_1.StorefrontService(this.endpoints.storefront, orgId, storeId);
70
+ this.cashbook = new cashbook_1.Cashbook(this.endpoints.cashbook, orgId, storeId);
69
71
  }
70
72
  setToken(token) {
71
73
  this.token = token;
@@ -95,6 +97,7 @@ class SDK {
95
97
  this.marketplace.setToken(token);
96
98
  this.storefront.setToken(token);
97
99
  this.dynamic_collection.setToken(token);
100
+ this.cashbook.setToken(token);
98
101
  // Set token for other services here
99
102
  }
100
103
  // các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
@@ -127,6 +130,7 @@ class SDK {
127
130
  this.marketplace = new marketplace_1.MarketPlaceService(this.endpoints.marketplace, this.orgId, storeId);
128
131
  this.storefront = new storefront_1.StorefrontService(this.endpoints.storefront, this.orgId, storeId);
129
132
  this.dynamic_collection = new dynamic_collection_1.DynamicCollectionService(this.endpoints.dynamic_collection, this.orgId, storeId);
133
+ this.cashbook = new cashbook_1.Cashbook(this.endpoints.cashbook, this.orgId, storeId);
130
134
  }
131
135
  }
132
136
  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;
@@ -1,6 +1,26 @@
1
1
  import { Service } from "../serviceSDK";
2
- export declare class CashbookService extends Service {
2
+ export declare class Cashbook extends Service {
3
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>;
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.CashbookService = void 0;
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
- const queries_1 = require("../../graphql/cashbook/queries");
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
- searchTransactions(keyword, dateFrom, dateTo, currentPage, pageSize) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const query = queries_1.SEARCH_TRANSACTIONS;
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
- keyword,
25
- dateFrom,
26
- dateTo,
27
- currentPage,
28
- pageSize,
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.graphqlQueryV3(query, variables);
32
- return response.searchTransactions;
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
- getCashbookTransactionDetail(cashTransactionId) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const query = queries_1.GET_CASHBOOK_TRANSACTION_DETAIL;
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
- cashTransactionId,
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.graphqlQueryV3(query, variables);
48
- return response.getCashbookTransactionDetail;
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.CashbookService = CashbookService;
126
+ exports.Cashbook = Cashbook;
@@ -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;
@@ -70,4 +70,5 @@ export declare class ComputingService extends Service {
70
70
  resizeDisk(computingId: string, diskIndex: number, size: number, unit: string): Promise<any>;
71
71
  isTemplateSupportExtendDiskAuto(computingId: string, diskIndex: number): Promise<any>;
72
72
  getScriptExtendDisk(templateId: string): Promise<any>;
73
+ isComputingOn(computingId: string): Promise<any>;
73
74
  }
@@ -1083,5 +1083,21 @@ class ComputingService extends serviceSDK_1.Service {
1083
1083
  }
1084
1084
  });
1085
1085
  }
1086
+ isComputingOn(computingId) {
1087
+ return __awaiter(this, void 0, void 0, function* () {
1088
+ const query = queries_1.IS_COMPUTING_ON;
1089
+ const variables = {
1090
+ computingId
1091
+ };
1092
+ try {
1093
+ const response = yield this.graphqlQueryV2(query, variables);
1094
+ return response.isComputingOn;
1095
+ }
1096
+ catch (error) {
1097
+ console.log(`Error in isComputingOn: ${error}`);
1098
+ throw error;
1099
+ }
1100
+ });
1101
+ }
1086
1102
  }
1087
1103
  exports.ComputingService = ComputingService;