@longvansoftware/service-js-client 1.11.8 → 1.12.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.
@@ -14,6 +14,7 @@ exports.DEPOSIT_WALLET = (0, graphql_tag_1.gql) `
14
14
  $paymentMethodCode: String
15
15
  $sourcePayment: String
16
16
  $paymentType: String
17
+ $returnUrl: String
17
18
  $createBy: String
18
19
  ) {
19
20
  depositWallet(
@@ -27,6 +28,7 @@ exports.DEPOSIT_WALLET = (0, graphql_tag_1.gql) `
27
28
  paymentMethodCode: $paymentMethodCode
28
29
  sourcePayment: $sourcePayment
29
30
  paymentType: $paymentType
31
+ returnUrl: $returnUrl
30
32
  createBy: $createBy
31
33
  ) {
32
34
  order {
@@ -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
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.11.8",
3
+ "version": "1.12.0",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [