@payabli/sdk-node 0.0.116 → 0.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -7
- package/dist/cjs/BaseClient.d.ts +10 -1
- package/dist/cjs/BaseClient.js +57 -0
- package/dist/cjs/Client.d.ts +87 -86
- package/dist/cjs/Client.js +31 -72
- package/dist/cjs/api/resources/bill/client/Client.d.ts +33 -33
- package/dist/cjs/api/resources/bill/client/Client.js +69 -216
- package/dist/cjs/api/resources/boarding/client/Client.d.ts +27 -27
- package/dist/cjs/api/resources/boarding/client/Client.js +51 -198
- package/dist/cjs/api/resources/chargeBacks/client/Client.d.ts +17 -15
- package/dist/cjs/api/resources/chargeBacks/client/Client.js +38 -79
- package/dist/cjs/api/resources/checkCapture/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/checkCapture/client/Client.js +11 -28
- package/dist/cjs/api/resources/cloud/client/Client.d.ts +17 -17
- package/dist/cjs/api/resources/cloud/client/Client.js +33 -89
- package/dist/cjs/api/resources/customer/client/Client.d.ts +17 -17
- package/dist/cjs/api/resources/customer/client/Client.js +31 -113
- package/dist/cjs/api/resources/export/client/Client.d.ts +93 -89
- package/dist/cjs/api/resources/export/client/Client.js +205 -582
- package/dist/cjs/api/resources/hostedPaymentPages/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/hostedPaymentPages/client/Client.js +19 -62
- package/dist/cjs/api/resources/import/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/import/client/Client.js +19 -62
- package/dist/cjs/api/resources/invoice/client/Client.d.ts +31 -31
- package/dist/cjs/api/resources/invoice/client/Client.js +62 -209
- package/dist/cjs/api/resources/lineItem/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/lineItem/client/Client.js +27 -96
- package/dist/cjs/api/resources/moneyIn/client/Client.d.ts +39 -39
- package/dist/cjs/api/resources/moneyIn/client/Client.js +79 -249
- package/dist/cjs/api/resources/moneyOut/client/Client.d.ts +43 -26
- package/dist/cjs/api/resources/moneyOut/client/Client.js +105 -168
- package/dist/cjs/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.ts +2 -1
- package/dist/cjs/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.ts +3 -1
- package/dist/cjs/api/resources/notification/client/Client.d.ts +16 -16
- package/dist/cjs/api/resources/notification/client/Client.js +32 -101
- package/dist/cjs/api/resources/notificationlogs/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/notificationlogs/client/Client.js +23 -79
- package/dist/cjs/api/resources/ocr/client/Client.d.ts +13 -9
- package/dist/cjs/api/resources/ocr/client/Client.js +19 -45
- package/dist/cjs/api/resources/organization/client/Client.d.ts +19 -19
- package/dist/cjs/api/resources/organization/client/Client.js +35 -130
- package/dist/cjs/api/resources/paymentLink/client/Client.d.ts +23 -23
- package/dist/cjs/api/resources/paymentLink/client/Client.js +43 -164
- package/dist/cjs/api/resources/paymentMethodDomain/client/Client.d.ts +19 -19
- package/dist/cjs/api/resources/paymentMethodDomain/client/Client.js +35 -130
- package/dist/cjs/api/resources/paypoint/client/Client.d.ts +22 -22
- package/dist/cjs/api/resources/paypoint/client/Client.js +44 -152
- package/dist/cjs/api/resources/query/client/Client.d.ts +71 -71
- package/dist/cjs/api/resources/query/client/Client.js +137 -572
- package/dist/cjs/api/resources/query/client/requests/ListPayoutOrgRequest.d.ts +1 -0
- package/dist/cjs/api/resources/query/client/requests/ListPayoutRequest.d.ts +1 -0
- package/dist/cjs/api/resources/query/client/requests/ListTransactionsRequest.d.ts +1 -0
- package/dist/cjs/api/resources/statistic/client/Client.d.ts +50 -50
- package/dist/cjs/api/resources/statistic/client/Client.js +80 -133
- package/dist/cjs/api/resources/statistic/client/requests/BasicStatsRequest.d.ts +2 -2
- package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.ts +76 -0
- package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.js +3 -0
- package/dist/cjs/api/resources/statistic/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/statistic/types/index.js +1 -0
- package/dist/cjs/api/resources/subscription/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/subscription/client/Client.js +23 -79
- package/dist/cjs/api/resources/templates/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/templates/client/Client.js +28 -84
- package/dist/cjs/api/resources/tokenStorage/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/tokenStorage/client/Client.js +23 -79
- package/dist/cjs/api/resources/user/client/Client.d.ts +54 -32
- package/dist/cjs/api/resources/user/client/Client.js +84 -222
- package/dist/cjs/api/resources/vendor/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/vendor/client/Client.js +23 -79
- package/dist/cjs/api/resources/wallet/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/wallet/client/Client.js +23 -79
- package/dist/cjs/api/types/ApplicationDetailsRecord.d.ts +2 -2
- package/dist/cjs/api/types/NotificationContent.d.ts +1 -0
- package/dist/cjs/api/types/NotificationContent.js +1 -0
- package/dist/cjs/api/types/NotificationStandardRequest.d.ts +1 -0
- package/dist/cjs/api/types/NotificationStandardRequest.js +1 -0
- package/dist/cjs/api/types/QueryResponseSettlements.d.ts +1 -1
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -0
- package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
- package/dist/cjs/{version.js → core/auth/AuthProvider.js} +0 -2
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
- package/dist/cjs/core/auth/BasicAuth.js +27 -0
- package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
- package/dist/cjs/core/auth/BearerToken.js +16 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +5 -0
- package/dist/cjs/core/auth/index.js +9 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
- package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
- package/dist/cjs/core/fetcher/Fetcher.js +42 -24
- package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +1 -7
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/index.d.ts +2 -0
- package/dist/cjs/core/index.js +2 -0
- package/dist/cjs/core/logging/logger.js +1 -1
- package/dist/cjs/core/runtime/runtime.js +11 -10
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
- package/dist/esm/BaseClient.d.mts +10 -1
- package/dist/esm/BaseClient.mjs +22 -1
- package/dist/esm/Client.d.mts +87 -86
- package/dist/esm/Client.mjs +59 -67
- package/dist/esm/api/resources/bill/client/Client.d.mts +33 -33
- package/dist/esm/api/resources/bill/client/Client.mjs +67 -214
- package/dist/esm/api/resources/boarding/client/Client.d.mts +27 -27
- package/dist/esm/api/resources/boarding/client/Client.mjs +50 -197
- package/dist/esm/api/resources/chargeBacks/client/Client.d.mts +17 -15
- package/dist/esm/api/resources/chargeBacks/client/Client.mjs +36 -77
- package/dist/esm/api/resources/checkCapture/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/checkCapture/client/Client.mjs +10 -27
- package/dist/esm/api/resources/cloud/client/Client.d.mts +17 -17
- package/dist/esm/api/resources/cloud/client/Client.mjs +31 -87
- package/dist/esm/api/resources/customer/client/Client.d.mts +17 -17
- package/dist/esm/api/resources/customer/client/Client.mjs +29 -111
- package/dist/esm/api/resources/export/client/Client.d.mts +93 -89
- package/dist/esm/api/resources/export/client/Client.mjs +204 -581
- package/dist/esm/api/resources/hostedPaymentPages/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/hostedPaymentPages/client/Client.mjs +17 -60
- package/dist/esm/api/resources/import/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/import/client/Client.mjs +17 -60
- package/dist/esm/api/resources/invoice/client/Client.d.mts +31 -31
- package/dist/esm/api/resources/invoice/client/Client.mjs +60 -207
- package/dist/esm/api/resources/lineItem/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/lineItem/client/Client.mjs +25 -94
- package/dist/esm/api/resources/moneyIn/client/Client.d.mts +39 -39
- package/dist/esm/api/resources/moneyIn/client/Client.mjs +77 -247
- package/dist/esm/api/resources/moneyOut/client/Client.d.mts +43 -26
- package/dist/esm/api/resources/moneyOut/client/Client.mjs +103 -166
- package/dist/esm/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.mts +2 -1
- package/dist/esm/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.mts +3 -1
- package/dist/esm/api/resources/notification/client/Client.d.mts +16 -16
- package/dist/esm/api/resources/notification/client/Client.mjs +31 -100
- package/dist/esm/api/resources/notificationlogs/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/notificationlogs/client/Client.mjs +22 -78
- package/dist/esm/api/resources/ocr/client/Client.d.mts +13 -9
- package/dist/esm/api/resources/ocr/client/Client.mjs +18 -44
- package/dist/esm/api/resources/organization/client/Client.d.mts +19 -19
- package/dist/esm/api/resources/organization/client/Client.mjs +33 -128
- package/dist/esm/api/resources/paymentLink/client/Client.d.mts +23 -23
- package/dist/esm/api/resources/paymentLink/client/Client.mjs +41 -162
- package/dist/esm/api/resources/paymentMethodDomain/client/Client.d.mts +19 -19
- package/dist/esm/api/resources/paymentMethodDomain/client/Client.mjs +34 -129
- package/dist/esm/api/resources/paypoint/client/Client.d.mts +22 -22
- package/dist/esm/api/resources/paypoint/client/Client.mjs +43 -151
- package/dist/esm/api/resources/query/client/Client.d.mts +71 -71
- package/dist/esm/api/resources/query/client/Client.mjs +136 -571
- package/dist/esm/api/resources/query/client/requests/ListPayoutOrgRequest.d.mts +1 -0
- package/dist/esm/api/resources/query/client/requests/ListPayoutRequest.d.mts +1 -0
- package/dist/esm/api/resources/query/client/requests/ListTransactionsRequest.d.mts +1 -0
- package/dist/esm/api/resources/statistic/client/Client.d.mts +50 -50
- package/dist/esm/api/resources/statistic/client/Client.mjs +79 -132
- package/dist/esm/api/resources/statistic/client/requests/BasicStatsRequest.d.mts +2 -2
- package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.mts +76 -0
- package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.mjs +2 -0
- package/dist/esm/api/resources/statistic/types/index.d.mts +1 -0
- package/dist/esm/api/resources/statistic/types/index.mjs +1 -0
- package/dist/esm/api/resources/subscription/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/subscription/client/Client.mjs +21 -77
- package/dist/esm/api/resources/templates/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/templates/client/Client.mjs +27 -83
- package/dist/esm/api/resources/tokenStorage/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/tokenStorage/client/Client.mjs +21 -77
- package/dist/esm/api/resources/user/client/Client.d.mts +54 -32
- package/dist/esm/api/resources/user/client/Client.mjs +83 -221
- package/dist/esm/api/resources/vendor/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/vendor/client/Client.mjs +22 -78
- package/dist/esm/api/resources/wallet/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/wallet/client/Client.mjs +22 -78
- package/dist/esm/api/types/ApplicationDetailsRecord.d.mts +2 -2
- package/dist/esm/api/types/NotificationContent.d.mts +1 -0
- package/dist/esm/api/types/NotificationContent.mjs +1 -0
- package/dist/esm/api/types/NotificationStandardRequest.d.mts +1 -0
- package/dist/esm/api/types/NotificationStandardRequest.mjs +1 -0
- package/dist/esm/api/types/QueryResponseSettlements.d.mts +1 -1
- package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -0
- package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
- package/dist/esm/core/auth/BasicAuth.mjs +24 -0
- package/dist/esm/core/auth/BearerToken.d.mts +7 -0
- package/dist/esm/core/auth/BearerToken.mjs +13 -0
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +5 -0
- package/dist/esm/core/auth/index.mjs +3 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
- package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +42 -24
- package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +1 -7
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/index.d.mts +2 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/core/logging/logger.mjs +1 -1
- package/dist/esm/core/runtime/runtime.mjs +11 -10
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
- package/package.json +4 -4
- package/reference.md +761 -473
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
- package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
- package/dist/cjs/version.d.ts +0 -1
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
- package/dist/esm/version.d.mts +0 -1
- package/dist/esm/version.mjs +0 -1
|
@@ -43,20 +43,24 @@ 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.OcrClient = 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 environments = __importStar(require("../../../../environments.js"));
|
|
51
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
50
52
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
53
|
const Payabli = __importStar(require("../../../index.js"));
|
|
52
|
-
class
|
|
53
|
-
constructor(
|
|
54
|
-
this._options =
|
|
54
|
+
class OcrClient {
|
|
55
|
+
constructor(options = {}) {
|
|
56
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
59
|
+
* Use this endpoint to upload an image file for OCR processing. The accepted file formats include PDF, JPG, JPEG, PNG, and GIF. Specify the desired type of result (either 'bill' or 'invoice') in the path parameter `typeResult`. The response will contain the OCR processing results, including extracted data such as bill number, vendor information, bill items, and more.
|
|
60
|
+
*
|
|
57
61
|
* @param {Payabli.TypeResult} typeResult
|
|
58
62
|
* @param {Payabli.FileContentImageOnly} request
|
|
59
|
-
* @param {
|
|
63
|
+
* @param {OcrClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
64
|
*
|
|
61
65
|
* @throws {@link Payabli.BadRequestError}
|
|
62
66
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -72,7 +76,8 @@ class Ocr {
|
|
|
72
76
|
__ocrDocumentForm(typeResult, request, requestOptions) {
|
|
73
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
78
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
-
const
|
|
79
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
80
|
+
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);
|
|
76
81
|
const _response = yield core.fetcher({
|
|
77
82
|
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, `/Import/ocrDocumentForm/${core.url.encodePathParam(typeResult)}`),
|
|
78
83
|
method: "POST",
|
|
@@ -108,27 +113,15 @@ class Ocr {
|
|
|
108
113
|
});
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
|
-
|
|
112
|
-
case "non-json":
|
|
113
|
-
throw new errors.PayabliError({
|
|
114
|
-
statusCode: _response.error.statusCode,
|
|
115
|
-
body: _response.error.rawBody,
|
|
116
|
-
rawResponse: _response.rawResponse,
|
|
117
|
-
});
|
|
118
|
-
case "timeout":
|
|
119
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Import/ocrDocumentForm/{typeResult}.");
|
|
120
|
-
case "unknown":
|
|
121
|
-
throw new errors.PayabliError({
|
|
122
|
-
message: _response.error.errorMessage,
|
|
123
|
-
rawResponse: _response.rawResponse,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
116
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/Import/ocrDocumentForm/{typeResult}");
|
|
126
117
|
});
|
|
127
118
|
}
|
|
128
119
|
/**
|
|
120
|
+
* Use this endpoint to submit a Base64-encoded image file for OCR processing. The accepted file formats include PDF, JPG, JPEG, PNG, and GIF. Specify the desired type of result (either 'bill' or 'invoice') in the path parameter `typeResult`. The response will contain the OCR processing results, including extracted data such as bill number, vendor information, bill items, and more.
|
|
121
|
+
*
|
|
129
122
|
* @param {Payabli.TypeResult} typeResult
|
|
130
123
|
* @param {Payabli.FileContentImageOnly} request
|
|
131
|
-
* @param {
|
|
124
|
+
* @param {OcrClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
132
125
|
*
|
|
133
126
|
* @throws {@link Payabli.BadRequestError}
|
|
134
127
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -144,7 +137,8 @@ class Ocr {
|
|
|
144
137
|
__ocrDocumentJson(typeResult, request, requestOptions) {
|
|
145
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
146
139
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
147
|
-
const
|
|
140
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
141
|
+
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);
|
|
148
142
|
const _response = yield core.fetcher({
|
|
149
143
|
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, `/Import/ocrDocumentJson/${core.url.encodePathParam(typeResult)}`),
|
|
150
144
|
method: "POST",
|
|
@@ -180,28 +174,8 @@ class Ocr {
|
|
|
180
174
|
});
|
|
181
175
|
}
|
|
182
176
|
}
|
|
183
|
-
|
|
184
|
-
case "non-json":
|
|
185
|
-
throw new errors.PayabliError({
|
|
186
|
-
statusCode: _response.error.statusCode,
|
|
187
|
-
body: _response.error.rawBody,
|
|
188
|
-
rawResponse: _response.rawResponse,
|
|
189
|
-
});
|
|
190
|
-
case "timeout":
|
|
191
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Import/ocrDocumentJson/{typeResult}.");
|
|
192
|
-
case "unknown":
|
|
193
|
-
throw new errors.PayabliError({
|
|
194
|
-
message: _response.error.errorMessage,
|
|
195
|
-
rawResponse: _response.rawResponse,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
_getCustomAuthorizationHeaders() {
|
|
201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
203
|
-
return { requestToken: apiKeyValue };
|
|
177
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/Import/ocrDocumentJson/{typeResult}");
|
|
204
178
|
});
|
|
205
179
|
}
|
|
206
180
|
}
|
|
207
|
-
exports.
|
|
181
|
+
exports.OcrClient = OcrClient;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
2
3
|
import * as core from "../../../../core/index.js";
|
|
3
4
|
import * as Payabli from "../../../index.js";
|
|
4
|
-
export declare namespace
|
|
5
|
+
export declare namespace OrganizationClient {
|
|
5
6
|
interface Options extends BaseClientOptions {
|
|
6
7
|
}
|
|
7
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
11
|
+
export declare class OrganizationClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<OrganizationClient.Options>;
|
|
13
|
+
constructor(options?: OrganizationClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* Creates an organization under a parent organization. This is also referred to as a suborganization.
|
|
15
16
|
*
|
|
16
17
|
* @param {Payabli.AddOrganizationRequest} request
|
|
17
|
-
* @param {
|
|
18
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
19
|
*
|
|
19
20
|
* @throws {@link Payabli.BadRequestError}
|
|
20
21
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -62,13 +63,13 @@ export declare class Organization {
|
|
|
62
63
|
* replyToEmail: "email@example.com"
|
|
63
64
|
* })
|
|
64
65
|
*/
|
|
65
|
-
addOrganization(request: Payabli.AddOrganizationRequest, requestOptions?:
|
|
66
|
+
addOrganization(request: Payabli.AddOrganizationRequest, requestOptions?: OrganizationClient.RequestOptions): core.HttpResponsePromise<Payabli.AddOrganizationResponse>;
|
|
66
67
|
private __addOrganization;
|
|
67
68
|
/**
|
|
68
69
|
* Delete an organization by ID.
|
|
69
70
|
*
|
|
70
71
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
71
|
-
* @param {
|
|
72
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
73
|
*
|
|
73
74
|
* @throws {@link Payabli.BadRequestError}
|
|
74
75
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -78,14 +79,14 @@ export declare class Organization {
|
|
|
78
79
|
* @example
|
|
79
80
|
* await client.organization.deleteOrganization(123)
|
|
80
81
|
*/
|
|
81
|
-
deleteOrganization(orgId: number, requestOptions?:
|
|
82
|
+
deleteOrganization(orgId: number, requestOptions?: OrganizationClient.RequestOptions): core.HttpResponsePromise<Payabli.DeleteOrganizationResponse>;
|
|
82
83
|
private __deleteOrganization;
|
|
83
84
|
/**
|
|
84
85
|
* Updates an organization's details by ID.
|
|
85
86
|
*
|
|
86
87
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
87
88
|
* @param {Payabli.OrganizationData} request
|
|
88
|
-
* @param {
|
|
89
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
89
90
|
*
|
|
90
91
|
* @throws {@link Payabli.BadRequestError}
|
|
91
92
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -113,13 +114,13 @@ export declare class Organization {
|
|
|
113
114
|
* orgZip: "37615"
|
|
114
115
|
* })
|
|
115
116
|
*/
|
|
116
|
-
editOrganization(orgId: number, request?: Payabli.OrganizationData, requestOptions?:
|
|
117
|
+
editOrganization(orgId: number, request?: Payabli.OrganizationData, requestOptions?: OrganizationClient.RequestOptions): core.HttpResponsePromise<Payabli.EditOrganizationResponse>;
|
|
117
118
|
private __editOrganization;
|
|
118
119
|
/**
|
|
119
120
|
* Gets an organization's basic information by entry name (entrypoint identifier).
|
|
120
121
|
*
|
|
121
122
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
122
|
-
* @param {
|
|
123
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
123
124
|
*
|
|
124
125
|
* @throws {@link Payabli.BadRequestError}
|
|
125
126
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -129,13 +130,13 @@ export declare class Organization {
|
|
|
129
130
|
* @example
|
|
130
131
|
* await client.organization.getBasicOrganization("8cfec329267")
|
|
131
132
|
*/
|
|
132
|
-
getBasicOrganization(entry: string, requestOptions?:
|
|
133
|
+
getBasicOrganization(entry: string, requestOptions?: OrganizationClient.RequestOptions): core.HttpResponsePromise<Payabli.OrganizationQueryRecord>;
|
|
133
134
|
private __getBasicOrganization;
|
|
134
135
|
/**
|
|
135
136
|
* Gets an organizations basic details by org ID.
|
|
136
137
|
*
|
|
137
138
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
138
|
-
* @param {
|
|
139
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
139
140
|
*
|
|
140
141
|
* @throws {@link Payabli.BadRequestError}
|
|
141
142
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -145,13 +146,13 @@ export declare class Organization {
|
|
|
145
146
|
* @example
|
|
146
147
|
* await client.organization.getBasicOrganizationById(123)
|
|
147
148
|
*/
|
|
148
|
-
getBasicOrganizationById(orgId: number, requestOptions?:
|
|
149
|
+
getBasicOrganizationById(orgId: number, requestOptions?: OrganizationClient.RequestOptions): core.HttpResponsePromise<Payabli.OrganizationQueryRecord>;
|
|
149
150
|
private __getBasicOrganizationById;
|
|
150
151
|
/**
|
|
151
152
|
* Retrieves details for an organization by ID.
|
|
152
153
|
*
|
|
153
154
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
154
|
-
* @param {
|
|
155
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
155
156
|
*
|
|
156
157
|
* @throws {@link Payabli.BadRequestError}
|
|
157
158
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -161,13 +162,13 @@ export declare class Organization {
|
|
|
161
162
|
* @example
|
|
162
163
|
* await client.organization.getOrganization(123)
|
|
163
164
|
*/
|
|
164
|
-
getOrganization(orgId: number, requestOptions?:
|
|
165
|
+
getOrganization(orgId: number, requestOptions?: OrganizationClient.RequestOptions): core.HttpResponsePromise<Payabli.OrganizationQueryRecord>;
|
|
165
166
|
private __getOrganization;
|
|
166
167
|
/**
|
|
167
168
|
* Retrieves an organization's settings.
|
|
168
169
|
*
|
|
169
170
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
170
|
-
* @param {
|
|
171
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
171
172
|
*
|
|
172
173
|
* @throws {@link Payabli.BadRequestError}
|
|
173
174
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -177,7 +178,6 @@ export declare class Organization {
|
|
|
177
178
|
* @example
|
|
178
179
|
* await client.organization.getSettingsOrganization(123)
|
|
179
180
|
*/
|
|
180
|
-
getSettingsOrganization(orgId: number, requestOptions?:
|
|
181
|
+
getSettingsOrganization(orgId: number, requestOptions?: OrganizationClient.RequestOptions): core.HttpResponsePromise<Payabli.SettingsQueryRecord>;
|
|
181
182
|
private __getSettingsOrganization;
|
|
182
|
-
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
183
183
|
}
|
|
@@ -54,21 +54,23 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
54
54
|
return t;
|
|
55
55
|
};
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
exports.
|
|
57
|
+
exports.OrganizationClient = void 0;
|
|
58
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
58
59
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
59
60
|
const core = __importStar(require("../../../../core/index.js"));
|
|
60
61
|
const environments = __importStar(require("../../../../environments.js"));
|
|
62
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
61
63
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
62
64
|
const Payabli = __importStar(require("../../../index.js"));
|
|
63
|
-
class
|
|
64
|
-
constructor(
|
|
65
|
-
this._options =
|
|
65
|
+
class OrganizationClient {
|
|
66
|
+
constructor(options = {}) {
|
|
67
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
68
70
|
* Creates an organization under a parent organization. This is also referred to as a suborganization.
|
|
69
71
|
*
|
|
70
72
|
* @param {Payabli.AddOrganizationRequest} request
|
|
71
|
-
* @param {
|
|
73
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
74
|
*
|
|
73
75
|
* @throws {@link Payabli.BadRequestError}
|
|
74
76
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -123,7 +125,8 @@ class Organization {
|
|
|
123
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
126
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
125
127
|
const { idempotencyKey } = request, _body = __rest(request, ["idempotencyKey"]);
|
|
126
|
-
const
|
|
128
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
129
|
+
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);
|
|
127
130
|
const _response = yield core.fetcher({
|
|
128
131
|
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, "Organization"),
|
|
129
132
|
method: "POST",
|
|
@@ -159,28 +162,14 @@ class Organization {
|
|
|
159
162
|
});
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
|
-
|
|
163
|
-
case "non-json":
|
|
164
|
-
throw new errors.PayabliError({
|
|
165
|
-
statusCode: _response.error.statusCode,
|
|
166
|
-
body: _response.error.rawBody,
|
|
167
|
-
rawResponse: _response.rawResponse,
|
|
168
|
-
});
|
|
169
|
-
case "timeout":
|
|
170
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Organization.");
|
|
171
|
-
case "unknown":
|
|
172
|
-
throw new errors.PayabliError({
|
|
173
|
-
message: _response.error.errorMessage,
|
|
174
|
-
rawResponse: _response.rawResponse,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
165
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/Organization");
|
|
177
166
|
});
|
|
178
167
|
}
|
|
179
168
|
/**
|
|
180
169
|
* Delete an organization by ID.
|
|
181
170
|
*
|
|
182
171
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
183
|
-
* @param {
|
|
172
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
184
173
|
*
|
|
185
174
|
* @throws {@link Payabli.BadRequestError}
|
|
186
175
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -196,7 +185,8 @@ class Organization {
|
|
|
196
185
|
__deleteOrganization(orgId, requestOptions) {
|
|
197
186
|
return __awaiter(this, void 0, void 0, function* () {
|
|
198
187
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
199
|
-
const
|
|
188
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
189
|
+
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);
|
|
200
190
|
const _response = yield core.fetcher({
|
|
201
191
|
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, `Organization/${core.url.encodePathParam(orgId)}`),
|
|
202
192
|
method: "DELETE",
|
|
@@ -229,21 +219,7 @@ class Organization {
|
|
|
229
219
|
});
|
|
230
220
|
}
|
|
231
221
|
}
|
|
232
|
-
|
|
233
|
-
case "non-json":
|
|
234
|
-
throw new errors.PayabliError({
|
|
235
|
-
statusCode: _response.error.statusCode,
|
|
236
|
-
body: _response.error.rawBody,
|
|
237
|
-
rawResponse: _response.rawResponse,
|
|
238
|
-
});
|
|
239
|
-
case "timeout":
|
|
240
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Organization/{orgId}.");
|
|
241
|
-
case "unknown":
|
|
242
|
-
throw new errors.PayabliError({
|
|
243
|
-
message: _response.error.errorMessage,
|
|
244
|
-
rawResponse: _response.rawResponse,
|
|
245
|
-
});
|
|
246
|
-
}
|
|
222
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/Organization/{orgId}");
|
|
247
223
|
});
|
|
248
224
|
}
|
|
249
225
|
/**
|
|
@@ -251,7 +227,7 @@ class Organization {
|
|
|
251
227
|
*
|
|
252
228
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
253
229
|
* @param {Payabli.OrganizationData} request
|
|
254
|
-
* @param {
|
|
230
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
255
231
|
*
|
|
256
232
|
* @throws {@link Payabli.BadRequestError}
|
|
257
233
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -285,7 +261,8 @@ class Organization {
|
|
|
285
261
|
__editOrganization(orgId_1) {
|
|
286
262
|
return __awaiter(this, arguments, void 0, function* (orgId, request = {}, requestOptions) {
|
|
287
263
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
288
|
-
const
|
|
264
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
265
|
+
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);
|
|
289
266
|
const _response = yield core.fetcher({
|
|
290
267
|
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, `Organization/${core.url.encodePathParam(orgId)}`),
|
|
291
268
|
method: "PUT",
|
|
@@ -321,28 +298,14 @@ class Organization {
|
|
|
321
298
|
});
|
|
322
299
|
}
|
|
323
300
|
}
|
|
324
|
-
|
|
325
|
-
case "non-json":
|
|
326
|
-
throw new errors.PayabliError({
|
|
327
|
-
statusCode: _response.error.statusCode,
|
|
328
|
-
body: _response.error.rawBody,
|
|
329
|
-
rawResponse: _response.rawResponse,
|
|
330
|
-
});
|
|
331
|
-
case "timeout":
|
|
332
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Organization/{orgId}.");
|
|
333
|
-
case "unknown":
|
|
334
|
-
throw new errors.PayabliError({
|
|
335
|
-
message: _response.error.errorMessage,
|
|
336
|
-
rawResponse: _response.rawResponse,
|
|
337
|
-
});
|
|
338
|
-
}
|
|
301
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/Organization/{orgId}");
|
|
339
302
|
});
|
|
340
303
|
}
|
|
341
304
|
/**
|
|
342
305
|
* Gets an organization's basic information by entry name (entrypoint identifier).
|
|
343
306
|
*
|
|
344
307
|
* @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
|
|
345
|
-
* @param {
|
|
308
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
346
309
|
*
|
|
347
310
|
* @throws {@link Payabli.BadRequestError}
|
|
348
311
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -358,7 +321,8 @@ class Organization {
|
|
|
358
321
|
__getBasicOrganization(entry, requestOptions) {
|
|
359
322
|
return __awaiter(this, void 0, void 0, function* () {
|
|
360
323
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
361
|
-
const
|
|
324
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
325
|
+
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);
|
|
362
326
|
const _response = yield core.fetcher({
|
|
363
327
|
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, `Organization/basic/${core.url.encodePathParam(entry)}`),
|
|
364
328
|
method: "GET",
|
|
@@ -391,28 +355,14 @@ class Organization {
|
|
|
391
355
|
});
|
|
392
356
|
}
|
|
393
357
|
}
|
|
394
|
-
|
|
395
|
-
case "non-json":
|
|
396
|
-
throw new errors.PayabliError({
|
|
397
|
-
statusCode: _response.error.statusCode,
|
|
398
|
-
body: _response.error.rawBody,
|
|
399
|
-
rawResponse: _response.rawResponse,
|
|
400
|
-
});
|
|
401
|
-
case "timeout":
|
|
402
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Organization/basic/{entry}.");
|
|
403
|
-
case "unknown":
|
|
404
|
-
throw new errors.PayabliError({
|
|
405
|
-
message: _response.error.errorMessage,
|
|
406
|
-
rawResponse: _response.rawResponse,
|
|
407
|
-
});
|
|
408
|
-
}
|
|
358
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Organization/basic/{entry}");
|
|
409
359
|
});
|
|
410
360
|
}
|
|
411
361
|
/**
|
|
412
362
|
* Gets an organizations basic details by org ID.
|
|
413
363
|
*
|
|
414
364
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
415
|
-
* @param {
|
|
365
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
416
366
|
*
|
|
417
367
|
* @throws {@link Payabli.BadRequestError}
|
|
418
368
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -428,7 +378,8 @@ class Organization {
|
|
|
428
378
|
__getBasicOrganizationById(orgId, requestOptions) {
|
|
429
379
|
return __awaiter(this, void 0, void 0, function* () {
|
|
430
380
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
431
|
-
const
|
|
381
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
382
|
+
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);
|
|
432
383
|
const _response = yield core.fetcher({
|
|
433
384
|
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, `Organization/basicById/${core.url.encodePathParam(orgId)}`),
|
|
434
385
|
method: "GET",
|
|
@@ -461,28 +412,14 @@ class Organization {
|
|
|
461
412
|
});
|
|
462
413
|
}
|
|
463
414
|
}
|
|
464
|
-
|
|
465
|
-
case "non-json":
|
|
466
|
-
throw new errors.PayabliError({
|
|
467
|
-
statusCode: _response.error.statusCode,
|
|
468
|
-
body: _response.error.rawBody,
|
|
469
|
-
rawResponse: _response.rawResponse,
|
|
470
|
-
});
|
|
471
|
-
case "timeout":
|
|
472
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Organization/basicById/{orgId}.");
|
|
473
|
-
case "unknown":
|
|
474
|
-
throw new errors.PayabliError({
|
|
475
|
-
message: _response.error.errorMessage,
|
|
476
|
-
rawResponse: _response.rawResponse,
|
|
477
|
-
});
|
|
478
|
-
}
|
|
415
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Organization/basicById/{orgId}");
|
|
479
416
|
});
|
|
480
417
|
}
|
|
481
418
|
/**
|
|
482
419
|
* Retrieves details for an organization by ID.
|
|
483
420
|
*
|
|
484
421
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
485
|
-
* @param {
|
|
422
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
486
423
|
*
|
|
487
424
|
* @throws {@link Payabli.BadRequestError}
|
|
488
425
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -498,7 +435,8 @@ class Organization {
|
|
|
498
435
|
__getOrganization(orgId, requestOptions) {
|
|
499
436
|
return __awaiter(this, void 0, void 0, function* () {
|
|
500
437
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
501
|
-
const
|
|
438
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
439
|
+
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);
|
|
502
440
|
const _response = yield core.fetcher({
|
|
503
441
|
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, `Organization/read/${core.url.encodePathParam(orgId)}`),
|
|
504
442
|
method: "GET",
|
|
@@ -531,28 +469,14 @@ class Organization {
|
|
|
531
469
|
});
|
|
532
470
|
}
|
|
533
471
|
}
|
|
534
|
-
|
|
535
|
-
case "non-json":
|
|
536
|
-
throw new errors.PayabliError({
|
|
537
|
-
statusCode: _response.error.statusCode,
|
|
538
|
-
body: _response.error.rawBody,
|
|
539
|
-
rawResponse: _response.rawResponse,
|
|
540
|
-
});
|
|
541
|
-
case "timeout":
|
|
542
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Organization/read/{orgId}.");
|
|
543
|
-
case "unknown":
|
|
544
|
-
throw new errors.PayabliError({
|
|
545
|
-
message: _response.error.errorMessage,
|
|
546
|
-
rawResponse: _response.rawResponse,
|
|
547
|
-
});
|
|
548
|
-
}
|
|
472
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Organization/read/{orgId}");
|
|
549
473
|
});
|
|
550
474
|
}
|
|
551
475
|
/**
|
|
552
476
|
* Retrieves an organization's settings.
|
|
553
477
|
*
|
|
554
478
|
* @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
|
|
555
|
-
* @param {
|
|
479
|
+
* @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
556
480
|
*
|
|
557
481
|
* @throws {@link Payabli.BadRequestError}
|
|
558
482
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -568,7 +492,8 @@ class Organization {
|
|
|
568
492
|
__getSettingsOrganization(orgId, requestOptions) {
|
|
569
493
|
return __awaiter(this, void 0, void 0, function* () {
|
|
570
494
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
571
|
-
const
|
|
495
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
496
|
+
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);
|
|
572
497
|
const _response = yield core.fetcher({
|
|
573
498
|
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, `Organization/settings/${core.url.encodePathParam(orgId)}`),
|
|
574
499
|
method: "GET",
|
|
@@ -601,28 +526,8 @@ class Organization {
|
|
|
601
526
|
});
|
|
602
527
|
}
|
|
603
528
|
}
|
|
604
|
-
|
|
605
|
-
case "non-json":
|
|
606
|
-
throw new errors.PayabliError({
|
|
607
|
-
statusCode: _response.error.statusCode,
|
|
608
|
-
body: _response.error.rawBody,
|
|
609
|
-
rawResponse: _response.rawResponse,
|
|
610
|
-
});
|
|
611
|
-
case "timeout":
|
|
612
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Organization/settings/{orgId}.");
|
|
613
|
-
case "unknown":
|
|
614
|
-
throw new errors.PayabliError({
|
|
615
|
-
message: _response.error.errorMessage,
|
|
616
|
-
rawResponse: _response.rawResponse,
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
_getCustomAuthorizationHeaders() {
|
|
622
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
623
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
624
|
-
return { requestToken: apiKeyValue };
|
|
529
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Organization/settings/{orgId}");
|
|
625
530
|
});
|
|
626
531
|
}
|
|
627
532
|
}
|
|
628
|
-
exports.
|
|
533
|
+
exports.OrganizationClient = OrganizationClient;
|