@longvansoftware/storefront-js-client 1.6.5 → 1.6.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.
@@ -11,6 +11,7 @@ export declare const environmentEndpoints: {
11
11
  computing: string;
12
12
  campaign: string;
13
13
  image: string;
14
+ paymentV2: string;
14
15
  };
15
16
  live: {
16
17
  product: string;
@@ -24,5 +25,6 @@ export declare const environmentEndpoints: {
24
25
  computing: string;
25
26
  campaign: string;
26
27
  image: string;
28
+ paymentV2: string;
27
29
  };
28
30
  };
@@ -14,6 +14,7 @@ exports.environmentEndpoints = {
14
14
  computing: "https://api-gateway.dev.longvan.vn/computing-service/graphql",
15
15
  campaign: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
16
16
  image: "https://product-service.dev.longvan.vn/product-service/v1/products",
17
+ paymentV2: "https://payment.dev.longvan.vn/graphql"
17
18
  },
18
19
  live: {
19
20
  product: "https://product-service.longvan.vn/product-service/graphql",
@@ -26,6 +27,7 @@ exports.environmentEndpoints = {
26
27
  warehouse: "https://portal.longvan.vn/facility-api/public-facility/1.0.0",
27
28
  computing: "https://api-gateway.longvan.vn/computing-service/graphql",
28
29
  campaign: "https://crm.longvan.vn/campaign-gateway/graphql",
29
- image: "https://product-service.dev.longvan.vn/product-service/v1/products"
30
+ image: "https://product-service.dev.longvan.vn/product-service/v1/products",
31
+ paymentV2: "https://payment.dev.longvan.vn/graphql"
30
32
  },
31
33
  };
@@ -5,7 +5,7 @@ const graphql_tag_1 = require("graphql-tag");
5
5
  exports.ADD_OPPORTUNITY_MUTATION = (0, graphql_tag_1.gql) `
6
6
  mutation AddOpportunity(
7
7
  $partyId: String!
8
- $addOpportunityRequest: AddOpportunityRequest!
8
+ $addOpportunityRequest: AddOpportunityRequest
9
9
  $performerId: String!
10
10
  ) {
11
11
  addOpportunity(
@@ -109,13 +109,6 @@ exports.UPDATE_WORK_EFFORT_DESCRIPTION = (0, graphql_tag_1.gql) `
109
109
  ownerId
110
110
  priorityName
111
111
  priorityValue
112
- extSource
113
- extSourceTopicId
114
- extSourceSocialAppId
115
- extSourceSupportChannelType
116
- extSourceSocialChannelType
117
- extSourceSocialAppName
118
- extSourceTopicUrl
119
112
  connectorId
120
113
  mode
121
114
  partyGroupIds
@@ -161,18 +154,79 @@ exports.UPDATE_WORK_EFFORT_NAME = (0, graphql_tag_1.gql) `
161
154
  ownerId
162
155
  priorityName
163
156
  priorityValue
164
- extSource
165
- extSourceTopicId
166
- extSourceSocialAppId
167
- extSourceSupportChannelType
168
- extSourceSocialChannelType
169
- extSourceSocialAppName
170
- extSourceTopicUrl
171
157
  connectorId
172
158
  mode
173
159
  partyGroupIds
174
160
  tagIds
175
161
  processResult
162
+ processPipeline {
163
+ id
164
+ name
165
+ }
166
+ attachments {
167
+ id
168
+ createdStamp
169
+ updatedStamp
170
+ updatedBy
171
+ createdBy
172
+ partyId
173
+ path
174
+ srcId
175
+ srcName
176
+ srcPath
177
+ srcConfigPathId
178
+ name
179
+ fileType
180
+ type
181
+ status
182
+ referId
183
+ }
184
+ subTasks {
185
+ id
186
+ createdStamp
187
+ updatedStamp
188
+ createdBy
189
+ updatedBy
190
+ name
191
+ partyId
192
+ targetId
193
+ targetType
194
+ targetUrl
195
+ description
196
+ status
197
+ parentId
198
+ workEffortTypeId
199
+ stmId
200
+ workflowId
201
+ endDateExpect
202
+ endDateActual
203
+ startDateActual
204
+ startDateExpect
205
+ source
206
+ ownerId
207
+ priorityName
208
+ priorityValue
209
+ connectorId
210
+ mode
211
+ partyGroupIds
212
+ tagIds
213
+ processResult
214
+ }
215
+ actionLink {
216
+ name
217
+ uri
218
+ type
219
+ partyId
220
+ fromCollection
221
+ toCollection
222
+ group
223
+ params
224
+ id
225
+ createdStamp
226
+ updatedStamp
227
+ updatedBy
228
+ createdBy
229
+ }
176
230
  }
177
231
  }
178
232
  `;
@@ -235,13 +289,13 @@ exports.ADD_ATTACHMENT_FOR_WORK_EFFORT = (0, graphql_tag_1.gql) `
235
289
  $partyId: String!
236
290
  $performerId: String!
237
291
  $workEffortId: String!
238
- $attachments: [AddAttachmentRequest]
292
+ $addAttachmentRequest: [AddAttachmentRequestFull]
239
293
  ) {
240
294
  addAttachmentForWorkEffort(
241
295
  partyId: $partyId
242
296
  performerId: $performerId
243
297
  workEffortId: $workEffortId
244
- addAttachmentRequest: $attachments
298
+ addAttachmentRequest: $addAttachmentRequest
245
299
  ) {
246
300
  id
247
301
  createdStamp
@@ -327,7 +381,7 @@ exports.CREATE_WORK_EFFORT = (0, graphql_tag_1.gql) `
327
381
  createWorkEffort(
328
382
  partnerId: $partnerId
329
383
  createdBy: $createdBy
330
- name:$name
384
+ name: $name
331
385
  workEffortTypeId: $workEffortTypeId
332
386
  source: $source
333
387
  attributes: $attributes
@@ -43,6 +43,10 @@ exports.GET_LIST_OPPORTUNITY_QUERY = (0, graphql_tag_1.gql) `
43
43
  extSource
44
44
  connectorId
45
45
  processResult
46
+ processPipeline {
47
+ id
48
+ name
49
+ }
46
50
  }
47
51
  }
48
52
  }
@@ -286,6 +290,7 @@ exports.GET_WORK_EFFORTS = (0, graphql_tag_1.gql) `
286
290
  query GetWorkEfforts(
287
291
  $partnerId: String!
288
292
  $performerId: String!
293
+ $workEffortTypeId: String
289
294
  $source: String!
290
295
  $pageNumber: Int!
291
296
  $pageSize: Int!
@@ -294,6 +299,7 @@ exports.GET_WORK_EFFORTS = (0, graphql_tag_1.gql) `
294
299
  getWorkEfforts(
295
300
  partnerId: $partnerId
296
301
  performerId: $performerId
302
+ workEffortTypeId: $workEffortTypeId
297
303
  source: $source
298
304
  pageNumber: $pageNumber
299
305
  pageSize: $pageSize
@@ -325,13 +331,6 @@ exports.GET_WORK_EFFORTS = (0, graphql_tag_1.gql) `
325
331
  ownerId
326
332
  priorityName
327
333
  priorityValue
328
- extSource
329
- extSourceTopicId
330
- extSourceSocialAppId
331
- extSourceSupportChannelType
332
- extSourceSocialChannelType
333
- extSourceSocialAppName
334
- extSourceTopicUrl
335
334
  connectorId
336
335
  mode
337
336
  partyGroupIds
@@ -368,18 +367,15 @@ exports.GET_WORK_EFFORT_BY_ID = (0, graphql_tag_1.gql) `
368
367
  ownerId
369
368
  priorityName
370
369
  priorityValue
371
- extSource
372
- extSourceTopicId
373
- extSourceSocialAppId
374
- extSourceSupportChannelType
375
- extSourceSocialChannelType
376
- extSourceSocialAppName
377
- extSourceTopicUrl
378
370
  connectorId
379
371
  mode
380
372
  partyGroupIds
381
373
  tagIds
382
374
  processResult
375
+ processPipeline {
376
+ id
377
+ name
378
+ }
383
379
  attachments {
384
380
  id
385
381
  createdStamp
@@ -398,6 +394,70 @@ exports.GET_WORK_EFFORT_BY_ID = (0, graphql_tag_1.gql) `
398
394
  status
399
395
  referId
400
396
  }
397
+ subTasks {
398
+ id
399
+ createdStamp
400
+ updatedStamp
401
+ createdBy
402
+ updatedBy
403
+ name
404
+ partyId
405
+ targetId
406
+ targetType
407
+ targetUrl
408
+ description
409
+ status
410
+ parentId
411
+ workEffortTypeId
412
+ stmId
413
+ workflowId
414
+ endDateExpect
415
+ endDateActual
416
+ startDateActual
417
+ startDateExpect
418
+ source
419
+ ownerId
420
+ priorityName
421
+ priorityValue
422
+ connectorId
423
+ mode
424
+ partyGroupIds
425
+ tagIds
426
+ processResult
427
+ attachments {
428
+ id
429
+ createdStamp
430
+ updatedStamp
431
+ updatedBy
432
+ createdBy
433
+ partyId
434
+ path
435
+ srcId
436
+ srcName
437
+ srcPath
438
+ srcConfigPathId
439
+ name
440
+ fileType
441
+ type
442
+ status
443
+ referId
444
+ }
445
+ }
446
+ actionLink {
447
+ name
448
+ uri
449
+ type
450
+ partyId
451
+ fromCollection
452
+ toCollection
453
+ group
454
+ params
455
+ id
456
+ createdStamp
457
+ updatedStamp
458
+ updatedBy
459
+ createdBy
460
+ }
401
461
  }
402
462
  }
403
463
  `;
@@ -0,0 +1 @@
1
+ export declare const CANCEL_PAYMENT: import("graphql").DocumentNode;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CANCEL_PAYMENT = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ exports.CANCEL_PAYMENT = (0, graphql_tag_1.gql) `
6
+ mutation CancelPayment($paymentId: String!, $reason: String!) {
7
+ cancelPayment(paymentId: $paymentId, reason: $reason)
8
+ }
9
+ `;
@@ -0,0 +1 @@
1
+ export declare const PAYMENTS_BY_ORDERS: import("graphql").DocumentNode;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PAYMENTS_BY_ORDERS = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ exports.PAYMENTS_BY_ORDERS = (0, graphql_tag_1.gql) `
6
+ query PaymentsByOrders($orderIds: [String!]!) {
7
+ paymentsByOrders(orderIds: $orderIds) {
8
+ methodCode
9
+ partnerCode
10
+ totalAmount
11
+ fee
12
+ discountAmount
13
+ payDate
14
+ payType
15
+ transactionDate
16
+ orderId
17
+ paymentId
18
+ invoiceId
19
+ orderInfo
20
+ orderType
21
+ locale
22
+ merchantIp
23
+ extraData
24
+ storeID
25
+ bankCode
26
+ appUser
27
+ phone
28
+ email
29
+ address
30
+ statusCode
31
+ statusDescription
32
+ transactionId
33
+ createBy
34
+ methodDescription
35
+ methodMapping
36
+ baseMethodCode
37
+ }
38
+ }
39
+ `;
@@ -11,3 +11,4 @@ export declare const GET_CONTACT_INFOS_BY_COMPANY_ID: import("graphql").Document
11
11
  export declare const GET_PROVINCES: import("graphql").DocumentNode;
12
12
  export declare const GET_DISTRICTS: import("graphql").DocumentNode;
13
13
  export declare const GET_WARDS: import("graphql").DocumentNode;
14
+ export declare const GET_PERSON_BY_PARTY_ID: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_WARDS = exports.GET_DISTRICTS = exports.GET_PROVINCES = exports.GET_CONTACT_INFOS_BY_COMPANY_ID = exports.GET_COMPANY_BY_CONTACT_INFO_ID = exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = exports.GET_POSTIONS_BY_EMPLOYEES_ID = exports.SEARCH_EMPLOYEES = exports.SEARCH_CUSTOMER = exports.GET_CUSTOMER_BY_ID = exports.SEARCH_COMPANY = exports.GET_PERSON_BY_IDS_QUERY = void 0;
3
+ exports.GET_PERSON_BY_PARTY_ID = exports.GET_WARDS = exports.GET_DISTRICTS = exports.GET_PROVINCES = exports.GET_CONTACT_INFOS_BY_COMPANY_ID = exports.GET_COMPANY_BY_CONTACT_INFO_ID = exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = exports.GET_POSTIONS_BY_EMPLOYEES_ID = exports.SEARCH_EMPLOYEES = exports.SEARCH_CUSTOMER = exports.GET_CUSTOMER_BY_ID = exports.SEARCH_COMPANY = exports.GET_PERSON_BY_IDS_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
6
6
  query GetPersonByIds($partyIds: [String!]!) {
@@ -106,7 +106,11 @@ exports.SEARCH_CUSTOMER = (0, graphql_tag_1.gql) `
106
106
  }
107
107
  `;
108
108
  exports.SEARCH_EMPLOYEES = (0, graphql_tag_1.gql) `
109
- query SearchEmployees($keyword: String, $positionShortName: String, $partnerId: String) {
109
+ query SearchEmployees(
110
+ $keyword: String
111
+ $positionShortName: String
112
+ $partnerId: String
113
+ ) {
110
114
  searchEmployees(
111
115
  keyword: $keyword
112
116
  positionShortName: $positionShortName
@@ -132,13 +136,25 @@ exports.GET_POSTIONS_BY_EMPLOYEES_ID = (0, graphql_tag_1.gql) `
132
136
  }
133
137
  `;
134
138
  exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = (0, graphql_tag_1.gql) `
135
- query GetStoreChannelIdsByEmployeeId($employeeId: String!, $partnerId: String!) {
136
- getStoreChannelIdsByEmployeeId(employeeId: $employeeId, partnerId: $partnerId)
139
+ query GetStoreChannelIdsByEmployeeId(
140
+ $employeeId: String!
141
+ $partnerId: String!
142
+ ) {
143
+ getStoreChannelIdsByEmployeeId(
144
+ employeeId: $employeeId
145
+ partnerId: $partnerId
146
+ )
137
147
  }
138
148
  `;
139
149
  exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = (0, graphql_tag_1.gql) `
140
- query GetEmployeesByStoreChannelId($storeChannelId: String!, $partnerId: String!) {
141
- getEmployeesByStoreChannelId(storeChannelId: $storeChannelId, partnerId: $partnerId) {
150
+ query GetEmployeesByStoreChannelId(
151
+ $storeChannelId: String!
152
+ $partnerId: String!
153
+ ) {
154
+ getEmployeesByStoreChannelId(
155
+ storeChannelId: $storeChannelId
156
+ partnerId: $partnerId
157
+ ) {
142
158
  id
143
159
  name
144
160
  address
@@ -250,3 +266,32 @@ exports.GET_WARDS = (0, graphql_tag_1.gql) `
250
266
  }
251
267
  }
252
268
  `;
269
+ exports.GET_PERSON_BY_PARTY_ID = (0, graphql_tag_1.gql) `
270
+ query GetPersonByPartyId($partyId: String!) {
271
+ getPersonByPartyId(partyId: $partyId) {
272
+ status
273
+ partyId
274
+ fullName
275
+ phone
276
+ address
277
+ gender
278
+ birthDate
279
+ email
280
+ personalTitle
281
+ imageUrl
282
+ identityNumber
283
+ id
284
+ addressModel {
285
+ id
286
+ addressInfo
287
+ provinceGeoId
288
+ districtGeoId
289
+ wardGeoId
290
+ provinceName
291
+ districtName
292
+ wardName
293
+ isDefault
294
+ }
295
+ }
296
+ }
297
+ `;
@@ -9,6 +9,7 @@ import { WarehouseService } from "../lib/warehouse/index";
9
9
  import { ComputingService } from "../lib/computing/index";
10
10
  import { CampaignService } from "./campaign";
11
11
  import { ImageService } from "./image";
12
+ import { PaymentServiceV2 } from "./paymentV2";
12
13
  export interface Endpoints {
13
14
  product: string;
14
15
  crm: string;
@@ -21,6 +22,7 @@ export interface Endpoints {
21
22
  computing: string;
22
23
  campaign: string;
23
24
  image: string;
25
+ paymentV2: string;
24
26
  }
25
27
  export declare class SDK {
26
28
  orgId: string;
@@ -37,6 +39,7 @@ export declare class SDK {
37
39
  computing: ComputingService;
38
40
  campaign: CampaignService;
39
41
  image: ImageService;
42
+ paymentV2: PaymentServiceV2;
40
43
  token: string | null;
41
44
  constructor(orgId: string, storeId: string, environment: "dev" | "live");
42
45
  setToken(token: string): void;
@@ -14,6 +14,7 @@ const index_8 = require("../lib/warehouse/index");
14
14
  const index_9 = require("../lib/computing/index");
15
15
  const campaign_1 = require("./campaign");
16
16
  const image_1 = require("./image");
17
+ const paymentV2_1 = require("./paymentV2");
17
18
  class SDK {
18
19
  constructor(orgId, storeId, environment) {
19
20
  this.orgId = orgId;
@@ -32,6 +33,7 @@ class SDK {
32
33
  this.computing = new index_9.ComputingService(endpoints.computing, orgId, storeId);
33
34
  this.campaign = new campaign_1.CampaignService(endpoints.campaign, orgId, storeId);
34
35
  this.image = new image_1.ImageService(endpoints.image, orgId, storeId);
36
+ this.paymentV2 = new paymentV2_1.PaymentServiceV2(endpoints.paymentV2, orgId, storeId);
35
37
  // Initialize other services here
36
38
  }
37
39
  setToken(token) {
@@ -47,6 +49,7 @@ class SDK {
47
49
  this.warehouse.setToken(token);
48
50
  this.computing.setToken(token);
49
51
  this.image.setToken(token);
52
+ this.paymentV2.setToken(token);
50
53
  // Set token for other services here
51
54
  }
52
55
  // các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
@@ -62,6 +65,7 @@ class SDK {
62
65
  this.service.setStoreId(storeId);
63
66
  this.warehouse.setStoreId(storeId);
64
67
  this.image.setStoreId(storeId);
68
+ this.paymentV2.setStoreId(storeId);
65
69
  // Set storeId for other services here
66
70
  }
67
71
  }
@@ -1,9 +1,9 @@
1
- import { AddAttachmentRequest, AddOpportunityRequest, AddTicketRequest, GetCommentRequest, GetOpportunityRequest, getTicketRequest, BaseSort } from "../../types/crm";
1
+ import { AddAttachmentRequest, AddOpportunityRequest, AddTicketRequest, GetCommentRequest, GetOpportunityRequest, getTicketRequest, BaseSort, AddAttachmentRequestFull } from "../../types/crm";
2
2
  import { Service } from "../serviceSDK";
3
3
  export declare class CrmService extends Service {
4
4
  constructor(endpoint: string, orgId: string, storeId: string);
5
5
  setToken(token: string): void;
6
- addOpportunity(addOpportunityRequest: AddOpportunityRequest, performerId: string): Promise<any>;
6
+ addOpportunity(performerId: string, addOpportunityRequest?: AddOpportunityRequest): Promise<any>;
7
7
  getListOpportunity(performerId: string, getOpportunityRequest: GetOpportunityRequest): Promise<any>;
8
8
  getListTodo(workEffortId: string[]): Promise<any>;
9
9
  getListWorkEffortType(id: string): Promise<any>;
@@ -11,7 +11,7 @@ export declare class CrmService extends Service {
11
11
  updateWorkEffortDescription(performerId: string, workEffortId: string, description: string): Promise<any>;
12
12
  updateWorkEffortName(performerId: string, workEffortId: string, name: string): Promise<any>;
13
13
  updateWorkEffortStatus(performerId: string, workEffortId: string, source: string, status: string): Promise<any>;
14
- addAttachmentForWorkEffort(performerId: string, workEffortId: string, attachments: [{}]): Promise<any>;
14
+ addAttachmentForWorkEffort(performerId: string, workEffortId: string, addAttachmentRequest: AddAttachmentRequestFull): Promise<any>;
15
15
  getListTicket(performerId: string, getTicketRequest: getTicketRequest): Promise<any>;
16
16
  addTicket(performerId: string, addTicketRequest: AddTicketRequest, addAttachmentRequest: [AddAttachmentRequest]): Promise<any>;
17
17
  getTicketById(ticketId: string): Promise<any>;
@@ -20,13 +20,13 @@ class CrmService extends serviceSDK_1.Service {
20
20
  setToken(token) {
21
21
  this.token = token;
22
22
  }
23
- addOpportunity(addOpportunityRequest, performerId) {
23
+ addOpportunity(performerId, addOpportunityRequest) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  const mutation = mutations_1.ADD_OPPORTUNITY_MUTATION;
26
26
  const variables = {
27
27
  partyId: this.orgId,
28
- addOpportunityRequest,
29
28
  performerId,
29
+ addOpportunityRequest,
30
30
  };
31
31
  try {
32
32
  const response = yield this.graphqlMutationV2(mutation, variables);
@@ -165,14 +165,14 @@ class CrmService extends serviceSDK_1.Service {
165
165
  }
166
166
  });
167
167
  }
168
- addAttachmentForWorkEffort(performerId, workEffortId, attachments) {
168
+ addAttachmentForWorkEffort(performerId, workEffortId, addAttachmentRequest) {
169
169
  return __awaiter(this, void 0, void 0, function* () {
170
170
  const mutation = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
171
171
  const variables = {
172
172
  partyId: this.orgId,
173
173
  performerId,
174
174
  workEffortId,
175
- attachments,
175
+ addAttachmentRequest,
176
176
  };
177
177
  try {
178
178
  const response = yield this.graphqlMutationV2(mutation, variables);
@@ -1,4 +1,4 @@
1
- import { LineItem, DiscountCampaign, CancelOrder, MemberDiscount, CampaignPromotion, OrderQuery } from "../../types/order";
1
+ import { LineItem, DiscountCampaign, CancelOrder, MemberDiscount, CampaignPromotion, OrderQuery, ShippingAddress } from "../../types/order";
2
2
  import { Service } from "../serviceSDK";
3
3
  /**
4
4
  * Represents a service for managing orders.
@@ -448,6 +448,11 @@ export declare class OrderService extends Service {
448
448
  * @throws If an error occurs while updating the customer and shipping address.
449
449
  */
450
450
  deleteNoteWithoutLogin(orderId: string, noteId: string, deletedBy: string): Promise<any>;
451
+ getOrderByIdNoLogin(partnerId: string, storeId: string, orderId: string): Promise<any>;
451
452
  updateOrderDescription(orderId: string, description: string): Promise<any>;
452
453
  getOrderDetail(orderId: string): Promise<any>;
454
+ createInfoReceiver(ownerId: string, dataRequest: ShippingAddress): Promise<any>;
455
+ getInfoReceiver(ownerId: string): Promise<any>;
456
+ updateInfoReceiver(ownerId: string, receiverId: string, updatedBy: string, dataRequest: ShippingAddress): Promise<any>;
457
+ deleteInfoReceiver(ownerId: string, receiverId: string, deletedBy: string): Promise<any>;
453
458
  }
@@ -1197,6 +1197,19 @@ class OrderService extends serviceSDK_1.Service {
1197
1197
  }
1198
1198
  });
1199
1199
  }
1200
+ getOrderByIdNoLogin(partnerId, storeId, orderId) {
1201
+ return __awaiter(this, void 0, void 0, function* () {
1202
+ const endpoint = `/front/orders/express/${partnerId}/${storeId}?order_id=${orderId}`;
1203
+ const method = "GET";
1204
+ try {
1205
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
1206
+ return response;
1207
+ }
1208
+ catch (error) {
1209
+ throw error;
1210
+ }
1211
+ });
1212
+ }
1200
1213
  updateOrderDescription(orderId, description) {
1201
1214
  return __awaiter(this, void 0, void 0, function* () {
1202
1215
  const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/description`;
@@ -1218,5 +1231,57 @@ class OrderService extends serviceSDK_1.Service {
1218
1231
  return this.restApiCallWithToken(`/orders/${this.orgId}/${this.storeId}/${orderId}/sale_order`, "GET");
1219
1232
  });
1220
1233
  }
1234
+ createInfoReceiver(ownerId, dataRequest) {
1235
+ return __awaiter(this, void 0, void 0, function* () {
1236
+ const endpoint = `/receiver-infos/${this.orgId}/owner/${ownerId}`;
1237
+ const method = "POST";
1238
+ try {
1239
+ const response = yield this.restApiCallWithToken(endpoint, method, dataRequest);
1240
+ return response;
1241
+ }
1242
+ catch (error) {
1243
+ throw error;
1244
+ }
1245
+ });
1246
+ }
1247
+ getInfoReceiver(ownerId) {
1248
+ return __awaiter(this, void 0, void 0, function* () {
1249
+ const endpoint = `/receiver-infos/${this.orgId}/owner/${ownerId}`;
1250
+ const method = "GET";
1251
+ try {
1252
+ const response = yield this.restApiCallWithToken(endpoint, method);
1253
+ return response;
1254
+ }
1255
+ catch (error) {
1256
+ throw error;
1257
+ }
1258
+ });
1259
+ }
1260
+ updateInfoReceiver(ownerId, receiverId, updatedBy, dataRequest) {
1261
+ return __awaiter(this, void 0, void 0, function* () {
1262
+ const endpoint = `/receiver-infos/${this.orgId}/owner/${ownerId}/${receiverId}?updated_by=${updatedBy}`;
1263
+ const method = "PUT";
1264
+ try {
1265
+ const response = yield this.restApiCallWithToken(endpoint, method, dataRequest);
1266
+ return response;
1267
+ }
1268
+ catch (error) {
1269
+ throw error;
1270
+ }
1271
+ });
1272
+ }
1273
+ deleteInfoReceiver(ownerId, receiverId, deletedBy) {
1274
+ return __awaiter(this, void 0, void 0, function* () {
1275
+ const endpoint = `/receiver-infos/${this.orgId}/owner/${ownerId}/${receiverId}?deleted_by=${deletedBy}`;
1276
+ const method = "DELETE";
1277
+ try {
1278
+ const response = yield this.restApiCallWithToken(endpoint, method);
1279
+ return response;
1280
+ }
1281
+ catch (error) {
1282
+ throw error;
1283
+ }
1284
+ });
1285
+ }
1221
1286
  }
