@longvansoftware/service-js-client 1.18.5 → 1.18.7

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.
@@ -15,3 +15,4 @@ export declare const GET_RESUME_DOMAIN_BY_SERVICE_ID: DocumentNode;
15
15
  export declare const GET_COLLEGES_BY_PROVINCE_ID: DocumentNode;
16
16
  export declare const GET_RELATED_RESOURCE_BY_RESOURCE_TYPE: DocumentNode;
17
17
  export declare const GET_RESUME_INFO_BY_CUSTOMER_ID: DocumentNode;
18
+ export declare const GET_RESUME_INFO_BY_CUSTOMER_ID_DYNAMIC: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_RESUME_INFO_BY_CUSTOMER_ID = exports.GET_RELATED_RESOURCE_BY_RESOURCE_TYPE = exports.GET_COLLEGES_BY_PROVINCE_ID = exports.GET_RESUME_DOMAIN_BY_SERVICE_ID = exports.GET_REUSME_BY_CUSTOMER_ID = exports.GET_RESUME_CONTACT = exports.GET_RESUME_ID_BY_RESOURCE = exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_LIST_TICKET_BY_ID_DYNAMIC = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET_DYNAMIC = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
3
+ exports.GET_RESUME_INFO_BY_CUSTOMER_ID_DYNAMIC = exports.GET_RESUME_INFO_BY_CUSTOMER_ID = exports.GET_RELATED_RESOURCE_BY_RESOURCE_TYPE = exports.GET_COLLEGES_BY_PROVINCE_ID = exports.GET_RESUME_DOMAIN_BY_SERVICE_ID = exports.GET_REUSME_BY_CUSTOMER_ID = exports.GET_RESUME_CONTACT = exports.GET_RESUME_ID_BY_RESOURCE = exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_LIST_TICKET_BY_ID_DYNAMIC = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET_DYNAMIC = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_LIST_OPPORTUNITY_QUERY = (0, graphql_tag_1.gql) `
6
6
  query GetListOpportunity(
@@ -442,3 +442,16 @@ exports.GET_RESUME_INFO_BY_CUSTOMER_ID = (0, graphql_tag_1.gql) `
442
442
  }
443
443
  }
444
444
  `;
445
+ const GET_RESUME_INFO_BY_CUSTOMER_ID_DYNAMIC = (fields = []) => {
446
+ const fieldStr = fields.join("\n ");
447
+ const hasFields = fields.length > 0;
448
+ return (0, graphql_tag_1.gql) `
449
+ query GetResumeInfoByCustomerId($customerId: String!, $orgId: String!) {
450
+ getResumeInfoByCustomerId(customerId: $customerId, orgId: $orgId)
451
+ {
452
+ ${hasFields ? `${fieldStr}` : ""}
453
+ }
454
+ }
455
+ `;
456
+ };
457
+ exports.GET_RESUME_INFO_BY_CUSTOMER_ID_DYNAMIC = GET_RESUME_INFO_BY_CUSTOMER_ID_DYNAMIC;
@@ -113,6 +113,8 @@ exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
113
113
  currencyCode
114
114
  }
115
115
  orderLineItemParentId
116
+ giftConditionProductId
117
+ giftQuantity
116
118
  variant {
117
119
  id
118
120
  price {
@@ -135,18 +137,47 @@ exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
135
137
  value
136
138
  title
137
139
  }
138
- resourceItems {
139
- name
140
- quantity
141
- unit
142
- productId
143
- }
144
140
  resourceConfigs {
145
- name
146
- quantity
147
- unit
148
- productId
149
- }
141
+ name
142
+ quantity
143
+ unit
144
+ productId
145
+ giftProductId
146
+ gift
147
+ giftQuantity
148
+ campaignId
149
+ campaignActionId
150
+ qualify
151
+ idParent
152
+ addQuantity
153
+ defaultQuantity
154
+ title
155
+ price
156
+ unitPrice
157
+ totalResource
158
+ }
159
+ resourceItems {
160
+ name
161
+ quantity
162
+ unit
163
+ productId
164
+ giftProductId
165
+ gift
166
+ giftQuantity
167
+ campaignId
168
+ campaignActionId
169
+ qualify
170
+ idParent
171
+ addQuantity
172
+ defaultQuantity
173
+ title
174
+ price
175
+ unitPrice
176
+ totalResource
177
+ unitGift
178
+ giftDuration
179
+ giftDurationUnit
180
+ }
150
181
  itemType
151
182
  }
152
183
  serviceId
@@ -181,6 +212,7 @@ exports.GET_QUANTITY_ORDER_LINEITEMS = (0, graphql_tag_1.gql) `
181
212
  }
182
213
  itemType
183
214
  orderLineItemParentId
215
+ giftConditionProductId
184
216
  }
185
217
  }
186
218
  }
@@ -240,6 +272,8 @@ exports.GET_ORDER_LINE_ITEM_BY_SERVICE_ID = (0, graphql_tag_1.gql) `
240
272
  updatedStamp
241
273
  completedAt
242
274
  orderLineItemParentId
275
+ giftConditionProductId
276
+ giftQuantity
243
277
  orderStatus
244
278
  totalVAT {
245
279
  amount
@@ -5,10 +5,16 @@ const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CANCEL_PAYMENT = (0, graphql_tag_1.gql) `
6
6
  mutation CancelPayment(
7
7
  $paymentId: String!
8
+ $safeMode: Boolean!
8
9
  $reason: String!
9
10
  $createBy: String
10
11
  ) {
11
- cancelPayment(paymentId: $paymentId, reason: $reason, createBy: $createBy)
12
+ cancelPayment(
13
+ paymentId: $paymentId
14
+ safeMode: $safeMode
15
+ reason: $reason
16
+ createBy: $createBy
17
+ )
12
18
  }
13
19
  `;
14
20
  exports.CONFIRM_PAID_MANUAL = (0, graphql_tag_1.gql) `
@@ -2,3 +2,4 @@ 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
4
  export declare const PAYMENT_METHODS: import("graphql").DocumentNode;
5
+ export declare const PAYMENT_STATUS: import("graphql").DocumentNode;
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PAYMENT_METHODS = exports.GET_PAYMENT_METHOD_TYPES = exports.GET_TRANSFER_INFO = exports.PAYMENTS_BY_ORDERS = void 0;
3
+ exports.PAYMENT_STATUS = 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!]!) {
7
7
  paymentsByOrders(orderIds: $orderIds) {
8
8
  methodCode
9
9
  methodTypeCode
10
+ gatewayConfigId
10
11
  partnerCode
11
12
  totalAmount
12
13
  fee
@@ -37,6 +38,12 @@ exports.PAYMENTS_BY_ORDERS = (0, graphql_tag_1.gql) `
37
38
  baseMethodCode
38
39
  confirmPaidBy
39
40
  confirmPaidDate
41
+ qrCode
42
+ payUrl
43
+ customerId
44
+ attributes
45
+ paymentNote
46
+ payExpireDate
40
47
  }
41
48
  }
42
49
  `;
@@ -81,3 +88,48 @@ exports.PAYMENT_METHODS = (0, graphql_tag_1.gql) `
81
88
  }
82
89
  }
83
90
  `;
91
+ exports.PAYMENT_STATUS = (0, graphql_tag_1.gql) `
92
+ query PaymentStatus($paymentId: String!) {
93
+ paymentStatus(paymentId: $paymentId) {
94
+ methodCode
95
+ methodTypeCode
96
+ gatewayConfigId
97
+ partnerCode
98
+ totalAmount
99
+ fee
100
+ discountAmount
101
+ payDate
102
+ payType
103
+ transactionDate
104
+ orderId
105
+ paymentId
106
+ invoiceId
107
+ orderInfo
108
+ orderType
109
+ locale
110
+ merchantIp
111
+ extraData
112
+ storeID
113
+ bankCode
114
+ appUser
115
+ phone
116
+ email
117
+ address
118
+ statusCode
119
+ statusDescription
120
+ transactionId
121
+ createBy
122
+ methodDescription
123
+ methodMapping
124
+ baseMethodCode
125
+ confirmPaidBy
126
+ confirmPaidDate
127
+ qrCode
128
+ payUrl
129
+ customerId
130
+ attributes
131
+ paymentNote
132
+ payExpireDate
133
+ }
134
+ }
135
+ `;
@@ -34,6 +34,7 @@ export declare class CrmService extends Service {
34
34
  getRelatedResourceByResourceType(fromId: string, fromResourceType: string, toResourceType: string): Promise<any>;
35
35
  addResourceRelated(fromId: string, fromResourceType: string, toIds: string[], toResourceType: string, createdBy: string): Promise<any>;
36
36
  getResumeInfoByCustomerId(customerId: string): Promise<any>;
37
+ getResumeInfoByCustomerIdDynamic(customerId: string, fields: string[]): Promise<any>;
37
38
  createResumeInfo(data: any): Promise<any>;
38
39
  updateFieldResume(resumeId: string, fieldName: string, value: string, resourceType: string, updatedBy: string): Promise<any>;
39
40
  }
@@ -564,6 +564,23 @@ class CrmService extends serviceSDK_1.Service {
564
564
  }
565
565
  });
566
566
  }
567
+ getResumeInfoByCustomerIdDynamic(customerId, fields) {
568
+ return __awaiter(this, void 0, void 0, function* () {
569
+ const query = (0, queries_1.GET_RESUME_INFO_BY_CUSTOMER_ID_DYNAMIC)(fields);
570
+ const variables = {
571
+ customerId,
572
+ orgId: this.orgId,
573
+ };
574
+ try {
575
+ const response = yield this.graphqlQueryV2(query, variables);
576
+ return response.getResumeInfoByCustomerId;
577
+ }
578
+ catch (error) {
579
+ console.log(`Error in getResumeInfoByCustomerIdDynamic: ${error}`);
580
+ throw error;
581
+ }
582
+ });
583
+ }
567
584
  createResumeInfo(data) {
568
585
  return __awaiter(this, void 0, void 0, function* () {
569
586
  const mutation = mutations_1.CREATE_RUSUME_INFO;
@@ -9,4 +9,5 @@ export declare class PaymentLVService extends Service {
9
9
  confirmPaidManual(paymentId: string, confirmBy: string): Promise<any>;
10
10
  getPaymentMethodTypes(store: string): Promise<any>;
11
11
  paymentMethods(): Promise<any>;
12
+ paymentStatus(paymentId: string): Promise<any>;
12
13
  }
@@ -65,6 +65,7 @@ class PaymentLVService extends serviceSDK_1.Service {
65
65
  const mutation = mutations_1.CANCEL_PAYMENT;
66
66
  const variables = {
67
67
  paymentId,
68
+ safeMode: true,
68
69
  reason,
69
70
  createBy,
70
71
  };
@@ -128,5 +129,21 @@ class PaymentLVService extends serviceSDK_1.Service {
128
129
  }
129
130
  });
130
131
  }
132
+ paymentStatus(paymentId) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ const query = queries_1.PAYMENT_STATUS;
135
+ const variables = {
136
+ paymentId,
137
+ };
138
+ try {
139
+ const response = yield this.graphqlQueryCustomHeader(query, variables);
140
+ return response.paymentStatus;
141
+ }
142
+ catch (error) {
143
+ console.log(`Error fetching get paymentStatus method: ${error}`);
144
+ throw error;
145
+ }
146
+ });
147
+ }
131
148
  }
132
149
  exports.PaymentLVService = PaymentLVService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.18.5",
3
+ "version": "1.18.7",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [
@@ -1,14 +0,0 @@
1
- import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
2
- import { DocumentNode } from "graphql";
3
- export declare class Service {
4
- protected token: string | null;
5
- protected client: ApolloClient<NormalizedCacheObject>;
6
- protected orgId: string;
7
- protected storeId: string;
8
- protected endpoint: string;
9
- constructor(endpoint: string, orgId: string, storeId: string);
10
- setToken(token: string): void;
11
- protected graphqlQuery(query: DocumentNode, variables: any): Promise<any>;
12
- protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
13
- protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
14
- }
@@ -1,101 +0,0 @@
1
- "use strict";
2
- // src/service.ts
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Service = void 0;
17
- const client_1 = require("@apollo/client");
18
- const axios_1 = __importDefault(require("axios"));
19
- class Service {
20
- constructor(endpoint, orgId, storeId) {
21
- this.token = null;
22
- this.client = new client_1.ApolloClient({
23
- uri: endpoint,
24
- cache: new client_1.InMemoryCache(),
25
- defaultOptions: {
26
- query: {
27
- fetchPolicy: "network-only",
28
- },
29
- },
30
- });
31
- this.orgId = orgId;
32
- this.storeId = storeId;
33
- this.endpoint = endpoint;
34
- }
35
- setToken(token) {
36
- this.token = token;
37
- }
38
- // setOrgId(orgId: string) {
39
- // this.orgId = orgId;
40
- // }
41
- graphqlQuery(query, variables) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- try {
44
- const { data, errors } = yield this.client.query({
45
- query: (0, client_1.gql) `
46
- ${query}
47
- `,
48
- variables,
49
- });
50
- if (errors) {
51
- throw new Error(`GraphQL error! errors: ${errors}`);
52
- }
53
- return data;
54
- }
55
- catch (error) {
56
- console.log(`Error in graphqlQuery: ${error}`);
57
- throw error;
58
- }
59
- });
60
- }
61
- graphqlMutation(mutation, variables) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- try {
64
- const { data, errors } = yield this.client.mutate({
65
- mutation: (0, client_1.gql) `
66
- ${mutation}
67
- `,
68
- variables,
69
- });
70
- if (errors) {
71
- throw new Error(`GraphQL error! errors: ${errors}`);
72
- }
73
- return data;
74
- }
75
- catch (error) {
76
- console.log(`Error in graphqlMutation: ${error}`);
77
- throw error;
78
- }
79
- });
80
- }
81
- restApiCallWithToken(path, method, data, headers) {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- try {
84
- const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
85
- console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
86
- const response = yield (0, axios_1.default)({
87
- url: this.endpoint + path,
88
- method,
89
- data,
90
- headers: modifiedHeaders,
91
- });
92
- return response.data;
93
- }
94
- catch (error) {
95
- console.log(`Error in restApiCallWithToken: ${error}`);
96
- throw error;
97
- }
98
- });
99
- }
100
- }
101
- exports.Service = Service;
@@ -1 +0,0 @@
1
- export declare function buildFieldString(fields: (string | Record<string, any>)[], indent?: number): string;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildFieldString = void 0;
4
- function buildFieldString(fields, indent = 6) {
5
- const space = " ".repeat(indent);
6
- return fields
7
- .map((field) => {
8
- if (typeof field === "string")
9
- return `${space}${field}`;
10
- const [key, value] = Object.entries(field)[0];
11
- const nested = buildFieldString(value, indent + 2);
12
- return `${space}${key} {\n${nested}\n${space}}`;
13
- })
14
- .join("\n");
15
- }
16
- exports.buildFieldString = buildFieldString;