@longvansoftware/service-js-client 1.11.6 → 1.11.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.
@@ -82,11 +82,12 @@ exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
82
82
  // }
83
83
  // `;
84
84
  exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
85
- query SuggestVoucher($partyId: String, $excludeExpired: Boolean) {
85
+ query SuggestVoucher($partyId: String, $excludeExpired: Boolean, $customerId: String) {
86
86
  suggestVoucher(
87
87
  searchVoucherRequest: {
88
88
  partyId: $partyId
89
89
  excludeExpired: $excludeExpired
90
+ customerId: $customerId
90
91
  }
91
92
  ) {
92
93
  total
@@ -118,6 +119,9 @@ exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
118
119
  isBirthday
119
120
  customerId
120
121
  scope
122
+ affiliateId
123
+ maximumSpend
124
+ minimumSpend
121
125
  }
122
126
  }
123
127
  }
@@ -1,3 +1,4 @@
1
1
  export declare const PAYMENTS_BY_ORDERS: import("graphql").DocumentNode;
2
2
  export declare const GET_TRANSFER_INFO: import("graphql").DocumentNode;
3
3
  export declare const GET_PAYMENT_METHOD_TYPES: import("graphql").DocumentNode;
4
+ export declare const PAYMENT_METHODS: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_PAYMENT_METHOD_TYPES = exports.GET_TRANSFER_INFO = exports.PAYMENTS_BY_ORDERS = void 0;
3
+ exports.PAYMENT_METHODS = exports.GET_PAYMENT_METHOD_TYPES = exports.GET_TRANSFER_INFO = 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!]!) {
@@ -70,3 +70,14 @@ exports.GET_PAYMENT_METHOD_TYPES = (0, graphql_tag_1.gql) `
70
70
  }
71
71
  }
72
72
  `;
73
+ exports.PAYMENT_METHODS = (0, graphql_tag_1.gql) `
74
+ query PaymentMethods($partnerCode: String!) {
75
+ paymentMethods(partnerCode: $partnerCode) {
76
+ id
77
+ code
78
+ name
79
+ description
80
+ image
81
+ }
82
+ }
83
+ `;
@@ -6,6 +6,6 @@ export declare class CrmCampingService extends Service {
6
6
  searchProductQuantityPromotionAction(productId: string): Promise<any>;
7
7
  addCustomerToVoucher(userId: string, voucherCode: string): Promise<any>;
8
8
  getCampaignActionById(campaignActionId: string): Promise<any>;
9
- suggestVoucher(): Promise<any>;
9
+ suggestVoucher(customerId: string): Promise<any>;
10
10
  searchVouchers(campaignId: String, campaignActionId: String, campaignActionType: String, customerId: String, pageNumber: number, pageSize: number): Promise<any>;
11
11
  }
@@ -89,13 +89,15 @@ class CrmCampingService extends serviceSDK_1.Service {
89
89
  // throw error;
90
90
  // }
91
91
  // }
92
- suggestVoucher() {
92
+ suggestVoucher(customerId) {
93
93
  return __awaiter(this, void 0, void 0, function* () {
94
94
  const query = queries_1.SUGGEST_VOUCHER;
95
95
  const variables = {
96
96
  partyId: this.orgId,
97
97
  excludeExpired: true,
98
+ customerId
98
99
  };
100
+ console.log("cusID sdk", customerId);
99
101
  try {
100
102
  const response = yield this.graphqlQueryV2(query, variables);
101
103
  return response.suggestVoucher;
@@ -103,7 +103,8 @@ class OrderService extends serviceSDK_1.Service {
103
103
  */
104
104
  addVoucher(orderId, voucherCode) {
105
105
  return __awaiter(this, void 0, void 0, function* () {
106
- const endpoint = `/orders/${this.orgId}/${orderId}/voucher/${voucherCode}`;
106
+ const encodedVoucherCode = encodeURIComponent(voucherCode); // Mã hóa voucherCode
107
+ const endpoint = `/orders/${this.orgId}/${orderId}/voucher/${encodedVoucherCode}`;
107
108
  const method = "POST";
108
109
  try {
109
110
  const response = yield this.restApiCallWithToken(endpoint, method);
@@ -8,4 +8,5 @@ export declare class PaymentLVService extends Service {
8
8
  cancelPayment(paymentId: string, reason: string, createBy: string): Promise<any>;
9
9
  confirmPaidManual(paymentId: string, confirmBy: string): Promise<any>;
10
10
  getPaymentMethodTypes(store: string): Promise<any>;
11
+ paymentMethods(): Promise<any>;
11
12
  }
@@ -112,5 +112,21 @@ class PaymentLVService extends serviceSDK_1.Service {
112
112
  }
113
113
  });
114
114
  }
115
+ paymentMethods() {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const query = queries_1.PAYMENT_METHODS;
118
+ const variables = {
119
+ partnerCode: this.orgId,
120
+ };
121
+ try {
122
+ const response = yield this.graphqlQueryCustomHeader(query, variables);
123
+ return response.paymentMethods;
124
+ }
125
+ catch (error) {
126
+ console.log(`Error fetching get paymentMethods method: ${error}`);
127
+ throw error;
128
+ }
129
+ });
130
+ }
115
131
  }
116
132
  exports.PaymentLVService = PaymentLVService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.11.6",
3
+ "version": "1.11.9",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [