@longvansoftware/service-js-client 1.6.6 → 1.6.8

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.
@@ -0,0 +1 @@
1
+ export declare const ADD_CUSTOMER_TO_VOUCHER: import("graphql").DocumentNode;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ADD_CUSTOMER_TO_VOUCHER = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ exports.ADD_CUSTOMER_TO_VOUCHER = (0, graphql_tag_1.gql) `
6
+ mutation AddCustomerToVoucher(
7
+ $partyId: String!
8
+ $userId: String!
9
+ $campaignActionId: String!
10
+ ) {
11
+ addCustomerToVoucher(
12
+ partyId: $partyId
13
+ userId: $userId
14
+ campaignActionId: $campaignActionId
15
+ ) {
16
+ campaignActionId
17
+ campaignId
18
+ partyId
19
+ voucherCode
20
+ voucherType
21
+ status
22
+ discountAmount
23
+ discountPercent
24
+ usageLimitPerVoucher
25
+ maximumDiscount
26
+ numberOfTimeUsed
27
+ id
28
+ createdStamp
29
+ updatedStamp
30
+ updatedBy
31
+ createdBy
32
+ isBirthday
33
+ customerId
34
+ }
35
+ }
36
+ `;
@@ -4,4 +4,5 @@ export declare class CrmCampingService extends Service {
4
4
  setToken(token: string): void;
5
5
  setStoreId(storeId: string): void;
6
6
  searchProductQuantityPromotionAction(productId: string): Promise<any>;
7
+ addCustomerToVoucher(userId: string, campaignActionId: string): Promise<any>;
7
8
  }
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CrmCampingService = void 0;
13
+ const mutations_1 = require("../../graphql/crm_camping/mutations");
13
14
  const queries_1 = require("../../graphql/crm_camping/queries");
14
15
  const serviceSDK_1 = require("../serviceSDK");
15
16
  class CrmCampingService extends serviceSDK_1.Service {
@@ -28,7 +29,7 @@ class CrmCampingService extends serviceSDK_1.Service {
28
29
  const variables = {
29
30
  productId,
30
31
  partyId: this.orgId,
31
- storeChannel: this.storeId
32
+ storeChannel: this.storeId,
32
33
  };
33
34
  try {
34
35
  const response = yield this.graphqlQueryV2(query, variables);
@@ -40,5 +41,23 @@ class CrmCampingService extends serviceSDK_1.Service {
40
41
  }
41
42
  });
42
43
  }
44
+ addCustomerToVoucher(userId, campaignActionId) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const mutation = mutations_1.ADD_CUSTOMER_TO_VOUCHER;
47
+ const variables = {
48
+ partyId: this.orgId,
49
+ userId,
50
+ campaignActionId,
51
+ };
52
+ try {
53
+ const response = yield this.graphqlMutationV2(mutation, variables);
54
+ return response.addCustomerToVoucher;
55
+ }
56
+ catch (error) {
57
+ console.log(`Error in addCustomerToVoucher: ${error}`);
58
+ throw error;
59
+ }
60
+ });
61
+ }
43
62
  }
44
63
  exports.CrmCampingService = CrmCampingService;
@@ -1,4 +1,4 @@
1
- import { LineItem, DiscountCampaign, CancelOrder, MemberDiscount, CampaignPromotion, OrderQuery } from "../../types/order";
1
+ import { LineItem, CancelOrder, MemberDiscount, CampaignPromotion, OrderQuery } from "../../types/order";
2
2
  import { Service } from "../serviceSDK";
3
3
  /**
4
4
  * Represents a service for managing orders.
@@ -130,7 +130,7 @@ export declare class OrderService extends Service {
130
130
  * @returns A promise that resolves when the customer and shipping address are updated.
131
131
  * @throws If an error occurs while updating the customer and shipping address.
132
132
  */
133
- updateDiscountPriceInOrder(orderId: string, orderItemId: string, requestData: DiscountCampaign): Promise<any>;
133
+ updateDiscountPriceInOrder(orderId: string, orderItemId: string, requestData: any): Promise<any>;
134
134
  /**
135
135
  * Update cancel order
136
136
  * @param orderId - The ID of the order.
@@ -468,4 +468,5 @@ export declare class OrderService extends Service {
468
468
  * @throws If an error occurs while updating the customer and shipping address.
469
469
  */
470
470
  addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any, store: string): Promise<any>;
471
+ findCampaignActionGiftVoucher(): Promise<any>;
471
472
  }
@@ -307,7 +307,9 @@ class OrderService extends serviceSDK_1.Service {
307
307
  * @returns A promise that resolves when the customer and shipping address are updated.
308
308
  * @throws If an error occurs while updating the customer and shipping address.
309
309
  */
310
- updateDiscountPriceInOrder(orderId, orderItemId, requestData) {
310
+ updateDiscountPriceInOrder(orderId, orderItemId, requestData
311
+ //DiscountCampaign
312
+ ) {
311
313
  return __awaiter(this, void 0, void 0, function* () {
312
314
  const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/discount`;
313
315
  const method = "PUT";
@@ -1247,5 +1249,19 @@ class OrderService extends serviceSDK_1.Service {
1247
1249
  }
1248
1250
  });
1249
1251
  }
1252
+ findCampaignActionGiftVoucher() {
1253
+ return __awaiter(this, void 0, void 0, function* () {
1254
+ const endpoint = `/orders/${this.orgId}/findCampaignActionGiftVoucher`;
1255
+ const method = "GET";
1256
+ try {
1257
+ const response = yield this.restApiCallWithToken(endpoint, method);
1258
+ return response;
1259
+ }
1260
+ catch (error) {
1261
+ console.log(`Error in deleteNoteWithoutLogin: ${error}`);
1262
+ throw error;
1263
+ }
1264
+ });
1265
+ }
1250
1266
  }
1251
1267
  exports.OrderService = OrderService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [