@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.BillClient = 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 BillClient {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* Creates a bill 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.AddBillRequest} request
|
|
62
|
-
* @param {
|
|
64
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
63
65
|
*
|
|
64
66
|
* @throws {@link Payabli.BadRequestError}
|
|
65
67
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -112,7 +114,8 @@ class Bill {
|
|
|
112
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
115
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
114
116
|
const { idempotencyKey, body: _body } = request;
|
|
115
|
-
const
|
|
117
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
118
|
+
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);
|
|
116
119
|
const _response = yield core.fetcher({
|
|
117
120
|
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, `Bill/single/${core.url.encodePathParam(entry)}`),
|
|
118
121
|
method: "POST",
|
|
@@ -148,26 +151,13 @@ class Bill {
|
|
|
148
151
|
});
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
|
-
|
|
152
|
-
case "non-json":
|
|
153
|
-
throw new errors.PayabliError({
|
|
154
|
-
statusCode: _response.error.statusCode,
|
|
155
|
-
body: _response.error.rawBody,
|
|
156
|
-
rawResponse: _response.rawResponse,
|
|
157
|
-
});
|
|
158
|
-
case "timeout":
|
|
159
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Bill/single/{entry}.");
|
|
160
|
-
case "unknown":
|
|
161
|
-
throw new errors.PayabliError({
|
|
162
|
-
message: _response.error.errorMessage,
|
|
163
|
-
rawResponse: _response.rawResponse,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
154
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/Bill/single/{entry}");
|
|
166
155
|
});
|
|
167
156
|
}
|
|
168
157
|
/**
|
|
169
158
|
* Delete a file attached to a bill.
|
|
170
159
|
*
|
|
160
|
+
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
171
161
|
* @param {string} filename - The filename in Payabli. Filename is `zipName` in response to a
|
|
172
162
|
* request to `/api/Invoice/{idInvoice}`. Here, the filename is
|
|
173
163
|
* `0_Bill.pdf`.
|
|
@@ -184,9 +174,8 @@ class Bill {
|
|
|
184
174
|
* ]
|
|
185
175
|
* }
|
|
186
176
|
* ```
|
|
187
|
-
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
188
177
|
* @param {Payabli.DeleteAttachedFromBillRequest} request
|
|
189
|
-
* @param {
|
|
178
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
190
179
|
*
|
|
191
180
|
* @throws {@link Payabli.BadRequestError}
|
|
192
181
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -194,20 +183,21 @@ class Bill {
|
|
|
194
183
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
195
184
|
*
|
|
196
185
|
* @example
|
|
197
|
-
* await client.bill.deleteAttachedFromBill("0_Bill.pdf"
|
|
186
|
+
* await client.bill.deleteAttachedFromBill(285, "0_Bill.pdf")
|
|
198
187
|
*/
|
|
199
|
-
deleteAttachedFromBill(
|
|
200
|
-
return core.HttpResponsePromise.fromPromise(this.__deleteAttachedFromBill(
|
|
188
|
+
deleteAttachedFromBill(idBill, filename, request = {}, requestOptions) {
|
|
189
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteAttachedFromBill(idBill, filename, request, requestOptions));
|
|
201
190
|
}
|
|
202
|
-
__deleteAttachedFromBill(
|
|
203
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
191
|
+
__deleteAttachedFromBill(idBill_1, filename_1) {
|
|
192
|
+
return __awaiter(this, arguments, void 0, function* (idBill, filename, request = {}, requestOptions) {
|
|
204
193
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
205
194
|
const { returnObject } = request;
|
|
206
195
|
const _queryParams = {};
|
|
207
196
|
if (returnObject != null) {
|
|
208
197
|
_queryParams.returnObject = returnObject.toString();
|
|
209
198
|
}
|
|
210
|
-
const
|
|
199
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
200
|
+
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);
|
|
211
201
|
const _response = yield core.fetcher({
|
|
212
202
|
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, `Bill/attachedFileFromBill/${core.url.encodePathParam(idBill)}/${core.url.encodePathParam(filename)}`),
|
|
213
203
|
method: "DELETE",
|
|
@@ -240,28 +230,14 @@ class Bill {
|
|
|
240
230
|
});
|
|
241
231
|
}
|
|
242
232
|
}
|
|
243
|
-
|
|
244
|
-
case "non-json":
|
|
245
|
-
throw new errors.PayabliError({
|
|
246
|
-
statusCode: _response.error.statusCode,
|
|
247
|
-
body: _response.error.rawBody,
|
|
248
|
-
rawResponse: _response.rawResponse,
|
|
249
|
-
});
|
|
250
|
-
case "timeout":
|
|
251
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Bill/attachedFileFromBill/{idBill}/{filename}.");
|
|
252
|
-
case "unknown":
|
|
253
|
-
throw new errors.PayabliError({
|
|
254
|
-
message: _response.error.errorMessage,
|
|
255
|
-
rawResponse: _response.rawResponse,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
233
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/Bill/attachedFileFromBill/{idBill}/{filename}");
|
|
258
234
|
});
|
|
259
235
|
}
|
|
260
236
|
/**
|
|
261
237
|
* Deletes a bill by ID.
|
|
262
238
|
*
|
|
263
239
|
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
264
|
-
* @param {
|
|
240
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
265
241
|
*
|
|
266
242
|
* @throws {@link Payabli.BadRequestError}
|
|
267
243
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -277,7 +253,8 @@ class Bill {
|
|
|
277
253
|
__deleteBill(idBill, requestOptions) {
|
|
278
254
|
return __awaiter(this, void 0, void 0, function* () {
|
|
279
255
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
280
|
-
const
|
|
256
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
257
|
+
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);
|
|
281
258
|
const _response = yield core.fetcher({
|
|
282
259
|
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, `Bill/${core.url.encodePathParam(idBill)}`),
|
|
283
260
|
method: "DELETE",
|
|
@@ -310,21 +287,7 @@ class Bill {
|
|
|
310
287
|
});
|
|
311
288
|
}
|
|
312
289
|
}
|
|
313
|
-
|
|
314
|
-
case "non-json":
|
|
315
|
-
throw new errors.PayabliError({
|
|
316
|
-
statusCode: _response.error.statusCode,
|
|
317
|
-
body: _response.error.rawBody,
|
|
318
|
-
rawResponse: _response.rawResponse,
|
|
319
|
-
});
|
|
320
|
-
case "timeout":
|
|
321
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Bill/{idBill}.");
|
|
322
|
-
case "unknown":
|
|
323
|
-
throw new errors.PayabliError({
|
|
324
|
-
message: _response.error.errorMessage,
|
|
325
|
-
rawResponse: _response.rawResponse,
|
|
326
|
-
});
|
|
327
|
-
}
|
|
290
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/Bill/{idBill}");
|
|
328
291
|
});
|
|
329
292
|
}
|
|
330
293
|
/**
|
|
@@ -332,7 +295,7 @@ class Bill {
|
|
|
332
295
|
*
|
|
333
296
|
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
334
297
|
* @param {Payabli.BillOutData} request
|
|
335
|
-
* @param {
|
|
298
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
336
299
|
*
|
|
337
300
|
* @throws {@link Payabli.BadRequestError}
|
|
338
301
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -351,7 +314,8 @@ class Bill {
|
|
|
351
314
|
__editBill(idBill, request, requestOptions) {
|
|
352
315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
353
316
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
354
|
-
const
|
|
317
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
318
|
+
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);
|
|
355
319
|
const _response = yield core.fetcher({
|
|
356
320
|
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, `Bill/${core.url.encodePathParam(idBill)}`),
|
|
357
321
|
method: "PUT",
|
|
@@ -387,26 +351,13 @@ class Bill {
|
|
|
387
351
|
});
|
|
388
352
|
}
|
|
389
353
|
}
|
|
390
|
-
|
|
391
|
-
case "non-json":
|
|
392
|
-
throw new errors.PayabliError({
|
|
393
|
-
statusCode: _response.error.statusCode,
|
|
394
|
-
body: _response.error.rawBody,
|
|
395
|
-
rawResponse: _response.rawResponse,
|
|
396
|
-
});
|
|
397
|
-
case "timeout":
|
|
398
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Bill/{idBill}.");
|
|
399
|
-
case "unknown":
|
|
400
|
-
throw new errors.PayabliError({
|
|
401
|
-
message: _response.error.errorMessage,
|
|
402
|
-
rawResponse: _response.rawResponse,
|
|
403
|
-
});
|
|
404
|
-
}
|
|
354
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/Bill/{idBill}");
|
|
405
355
|
});
|
|
406
356
|
}
|
|
407
357
|
/**
|
|
408
358
|
* Retrieves a file attached to a bill, either as a binary file or as a Base64-encoded string.
|
|
409
359
|
*
|
|
360
|
+
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
410
361
|
* @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``.
|
|
411
362
|
* "DocumentsRef": {
|
|
412
363
|
* "zipfile": "inva_269.zip",
|
|
@@ -418,9 +369,8 @@ class Bill {
|
|
|
418
369
|
* }
|
|
419
370
|
* ]
|
|
420
371
|
* }
|
|
421
|
-
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
422
372
|
* @param {Payabli.GetAttachedFromBillRequest} request
|
|
423
|
-
* @param {
|
|
373
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
424
374
|
*
|
|
425
375
|
* @throws {@link Payabli.BadRequestError}
|
|
426
376
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -428,22 +378,23 @@ class Bill {
|
|
|
428
378
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
429
379
|
*
|
|
430
380
|
* @example
|
|
431
|
-
* await client.bill.getAttachedFromBill("0_Bill.pdf",
|
|
381
|
+
* await client.bill.getAttachedFromBill(285, "0_Bill.pdf", {
|
|
432
382
|
* returnObject: true
|
|
433
383
|
* })
|
|
434
384
|
*/
|
|
435
|
-
getAttachedFromBill(
|
|
436
|
-
return core.HttpResponsePromise.fromPromise(this.__getAttachedFromBill(
|
|
385
|
+
getAttachedFromBill(idBill, filename, request = {}, requestOptions) {
|
|
386
|
+
return core.HttpResponsePromise.fromPromise(this.__getAttachedFromBill(idBill, filename, request, requestOptions));
|
|
437
387
|
}
|
|
438
|
-
__getAttachedFromBill(
|
|
439
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
388
|
+
__getAttachedFromBill(idBill_1, filename_1) {
|
|
389
|
+
return __awaiter(this, arguments, void 0, function* (idBill, filename, request = {}, requestOptions) {
|
|
440
390
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
441
391
|
const { returnObject } = request;
|
|
442
392
|
const _queryParams = {};
|
|
443
393
|
if (returnObject != null) {
|
|
444
394
|
_queryParams.returnObject = returnObject.toString();
|
|
445
395
|
}
|
|
446
|
-
const
|
|
396
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
397
|
+
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);
|
|
447
398
|
const _response = yield core.fetcher({
|
|
448
399
|
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, `Bill/attachedFileFromBill/${core.url.encodePathParam(idBill)}/${core.url.encodePathParam(filename)}`),
|
|
449
400
|
method: "GET",
|
|
@@ -476,28 +427,14 @@ class Bill {
|
|
|
476
427
|
});
|
|
477
428
|
}
|
|
478
429
|
}
|
|
479
|
-
|
|
480
|
-
case "non-json":
|
|
481
|
-
throw new errors.PayabliError({
|
|
482
|
-
statusCode: _response.error.statusCode,
|
|
483
|
-
body: _response.error.rawBody,
|
|
484
|
-
rawResponse: _response.rawResponse,
|
|
485
|
-
});
|
|
486
|
-
case "timeout":
|
|
487
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Bill/attachedFileFromBill/{idBill}/{filename}.");
|
|
488
|
-
case "unknown":
|
|
489
|
-
throw new errors.PayabliError({
|
|
490
|
-
message: _response.error.errorMessage,
|
|
491
|
-
rawResponse: _response.rawResponse,
|
|
492
|
-
});
|
|
493
|
-
}
|
|
430
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Bill/attachedFileFromBill/{idBill}/{filename}");
|
|
494
431
|
});
|
|
495
432
|
}
|
|
496
433
|
/**
|
|
497
434
|
* Retrieves a bill by ID from an entrypoint.
|
|
498
435
|
*
|
|
499
436
|
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
500
|
-
* @param {
|
|
437
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
501
438
|
*
|
|
502
439
|
* @throws {@link Payabli.BadRequestError}
|
|
503
440
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -513,7 +450,8 @@ class Bill {
|
|
|
513
450
|
__getBill(idBill, requestOptions) {
|
|
514
451
|
return __awaiter(this, void 0, void 0, function* () {
|
|
515
452
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
516
|
-
const
|
|
453
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
454
|
+
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);
|
|
517
455
|
const _response = yield core.fetcher({
|
|
518
456
|
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, `Bill/${core.url.encodePathParam(idBill)}`),
|
|
519
457
|
method: "GET",
|
|
@@ -546,21 +484,7 @@ class Bill {
|
|
|
546
484
|
});
|
|
547
485
|
}
|
|
548
486
|
}
|
|
549
|
-
|
|
550
|
-
case "non-json":
|
|
551
|
-
throw new errors.PayabliError({
|
|
552
|
-
statusCode: _response.error.statusCode,
|
|
553
|
-
body: _response.error.rawBody,
|
|
554
|
-
rawResponse: _response.rawResponse,
|
|
555
|
-
});
|
|
556
|
-
case "timeout":
|
|
557
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Bill/{idBill}.");
|
|
558
|
-
case "unknown":
|
|
559
|
-
throw new errors.PayabliError({
|
|
560
|
-
message: _response.error.errorMessage,
|
|
561
|
-
rawResponse: _response.rawResponse,
|
|
562
|
-
});
|
|
563
|
-
}
|
|
487
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Bill/{idBill}");
|
|
564
488
|
});
|
|
565
489
|
}
|
|
566
490
|
/**
|
|
@@ -568,7 +492,7 @@ class Bill {
|
|
|
568
492
|
*
|
|
569
493
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
570
494
|
* @param {Payabli.ListBillsRequest} request
|
|
571
|
-
* @param {
|
|
495
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
572
496
|
*
|
|
573
497
|
* @throws {@link Payabli.BadRequestError}
|
|
574
498
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -605,7 +529,8 @@ class Bill {
|
|
|
605
529
|
if (sortBy != null) {
|
|
606
530
|
_queryParams.sortBy = sortBy;
|
|
607
531
|
}
|
|
608
|
-
const
|
|
532
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
533
|
+
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);
|
|
609
534
|
const _response = yield core.fetcher({
|
|
610
535
|
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/bills/${core.url.encodePathParam(entry)}`),
|
|
611
536
|
method: "GET",
|
|
@@ -638,21 +563,7 @@ class Bill {
|
|
|
638
563
|
});
|
|
639
564
|
}
|
|
640
565
|
}
|
|
641
|
-
|
|
642
|
-
case "non-json":
|
|
643
|
-
throw new errors.PayabliError({
|
|
644
|
-
statusCode: _response.error.statusCode,
|
|
645
|
-
body: _response.error.rawBody,
|
|
646
|
-
rawResponse: _response.rawResponse,
|
|
647
|
-
});
|
|
648
|
-
case "timeout":
|
|
649
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/bills/{entry}.");
|
|
650
|
-
case "unknown":
|
|
651
|
-
throw new errors.PayabliError({
|
|
652
|
-
message: _response.error.errorMessage,
|
|
653
|
-
rawResponse: _response.rawResponse,
|
|
654
|
-
});
|
|
655
|
-
}
|
|
566
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Query/bills/{entry}");
|
|
656
567
|
});
|
|
657
568
|
}
|
|
658
569
|
/**
|
|
@@ -660,7 +571,7 @@ class Bill {
|
|
|
660
571
|
*
|
|
661
572
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
662
573
|
* @param {Payabli.ListBillsOrgRequest} request
|
|
663
|
-
* @param {
|
|
574
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
664
575
|
*
|
|
665
576
|
* @throws {@link Payabli.BadRequestError}
|
|
666
577
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -697,7 +608,8 @@ class Bill {
|
|
|
697
608
|
if (sortBy != null) {
|
|
698
609
|
_queryParams.sortBy = sortBy;
|
|
699
610
|
}
|
|
700
|
-
const
|
|
611
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
612
|
+
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);
|
|
701
613
|
const _response = yield core.fetcher({
|
|
702
614
|
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/bills/org/${core.url.encodePathParam(orgId)}`),
|
|
703
615
|
method: "GET",
|
|
@@ -730,21 +642,7 @@ class Bill {
|
|
|
730
642
|
});
|
|
731
643
|
}
|
|
732
644
|
}
|
|
733
|
-
|
|
734
|
-
case "non-json":
|
|
735
|
-
throw new errors.PayabliError({
|
|
736
|
-
statusCode: _response.error.statusCode,
|
|
737
|
-
body: _response.error.rawBody,
|
|
738
|
-
rawResponse: _response.rawResponse,
|
|
739
|
-
});
|
|
740
|
-
case "timeout":
|
|
741
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/bills/org/{orgId}.");
|
|
742
|
-
case "unknown":
|
|
743
|
-
throw new errors.PayabliError({
|
|
744
|
-
message: _response.error.errorMessage,
|
|
745
|
-
rawResponse: _response.rawResponse,
|
|
746
|
-
});
|
|
747
|
-
}
|
|
645
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Query/bills/org/{orgId}");
|
|
748
646
|
});
|
|
749
647
|
}
|
|
750
648
|
/**
|
|
@@ -752,7 +650,7 @@ class Bill {
|
|
|
752
650
|
*
|
|
753
651
|
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
754
652
|
* @param {string[]} request
|
|
755
|
-
* @param {
|
|
653
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
756
654
|
*
|
|
757
655
|
* @throws {@link Payabli.BadRequestError}
|
|
758
656
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -768,7 +666,8 @@ class Bill {
|
|
|
768
666
|
__modifyApprovalBill(idBill, request, requestOptions) {
|
|
769
667
|
return __awaiter(this, void 0, void 0, function* () {
|
|
770
668
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
771
|
-
const
|
|
669
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
670
|
+
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);
|
|
772
671
|
const _response = yield core.fetcher({
|
|
773
672
|
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, `Bill/approval/${core.url.encodePathParam(idBill)}`),
|
|
774
673
|
method: "PUT",
|
|
@@ -804,21 +703,7 @@ class Bill {
|
|
|
804
703
|
});
|
|
805
704
|
}
|
|
806
705
|
}
|
|
807
|
-
|
|
808
|
-
case "non-json":
|
|
809
|
-
throw new errors.PayabliError({
|
|
810
|
-
statusCode: _response.error.statusCode,
|
|
811
|
-
body: _response.error.rawBody,
|
|
812
|
-
rawResponse: _response.rawResponse,
|
|
813
|
-
});
|
|
814
|
-
case "timeout":
|
|
815
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Bill/approval/{idBill}.");
|
|
816
|
-
case "unknown":
|
|
817
|
-
throw new errors.PayabliError({
|
|
818
|
-
message: _response.error.errorMessage,
|
|
819
|
-
rawResponse: _response.rawResponse,
|
|
820
|
-
});
|
|
821
|
-
}
|
|
706
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/Bill/approval/{idBill}");
|
|
822
707
|
});
|
|
823
708
|
}
|
|
824
709
|
/**
|
|
@@ -826,7 +711,7 @@ class Bill {
|
|
|
826
711
|
*
|
|
827
712
|
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
828
713
|
* @param {Payabli.SendToApprovalBillRequest} request
|
|
829
|
-
* @param {
|
|
714
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
830
715
|
*
|
|
831
716
|
* @throws {@link Payabli.BadRequestError}
|
|
832
717
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -850,7 +735,8 @@ class Bill {
|
|
|
850
735
|
if (autocreateUser != null) {
|
|
851
736
|
_queryParams.autocreateUser = autocreateUser.toString();
|
|
852
737
|
}
|
|
853
|
-
const
|
|
738
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
739
|
+
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);
|
|
854
740
|
const _response = yield core.fetcher({
|
|
855
741
|
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, `Bill/approval/${core.url.encodePathParam(idBill)}`),
|
|
856
742
|
method: "POST",
|
|
@@ -886,30 +772,16 @@ class Bill {
|
|
|
886
772
|
});
|
|
887
773
|
}
|
|
888
774
|
}
|
|
889
|
-
|
|
890
|
-
case "non-json":
|
|
891
|
-
throw new errors.PayabliError({
|
|
892
|
-
statusCode: _response.error.statusCode,
|
|
893
|
-
body: _response.error.rawBody,
|
|
894
|
-
rawResponse: _response.rawResponse,
|
|
895
|
-
});
|
|
896
|
-
case "timeout":
|
|
897
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Bill/approval/{idBill}.");
|
|
898
|
-
case "unknown":
|
|
899
|
-
throw new errors.PayabliError({
|
|
900
|
-
message: _response.error.errorMessage,
|
|
901
|
-
rawResponse: _response.rawResponse,
|
|
902
|
-
});
|
|
903
|
-
}
|
|
775
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/Bill/approval/{idBill}");
|
|
904
776
|
});
|
|
905
777
|
}
|
|
906
778
|
/**
|
|
907
779
|
* Approve or disapprove a bill by ID.
|
|
908
780
|
*
|
|
909
|
-
* @param {string} approved - String representing the approved status. Accepted values: 'true' or 'false'.
|
|
910
781
|
* @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.
|
|
782
|
+
* @param {string} approved - String representing the approved status. Accepted values: 'true' or 'false'.
|
|
911
783
|
* @param {Payabli.SetApprovedBillRequest} request
|
|
912
|
-
* @param {
|
|
784
|
+
* @param {BillClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
913
785
|
*
|
|
914
786
|
* @throws {@link Payabli.BadRequestError}
|
|
915
787
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -917,20 +789,21 @@ class Bill {
|
|
|
917
789
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
918
790
|
*
|
|
919
791
|
* @example
|
|
920
|
-
* await client.bill.setApprovedBill("true"
|
|
792
|
+
* await client.bill.setApprovedBill(285, "true")
|
|
921
793
|
*/
|
|
922
|
-
setApprovedBill(
|
|
923
|
-
return core.HttpResponsePromise.fromPromise(this.__setApprovedBill(
|
|
794
|
+
setApprovedBill(idBill, approved, request = {}, requestOptions) {
|
|
795
|
+
return core.HttpResponsePromise.fromPromise(this.__setApprovedBill(idBill, approved, request, requestOptions));
|
|
924
796
|
}
|
|
925
|
-
__setApprovedBill(
|
|
926
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
797
|
+
__setApprovedBill(idBill_1, approved_1) {
|
|
798
|
+
return __awaiter(this, arguments, void 0, function* (idBill, approved, request = {}, requestOptions) {
|
|
927
799
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
928
800
|
const { email } = request;
|
|
929
801
|
const _queryParams = {};
|
|
930
802
|
if (email != null) {
|
|
931
803
|
_queryParams.email = email;
|
|
932
804
|
}
|
|
933
|
-
const
|
|
805
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
806
|
+
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);
|
|
934
807
|
const _response = yield core.fetcher({
|
|
935
808
|
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, `Bill/approval/${core.url.encodePathParam(idBill)}/${core.url.encodePathParam(approved)}`),
|
|
936
809
|
method: "GET",
|
|
@@ -963,28 +836,8 @@ class Bill {
|
|
|
963
836
|
});
|
|
964
837
|
}
|
|
965
838
|
}
|
|
966
|
-
|
|
967
|
-
case "non-json":
|
|
968
|
-
throw new errors.PayabliError({
|
|
969
|
-
statusCode: _response.error.statusCode,
|
|
970
|
-
body: _response.error.rawBody,
|
|
971
|
-
rawResponse: _response.rawResponse,
|
|
972
|
-
});
|
|
973
|
-
case "timeout":
|
|
974
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Bill/approval/{idBill}/{approved}.");
|
|
975
|
-
case "unknown":
|
|
976
|
-
throw new errors.PayabliError({
|
|
977
|
-
message: _response.error.errorMessage,
|
|
978
|
-
rawResponse: _response.rawResponse,
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
_getCustomAuthorizationHeaders() {
|
|
984
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
985
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
986
|
-
return { requestToken: apiKeyValue };
|
|
839
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Bill/approval/{idBill}/{approved}");
|
|
987
840
|
});
|
|
988
841
|
}
|
|
989
842
|
}
|
|
990
|
-
exports.
|
|
843
|
+
exports.BillClient = BillClient;
|