@payabli/sdk-node 0.0.116 → 0.0.123
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 +31 -2
- package/dist/cjs/BaseClient.d.ts +13 -4
- package/dist/cjs/BaseClient.js +59 -0
- package/dist/cjs/Client.d.ts +88 -88
- package/dist/cjs/Client.js +31 -72
- package/dist/cjs/api/errors/BadRequestError.js +5 -1
- package/dist/cjs/api/errors/ConflictError.js +5 -1
- package/dist/cjs/api/errors/ForbiddenError.js +5 -1
- package/dist/cjs/api/errors/InternalServerError.js +5 -1
- package/dist/cjs/api/errors/ServiceUnavailableError.js +5 -1
- package/dist/cjs/api/errors/UnauthorizedError.js +5 -1
- package/dist/cjs/api/resources/bill/client/Client.d.ts +34 -35
- package/dist/cjs/api/resources/bill/client/Client.js +69 -216
- package/dist/cjs/api/resources/boarding/client/Client.d.ts +28 -29
- package/dist/cjs/api/resources/boarding/client/Client.js +51 -198
- package/dist/cjs/api/resources/chargeBacks/client/Client.d.ts +18 -17
- package/dist/cjs/api/resources/chargeBacks/client/Client.js +38 -79
- package/dist/cjs/api/resources/checkCapture/client/Client.d.ts +8 -9
- package/dist/cjs/api/resources/checkCapture/client/Client.js +11 -28
- package/dist/cjs/api/resources/cloud/client/Client.d.ts +18 -19
- package/dist/cjs/api/resources/cloud/client/Client.js +33 -89
- package/dist/cjs/api/resources/customer/client/Client.d.ts +18 -19
- package/dist/cjs/api/resources/customer/client/Client.js +31 -113
- package/dist/cjs/api/resources/export/client/Client.d.ts +94 -91
- package/dist/cjs/api/resources/export/client/Client.js +205 -582
- package/dist/cjs/api/resources/hostedPaymentPages/client/Client.d.ts +12 -13
- package/dist/cjs/api/resources/hostedPaymentPages/client/Client.js +19 -62
- package/dist/cjs/api/resources/import/client/Client.d.ts +12 -13
- package/dist/cjs/api/resources/import/client/Client.js +19 -62
- package/dist/cjs/api/resources/invoice/client/Client.d.ts +37 -36
- package/dist/cjs/api/resources/invoice/client/Client.js +67 -212
- package/dist/cjs/api/resources/invoice/client/requests/AddInvoiceRequest.d.ts +5 -3
- package/dist/cjs/api/resources/lineItem/client/Client.d.ts +16 -17
- package/dist/cjs/api/resources/lineItem/client/Client.js +27 -96
- package/dist/cjs/api/resources/moneyIn/client/Client.d.ts +40 -41
- package/dist/cjs/api/resources/moneyIn/client/Client.js +79 -249
- package/dist/cjs/api/resources/moneyIn/errors/CaptureError.js +5 -1
- package/dist/cjs/api/resources/moneyIn/errors/InvalidTransStatusError.js +5 -1
- package/dist/cjs/api/resources/moneyOut/client/Client.d.ts +44 -28
- 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 +30 -18
- package/dist/cjs/api/resources/notification/client/Client.js +45 -101
- package/dist/cjs/api/resources/notificationlogs/client/Client.d.ts +14 -15
- package/dist/cjs/api/resources/notificationlogs/client/Client.js +23 -79
- package/dist/cjs/api/resources/ocr/client/Client.d.ts +14 -11
- package/dist/cjs/api/resources/ocr/client/Client.js +19 -45
- package/dist/cjs/api/resources/organization/client/Client.d.ts +20 -21
- package/dist/cjs/api/resources/organization/client/Client.js +35 -130
- package/dist/cjs/api/resources/paymentLink/client/Client.d.ts +27 -28
- package/dist/cjs/api/resources/paymentLink/client/Client.js +46 -167
- package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataBill.d.ts +1 -1
- package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.ts +1 -1
- package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataOut.d.ts +1 -1
- package/dist/cjs/api/resources/paymentLink/types/PaymentPageRequestBody.d.ts +2 -2
- package/dist/cjs/api/resources/paymentMethodDomain/client/Client.d.ts +20 -21
- package/dist/cjs/api/resources/paymentMethodDomain/client/Client.js +35 -130
- package/dist/cjs/api/resources/paypoint/client/Client.d.ts +23 -24
- package/dist/cjs/api/resources/paypoint/client/Client.js +44 -152
- package/dist/cjs/api/resources/query/client/Client.d.ts +72 -73
- 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 +51 -52
- 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 +14 -15
- package/dist/cjs/api/resources/subscription/client/Client.js +23 -79
- package/dist/cjs/api/resources/templates/client/Client.d.ts +16 -17
- package/dist/cjs/api/resources/templates/client/Client.js +28 -84
- package/dist/cjs/api/resources/tokenStorage/client/Client.d.ts +14 -15
- package/dist/cjs/api/resources/tokenStorage/client/Client.js +23 -79
- package/dist/cjs/api/resources/tokenStorage/types/GetMethodResponse.d.ts +1 -1
- package/dist/cjs/api/resources/user/client/Client.d.ts +55 -34
- package/dist/cjs/api/resources/user/client/Client.js +84 -222
- package/dist/cjs/api/resources/vendor/client/Client.d.ts +14 -15
- package/dist/cjs/api/resources/vendor/client/Client.js +23 -79
- package/dist/cjs/api/resources/wallet/client/Client.d.ts +14 -15
- 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/Frequency.d.ts +1 -1
- package/dist/cjs/api/types/Frequency.js +1 -1
- package/dist/cjs/api/types/FrequencyList.d.ts +1 -1
- 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/PayorDataResponse.d.ts +1 -1
- package/dist/cjs/api/types/QueryResponseSettlements.d.ts +1 -1
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +16 -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/core/auth/AuthProvider.js +2 -0
- 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/PayabliError.js +5 -1
- package/dist/cjs/errors/PayabliTimeoutError.js +5 -1
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +13 -4
- package/dist/esm/BaseClient.mjs +24 -1
- package/dist/esm/Client.d.mts +88 -88
- package/dist/esm/Client.mjs +59 -67
- package/dist/esm/api/errors/BadRequestError.mjs +5 -1
- package/dist/esm/api/errors/ConflictError.mjs +5 -1
- package/dist/esm/api/errors/ForbiddenError.mjs +5 -1
- package/dist/esm/api/errors/InternalServerError.mjs +5 -1
- package/dist/esm/api/errors/ServiceUnavailableError.mjs +5 -1
- package/dist/esm/api/errors/UnauthorizedError.mjs +5 -1
- package/dist/esm/api/resources/bill/client/Client.d.mts +34 -35
- package/dist/esm/api/resources/bill/client/Client.mjs +67 -214
- package/dist/esm/api/resources/boarding/client/Client.d.mts +28 -29
- package/dist/esm/api/resources/boarding/client/Client.mjs +50 -197
- package/dist/esm/api/resources/chargeBacks/client/Client.d.mts +18 -17
- package/dist/esm/api/resources/chargeBacks/client/Client.mjs +36 -77
- package/dist/esm/api/resources/checkCapture/client/Client.d.mts +8 -9
- package/dist/esm/api/resources/checkCapture/client/Client.mjs +10 -27
- package/dist/esm/api/resources/cloud/client/Client.d.mts +18 -19
- package/dist/esm/api/resources/cloud/client/Client.mjs +31 -87
- package/dist/esm/api/resources/customer/client/Client.d.mts +18 -19
- package/dist/esm/api/resources/customer/client/Client.mjs +29 -111
- package/dist/esm/api/resources/export/client/Client.d.mts +94 -91
- package/dist/esm/api/resources/export/client/Client.mjs +204 -581
- package/dist/esm/api/resources/hostedPaymentPages/client/Client.d.mts +12 -13
- package/dist/esm/api/resources/hostedPaymentPages/client/Client.mjs +17 -60
- package/dist/esm/api/resources/import/client/Client.d.mts +12 -13
- package/dist/esm/api/resources/import/client/Client.mjs +17 -60
- package/dist/esm/api/resources/invoice/client/Client.d.mts +37 -36
- package/dist/esm/api/resources/invoice/client/Client.mjs +65 -210
- package/dist/esm/api/resources/invoice/client/requests/AddInvoiceRequest.d.mts +5 -3
- package/dist/esm/api/resources/lineItem/client/Client.d.mts +16 -17
- package/dist/esm/api/resources/lineItem/client/Client.mjs +25 -94
- package/dist/esm/api/resources/moneyIn/client/Client.d.mts +40 -41
- package/dist/esm/api/resources/moneyIn/client/Client.mjs +77 -247
- package/dist/esm/api/resources/moneyIn/errors/CaptureError.mjs +5 -1
- package/dist/esm/api/resources/moneyIn/errors/InvalidTransStatusError.mjs +5 -1
- package/dist/esm/api/resources/moneyOut/client/Client.d.mts +44 -28
- 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 +30 -18
- package/dist/esm/api/resources/notification/client/Client.mjs +44 -100
- package/dist/esm/api/resources/notificationlogs/client/Client.d.mts +14 -15
- package/dist/esm/api/resources/notificationlogs/client/Client.mjs +22 -78
- package/dist/esm/api/resources/ocr/client/Client.d.mts +14 -11
- package/dist/esm/api/resources/ocr/client/Client.mjs +18 -44
- package/dist/esm/api/resources/organization/client/Client.d.mts +20 -21
- package/dist/esm/api/resources/organization/client/Client.mjs +33 -128
- package/dist/esm/api/resources/paymentLink/client/Client.d.mts +27 -28
- package/dist/esm/api/resources/paymentLink/client/Client.mjs +44 -165
- package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataBill.d.mts +1 -1
- package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.mts +1 -1
- package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataOut.d.mts +1 -1
- package/dist/esm/api/resources/paymentLink/types/PaymentPageRequestBody.d.mts +2 -2
- package/dist/esm/api/resources/paymentMethodDomain/client/Client.d.mts +20 -21
- package/dist/esm/api/resources/paymentMethodDomain/client/Client.mjs +34 -129
- package/dist/esm/api/resources/paypoint/client/Client.d.mts +23 -24
- package/dist/esm/api/resources/paypoint/client/Client.mjs +43 -151
- package/dist/esm/api/resources/query/client/Client.d.mts +72 -73
- 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 +51 -52
- 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 +14 -15
- package/dist/esm/api/resources/subscription/client/Client.mjs +21 -77
- package/dist/esm/api/resources/templates/client/Client.d.mts +16 -17
- package/dist/esm/api/resources/templates/client/Client.mjs +27 -83
- package/dist/esm/api/resources/tokenStorage/client/Client.d.mts +14 -15
- package/dist/esm/api/resources/tokenStorage/client/Client.mjs +21 -77
- package/dist/esm/api/resources/tokenStorage/types/GetMethodResponse.d.mts +1 -1
- package/dist/esm/api/resources/user/client/Client.d.mts +55 -34
- package/dist/esm/api/resources/user/client/Client.mjs +83 -221
- package/dist/esm/api/resources/vendor/client/Client.d.mts +14 -15
- package/dist/esm/api/resources/vendor/client/Client.mjs +22 -78
- package/dist/esm/api/resources/wallet/client/Client.d.mts +14 -15
- 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/Frequency.d.mts +1 -1
- package/dist/esm/api/types/Frequency.mjs +1 -1
- package/dist/esm/api/types/FrequencyList.d.mts +1 -1
- 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/PayorDataResponse.d.mts +1 -1
- package/dist/esm/api/types/QueryResponseSettlements.d.mts +1 -1
- package/dist/esm/auth/HeaderAuthProvider.d.mts +16 -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/PayabliError.mjs +5 -1
- package/dist/esm/errors/PayabliTimeoutError.mjs +5 -1
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +5 -2
- package/reference.md +768 -478
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
- package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
|
@@ -43,23 +43,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.InvoiceClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const json_js_1 = require("../../../../core/json.js");
|
|
50
51
|
const environments = __importStar(require("../../../../environments.js"));
|
|
52
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
51
53
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
52
54
|
const Payabli = __importStar(require("../../../index.js"));
|
|
53
|
-
class
|
|
54
|
-
constructor(
|
|
55
|
-
this._options =
|
|
55
|
+
class InvoiceClient {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* Creates an invoice in an entrypoint.
|
|
59
61
|
*
|
|
60
62
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
61
63
|
* @param {Payabli.AddInvoiceRequest} request
|
|
62
|
-
* @param {
|
|
64
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
63
65
|
*
|
|
64
66
|
* @throws {@link Payabli.BadRequestError}
|
|
65
67
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -80,17 +82,19 @@ class Invoice {
|
|
|
80
82
|
* itemDescription: "Consultation for Georgian tours",
|
|
81
83
|
* itemCost: 100,
|
|
82
84
|
* itemQty: 1,
|
|
83
|
-
* itemMode: 1
|
|
85
|
+
* itemMode: 1,
|
|
86
|
+
* itemTotalAmount: 1
|
|
84
87
|
* }, {
|
|
85
88
|
* itemProductName: "Deposit ",
|
|
86
89
|
* itemDescription: "Deposit for trip planning",
|
|
87
90
|
* itemCost: 882.37,
|
|
88
|
-
* itemQty: 1
|
|
91
|
+
* itemQty: 1,
|
|
92
|
+
* itemTotalAmount: 1
|
|
89
93
|
* }],
|
|
90
94
|
* invoiceDate: "2025-10-19",
|
|
91
95
|
* invoiceType: 0,
|
|
92
96
|
* invoiceStatus: 1,
|
|
93
|
-
* frequency: "
|
|
97
|
+
* frequency: "onetime",
|
|
94
98
|
* invoiceAmount: 982.37,
|
|
95
99
|
* discount: 10,
|
|
96
100
|
* invoiceNumber: "INV-3"
|
|
@@ -109,7 +113,8 @@ class Invoice {
|
|
|
109
113
|
if (forceCustomerCreation != null) {
|
|
110
114
|
_queryParams.forceCustomerCreation = forceCustomerCreation.toString();
|
|
111
115
|
}
|
|
112
|
-
const
|
|
116
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
117
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
113
118
|
const _response = yield core.fetcher({
|
|
114
119
|
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)}`),
|
|
115
120
|
method: "POST",
|
|
@@ -145,26 +150,13 @@ class Invoice {
|
|
|
145
150
|
});
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
|
-
|
|
149
|
-
case "non-json":
|
|
150
|
-
throw new errors.PayabliError({
|
|
151
|
-
statusCode: _response.error.statusCode,
|
|
152
|
-
body: _response.error.rawBody,
|
|
153
|
-
rawResponse: _response.rawResponse,
|
|
154
|
-
});
|
|
155
|
-
case "timeout":
|
|
156
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Invoice/{entry}.");
|
|
157
|
-
case "unknown":
|
|
158
|
-
throw new errors.PayabliError({
|
|
159
|
-
message: _response.error.errorMessage,
|
|
160
|
-
rawResponse: _response.rawResponse,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
153
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/Invoice/{entry}");
|
|
163
154
|
});
|
|
164
155
|
}
|
|
165
156
|
/**
|
|
166
157
|
* Deletes an invoice that's attached to a file.
|
|
167
158
|
*
|
|
159
|
+
* @param {number} idInvoice - Invoice ID
|
|
168
160
|
* @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``.
|
|
169
161
|
* "DocumentsRef": {
|
|
170
162
|
* "zipfile": "inva_269.zip",
|
|
@@ -176,8 +168,7 @@ class Invoice {
|
|
|
176
168
|
* }
|
|
177
169
|
* ]
|
|
178
170
|
* }
|
|
179
|
-
* @param {
|
|
180
|
-
* @param {Invoice.RequestOptions} requestOptions - Request-specific configuration.
|
|
171
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
181
172
|
*
|
|
182
173
|
* @throws {@link Payabli.BadRequestError}
|
|
183
174
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -185,15 +176,16 @@ class Invoice {
|
|
|
185
176
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
186
177
|
*
|
|
187
178
|
* @example
|
|
188
|
-
* await client.invoice.deleteAttachedFromInvoice("0_Bill.pdf"
|
|
179
|
+
* await client.invoice.deleteAttachedFromInvoice(23548884, "0_Bill.pdf")
|
|
189
180
|
*/
|
|
190
|
-
deleteAttachedFromInvoice(
|
|
191
|
-
return core.HttpResponsePromise.fromPromise(this.__deleteAttachedFromInvoice(
|
|
181
|
+
deleteAttachedFromInvoice(idInvoice, filename, requestOptions) {
|
|
182
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteAttachedFromInvoice(idInvoice, filename, requestOptions));
|
|
192
183
|
}
|
|
193
|
-
__deleteAttachedFromInvoice(
|
|
184
|
+
__deleteAttachedFromInvoice(idInvoice, filename, requestOptions) {
|
|
194
185
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
186
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
196
|
-
const
|
|
187
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
188
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
197
189
|
const _response = yield core.fetcher({
|
|
198
190
|
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)}`),
|
|
199
191
|
method: "DELETE",
|
|
@@ -226,28 +218,14 @@ class Invoice {
|
|
|
226
218
|
});
|
|
227
219
|
}
|
|
228
220
|
}
|
|
229
|
-
|
|
230
|
-
case "non-json":
|
|
231
|
-
throw new errors.PayabliError({
|
|
232
|
-
statusCode: _response.error.statusCode,
|
|
233
|
-
body: _response.error.rawBody,
|
|
234
|
-
rawResponse: _response.rawResponse,
|
|
235
|
-
});
|
|
236
|
-
case "timeout":
|
|
237
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Invoice/attachedFileFromInvoice/{idInvoice}/{filename}.");
|
|
238
|
-
case "unknown":
|
|
239
|
-
throw new errors.PayabliError({
|
|
240
|
-
message: _response.error.errorMessage,
|
|
241
|
-
rawResponse: _response.rawResponse,
|
|
242
|
-
});
|
|
243
|
-
}
|
|
221
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/Invoice/attachedFileFromInvoice/{idInvoice}/{filename}");
|
|
244
222
|
});
|
|
245
223
|
}
|
|
246
224
|
/**
|
|
247
225
|
* Deletes a single invoice from an entrypoint.
|
|
248
226
|
*
|
|
249
227
|
* @param {number} idInvoice - Invoice ID
|
|
250
|
-
* @param {
|
|
228
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
251
229
|
*
|
|
252
230
|
* @throws {@link Payabli.BadRequestError}
|
|
253
231
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -263,7 +241,8 @@ class Invoice {
|
|
|
263
241
|
__deleteInvoice(idInvoice, requestOptions) {
|
|
264
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
265
243
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
266
|
-
const
|
|
244
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
245
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
267
246
|
const _response = yield core.fetcher({
|
|
268
247
|
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)}`),
|
|
269
248
|
method: "DELETE",
|
|
@@ -296,21 +275,7 @@ class Invoice {
|
|
|
296
275
|
});
|
|
297
276
|
}
|
|
298
277
|
}
|
|
299
|
-
|
|
300
|
-
case "non-json":
|
|
301
|
-
throw new errors.PayabliError({
|
|
302
|
-
statusCode: _response.error.statusCode,
|
|
303
|
-
body: _response.error.rawBody,
|
|
304
|
-
rawResponse: _response.rawResponse,
|
|
305
|
-
});
|
|
306
|
-
case "timeout":
|
|
307
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Invoice/{idInvoice}.");
|
|
308
|
-
case "unknown":
|
|
309
|
-
throw new errors.PayabliError({
|
|
310
|
-
message: _response.error.errorMessage,
|
|
311
|
-
rawResponse: _response.rawResponse,
|
|
312
|
-
});
|
|
313
|
-
}
|
|
278
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/Invoice/{idInvoice}");
|
|
314
279
|
});
|
|
315
280
|
}
|
|
316
281
|
/**
|
|
@@ -318,7 +283,7 @@ class Invoice {
|
|
|
318
283
|
*
|
|
319
284
|
* @param {number} idInvoice - Invoice ID
|
|
320
285
|
* @param {Payabli.EditInvoiceRequest} request
|
|
321
|
-
* @param {
|
|
286
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
322
287
|
*
|
|
323
288
|
* @throws {@link Payabli.BadRequestError}
|
|
324
289
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -353,7 +318,8 @@ class Invoice {
|
|
|
353
318
|
if (forceCustomerCreation != null) {
|
|
354
319
|
_queryParams.forceCustomerCreation = forceCustomerCreation.toString();
|
|
355
320
|
}
|
|
356
|
-
const
|
|
321
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
322
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
357
323
|
const _response = yield core.fetcher({
|
|
358
324
|
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)}`),
|
|
359
325
|
method: "PUT",
|
|
@@ -389,26 +355,13 @@ class Invoice {
|
|
|
389
355
|
});
|
|
390
356
|
}
|
|
391
357
|
}
|
|
392
|
-
|
|
393
|
-
case "non-json":
|
|
394
|
-
throw new errors.PayabliError({
|
|
395
|
-
statusCode: _response.error.statusCode,
|
|
396
|
-
body: _response.error.rawBody,
|
|
397
|
-
rawResponse: _response.rawResponse,
|
|
398
|
-
});
|
|
399
|
-
case "timeout":
|
|
400
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Invoice/{idInvoice}.");
|
|
401
|
-
case "unknown":
|
|
402
|
-
throw new errors.PayabliError({
|
|
403
|
-
message: _response.error.errorMessage,
|
|
404
|
-
rawResponse: _response.rawResponse,
|
|
405
|
-
});
|
|
406
|
-
}
|
|
358
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/Invoice/{idInvoice}");
|
|
407
359
|
});
|
|
408
360
|
}
|
|
409
361
|
/**
|
|
410
362
|
* Retrieves a file attached to an invoice.
|
|
411
363
|
*
|
|
364
|
+
* @param {number} idInvoice - Invoice ID
|
|
412
365
|
* @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``.
|
|
413
366
|
* ```
|
|
414
367
|
* "DocumentsRef": {
|
|
@@ -422,9 +375,8 @@ class Invoice {
|
|
|
422
375
|
* ]
|
|
423
376
|
* }
|
|
424
377
|
* ```
|
|
425
|
-
* @param {number} idInvoice - Invoice ID
|
|
426
378
|
* @param {Payabli.GetAttachedFileFromInvoiceRequest} request
|
|
427
|
-
* @param {
|
|
379
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
428
380
|
*
|
|
429
381
|
* @throws {@link Payabli.BadRequestError}
|
|
430
382
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -432,20 +384,21 @@ class Invoice {
|
|
|
432
384
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
433
385
|
*
|
|
434
386
|
* @example
|
|
435
|
-
* await client.invoice.getAttachedFileFromInvoice("filename"
|
|
387
|
+
* await client.invoice.getAttachedFileFromInvoice(1, "filename")
|
|
436
388
|
*/
|
|
437
|
-
getAttachedFileFromInvoice(
|
|
438
|
-
return core.HttpResponsePromise.fromPromise(this.__getAttachedFileFromInvoice(
|
|
389
|
+
getAttachedFileFromInvoice(idInvoice, filename, request = {}, requestOptions) {
|
|
390
|
+
return core.HttpResponsePromise.fromPromise(this.__getAttachedFileFromInvoice(idInvoice, filename, request, requestOptions));
|
|
439
391
|
}
|
|
440
|
-
__getAttachedFileFromInvoice(
|
|
441
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
392
|
+
__getAttachedFileFromInvoice(idInvoice_1, filename_1) {
|
|
393
|
+
return __awaiter(this, arguments, void 0, function* (idInvoice, filename, request = {}, requestOptions) {
|
|
442
394
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
443
395
|
const { returnObject } = request;
|
|
444
396
|
const _queryParams = {};
|
|
445
397
|
if (returnObject != null) {
|
|
446
398
|
_queryParams.returnObject = returnObject.toString();
|
|
447
399
|
}
|
|
448
|
-
const
|
|
400
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
401
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
449
402
|
const _response = yield core.fetcher({
|
|
450
403
|
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)}`),
|
|
451
404
|
method: "GET",
|
|
@@ -478,28 +431,14 @@ class Invoice {
|
|
|
478
431
|
});
|
|
479
432
|
}
|
|
480
433
|
}
|
|
481
|
-
|
|
482
|
-
case "non-json":
|
|
483
|
-
throw new errors.PayabliError({
|
|
484
|
-
statusCode: _response.error.statusCode,
|
|
485
|
-
body: _response.error.rawBody,
|
|
486
|
-
rawResponse: _response.rawResponse,
|
|
487
|
-
});
|
|
488
|
-
case "timeout":
|
|
489
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/attachedFileFromInvoice/{idInvoice}/{filename}.");
|
|
490
|
-
case "unknown":
|
|
491
|
-
throw new errors.PayabliError({
|
|
492
|
-
message: _response.error.errorMessage,
|
|
493
|
-
rawResponse: _response.rawResponse,
|
|
494
|
-
});
|
|
495
|
-
}
|
|
434
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Invoice/attachedFileFromInvoice/{idInvoice}/{filename}");
|
|
496
435
|
});
|
|
497
436
|
}
|
|
498
437
|
/**
|
|
499
438
|
* Retrieves a single invoice by ID.
|
|
500
439
|
*
|
|
501
440
|
* @param {number} idInvoice - Invoice ID
|
|
502
|
-
* @param {
|
|
441
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
503
442
|
*
|
|
504
443
|
* @throws {@link Payabli.BadRequestError}
|
|
505
444
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -515,7 +454,8 @@ class Invoice {
|
|
|
515
454
|
__getInvoice(idInvoice, requestOptions) {
|
|
516
455
|
return __awaiter(this, void 0, void 0, function* () {
|
|
517
456
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
518
|
-
const
|
|
457
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
458
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
519
459
|
const _response = yield core.fetcher({
|
|
520
460
|
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)}`),
|
|
521
461
|
method: "GET",
|
|
@@ -548,28 +488,14 @@ class Invoice {
|
|
|
548
488
|
});
|
|
549
489
|
}
|
|
550
490
|
}
|
|
551
|
-
|
|
552
|
-
case "non-json":
|
|
553
|
-
throw new errors.PayabliError({
|
|
554
|
-
statusCode: _response.error.statusCode,
|
|
555
|
-
body: _response.error.rawBody,
|
|
556
|
-
rawResponse: _response.rawResponse,
|
|
557
|
-
});
|
|
558
|
-
case "timeout":
|
|
559
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/{idInvoice}.");
|
|
560
|
-
case "unknown":
|
|
561
|
-
throw new errors.PayabliError({
|
|
562
|
-
message: _response.error.errorMessage,
|
|
563
|
-
rawResponse: _response.rawResponse,
|
|
564
|
-
});
|
|
565
|
-
}
|
|
491
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Invoice/{idInvoice}");
|
|
566
492
|
});
|
|
567
493
|
}
|
|
568
494
|
/**
|
|
569
495
|
* Retrieves the next available invoice number for a paypoint.
|
|
570
496
|
*
|
|
571
497
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
572
|
-
* @param {
|
|
498
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
573
499
|
*
|
|
574
500
|
* @throws {@link Payabli.BadRequestError}
|
|
575
501
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -585,7 +511,8 @@ class Invoice {
|
|
|
585
511
|
__getInvoiceNumber(entry, requestOptions) {
|
|
586
512
|
return __awaiter(this, void 0, void 0, function* () {
|
|
587
513
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
588
|
-
const
|
|
514
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
515
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
589
516
|
const _response = yield core.fetcher({
|
|
590
517
|
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)}`),
|
|
591
518
|
method: "GET",
|
|
@@ -618,21 +545,7 @@ class Invoice {
|
|
|
618
545
|
});
|
|
619
546
|
}
|
|
620
547
|
}
|
|
621
|
-
|
|
622
|
-
case "non-json":
|
|
623
|
-
throw new errors.PayabliError({
|
|
624
|
-
statusCode: _response.error.statusCode,
|
|
625
|
-
body: _response.error.rawBody,
|
|
626
|
-
rawResponse: _response.rawResponse,
|
|
627
|
-
});
|
|
628
|
-
case "timeout":
|
|
629
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/getNumber/{entry}.");
|
|
630
|
-
case "unknown":
|
|
631
|
-
throw new errors.PayabliError({
|
|
632
|
-
message: _response.error.errorMessage,
|
|
633
|
-
rawResponse: _response.rawResponse,
|
|
634
|
-
});
|
|
635
|
-
}
|
|
548
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Invoice/getNumber/{entry}");
|
|
636
549
|
});
|
|
637
550
|
}
|
|
638
551
|
/**
|
|
@@ -640,7 +553,7 @@ class Invoice {
|
|
|
640
553
|
*
|
|
641
554
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
642
555
|
* @param {Payabli.ListInvoicesRequest} request
|
|
643
|
-
* @param {
|
|
556
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
644
557
|
*
|
|
645
558
|
* @throws {@link Payabli.BadRequestError}
|
|
646
559
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -677,7 +590,8 @@ class Invoice {
|
|
|
677
590
|
if (sortBy != null) {
|
|
678
591
|
_queryParams.sortBy = sortBy;
|
|
679
592
|
}
|
|
680
|
-
const
|
|
593
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
594
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
681
595
|
const _response = yield core.fetcher({
|
|
682
596
|
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)}`),
|
|
683
597
|
method: "GET",
|
|
@@ -710,21 +624,7 @@ class Invoice {
|
|
|
710
624
|
});
|
|
711
625
|
}
|
|
712
626
|
}
|
|
713
|
-
|
|
714
|
-
case "non-json":
|
|
715
|
-
throw new errors.PayabliError({
|
|
716
|
-
statusCode: _response.error.statusCode,
|
|
717
|
-
body: _response.error.rawBody,
|
|
718
|
-
rawResponse: _response.rawResponse,
|
|
719
|
-
});
|
|
720
|
-
case "timeout":
|
|
721
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/invoices/{entry}.");
|
|
722
|
-
case "unknown":
|
|
723
|
-
throw new errors.PayabliError({
|
|
724
|
-
message: _response.error.errorMessage,
|
|
725
|
-
rawResponse: _response.rawResponse,
|
|
726
|
-
});
|
|
727
|
-
}
|
|
627
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Query/invoices/{entry}");
|
|
728
628
|
});
|
|
729
629
|
}
|
|
730
630
|
/**
|
|
@@ -732,7 +632,7 @@ class Invoice {
|
|
|
732
632
|
*
|
|
733
633
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
734
634
|
* @param {Payabli.ListInvoicesOrgRequest} request
|
|
735
|
-
* @param {
|
|
635
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
736
636
|
*
|
|
737
637
|
* @throws {@link Payabli.BadRequestError}
|
|
738
638
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -769,7 +669,8 @@ class Invoice {
|
|
|
769
669
|
if (sortBy != null) {
|
|
770
670
|
_queryParams.sortBy = sortBy;
|
|
771
671
|
}
|
|
772
|
-
const
|
|
672
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
673
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
773
674
|
const _response = yield core.fetcher({
|
|
774
675
|
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)}`),
|
|
775
676
|
method: "GET",
|
|
@@ -802,21 +703,7 @@ class Invoice {
|
|
|
802
703
|
});
|
|
803
704
|
}
|
|
804
705
|
}
|
|
805
|
-
|
|
806
|
-
case "non-json":
|
|
807
|
-
throw new errors.PayabliError({
|
|
808
|
-
statusCode: _response.error.statusCode,
|
|
809
|
-
body: _response.error.rawBody,
|
|
810
|
-
rawResponse: _response.rawResponse,
|
|
811
|
-
});
|
|
812
|
-
case "timeout":
|
|
813
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/invoices/org/{orgId}.");
|
|
814
|
-
case "unknown":
|
|
815
|
-
throw new errors.PayabliError({
|
|
816
|
-
message: _response.error.errorMessage,
|
|
817
|
-
rawResponse: _response.rawResponse,
|
|
818
|
-
});
|
|
819
|
-
}
|
|
706
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Query/invoices/org/{orgId}");
|
|
820
707
|
});
|
|
821
708
|
}
|
|
822
709
|
/**
|
|
@@ -824,7 +711,7 @@ class Invoice {
|
|
|
824
711
|
*
|
|
825
712
|
* @param {number} idInvoice - Invoice ID
|
|
826
713
|
* @param {Payabli.SendInvoiceRequest} request
|
|
827
|
-
* @param {
|
|
714
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
828
715
|
*
|
|
829
716
|
* @throws {@link Payabli.BadRequestError}
|
|
830
717
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -851,7 +738,8 @@ class Invoice {
|
|
|
851
738
|
if (mail2 != null) {
|
|
852
739
|
_queryParams.mail2 = mail2;
|
|
853
740
|
}
|
|
854
|
-
const
|
|
741
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
742
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
855
743
|
const _response = yield core.fetcher({
|
|
856
744
|
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)}`),
|
|
857
745
|
method: "GET",
|
|
@@ -884,28 +772,14 @@ class Invoice {
|
|
|
884
772
|
});
|
|
885
773
|
}
|
|
886
774
|
}
|
|
887
|
-
|
|
888
|
-
case "non-json":
|
|
889
|
-
throw new errors.PayabliError({
|
|
890
|
-
statusCode: _response.error.statusCode,
|
|
891
|
-
body: _response.error.rawBody,
|
|
892
|
-
rawResponse: _response.rawResponse,
|
|
893
|
-
});
|
|
894
|
-
case "timeout":
|
|
895
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/send/{idInvoice}.");
|
|
896
|
-
case "unknown":
|
|
897
|
-
throw new errors.PayabliError({
|
|
898
|
-
message: _response.error.errorMessage,
|
|
899
|
-
rawResponse: _response.rawResponse,
|
|
900
|
-
});
|
|
901
|
-
}
|
|
775
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Invoice/send/{idInvoice}");
|
|
902
776
|
});
|
|
903
777
|
}
|
|
904
778
|
/**
|
|
905
779
|
* Export a single invoice in PDF format.
|
|
906
780
|
*
|
|
907
781
|
* @param {number} idInvoice - Invoice ID
|
|
908
|
-
* @param {
|
|
782
|
+
* @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
909
783
|
*
|
|
910
784
|
* @throws {@link Payabli.BadRequestError}
|
|
911
785
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -921,7 +795,8 @@ class Invoice {
|
|
|
921
795
|
__getInvoicePdf(idInvoice, requestOptions) {
|
|
922
796
|
return __awaiter(this, void 0, void 0, function* () {
|
|
923
797
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
924
|
-
const
|
|
798
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
799
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
925
800
|
const _response = yield core.fetcher({
|
|
926
801
|
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)}`),
|
|
927
802
|
method: "GET",
|
|
@@ -954,28 +829,8 @@ class Invoice {
|
|
|
954
829
|
});
|
|
955
830
|
}
|
|
956
831
|
}
|
|
957
|
-
|
|
958
|
-
case "non-json":
|
|
959
|
-
throw new errors.PayabliError({
|
|
960
|
-
statusCode: _response.error.statusCode,
|
|
961
|
-
body: _response.error.rawBody,
|
|
962
|
-
rawResponse: _response.rawResponse,
|
|
963
|
-
});
|
|
964
|
-
case "timeout":
|
|
965
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/invoicePdf/{idInvoice}.");
|
|
966
|
-
case "unknown":
|
|
967
|
-
throw new errors.PayabliError({
|
|
968
|
-
message: _response.error.errorMessage,
|
|
969
|
-
rawResponse: _response.rawResponse,
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
_getCustomAuthorizationHeaders() {
|
|
975
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
976
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
977
|
-
return { requestToken: apiKeyValue };
|
|
832
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/invoicePdf/{idInvoice}");
|
|
978
833
|
});
|
|
979
834
|
}
|
|
980
835
|
}
|
|
981
|
-
exports.
|
|
836
|
+
exports.InvoiceClient = InvoiceClient;
|
|
@@ -14,17 +14,19 @@ import type * as Payabli from "../../../../index.js";
|
|
|
14
14
|
* itemDescription: "Consultation for Georgian tours",
|
|
15
15
|
* itemCost: 100,
|
|
16
16
|
* itemQty: 1,
|
|
17
|
-
* itemMode: 1
|
|
17
|
+
* itemMode: 1,
|
|
18
|
+
* itemTotalAmount: 1
|
|
18
19
|
* }, {
|
|
19
20
|
* itemProductName: "Deposit ",
|
|
20
21
|
* itemDescription: "Deposit for trip planning",
|
|
21
22
|
* itemCost: 882.37,
|
|
22
|
-
* itemQty: 1
|
|
23
|
+
* itemQty: 1,
|
|
24
|
+
* itemTotalAmount: 1
|
|
23
25
|
* }],
|
|
24
26
|
* invoiceDate: "2025-10-19",
|
|
25
27
|
* invoiceType: 0,
|
|
26
28
|
* invoiceStatus: 1,
|
|
27
|
-
* frequency: "
|
|
29
|
+
* frequency: "onetime",
|
|
28
30
|
* invoiceAmount: 982.37,
|
|
29
31
|
* discount: 10,
|
|
30
32
|
* invoiceNumber: "INV-3"
|