@longvansoftware/service-js-client 2.4.2 → 2.4.4

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.
@@ -1,2 +1,4 @@
1
- export declare const CREATE_PAYMENT_ORDER_MUTATION: import("graphql").DocumentNode;
2
- export declare const CREATE_VAT_INVOICE_REQUEST: import("graphql").DocumentNode;
1
+ import { DocumentNode } from "graphql";
2
+ export declare const CREATE_PAYMENT_ORDER_MUTATION: DocumentNode;
3
+ export declare const CREATE_VAT_INVOICE_REQUEST: DocumentNode;
4
+ export declare const REQUEST_UNPUBLISH_VAT_INVOICE: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CREATE_VAT_INVOICE_REQUEST = exports.CREATE_PAYMENT_ORDER_MUTATION = void 0;
3
+ exports.REQUEST_UNPUBLISH_VAT_INVOICE = exports.CREATE_VAT_INVOICE_REQUEST = exports.CREATE_PAYMENT_ORDER_MUTATION = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CREATE_PAYMENT_ORDER_MUTATION = (0, graphql_tag_1.gql) `
6
6
  mutation CreatePaymentOrder(
@@ -49,3 +49,21 @@ exports.CREATE_VAT_INVOICE_REQUEST = (0, graphql_tag_1.gql) `
49
49
  )
50
50
  }
51
51
  `;
52
+ const REQUEST_UNPUBLISH_VAT_INVOICE = (fields = []) => {
53
+ const fieldStr = fields.join("\n ");
54
+ const hasFields = fields.length > 0;
55
+ return (0, graphql_tag_1.gql) `
56
+ mutation RequestUnpublishVatInvoice(
57
+ $vatInvoiceRequest: VatInvoiceRequestDTO!
58
+ $byUser: String!
59
+ ) {
60
+ requestUnpublishVatInvoice(
61
+ vatInvoiceRequest: $vatInvoiceRequest
62
+ byUser: $byUser
63
+ ) {
64
+ ${hasFields ? `${fieldStr}` : ""}
65
+ }
66
+ }
67
+ `;
68
+ };
69
+ exports.REQUEST_UNPUBLISH_VAT_INVOICE = REQUEST_UNPUBLISH_VAT_INVOICE;
@@ -1,3 +1,5 @@
1
- export declare const GET_PAYMENT_METHOD: import("graphql").DocumentNode;
2
- export declare const GEN_QR_PAYMENT: import("graphql").DocumentNode;
3
- export declare const GET_VAT_INVOICE_REQUEST_BY_ORDER: import("graphql").DocumentNode;
1
+ import { DocumentNode } from "graphql";
2
+ export declare const GET_PAYMENT_METHOD: DocumentNode;
3
+ export declare const GEN_QR_PAYMENT: DocumentNode;
4
+ export declare const GET_VAT_INVOICE_REQUEST_BY_ORDER: DocumentNode;
5
+ export declare const GET_INVOICES_OF_ORDER: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_VAT_INVOICE_REQUEST_BY_ORDER = exports.GEN_QR_PAYMENT = exports.GET_PAYMENT_METHOD = void 0;
3
+ 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) {
@@ -65,3 +65,19 @@ exports.GET_VAT_INVOICE_REQUEST_BY_ORDER = (0, graphql_tag_1.gql) `
65
65
  }
66
66
  }
67
67
  `;
68
+ const GET_INVOICES_OF_ORDER = (fields = []) => {
69
+ const fieldStr = fields.join("\n ");
70
+ const hasFields = fields.length > 0;
71
+ return (0, graphql_tag_1.gql) `
72
+ query GetInvoicesOfOrder(
73
+ $orderId: String!
74
+ ) {
75
+ getInvoicesOfOrder(
76
+ orderId: $orderId
77
+ ) {
78
+ ${hasFields ? `${fieldStr}` : ""}
79
+ }
80
+ }
81
+ `;
82
+ };
83
+ exports.GET_INVOICES_OF_ORDER = GET_INVOICES_OF_ORDER;
@@ -7,5 +7,7 @@ export declare class PaymentService extends Service {
7
7
  createPaymentOrder(paymentOrderData: any): Promise<any>;
8
8
  genQRPayment(orderId: any, totalAmount: any): Promise<any>;
9
9
  createVatInvoiceRequest(vatInvoiceRequest: any, createBy: string): Promise<any>;
10
+ requestUnpublishVatInvoice(vatInvoiceRequest: any, byUser: string, fields: string[]): Promise<any>;
11
+ getInvoicesOfOrder(orderId: string, fields: string[]): Promise<any>;
10
12
  getVatInvoiceRequestByOrder(orderId: string, offset: number, pageSize: number): Promise<any>;
11
13
  }
@@ -88,6 +88,39 @@ class PaymentService extends serviceSDK_1.Service {
88
88
  }
89
89
  });
90
90
  }
91
+ requestUnpublishVatInvoice(vatInvoiceRequest, byUser, fields) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const mutation = (0, mutations_1.REQUEST_UNPUBLISH_VAT_INVOICE)(fields);
94
+ const variables = {
95
+ vatInvoiceRequest,
96
+ byUser,
97
+ };
98
+ try {
99
+ const response = yield this.graphqlMutation(mutation, variables);
100
+ return response.requestUnpublishVatInvoice;
101
+ }
102
+ catch (error) {
103
+ console.log(`Error in requestUnpublishVatInvoice: ${error}`);
104
+ throw error;
105
+ }
106
+ });
107
+ }
108
+ getInvoicesOfOrder(orderId, fields) {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ const query = (0, queries_1.GET_INVOICES_OF_ORDER)(fields);
111
+ const variables = {
112
+ orderId,
113
+ };
114
+ try {
115
+ const response = yield this.graphqlQuery(query, variables);
116
+ return response.getInvoicesOfOrder;
117
+ }
118
+ catch (error) {
119
+ console.log(`Error in getInvoicesOfOrder: ${error}`);
120
+ throw error;
121
+ }
122
+ });
123
+ }
91
124
  getVatInvoiceRequestByOrder(orderId, offset, pageSize) {
92
125
  return __awaiter(this, void 0, void 0, function* () {
93
126
  const data = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [