@longvansoftware/service-js-client 2.4.4 → 2.4.5

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.
@@ -3,3 +3,4 @@ export declare const GET_PAYMENT_METHOD: DocumentNode;
3
3
  export declare const GEN_QR_PAYMENT: DocumentNode;
4
4
  export declare const GET_VAT_INVOICE_REQUEST_BY_ORDER: DocumentNode;
5
5
  export declare const GET_INVOICES_OF_ORDER: (fields?: string[]) => DocumentNode;
6
+ export declare const GET_BUSINESS_TAX_INFO: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_INVOICES_OF_ORDER = exports.GET_VAT_INVOICE_REQUEST_BY_ORDER = exports.GEN_QR_PAYMENT = exports.GET_PAYMENT_METHOD = void 0;
3
+ exports.GET_BUSINESS_TAX_INFO = exports.GET_INVOICES_OF_ORDER = exports.GET_VAT_INVOICE_REQUEST_BY_ORDER = exports.GEN_QR_PAYMENT = exports.GET_PAYMENT_METHOD = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_PAYMENT_METHOD = (0, graphql_tag_1.gql) `
6
6
  query GetPaymentMethod($orgId: String!, $storeChannelId: String) {
@@ -81,3 +81,19 @@ const GET_INVOICES_OF_ORDER = (fields = []) => {
81
81
  `;
82
82
  };
83
83
  exports.GET_INVOICES_OF_ORDER = GET_INVOICES_OF_ORDER;
84
+ const GET_BUSINESS_TAX_INFO = (fields = []) => {
85
+ const fieldStr = fields.join("\n ");
86
+ const hasFields = fields.length > 0;
87
+ return (0, graphql_tag_1.gql) `
88
+ query getBusinessTaxInfo(
89
+ $taxCode: String!
90
+ ) {
91
+ getBusinessTaxInfo(
92
+ taxCode: $taxCode
93
+ ) {
94
+ ${hasFields ? `${fieldStr}` : ""}
95
+ }
96
+ }
97
+ `;
98
+ };
99
+ exports.GET_BUSINESS_TAX_INFO = GET_BUSINESS_TAX_INFO;
@@ -9,5 +9,6 @@ export declare class PaymentService extends Service {
9
9
  createVatInvoiceRequest(vatInvoiceRequest: any, createBy: string): Promise<any>;
10
10
  requestUnpublishVatInvoice(vatInvoiceRequest: any, byUser: string, fields: string[]): Promise<any>;
11
11
  getInvoicesOfOrder(orderId: string, fields: string[]): Promise<any>;
12
+ getBusinessTaxInfo(taxCode: string, fields: string[]): Promise<any>;
12
13
  getVatInvoiceRequestByOrder(orderId: string, offset: number, pageSize: number): Promise<any>;
13
14
  }
@@ -121,6 +121,22 @@ class PaymentService extends serviceSDK_1.Service {
121
121
  }
122
122
  });
123
123
  }
124
+ getBusinessTaxInfo(taxCode, fields) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ const query = (0, queries_1.GET_BUSINESS_TAX_INFO)(fields);
127
+ const variables = {
128
+ taxCode,
129
+ };
130
+ try {
131
+ const response = yield this.graphqlQuery(query, variables);
132
+ return response.getBusinessTaxInfo;
133
+ }
134
+ catch (error) {
135
+ console.log(`Error in getBusinessTaxInfo: ${error}`);
136
+ throw error;
137
+ }
138
+ });
139
+ }
124
140
  getVatInvoiceRequestByOrder(orderId, offset, pageSize) {
125
141
  return __awaiter(this, void 0, void 0, function* () {
126
142
  const data = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [