@payabli/sdk-node 0.0.116 → 0.0.117
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.
- package/README.md +24 -7
- package/dist/cjs/BaseClient.d.ts +10 -1
- package/dist/cjs/BaseClient.js +57 -0
- package/dist/cjs/Client.d.ts +87 -86
- package/dist/cjs/Client.js +31 -72
- package/dist/cjs/api/resources/bill/client/Client.d.ts +33 -33
- package/dist/cjs/api/resources/bill/client/Client.js +69 -216
- package/dist/cjs/api/resources/boarding/client/Client.d.ts +27 -27
- package/dist/cjs/api/resources/boarding/client/Client.js +51 -198
- package/dist/cjs/api/resources/chargeBacks/client/Client.d.ts +17 -15
- package/dist/cjs/api/resources/chargeBacks/client/Client.js +38 -79
- package/dist/cjs/api/resources/checkCapture/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/checkCapture/client/Client.js +11 -28
- package/dist/cjs/api/resources/cloud/client/Client.d.ts +17 -17
- package/dist/cjs/api/resources/cloud/client/Client.js +33 -89
- package/dist/cjs/api/resources/customer/client/Client.d.ts +17 -17
- package/dist/cjs/api/resources/customer/client/Client.js +31 -113
- package/dist/cjs/api/resources/export/client/Client.d.ts +93 -89
- package/dist/cjs/api/resources/export/client/Client.js +205 -582
- package/dist/cjs/api/resources/hostedPaymentPages/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/hostedPaymentPages/client/Client.js +19 -62
- package/dist/cjs/api/resources/import/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/import/client/Client.js +19 -62
- package/dist/cjs/api/resources/invoice/client/Client.d.ts +31 -31
- package/dist/cjs/api/resources/invoice/client/Client.js +62 -209
- package/dist/cjs/api/resources/lineItem/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/lineItem/client/Client.js +27 -96
- package/dist/cjs/api/resources/moneyIn/client/Client.d.ts +39 -39
- package/dist/cjs/api/resources/moneyIn/client/Client.js +79 -249
- package/dist/cjs/api/resources/moneyOut/client/Client.d.ts +43 -26
- package/dist/cjs/api/resources/moneyOut/client/Client.js +105 -168
- package/dist/cjs/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.ts +2 -1
- package/dist/cjs/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.ts +3 -1
- package/dist/cjs/api/resources/notification/client/Client.d.ts +16 -16
- package/dist/cjs/api/resources/notification/client/Client.js +32 -101
- package/dist/cjs/api/resources/notificationlogs/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/notificationlogs/client/Client.js +23 -79
- package/dist/cjs/api/resources/ocr/client/Client.d.ts +13 -9
- package/dist/cjs/api/resources/ocr/client/Client.js +19 -45
- package/dist/cjs/api/resources/organization/client/Client.d.ts +19 -19
- package/dist/cjs/api/resources/organization/client/Client.js +35 -130
- package/dist/cjs/api/resources/paymentLink/client/Client.d.ts +23 -23
- package/dist/cjs/api/resources/paymentLink/client/Client.js +43 -164
- package/dist/cjs/api/resources/paymentMethodDomain/client/Client.d.ts +19 -19
- package/dist/cjs/api/resources/paymentMethodDomain/client/Client.js +35 -130
- package/dist/cjs/api/resources/paypoint/client/Client.d.ts +22 -22
- package/dist/cjs/api/resources/paypoint/client/Client.js +44 -152
- package/dist/cjs/api/resources/query/client/Client.d.ts +71 -71
- package/dist/cjs/api/resources/query/client/Client.js +137 -572
- package/dist/cjs/api/resources/query/client/requests/ListPayoutOrgRequest.d.ts +1 -0
- package/dist/cjs/api/resources/query/client/requests/ListPayoutRequest.d.ts +1 -0
- package/dist/cjs/api/resources/query/client/requests/ListTransactionsRequest.d.ts +1 -0
- package/dist/cjs/api/resources/statistic/client/Client.d.ts +50 -50
- package/dist/cjs/api/resources/statistic/client/Client.js +80 -133
- package/dist/cjs/api/resources/statistic/client/requests/BasicStatsRequest.d.ts +2 -2
- package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.ts +76 -0
- package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.js +3 -0
- package/dist/cjs/api/resources/statistic/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/statistic/types/index.js +1 -0
- package/dist/cjs/api/resources/subscription/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/subscription/client/Client.js +23 -79
- package/dist/cjs/api/resources/templates/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/templates/client/Client.js +28 -84
- package/dist/cjs/api/resources/tokenStorage/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/tokenStorage/client/Client.js +23 -79
- package/dist/cjs/api/resources/user/client/Client.d.ts +54 -32
- package/dist/cjs/api/resources/user/client/Client.js +84 -222
- package/dist/cjs/api/resources/vendor/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/vendor/client/Client.js +23 -79
- package/dist/cjs/api/resources/wallet/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/wallet/client/Client.js +23 -79
- package/dist/cjs/api/types/ApplicationDetailsRecord.d.ts +2 -2
- package/dist/cjs/api/types/NotificationContent.d.ts +1 -0
- package/dist/cjs/api/types/NotificationContent.js +1 -0
- package/dist/cjs/api/types/NotificationStandardRequest.d.ts +1 -0
- package/dist/cjs/api/types/NotificationStandardRequest.js +1 -0
- package/dist/cjs/api/types/QueryResponseSettlements.d.ts +1 -1
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -0
- package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
- package/dist/cjs/{version.js → core/auth/AuthProvider.js} +0 -2
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
- package/dist/cjs/core/auth/BasicAuth.js +27 -0
- package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
- package/dist/cjs/core/auth/BearerToken.js +16 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +5 -0
- package/dist/cjs/core/auth/index.js +9 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
- package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
- package/dist/cjs/core/fetcher/Fetcher.js +42 -24
- package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +1 -7
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/index.d.ts +2 -0
- package/dist/cjs/core/index.js +2 -0
- package/dist/cjs/core/logging/logger.js +1 -1
- package/dist/cjs/core/runtime/runtime.js +11 -10
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
- package/dist/esm/BaseClient.d.mts +10 -1
- package/dist/esm/BaseClient.mjs +22 -1
- package/dist/esm/Client.d.mts +87 -86
- package/dist/esm/Client.mjs +59 -67
- package/dist/esm/api/resources/bill/client/Client.d.mts +33 -33
- package/dist/esm/api/resources/bill/client/Client.mjs +67 -214
- package/dist/esm/api/resources/boarding/client/Client.d.mts +27 -27
- package/dist/esm/api/resources/boarding/client/Client.mjs +50 -197
- package/dist/esm/api/resources/chargeBacks/client/Client.d.mts +17 -15
- package/dist/esm/api/resources/chargeBacks/client/Client.mjs +36 -77
- package/dist/esm/api/resources/checkCapture/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/checkCapture/client/Client.mjs +10 -27
- package/dist/esm/api/resources/cloud/client/Client.d.mts +17 -17
- package/dist/esm/api/resources/cloud/client/Client.mjs +31 -87
- package/dist/esm/api/resources/customer/client/Client.d.mts +17 -17
- package/dist/esm/api/resources/customer/client/Client.mjs +29 -111
- package/dist/esm/api/resources/export/client/Client.d.mts +93 -89
- package/dist/esm/api/resources/export/client/Client.mjs +204 -581
- package/dist/esm/api/resources/hostedPaymentPages/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/hostedPaymentPages/client/Client.mjs +17 -60
- package/dist/esm/api/resources/import/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/import/client/Client.mjs +17 -60
- package/dist/esm/api/resources/invoice/client/Client.d.mts +31 -31
- package/dist/esm/api/resources/invoice/client/Client.mjs +60 -207
- package/dist/esm/api/resources/lineItem/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/lineItem/client/Client.mjs +25 -94
- package/dist/esm/api/resources/moneyIn/client/Client.d.mts +39 -39
- package/dist/esm/api/resources/moneyIn/client/Client.mjs +77 -247
- package/dist/esm/api/resources/moneyOut/client/Client.d.mts +43 -26
- package/dist/esm/api/resources/moneyOut/client/Client.mjs +103 -166
- package/dist/esm/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.mts +2 -1
- package/dist/esm/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.mts +3 -1
- package/dist/esm/api/resources/notification/client/Client.d.mts +16 -16
- package/dist/esm/api/resources/notification/client/Client.mjs +31 -100
- package/dist/esm/api/resources/notificationlogs/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/notificationlogs/client/Client.mjs +22 -78
- package/dist/esm/api/resources/ocr/client/Client.d.mts +13 -9
- package/dist/esm/api/resources/ocr/client/Client.mjs +18 -44
- package/dist/esm/api/resources/organization/client/Client.d.mts +19 -19
- package/dist/esm/api/resources/organization/client/Client.mjs +33 -128
- package/dist/esm/api/resources/paymentLink/client/Client.d.mts +23 -23
- package/dist/esm/api/resources/paymentLink/client/Client.mjs +41 -162
- package/dist/esm/api/resources/paymentMethodDomain/client/Client.d.mts +19 -19
- package/dist/esm/api/resources/paymentMethodDomain/client/Client.mjs +34 -129
- package/dist/esm/api/resources/paypoint/client/Client.d.mts +22 -22
- package/dist/esm/api/resources/paypoint/client/Client.mjs +43 -151
- package/dist/esm/api/resources/query/client/Client.d.mts +71 -71
- package/dist/esm/api/resources/query/client/Client.mjs +136 -571
- package/dist/esm/api/resources/query/client/requests/ListPayoutOrgRequest.d.mts +1 -0
- package/dist/esm/api/resources/query/client/requests/ListPayoutRequest.d.mts +1 -0
- package/dist/esm/api/resources/query/client/requests/ListTransactionsRequest.d.mts +1 -0
- package/dist/esm/api/resources/statistic/client/Client.d.mts +50 -50
- package/dist/esm/api/resources/statistic/client/Client.mjs +79 -132
- package/dist/esm/api/resources/statistic/client/requests/BasicStatsRequest.d.mts +2 -2
- package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.mts +76 -0
- package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.mjs +2 -0
- package/dist/esm/api/resources/statistic/types/index.d.mts +1 -0
- package/dist/esm/api/resources/statistic/types/index.mjs +1 -0
- package/dist/esm/api/resources/subscription/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/subscription/client/Client.mjs +21 -77
- package/dist/esm/api/resources/templates/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/templates/client/Client.mjs +27 -83
- package/dist/esm/api/resources/tokenStorage/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/tokenStorage/client/Client.mjs +21 -77
- package/dist/esm/api/resources/user/client/Client.d.mts +54 -32
- package/dist/esm/api/resources/user/client/Client.mjs +83 -221
- package/dist/esm/api/resources/vendor/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/vendor/client/Client.mjs +22 -78
- package/dist/esm/api/resources/wallet/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/wallet/client/Client.mjs +22 -78
- package/dist/esm/api/types/ApplicationDetailsRecord.d.mts +2 -2
- package/dist/esm/api/types/NotificationContent.d.mts +1 -0
- package/dist/esm/api/types/NotificationContent.mjs +1 -0
- package/dist/esm/api/types/NotificationStandardRequest.d.mts +1 -0
- package/dist/esm/api/types/NotificationStandardRequest.mjs +1 -0
- package/dist/esm/api/types/QueryResponseSettlements.d.mts +1 -1
- package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -0
- package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
- package/dist/esm/core/auth/BasicAuth.mjs +24 -0
- package/dist/esm/core/auth/BearerToken.d.mts +7 -0
- package/dist/esm/core/auth/BearerToken.mjs +13 -0
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +5 -0
- package/dist/esm/core/auth/index.mjs +3 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
- package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +42 -24
- package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +1 -7
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/index.d.mts +2 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/core/logging/logger.mjs +1 -1
- package/dist/esm/core/runtime/runtime.mjs +11 -10
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
- package/package.json +4 -4
- package/reference.md +761 -473
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
- package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
- package/dist/cjs/version.d.ts +0 -1
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
- package/dist/esm/version.d.mts +0 -1
- package/dist/esm/version.mjs +0 -1
|
@@ -8,22 +8,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
11
12
|
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
12
13
|
import * as core from "../../../../core/index.mjs";
|
|
13
14
|
import { toJson } from "../../../../core/json.mjs";
|
|
14
15
|
import * as environments from "../../../../environments.mjs";
|
|
16
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
15
17
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
18
|
import * as Payabli from "../../../index.mjs";
|
|
17
|
-
export class
|
|
18
|
-
constructor(
|
|
19
|
-
this._options =
|
|
19
|
+
export class InvoiceClient {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Creates an invoice in an entrypoint.
|
|
23
25
|
*
|
|
24
26
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
25
27
|
* @param {Payabli.AddInvoiceRequest} request
|
|
26
|
-
* @param {
|
|
28
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
29
|
*
|
|
28
30
|
* @throws {@link Payabli.BadRequestError}
|
|
29
31
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -73,7 +75,8 @@ export class Invoice {
|
|
|
73
75
|
if (forceCustomerCreation != null) {
|
|
74
76
|
_queryParams.forceCustomerCreation = forceCustomerCreation.toString();
|
|
75
77
|
}
|
|
76
|
-
const
|
|
78
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
79
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
77
80
|
const _response = yield core.fetcher({
|
|
78
81
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/${core.url.encodePathParam(entry)}`),
|
|
79
82
|
method: "POST",
|
|
@@ -109,26 +112,13 @@ export class Invoice {
|
|
|
109
112
|
});
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
case "non-json":
|
|
114
|
-
throw new errors.PayabliError({
|
|
115
|
-
statusCode: _response.error.statusCode,
|
|
116
|
-
body: _response.error.rawBody,
|
|
117
|
-
rawResponse: _response.rawResponse,
|
|
118
|
-
});
|
|
119
|
-
case "timeout":
|
|
120
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Invoice/{entry}.");
|
|
121
|
-
case "unknown":
|
|
122
|
-
throw new errors.PayabliError({
|
|
123
|
-
message: _response.error.errorMessage,
|
|
124
|
-
rawResponse: _response.rawResponse,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
115
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Invoice/{entry}");
|
|
127
116
|
});
|
|
128
117
|
}
|
|
129
118
|
/**
|
|
130
119
|
* Deletes an invoice that's attached to a file.
|
|
131
120
|
*
|
|
121
|
+
* @param {number} idInvoice - Invoice ID
|
|
132
122
|
* @param {string} filename - The filename in Payabli. Filename is `zipName` in response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``.
|
|
133
123
|
* "DocumentsRef": {
|
|
134
124
|
* "zipfile": "inva_269.zip",
|
|
@@ -140,8 +130,7 @@ export class Invoice {
|
|
|
140
130
|
* }
|
|
141
131
|
* ]
|
|
142
132
|
* }
|
|
143
|
-
* @param {
|
|
144
|
-
* @param {Invoice.RequestOptions} requestOptions - Request-specific configuration.
|
|
133
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
145
134
|
*
|
|
146
135
|
* @throws {@link Payabli.BadRequestError}
|
|
147
136
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -149,15 +138,16 @@ export class Invoice {
|
|
|
149
138
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
150
139
|
*
|
|
151
140
|
* @example
|
|
152
|
-
* await client.invoice.deleteAttachedFromInvoice("0_Bill.pdf"
|
|
141
|
+
* await client.invoice.deleteAttachedFromInvoice(23548884, "0_Bill.pdf")
|
|
153
142
|
*/
|
|
154
|
-
deleteAttachedFromInvoice(
|
|
155
|
-
return core.HttpResponsePromise.fromPromise(this.__deleteAttachedFromInvoice(
|
|
143
|
+
deleteAttachedFromInvoice(idInvoice, filename, requestOptions) {
|
|
144
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteAttachedFromInvoice(idInvoice, filename, requestOptions));
|
|
156
145
|
}
|
|
157
|
-
__deleteAttachedFromInvoice(
|
|
146
|
+
__deleteAttachedFromInvoice(idInvoice, filename, requestOptions) {
|
|
158
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
148
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
160
|
-
const
|
|
149
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
150
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
161
151
|
const _response = yield core.fetcher({
|
|
162
152
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/attachedFileFromInvoice/${core.url.encodePathParam(idInvoice)}/${core.url.encodePathParam(filename)}`),
|
|
163
153
|
method: "DELETE",
|
|
@@ -190,28 +180,14 @@ export class Invoice {
|
|
|
190
180
|
});
|
|
191
181
|
}
|
|
192
182
|
}
|
|
193
|
-
|
|
194
|
-
case "non-json":
|
|
195
|
-
throw new errors.PayabliError({
|
|
196
|
-
statusCode: _response.error.statusCode,
|
|
197
|
-
body: _response.error.rawBody,
|
|
198
|
-
rawResponse: _response.rawResponse,
|
|
199
|
-
});
|
|
200
|
-
case "timeout":
|
|
201
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Invoice/attachedFileFromInvoice/{idInvoice}/{filename}.");
|
|
202
|
-
case "unknown":
|
|
203
|
-
throw new errors.PayabliError({
|
|
204
|
-
message: _response.error.errorMessage,
|
|
205
|
-
rawResponse: _response.rawResponse,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
183
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Invoice/attachedFileFromInvoice/{idInvoice}/{filename}");
|
|
208
184
|
});
|
|
209
185
|
}
|
|
210
186
|
/**
|
|
211
187
|
* Deletes a single invoice from an entrypoint.
|
|
212
188
|
*
|
|
213
189
|
* @param {number} idInvoice - Invoice ID
|
|
214
|
-
* @param {
|
|
190
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
215
191
|
*
|
|
216
192
|
* @throws {@link Payabli.BadRequestError}
|
|
217
193
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -227,7 +203,8 @@ export class Invoice {
|
|
|
227
203
|
__deleteInvoice(idInvoice, requestOptions) {
|
|
228
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
205
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
230
|
-
const
|
|
206
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
207
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
231
208
|
const _response = yield core.fetcher({
|
|
232
209
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/${core.url.encodePathParam(idInvoice)}`),
|
|
233
210
|
method: "DELETE",
|
|
@@ -260,21 +237,7 @@ export class Invoice {
|
|
|
260
237
|
});
|
|
261
238
|
}
|
|
262
239
|
}
|
|
263
|
-
|
|
264
|
-
case "non-json":
|
|
265
|
-
throw new errors.PayabliError({
|
|
266
|
-
statusCode: _response.error.statusCode,
|
|
267
|
-
body: _response.error.rawBody,
|
|
268
|
-
rawResponse: _response.rawResponse,
|
|
269
|
-
});
|
|
270
|
-
case "timeout":
|
|
271
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Invoice/{idInvoice}.");
|
|
272
|
-
case "unknown":
|
|
273
|
-
throw new errors.PayabliError({
|
|
274
|
-
message: _response.error.errorMessage,
|
|
275
|
-
rawResponse: _response.rawResponse,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
240
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Invoice/{idInvoice}");
|
|
278
241
|
});
|
|
279
242
|
}
|
|
280
243
|
/**
|
|
@@ -282,7 +245,7 @@ export class Invoice {
|
|
|
282
245
|
*
|
|
283
246
|
* @param {number} idInvoice - Invoice ID
|
|
284
247
|
* @param {Payabli.EditInvoiceRequest} request
|
|
285
|
-
* @param {
|
|
248
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
286
249
|
*
|
|
287
250
|
* @throws {@link Payabli.BadRequestError}
|
|
288
251
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -317,7 +280,8 @@ export class Invoice {
|
|
|
317
280
|
if (forceCustomerCreation != null) {
|
|
318
281
|
_queryParams.forceCustomerCreation = forceCustomerCreation.toString();
|
|
319
282
|
}
|
|
320
|
-
const
|
|
283
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
284
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
321
285
|
const _response = yield core.fetcher({
|
|
322
286
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/${core.url.encodePathParam(idInvoice)}`),
|
|
323
287
|
method: "PUT",
|
|
@@ -353,26 +317,13 @@ export class Invoice {
|
|
|
353
317
|
});
|
|
354
318
|
}
|
|
355
319
|
}
|
|
356
|
-
|
|
357
|
-
case "non-json":
|
|
358
|
-
throw new errors.PayabliError({
|
|
359
|
-
statusCode: _response.error.statusCode,
|
|
360
|
-
body: _response.error.rawBody,
|
|
361
|
-
rawResponse: _response.rawResponse,
|
|
362
|
-
});
|
|
363
|
-
case "timeout":
|
|
364
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Invoice/{idInvoice}.");
|
|
365
|
-
case "unknown":
|
|
366
|
-
throw new errors.PayabliError({
|
|
367
|
-
message: _response.error.errorMessage,
|
|
368
|
-
rawResponse: _response.rawResponse,
|
|
369
|
-
});
|
|
370
|
-
}
|
|
320
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Invoice/{idInvoice}");
|
|
371
321
|
});
|
|
372
322
|
}
|
|
373
323
|
/**
|
|
374
324
|
* Retrieves a file attached to an invoice.
|
|
375
325
|
*
|
|
326
|
+
* @param {number} idInvoice - Invoice ID
|
|
376
327
|
* @param {string} filename - The filename in Payabli. Filename is `zipName` in the response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``.
|
|
377
328
|
* ```
|
|
378
329
|
* "DocumentsRef": {
|
|
@@ -386,9 +337,8 @@ export class Invoice {
|
|
|
386
337
|
* ]
|
|
387
338
|
* }
|
|
388
339
|
* ```
|
|
389
|
-
* @param {number} idInvoice - Invoice ID
|
|
390
340
|
* @param {Payabli.GetAttachedFileFromInvoiceRequest} request
|
|
391
|
-
* @param {
|
|
341
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
392
342
|
*
|
|
393
343
|
* @throws {@link Payabli.BadRequestError}
|
|
394
344
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -396,20 +346,21 @@ export class Invoice {
|
|
|
396
346
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
397
347
|
*
|
|
398
348
|
* @example
|
|
399
|
-
* await client.invoice.getAttachedFileFromInvoice("filename"
|
|
349
|
+
* await client.invoice.getAttachedFileFromInvoice(1, "filename")
|
|
400
350
|
*/
|
|
401
|
-
getAttachedFileFromInvoice(
|
|
402
|
-
return core.HttpResponsePromise.fromPromise(this.__getAttachedFileFromInvoice(
|
|
351
|
+
getAttachedFileFromInvoice(idInvoice, filename, request = {}, requestOptions) {
|
|
352
|
+
return core.HttpResponsePromise.fromPromise(this.__getAttachedFileFromInvoice(idInvoice, filename, request, requestOptions));
|
|
403
353
|
}
|
|
404
|
-
__getAttachedFileFromInvoice(
|
|
405
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
354
|
+
__getAttachedFileFromInvoice(idInvoice_1, filename_1) {
|
|
355
|
+
return __awaiter(this, arguments, void 0, function* (idInvoice, filename, request = {}, requestOptions) {
|
|
406
356
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
407
357
|
const { returnObject } = request;
|
|
408
358
|
const _queryParams = {};
|
|
409
359
|
if (returnObject != null) {
|
|
410
360
|
_queryParams.returnObject = returnObject.toString();
|
|
411
361
|
}
|
|
412
|
-
const
|
|
362
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
363
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
413
364
|
const _response = yield core.fetcher({
|
|
414
365
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/attachedFileFromInvoice/${core.url.encodePathParam(idInvoice)}/${core.url.encodePathParam(filename)}`),
|
|
415
366
|
method: "GET",
|
|
@@ -442,28 +393,14 @@ export class Invoice {
|
|
|
442
393
|
});
|
|
443
394
|
}
|
|
444
395
|
}
|
|
445
|
-
|
|
446
|
-
case "non-json":
|
|
447
|
-
throw new errors.PayabliError({
|
|
448
|
-
statusCode: _response.error.statusCode,
|
|
449
|
-
body: _response.error.rawBody,
|
|
450
|
-
rawResponse: _response.rawResponse,
|
|
451
|
-
});
|
|
452
|
-
case "timeout":
|
|
453
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/attachedFileFromInvoice/{idInvoice}/{filename}.");
|
|
454
|
-
case "unknown":
|
|
455
|
-
throw new errors.PayabliError({
|
|
456
|
-
message: _response.error.errorMessage,
|
|
457
|
-
rawResponse: _response.rawResponse,
|
|
458
|
-
});
|
|
459
|
-
}
|
|
396
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Invoice/attachedFileFromInvoice/{idInvoice}/{filename}");
|
|
460
397
|
});
|
|
461
398
|
}
|
|
462
399
|
/**
|
|
463
400
|
* Retrieves a single invoice by ID.
|
|
464
401
|
*
|
|
465
402
|
* @param {number} idInvoice - Invoice ID
|
|
466
|
-
* @param {
|
|
403
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
467
404
|
*
|
|
468
405
|
* @throws {@link Payabli.BadRequestError}
|
|
469
406
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -479,7 +416,8 @@ export class Invoice {
|
|
|
479
416
|
__getInvoice(idInvoice, requestOptions) {
|
|
480
417
|
return __awaiter(this, void 0, void 0, function* () {
|
|
481
418
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
482
|
-
const
|
|
419
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
420
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
483
421
|
const _response = yield core.fetcher({
|
|
484
422
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/${core.url.encodePathParam(idInvoice)}`),
|
|
485
423
|
method: "GET",
|
|
@@ -512,28 +450,14 @@ export class Invoice {
|
|
|
512
450
|
});
|
|
513
451
|
}
|
|
514
452
|
}
|
|
515
|
-
|
|
516
|
-
case "non-json":
|
|
517
|
-
throw new errors.PayabliError({
|
|
518
|
-
statusCode: _response.error.statusCode,
|
|
519
|
-
body: _response.error.rawBody,
|
|
520
|
-
rawResponse: _response.rawResponse,
|
|
521
|
-
});
|
|
522
|
-
case "timeout":
|
|
523
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/{idInvoice}.");
|
|
524
|
-
case "unknown":
|
|
525
|
-
throw new errors.PayabliError({
|
|
526
|
-
message: _response.error.errorMessage,
|
|
527
|
-
rawResponse: _response.rawResponse,
|
|
528
|
-
});
|
|
529
|
-
}
|
|
453
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Invoice/{idInvoice}");
|
|
530
454
|
});
|
|
531
455
|
}
|
|
532
456
|
/**
|
|
533
457
|
* Retrieves the next available invoice number for a paypoint.
|
|
534
458
|
*
|
|
535
459
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
536
|
-
* @param {
|
|
460
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
537
461
|
*
|
|
538
462
|
* @throws {@link Payabli.BadRequestError}
|
|
539
463
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -549,7 +473,8 @@ export class Invoice {
|
|
|
549
473
|
__getInvoiceNumber(entry, requestOptions) {
|
|
550
474
|
return __awaiter(this, void 0, void 0, function* () {
|
|
551
475
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
552
|
-
const
|
|
476
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
477
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
553
478
|
const _response = yield core.fetcher({
|
|
554
479
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/getNumber/${core.url.encodePathParam(entry)}`),
|
|
555
480
|
method: "GET",
|
|
@@ -582,21 +507,7 @@ export class Invoice {
|
|
|
582
507
|
});
|
|
583
508
|
}
|
|
584
509
|
}
|
|
585
|
-
|
|
586
|
-
case "non-json":
|
|
587
|
-
throw new errors.PayabliError({
|
|
588
|
-
statusCode: _response.error.statusCode,
|
|
589
|
-
body: _response.error.rawBody,
|
|
590
|
-
rawResponse: _response.rawResponse,
|
|
591
|
-
});
|
|
592
|
-
case "timeout":
|
|
593
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/getNumber/{entry}.");
|
|
594
|
-
case "unknown":
|
|
595
|
-
throw new errors.PayabliError({
|
|
596
|
-
message: _response.error.errorMessage,
|
|
597
|
-
rawResponse: _response.rawResponse,
|
|
598
|
-
});
|
|
599
|
-
}
|
|
510
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Invoice/getNumber/{entry}");
|
|
600
511
|
});
|
|
601
512
|
}
|
|
602
513
|
/**
|
|
@@ -604,7 +515,7 @@ export class Invoice {
|
|
|
604
515
|
*
|
|
605
516
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
606
517
|
* @param {Payabli.ListInvoicesRequest} request
|
|
607
|
-
* @param {
|
|
518
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
608
519
|
*
|
|
609
520
|
* @throws {@link Payabli.BadRequestError}
|
|
610
521
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -641,7 +552,8 @@ export class Invoice {
|
|
|
641
552
|
if (sortBy != null) {
|
|
642
553
|
_queryParams.sortBy = sortBy;
|
|
643
554
|
}
|
|
644
|
-
const
|
|
555
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
556
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
645
557
|
const _response = yield core.fetcher({
|
|
646
558
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/invoices/${core.url.encodePathParam(entry)}`),
|
|
647
559
|
method: "GET",
|
|
@@ -674,21 +586,7 @@ export class Invoice {
|
|
|
674
586
|
});
|
|
675
587
|
}
|
|
676
588
|
}
|
|
677
|
-
|
|
678
|
-
case "non-json":
|
|
679
|
-
throw new errors.PayabliError({
|
|
680
|
-
statusCode: _response.error.statusCode,
|
|
681
|
-
body: _response.error.rawBody,
|
|
682
|
-
rawResponse: _response.rawResponse,
|
|
683
|
-
});
|
|
684
|
-
case "timeout":
|
|
685
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/invoices/{entry}.");
|
|
686
|
-
case "unknown":
|
|
687
|
-
throw new errors.PayabliError({
|
|
688
|
-
message: _response.error.errorMessage,
|
|
689
|
-
rawResponse: _response.rawResponse,
|
|
690
|
-
});
|
|
691
|
-
}
|
|
589
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/invoices/{entry}");
|
|
692
590
|
});
|
|
693
591
|
}
|
|
694
592
|
/**
|
|
@@ -696,7 +594,7 @@ export class Invoice {
|
|
|
696
594
|
*
|
|
697
595
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
698
596
|
* @param {Payabli.ListInvoicesOrgRequest} request
|
|
699
|
-
* @param {
|
|
597
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
700
598
|
*
|
|
701
599
|
* @throws {@link Payabli.BadRequestError}
|
|
702
600
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -733,7 +631,8 @@ export class Invoice {
|
|
|
733
631
|
if (sortBy != null) {
|
|
734
632
|
_queryParams.sortBy = sortBy;
|
|
735
633
|
}
|
|
736
|
-
const
|
|
634
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
635
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
737
636
|
const _response = yield core.fetcher({
|
|
738
637
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/invoices/org/${core.url.encodePathParam(orgId)}`),
|
|
739
638
|
method: "GET",
|
|
@@ -766,21 +665,7 @@ export class Invoice {
|
|
|
766
665
|
});
|
|
767
666
|
}
|
|
768
667
|
}
|
|
769
|
-
|
|
770
|
-
case "non-json":
|
|
771
|
-
throw new errors.PayabliError({
|
|
772
|
-
statusCode: _response.error.statusCode,
|
|
773
|
-
body: _response.error.rawBody,
|
|
774
|
-
rawResponse: _response.rawResponse,
|
|
775
|
-
});
|
|
776
|
-
case "timeout":
|
|
777
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/invoices/org/{orgId}.");
|
|
778
|
-
case "unknown":
|
|
779
|
-
throw new errors.PayabliError({
|
|
780
|
-
message: _response.error.errorMessage,
|
|
781
|
-
rawResponse: _response.rawResponse,
|
|
782
|
-
});
|
|
783
|
-
}
|
|
668
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/invoices/org/{orgId}");
|
|
784
669
|
});
|
|
785
670
|
}
|
|
786
671
|
/**
|
|
@@ -788,7 +673,7 @@ export class Invoice {
|
|
|
788
673
|
*
|
|
789
674
|
* @param {number} idInvoice - Invoice ID
|
|
790
675
|
* @param {Payabli.SendInvoiceRequest} request
|
|
791
|
-
* @param {
|
|
676
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
792
677
|
*
|
|
793
678
|
* @throws {@link Payabli.BadRequestError}
|
|
794
679
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -815,7 +700,8 @@ export class Invoice {
|
|
|
815
700
|
if (mail2 != null) {
|
|
816
701
|
_queryParams.mail2 = mail2;
|
|
817
702
|
}
|
|
818
|
-
const
|
|
703
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
704
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
819
705
|
const _response = yield core.fetcher({
|
|
820
706
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Invoice/send/${core.url.encodePathParam(idInvoice)}`),
|
|
821
707
|
method: "GET",
|
|
@@ -848,28 +734,14 @@ export class Invoice {
|
|
|
848
734
|
});
|
|
849
735
|
}
|
|
850
736
|
}
|
|
851
|
-
|
|
852
|
-
case "non-json":
|
|
853
|
-
throw new errors.PayabliError({
|
|
854
|
-
statusCode: _response.error.statusCode,
|
|
855
|
-
body: _response.error.rawBody,
|
|
856
|
-
rawResponse: _response.rawResponse,
|
|
857
|
-
});
|
|
858
|
-
case "timeout":
|
|
859
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/send/{idInvoice}.");
|
|
860
|
-
case "unknown":
|
|
861
|
-
throw new errors.PayabliError({
|
|
862
|
-
message: _response.error.errorMessage,
|
|
863
|
-
rawResponse: _response.rawResponse,
|
|
864
|
-
});
|
|
865
|
-
}
|
|
737
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Invoice/send/{idInvoice}");
|
|
866
738
|
});
|
|
867
739
|
}
|
|
868
740
|
/**
|
|
869
741
|
* Export a single invoice in PDF format.
|
|
870
742
|
*
|
|
871
743
|
* @param {number} idInvoice - Invoice ID
|
|
872
|
-
* @param {
|
|
744
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
873
745
|
*
|
|
874
746
|
* @throws {@link Payabli.BadRequestError}
|
|
875
747
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -885,7 +757,8 @@ export class Invoice {
|
|
|
885
757
|
__getInvoicePdf(idInvoice, requestOptions) {
|
|
886
758
|
return __awaiter(this, void 0, void 0, function* () {
|
|
887
759
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
888
|
-
const
|
|
760
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
761
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
889
762
|
const _response = yield core.fetcher({
|
|
890
763
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Export/invoicePdf/${core.url.encodePathParam(idInvoice)}`),
|
|
891
764
|
method: "GET",
|
|
@@ -918,27 +791,7 @@ export class Invoice {
|
|
|
918
791
|
});
|
|
919
792
|
}
|
|
920
793
|
}
|
|
921
|
-
|
|
922
|
-
case "non-json":
|
|
923
|
-
throw new errors.PayabliError({
|
|
924
|
-
statusCode: _response.error.statusCode,
|
|
925
|
-
body: _response.error.rawBody,
|
|
926
|
-
rawResponse: _response.rawResponse,
|
|
927
|
-
});
|
|
928
|
-
case "timeout":
|
|
929
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/invoicePdf/{idInvoice}.");
|
|
930
|
-
case "unknown":
|
|
931
|
-
throw new errors.PayabliError({
|
|
932
|
-
message: _response.error.errorMessage,
|
|
933
|
-
rawResponse: _response.rawResponse,
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
_getCustomAuthorizationHeaders() {
|
|
939
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
940
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
941
|
-
return { requestToken: apiKeyValue };
|
|
794
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Export/invoicePdf/{idInvoice}");
|
|
942
795
|
});
|
|
943
796
|
}
|
|
944
797
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import * as Payabli from "../../../index.mjs";
|
|
4
|
-
export declare namespace
|
|
5
|
+
export declare namespace LineItemClient {
|
|
5
6
|
interface Options extends BaseClientOptions {
|
|
6
7
|
}
|
|
7
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
11
|
+
export declare class LineItemClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<LineItemClient.Options>;
|
|
13
|
+
constructor(options?: LineItemClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* Adds products and services to an entrypoint's catalog. These are used as line items for invoicing and transactions. In the response, "responseData" displays the item's code.
|
|
15
16
|
*
|
|
16
17
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
17
18
|
* @param {Payabli.AddItemRequest} request
|
|
18
|
-
* @param {
|
|
19
|
+
* @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
20
|
*
|
|
20
21
|
* @throws {@link Payabli.BadRequestError}
|
|
21
22
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -36,13 +37,13 @@ export declare class LineItem {
|
|
|
36
37
|
* }
|
|
37
38
|
* })
|
|
38
39
|
*/
|
|
39
|
-
addItem(entry: string, request: Payabli.AddItemRequest, requestOptions?:
|
|
40
|
+
addItem(entry: string, request: Payabli.AddItemRequest, requestOptions?: LineItemClient.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponse6>;
|
|
40
41
|
private __addItem;
|
|
41
42
|
/**
|
|
42
43
|
* Deletes an item.
|
|
43
44
|
*
|
|
44
45
|
* @param {number} lineItemId - ID for the line item (also known as a product, service, or item).
|
|
45
|
-
* @param {
|
|
46
|
+
* @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
46
47
|
*
|
|
47
48
|
* @throws {@link Payabli.BadRequestError}
|
|
48
49
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -52,13 +53,13 @@ export declare class LineItem {
|
|
|
52
53
|
* @example
|
|
53
54
|
* await client.lineItem.deleteItem(700)
|
|
54
55
|
*/
|
|
55
|
-
deleteItem(lineItemId: number, requestOptions?:
|
|
56
|
+
deleteItem(lineItemId: number, requestOptions?: LineItemClient.RequestOptions): core.HttpResponsePromise<Payabli.DeleteItemResponse>;
|
|
56
57
|
private __deleteItem;
|
|
57
58
|
/**
|
|
58
59
|
* Gets an item by ID.
|
|
59
60
|
*
|
|
60
61
|
* @param {number} lineItemId - ID for the line item (also known as a product, service, or item).
|
|
61
|
-
* @param {
|
|
62
|
+
* @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
63
|
*
|
|
63
64
|
* @throws {@link Payabli.BadRequestError}
|
|
64
65
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -68,14 +69,14 @@ export declare class LineItem {
|
|
|
68
69
|
* @example
|
|
69
70
|
* await client.lineItem.getItem(700)
|
|
70
71
|
*/
|
|
71
|
-
getItem(lineItemId: number, requestOptions?:
|
|
72
|
+
getItem(lineItemId: number, requestOptions?: LineItemClient.RequestOptions): core.HttpResponsePromise<Payabli.LineItemQueryRecord>;
|
|
72
73
|
private __getItem;
|
|
73
74
|
/**
|
|
74
75
|
* Retrieves a list of line items and their details from an entrypoint. Line items are also known as items, products, and services. Use filters to limit results.
|
|
75
76
|
*
|
|
76
77
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
77
78
|
* @param {Payabli.ListLineItemsRequest} request
|
|
78
|
-
* @param {
|
|
79
|
+
* @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
80
|
*
|
|
80
81
|
* @throws {@link Payabli.BadRequestError}
|
|
81
82
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -89,14 +90,14 @@ export declare class LineItem {
|
|
|
89
90
|
* sortBy: "desc(field_name)"
|
|
90
91
|
* })
|
|
91
92
|
*/
|
|
92
|
-
listLineItems(entry: string, request?: Payabli.ListLineItemsRequest, requestOptions?:
|
|
93
|
+
listLineItems(entry: string, request?: Payabli.ListLineItemsRequest, requestOptions?: LineItemClient.RequestOptions): core.HttpResponsePromise<Payabli.QueryResponseItems>;
|
|
93
94
|
private __listLineItems;
|
|
94
95
|
/**
|
|
95
96
|
* Updates an item.
|
|
96
97
|
*
|
|
97
98
|
* @param {number} lineItemId - ID for the line item (also known as a product, service, or item).
|
|
98
99
|
* @param {Payabli.LineItem} request
|
|
99
|
-
* @param {
|
|
100
|
+
* @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
100
101
|
*
|
|
101
102
|
* @throws {@link Payabli.BadRequestError}
|
|
102
103
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -109,7 +110,6 @@ export declare class LineItem {
|
|
|
109
110
|
* itemQty: 1
|
|
110
111
|
* })
|
|
111
112
|
*/
|
|
112
|
-
updateItem(lineItemId: number, request: Payabli.LineItem, requestOptions?:
|
|
113
|
+
updateItem(lineItemId: number, request: Payabli.LineItem, requestOptions?: LineItemClient.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponse6>;
|
|
113
114
|
private __updateItem;
|
|
114
|
-
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
115
115
|
}
|