1222
1287
  exports.OrderService = OrderService;
@@ -0,0 +1,6 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class PaymentServiceV2 extends Service {
3
+ constructor(endpoint: string, orgId: string, storeId: string);
4
+ paymentsByOrders(orderIds: [string]): Promise<any>;
5
+ cancelPayment(paymentId: string, reason: string): Promise<any>;
6
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PaymentServiceV2 = void 0;
13
+ const serviceSDK_1 = require("../serviceSDK");
14
+ const queries_1 = require("../../graphql/paymentV2/queries");
15
+ const mutations_1 = require("../../graphql/paymentV2/mutations");
16
+ class PaymentServiceV2 extends serviceSDK_1.Service {
17
+ constructor(endpoint, orgId, storeId) {
18
+ super(endpoint, orgId, storeId);
19
+ }
20
+ paymentsByOrders(orderIds) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const query = queries_1.PAYMENTS_BY_ORDERS;
23
+ const variables = {
24
+ orderIds: orderIds,
25
+ };
26
+ try {
27
+ const response = yield this.graphqlQueryV3(query, variables);
28
+ return response.paymentsByOrders;
29
+ }
30
+ catch (error) {
31
+ throw error;
32
+ }
33
+ });
34
+ }
35
+ cancelPayment(paymentId, reason) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const mutation = mutations_1.CANCEL_PAYMENT;
38
+ const variables = {
39
+ paymentId: paymentId,
40
+ reason: reason,
41
+ };
42
+ try {
43
+ const respone = yield this.graphqlMutationV3(mutation, variables);
44
+ return respone.cancelPayment;
45
+ }
46
+ catch (error) {
47
+ throw error;
48
+ }
49
+ });
50
+ }
51
+ }
52
+ exports.PaymentServiceV2 = PaymentServiceV2;
@@ -15,4 +15,6 @@ export declare class Service {
15
15
  protected restApiCallWithNoToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
16
16
  protected graphqlQueryV2(query: DocumentNode, variables: any): Promise<any>;
17
17
  protected graphqlMutationV2(mutation: DocumentNode, variables: any): Promise<any>;
18
+ protected graphqlQueryV3(query: DocumentNode, variables: any): Promise<any>;
19
+ protected graphqlMutationV3(mutation: DocumentNode, variables: any): Promise<any>;
18
20
  }
@@ -183,5 +183,60 @@ class Service {
183
183
  }
184
184
  });
185
185
  }
186
+ graphqlQueryV3(query, variables) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ try {
189
+ const { data, errors } = yield this.client.query({
190
+ query: (0, client_1.gql) `
191
+ ${query}
192
+ `,
193
+ variables,
194
+ context: {
195
+ method: "POST",
196
+ headers: {
197
+ "Content-Type": "application/json",
198
+ // PartnerId: this.orgId, -> payment bị thừa partnerId -> lỗi
199
+ Authorization: "Bearer " + this.token,
200
+ },
201
+ },
202
+ });
203
+ if (errors) {
204
+ throw new Error(`GraphQL error! errors: ${errors}`);
205
+ }
206
+ return data;
207
+ }
208
+ catch (error) {
209
+ console.log(`Error in graphqlQuery: ${error}`);
210
+ throw error;
211
+ }
212
+ });
213
+ }
214
+ graphqlMutationV3(mutation, variables) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ try {
217
+ const { data, errors } = yield this.client.mutate({
218
+ mutation: (0, client_1.gql) `
219
+ ${mutation}
220
+ `,
221
+ variables,
222
+ context: {
223
+ method: "POST",
224
+ headers: {
225
+ "Content-Type": "application/json",
226
+ // PartnerId: this.orgId,
227
+ Authorization: "Bearer " + this.token,
228
+ },
229
+ },
230
+ });
231
+ if (errors) {
232
+ throw new Error(`GraphQL error! errors: ${errors}`);
233
+ }
234
+ return data;
235
+ }
236
+ catch (error) {
237
+ throw error;
238
+ }
239
+ });
240
+ }
186
241
  }
187
242
  exports.Service = Service;
@@ -20,4 +20,5 @@ export declare class UserService extends Service {
20
20
  getProvinces(): Promise<any>;
21
21
  getDistricts(provinceId: string): Promise<any>;
22
22
  getWards(districtId: string): Promise<any>;
23
+ getPersonByPartyId(partyId: string): Promise<any>;
23
24
  }
@@ -341,5 +341,20 @@ class UserService extends serviceSDK_1.Service {
341
341
  }
342
342
  });
343
343
  }
344
+ getPersonByPartyId(partyId) {
345
+ return __awaiter(this, void 0, void 0, function* () {
346
+ const query = queries_1.GET_PERSON_BY_PARTY_ID;
347
+ const variables = {
348
+ partyId,
349
+ };
350
+ try {
351
+ const response = yield this.graphqlQueryV2(query, variables);
352
+ return response.getPersonByPartyId;
353
+ }
354
+ catch (error) {
355
+ throw error;
356
+ }
357
+ });
358
+ }
344
359
  }
345
360
  exports.UserService = UserService;
@@ -8,7 +8,19 @@ export interface AddOpportunityRequest {
8
8
  referEmail: string;
9
9
  targetId: string;
10
10
  extSource: string;
11
- ownerId: string;
11
+ ownerId?: string;
12
+ }
13
+ export interface AddAttachmentRequestFull {
14
+ name: string;
15
+ description: string;
16
+ parentId?: string | null;
17
+ priorityName: string;
18
+ referName: string;
19
+ referPhone: string;
20
+ referEmail: string;
21
+ targetId: string;
22
+ extSource: string;
23
+ ownerId?: string;
12
24
  }
13
25
  export interface Opportunity {
14
26
  goal: string;
@@ -41,10 +53,11 @@ export interface Opportunity {
41
53
  processResult?: string | null;
42
54
  }
43
55
  export interface GetOpportunityRequest {
44
- id: string;
56
+ id?: string;
45
57
  pageSize: number;
46
58
  pageNumber: number;
47
59
  isPagination: boolean;
60
+ workEffortTypeId: string;
48
61
  sort: {
49
62
  key: string;
50
63
  asc: boolean;
@@ -52,3 +52,12 @@ export interface OrderQuery {
52
52
  maxResult?: number;
53
53
  source?: string;
54
54
  }
55
+ export interface ShippingAddress {
56
+ name: string;
57
+ phone: string;
58
+ address: string;
59
+ province_code: string;
60
+ district_code: string;
61
+ ward_code: string;
62
+ address_default?: boolean;
63
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.6.5",
3
+ "version": "1.6.7",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [