@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
|
@@ -54,15 +54,17 @@ 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.MoneyInClient = 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 MoneyInClient {
|
|
66
|
+
constructor(options = {}) {
|
|
67
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
68
70
|
* Authorize a card transaction. This returns an authorization code and reserves funds for the merchant. Authorized transactions aren't flagged for settlement until [captured](/api-reference/moneyin/capture-an-authorized-transaction).
|
|
@@ -70,7 +72,7 @@ class MoneyIn {
|
|
|
70
72
|
* **Note**: Only card transactions can be authorized. This endpoint can't be used for ACH transactions.
|
|
71
73
|
*
|
|
72
74
|
* @param {Payabli.RequestPaymentAuthorize} request
|
|
73
|
-
* @param {
|
|
75
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
74
76
|
*
|
|
75
77
|
* @throws {@link Payabli.BadRequestError}
|
|
76
78
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -112,7 +114,8 @@ class MoneyIn {
|
|
|
112
114
|
if (forceCustomerCreation != null) {
|
|
113
115
|
_queryParams.forceCustomerCreation = forceCustomerCreation.toString();
|
|
114
116
|
}
|
|
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, "MoneyIn/authorize"),
|
|
118
121
|
method: "POST",
|
|
@@ -148,21 +151,7 @@ class MoneyIn {
|
|
|
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 /MoneyIn/authorize.");
|
|
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", "/MoneyIn/authorize");
|
|
166
155
|
});
|
|
167
156
|
}
|
|
168
157
|
/**
|
|
@@ -173,9 +162,9 @@ class MoneyIn {
|
|
|
173
162
|
* Capture an [authorized
|
|
174
163
|
* transaction](/api-reference/moneyin/authorize-a-transaction) to complete the transaction and move funds from the customer to merchant account.
|
|
175
164
|
*
|
|
176
|
-
* @param {number} amount - Amount to be captured. The amount can't be greater the original total amount of the transaction. `0` captures the total amount authorized in the transaction. Partial captures aren't supported.
|
|
177
165
|
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
178
|
-
* @param {
|
|
166
|
+
* @param {number} amount - Amount to be captured. The amount can't be greater the original total amount of the transaction. `0` captures the total amount authorized in the transaction. Partial captures aren't supported.
|
|
167
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
179
168
|
*
|
|
180
169
|
* @throws {@link Payabli.BadRequestError}
|
|
181
170
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -183,15 +172,16 @@ class MoneyIn {
|
|
|
183
172
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
184
173
|
*
|
|
185
174
|
* @example
|
|
186
|
-
* await client.moneyIn.capture(
|
|
175
|
+
* await client.moneyIn.capture("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", 0)
|
|
187
176
|
*/
|
|
188
|
-
capture(
|
|
189
|
-
return core.HttpResponsePromise.fromPromise(this.__capture(
|
|
177
|
+
capture(transId, amount, requestOptions) {
|
|
178
|
+
return core.HttpResponsePromise.fromPromise(this.__capture(transId, amount, requestOptions));
|
|
190
179
|
}
|
|
191
|
-
__capture(
|
|
180
|
+
__capture(transId, amount, requestOptions) {
|
|
192
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
193
182
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
194
|
-
const
|
|
183
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
184
|
+
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);
|
|
195
185
|
const _response = yield core.fetcher({
|
|
196
186
|
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, `MoneyIn/capture/${core.url.encodePathParam(transId)}/${core.url.encodePathParam(amount)}`),
|
|
197
187
|
method: "GET",
|
|
@@ -224,21 +214,7 @@ class MoneyIn {
|
|
|
224
214
|
});
|
|
225
215
|
}
|
|
226
216
|
}
|
|
227
|
-
|
|
228
|
-
case "non-json":
|
|
229
|
-
throw new errors.PayabliError({
|
|
230
|
-
statusCode: _response.error.statusCode,
|
|
231
|
-
body: _response.error.rawBody,
|
|
232
|
-
rawResponse: _response.rawResponse,
|
|
233
|
-
});
|
|
234
|
-
case "timeout":
|
|
235
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/capture/{transId}/{amount}.");
|
|
236
|
-
case "unknown":
|
|
237
|
-
throw new errors.PayabliError({
|
|
238
|
-
message: _response.error.errorMessage,
|
|
239
|
-
rawResponse: _response.rawResponse,
|
|
240
|
-
});
|
|
241
|
-
}
|
|
217
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/MoneyIn/capture/{transId}/{amount}");
|
|
242
218
|
});
|
|
243
219
|
}
|
|
244
220
|
/**
|
|
@@ -248,7 +224,7 @@ class MoneyIn {
|
|
|
248
224
|
*
|
|
249
225
|
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
250
226
|
* @param {Payabli.CaptureRequest} request
|
|
251
|
-
* @param {
|
|
227
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
252
228
|
*
|
|
253
229
|
* @throws {@link Payabli.BadRequestError}
|
|
254
230
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -284,7 +260,8 @@ class MoneyIn {
|
|
|
284
260
|
__captureAuth(transId, request, requestOptions) {
|
|
285
261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
286
262
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
287
|
-
const
|
|
263
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
264
|
+
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);
|
|
288
265
|
const _response = yield core.fetcher({
|
|
289
266
|
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, `MoneyIn/capture/${core.url.encodePathParam(transId)}`),
|
|
290
267
|
method: "POST",
|
|
@@ -320,21 +297,7 @@ class MoneyIn {
|
|
|
320
297
|
});
|
|
321
298
|
}
|
|
322
299
|
}
|
|
323
|
-
|
|
324
|
-
case "non-json":
|
|
325
|
-
throw new errors.PayabliError({
|
|
326
|
-
statusCode: _response.error.statusCode,
|
|
327
|
-
body: _response.error.rawBody,
|
|
328
|
-
rawResponse: _response.rawResponse,
|
|
329
|
-
});
|
|
330
|
-
case "timeout":
|
|
331
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/capture/{transId}.");
|
|
332
|
-
case "unknown":
|
|
333
|
-
throw new errors.PayabliError({
|
|
334
|
-
message: _response.error.errorMessage,
|
|
335
|
-
rawResponse: _response.rawResponse,
|
|
336
|
-
});
|
|
337
|
-
}
|
|
300
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/MoneyIn/capture/{transId}");
|
|
338
301
|
});
|
|
339
302
|
}
|
|
340
303
|
/**
|
|
@@ -343,7 +306,7 @@ class MoneyIn {
|
|
|
343
306
|
* This feature must be enabled by Payabli on a per-merchant basis. Contact support for help.
|
|
344
307
|
*
|
|
345
308
|
* @param {Payabli.RequestCredit} request
|
|
346
|
-
* @param {
|
|
309
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
347
310
|
*
|
|
348
311
|
* @throws {@link Payabli.BadRequestError}
|
|
349
312
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -408,7 +371,8 @@ class MoneyIn {
|
|
|
408
371
|
if (forceCustomerCreation != null) {
|
|
409
372
|
_queryParams.forceCustomerCreation = forceCustomerCreation.toString();
|
|
410
373
|
}
|
|
411
|
-
const
|
|
374
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
375
|
+
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);
|
|
412
376
|
const _response = yield core.fetcher({
|
|
413
377
|
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, "MoneyIn/makecredit"),
|
|
414
378
|
method: "POST",
|
|
@@ -444,28 +408,14 @@ class MoneyIn {
|
|
|
444
408
|
});
|
|
445
409
|
}
|
|
446
410
|
}
|
|
447
|
-
|
|
448
|
-
case "non-json":
|
|
449
|
-
throw new errors.PayabliError({
|
|
450
|
-
statusCode: _response.error.statusCode,
|
|
451
|
-
body: _response.error.rawBody,
|
|
452
|
-
rawResponse: _response.rawResponse,
|
|
453
|
-
});
|
|
454
|
-
case "timeout":
|
|
455
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/makecredit.");
|
|
456
|
-
case "unknown":
|
|
457
|
-
throw new errors.PayabliError({
|
|
458
|
-
message: _response.error.errorMessage,
|
|
459
|
-
rawResponse: _response.rawResponse,
|
|
460
|
-
});
|
|
461
|
-
}
|
|
411
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/MoneyIn/makecredit");
|
|
462
412
|
});
|
|
463
413
|
}
|
|
464
414
|
/**
|
|
465
415
|
* Retrieve a processed transaction's details.
|
|
466
416
|
*
|
|
467
417
|
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
468
|
-
* @param {
|
|
418
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
469
419
|
*
|
|
470
420
|
* @throws {@link Payabli.BadRequestError}
|
|
471
421
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -481,7 +431,8 @@ class MoneyIn {
|
|
|
481
431
|
__details(transId, requestOptions) {
|
|
482
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
483
433
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
484
|
-
const
|
|
434
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
435
|
+
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);
|
|
485
436
|
const _response = yield core.fetcher({
|
|
486
437
|
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, `MoneyIn/details/${core.url.encodePathParam(transId)}`),
|
|
487
438
|
method: "GET",
|
|
@@ -517,28 +468,14 @@ class MoneyIn {
|
|
|
517
468
|
});
|
|
518
469
|
}
|
|
519
470
|
}
|
|
520
|
-
|
|
521
|
-
case "non-json":
|
|
522
|
-
throw new errors.PayabliError({
|
|
523
|
-
statusCode: _response.error.statusCode,
|
|
524
|
-
body: _response.error.rawBody,
|
|
525
|
-
rawResponse: _response.rawResponse,
|
|
526
|
-
});
|
|
527
|
-
case "timeout":
|
|
528
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/details/{transId}.");
|
|
529
|
-
case "unknown":
|
|
530
|
-
throw new errors.PayabliError({
|
|
531
|
-
message: _response.error.errorMessage,
|
|
532
|
-
rawResponse: _response.rawResponse,
|
|
533
|
-
});
|
|
534
|
-
}
|
|
471
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/MoneyIn/details/{transId}");
|
|
535
472
|
});
|
|
536
473
|
}
|
|
537
474
|
/**
|
|
538
475
|
* Make a single transaction. This method authorizes and captures a payment in one step.
|
|
539
476
|
*
|
|
540
477
|
* @param {Payabli.RequestPayment} request
|
|
541
|
-
* @param {
|
|
478
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
542
479
|
*
|
|
543
480
|
* @throws {@link Payabli.BadRequestError}
|
|
544
481
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -713,7 +650,11 @@ class MoneyIn {
|
|
|
713
650
|
if (includeDetails != null) {
|
|
714
651
|
_queryParams.includeDetails = includeDetails.toString();
|
|
715
652
|
}
|
|
716
|
-
const
|
|
653
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
654
|
+
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)({
|
|
655
|
+
idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined,
|
|
656
|
+
validationCode: validationCode != null ? validationCode : undefined,
|
|
657
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
717
658
|
const _response = yield core.fetcher({
|
|
718
659
|
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, "MoneyIn/getpaid"),
|
|
719
660
|
method: "POST",
|
|
@@ -749,34 +690,20 @@ class MoneyIn {
|
|
|
749
690
|
});
|
|
750
691
|
}
|
|
751
692
|
}
|
|
752
|
-
|
|
753
|
-
case "non-json":
|
|
754
|
-
throw new errors.PayabliError({
|
|
755
|
-
statusCode: _response.error.statusCode,
|
|
756
|
-
body: _response.error.rawBody,
|
|
757
|
-
rawResponse: _response.rawResponse,
|
|
758
|
-
});
|
|
759
|
-
case "timeout":
|
|
760
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/getpaid.");
|
|
761
|
-
case "unknown":
|
|
762
|
-
throw new errors.PayabliError({
|
|
763
|
-
message: _response.error.errorMessage,
|
|
764
|
-
rawResponse: _response.rawResponse,
|
|
765
|
-
});
|
|
766
|
-
}
|
|
693
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/MoneyIn/getpaid");
|
|
767
694
|
});
|
|
768
695
|
}
|
|
769
696
|
/**
|
|
770
697
|
* A reversal either refunds or voids a transaction independent of the transaction's settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it's a refund or void. You don't need to know whether the transaction is settled or not.
|
|
771
698
|
*
|
|
699
|
+
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
772
700
|
* @param {number} amount -
|
|
773
701
|
* Amount to reverse from original transaction, minus any service fees charged on the original transaction.
|
|
774
702
|
*
|
|
775
703
|
* The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was $90 plus a $10 service fee, you can reverse up to $90.
|
|
776
704
|
*
|
|
777
705
|
* An amount equal to zero will refunds the total amount authorized minus any service fee.
|
|
778
|
-
* @param {
|
|
779
|
-
* @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration.
|
|
706
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
780
707
|
*
|
|
781
708
|
* @throws {@link Payabli.BadRequestError}
|
|
782
709
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -784,18 +711,19 @@ class MoneyIn {
|
|
|
784
711
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
785
712
|
*
|
|
786
713
|
* @example
|
|
787
|
-
* await client.moneyIn.reverse(
|
|
714
|
+
* await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0)
|
|
788
715
|
*
|
|
789
716
|
* @example
|
|
790
|
-
* await client.moneyIn.reverse(
|
|
717
|
+
* await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 53.76)
|
|
791
718
|
*/
|
|
792
|
-
reverse(
|
|
793
|
-
return core.HttpResponsePromise.fromPromise(this.__reverse(
|
|
719
|
+
reverse(transId, amount, requestOptions) {
|
|
720
|
+
return core.HttpResponsePromise.fromPromise(this.__reverse(transId, amount, requestOptions));
|
|
794
721
|
}
|
|
795
|
-
__reverse(
|
|
722
|
+
__reverse(transId, amount, requestOptions) {
|
|
796
723
|
return __awaiter(this, void 0, void 0, function* () {
|
|
797
724
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
798
|
-
const
|
|
725
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
726
|
+
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);
|
|
799
727
|
const _response = yield core.fetcher({
|
|
800
728
|
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, `MoneyIn/reverse/${core.url.encodePathParam(transId)}/${core.url.encodePathParam(amount)}`),
|
|
801
729
|
method: "GET",
|
|
@@ -828,34 +756,20 @@ class MoneyIn {
|
|
|
828
756
|
});
|
|
829
757
|
}
|
|
830
758
|
}
|
|
831
|
-
|
|
832
|
-
case "non-json":
|
|
833
|
-
throw new errors.PayabliError({
|
|
834
|
-
statusCode: _response.error.statusCode,
|
|
835
|
-
body: _response.error.rawBody,
|
|
836
|
-
rawResponse: _response.rawResponse,
|
|
837
|
-
});
|
|
838
|
-
case "timeout":
|
|
839
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/reverse/{transId}/{amount}.");
|
|
840
|
-
case "unknown":
|
|
841
|
-
throw new errors.PayabliError({
|
|
842
|
-
message: _response.error.errorMessage,
|
|
843
|
-
rawResponse: _response.rawResponse,
|
|
844
|
-
});
|
|
845
|
-
}
|
|
759
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/MoneyIn/reverse/{transId}/{amount}");
|
|
846
760
|
});
|
|
847
761
|
}
|
|
848
762
|
/**
|
|
849
763
|
* Refund a transaction that has settled and send money back to the account holder. If a transaction hasn't been settled, void it instead.
|
|
850
764
|
*
|
|
765
|
+
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
851
766
|
* @param {number} amount -
|
|
852
767
|
* Amount to refund from original transaction, minus any service fees charged on the original transaction.
|
|
853
768
|
*
|
|
854
769
|
* The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was \$90 plus a \$10 service fee, you can refund up to \$90.
|
|
855
770
|
*
|
|
856
771
|
* An amount equal to zero will refund the total amount authorized minus any service fee.
|
|
857
|
-
* @param {
|
|
858
|
-
* @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration.
|
|
772
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
859
773
|
*
|
|
860
774
|
* @throws {@link Payabli.BadRequestError}
|
|
861
775
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -863,18 +777,19 @@ class MoneyIn {
|
|
|
863
777
|
* @throws {@link Payabli.ServiceUnavailableError}
|
|
864
778
|
*
|
|
865
779
|
* @example
|
|
866
|
-
* await client.moneyIn.refund(
|
|
780
|
+
* await client.moneyIn.refund("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0)
|
|
867
781
|
*
|
|
868
782
|
* @example
|
|
869
|
-
* await client.moneyIn.refund(
|
|
783
|
+
* await client.moneyIn.refund("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 100.99)
|
|
870
784
|
*/
|
|
871
|
-
refund(
|
|
872
|
-
return core.HttpResponsePromise.fromPromise(this.__refund(
|
|
785
|
+
refund(transId, amount, requestOptions) {
|
|
786
|
+
return core.HttpResponsePromise.fromPromise(this.__refund(transId, amount, requestOptions));
|
|
873
787
|
}
|
|
874
|
-
__refund(
|
|
788
|
+
__refund(transId, amount, requestOptions) {
|
|
875
789
|
return __awaiter(this, void 0, void 0, function* () {
|
|
876
790
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
877
|
-
const
|
|
791
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
792
|
+
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);
|
|
878
793
|
const _response = yield core.fetcher({
|
|
879
794
|
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, `MoneyIn/refund/${core.url.encodePathParam(transId)}/${core.url.encodePathParam(amount)}`),
|
|
880
795
|
method: "GET",
|
|
@@ -907,21 +822,7 @@ class MoneyIn {
|
|
|
907
822
|
});
|
|
908
823
|
}
|
|
909
824
|
}
|
|
910
|
-
|
|
911
|
-
case "non-json":
|
|
912
|
-
throw new errors.PayabliError({
|
|
913
|
-
statusCode: _response.error.statusCode,
|
|
914
|
-
body: _response.error.rawBody,
|
|
915
|
-
rawResponse: _response.rawResponse,
|
|
916
|
-
});
|
|
917
|
-
case "timeout":
|
|
918
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/refund/{transId}/{amount}.");
|
|
919
|
-
case "unknown":
|
|
920
|
-
throw new errors.PayabliError({
|
|
921
|
-
message: _response.error.errorMessage,
|
|
922
|
-
rawResponse: _response.rawResponse,
|
|
923
|
-
});
|
|
924
|
-
}
|
|
825
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/MoneyIn/refund/{transId}/{amount}");
|
|
925
826
|
});
|
|
926
827
|
}
|
|
927
828
|
/**
|
|
@@ -929,7 +830,7 @@ class MoneyIn {
|
|
|
929
830
|
*
|
|
930
831
|
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
931
832
|
* @param {Payabli.RequestRefund} request
|
|
932
|
-
* @param {
|
|
833
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
933
834
|
*
|
|
934
835
|
* @throws {@link Payabli.BadRequestError}
|
|
935
836
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -985,7 +886,8 @@ class MoneyIn {
|
|
|
985
886
|
return __awaiter(this, arguments, void 0, function* (transId, request = {}, requestOptions) {
|
|
986
887
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
987
888
|
const { idempotencyKey } = request, _body = __rest(request, ["idempotencyKey"]);
|
|
988
|
-
const
|
|
889
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
890
|
+
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);
|
|
989
891
|
const _response = yield core.fetcher({
|
|
990
892
|
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, `MoneyIn/refund/${core.url.encodePathParam(transId)}`),
|
|
991
893
|
method: "POST",
|
|
@@ -1024,28 +926,14 @@ class MoneyIn {
|
|
|
1024
926
|
});
|
|
1025
927
|
}
|
|
1026
928
|
}
|
|
1027
|
-
|
|
1028
|
-
case "non-json":
|
|
1029
|
-
throw new errors.PayabliError({
|
|
1030
|
-
statusCode: _response.error.statusCode,
|
|
1031
|
-
body: _response.error.rawBody,
|
|
1032
|
-
rawResponse: _response.rawResponse,
|
|
1033
|
-
});
|
|
1034
|
-
case "timeout":
|
|
1035
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/refund/{transId}.");
|
|
1036
|
-
case "unknown":
|
|
1037
|
-
throw new errors.PayabliError({
|
|
1038
|
-
message: _response.error.errorMessage,
|
|
1039
|
-
rawResponse: _response.rawResponse,
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
929
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/MoneyIn/refund/{transId}");
|
|
1042
930
|
});
|
|
1043
931
|
}
|
|
1044
932
|
/**
|
|
1045
933
|
* Reverse microdeposits that are used to verify customer account ownership and access. The `transId` value is returned in the success response for the original credit transaction made with `api/MoneyIn/makecredit`.
|
|
1046
934
|
*
|
|
1047
935
|
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
1048
|
-
* @param {
|
|
936
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1049
937
|
*
|
|
1050
938
|
* @throws {@link Payabli.BadRequestError}
|
|
1051
939
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -1061,7 +949,8 @@ class MoneyIn {
|
|
|
1061
949
|
__reverseCredit(transId, requestOptions) {
|
|
1062
950
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1063
951
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1064
|
-
const
|
|
952
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
953
|
+
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);
|
|
1065
954
|
const _response = yield core.fetcher({
|
|
1066
955
|
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, `MoneyIn/reverseCredit/${core.url.encodePathParam(transId)}`),
|
|
1067
956
|
method: "GET",
|
|
@@ -1094,21 +983,7 @@ class MoneyIn {
|
|
|
1094
983
|
});
|
|
1095
984
|
}
|
|
1096
985
|
}
|
|
1097
|
-
|
|
1098
|
-
case "non-json":
|
|
1099
|
-
throw new errors.PayabliError({
|
|
1100
|
-
statusCode: _response.error.statusCode,
|
|
1101
|
-
body: _response.error.rawBody,
|
|
1102
|
-
rawResponse: _response.rawResponse,
|
|
1103
|
-
});
|
|
1104
|
-
case "timeout":
|
|
1105
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/reverseCredit/{transId}.");
|
|
1106
|
-
case "unknown":
|
|
1107
|
-
throw new errors.PayabliError({
|
|
1108
|
-
message: _response.error.errorMessage,
|
|
1109
|
-
rawResponse: _response.rawResponse,
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
986
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/MoneyIn/reverseCredit/{transId}");
|
|
1112
987
|
});
|
|
1113
988
|
}
|
|
1114
989
|
/**
|
|
@@ -1116,7 +991,7 @@ class MoneyIn {
|
|
|
1116
991
|
*
|
|
1117
992
|
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
1118
993
|
* @param {Payabli.SendReceipt2TransRequest} request
|
|
1119
|
-
* @param {
|
|
994
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1120
995
|
*
|
|
1121
996
|
* @throws {@link Payabli.BadRequestError}
|
|
1122
997
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -1139,7 +1014,8 @@ class MoneyIn {
|
|
|
1139
1014
|
if (email != null) {
|
|
1140
1015
|
_queryParams.email = email;
|
|
1141
1016
|
}
|
|
1142
|
-
const
|
|
1017
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1018
|
+
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);
|
|
1143
1019
|
const _response = yield core.fetcher({
|
|
1144
1020
|
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, `MoneyIn/sendreceipt/${core.url.encodePathParam(transId)}`),
|
|
1145
1021
|
method: "GET",
|
|
@@ -1172,28 +1048,14 @@ class MoneyIn {
|
|
|
1172
1048
|
});
|
|
1173
1049
|
}
|
|
1174
1050
|
}
|
|
1175
|
-
|
|
1176
|
-
case "non-json":
|
|
1177
|
-
throw new errors.PayabliError({
|
|
1178
|
-
statusCode: _response.error.statusCode,
|
|
1179
|
-
body: _response.error.rawBody,
|
|
1180
|
-
rawResponse: _response.rawResponse,
|
|
1181
|
-
});
|
|
1182
|
-
case "timeout":
|
|
1183
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/sendreceipt/{transId}.");
|
|
1184
|
-
case "unknown":
|
|
1185
|
-
throw new errors.PayabliError({
|
|
1186
|
-
message: _response.error.errorMessage,
|
|
1187
|
-
rawResponse: _response.rawResponse,
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1051
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/MoneyIn/sendreceipt/{transId}");
|
|
1190
1052
|
});
|
|
1191
1053
|
}
|
|
1192
1054
|
/**
|
|
1193
1055
|
* Validates a card number without running a transaction or authorizing a charge.
|
|
1194
1056
|
*
|
|
1195
1057
|
* @param {Payabli.RequestPaymentValidate} request
|
|
1196
|
-
* @param {
|
|
1058
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1197
1059
|
*
|
|
1198
1060
|
* @throws {@link Payabli.BadRequestError}
|
|
1199
1061
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -1220,7 +1082,8 @@ class MoneyIn {
|
|
|
1220
1082
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1221
1083
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1222
1084
|
const { idempotencyKey } = request, _body = __rest(request, ["idempotencyKey"]);
|
|
1223
|
-
const
|
|
1085
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1086
|
+
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);
|
|
1224
1087
|
const _response = yield core.fetcher({
|
|
1225
1088
|
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, "MoneyIn/validate"),
|
|
1226
1089
|
method: "POST",
|
|
@@ -1256,28 +1119,14 @@ class MoneyIn {
|
|
|
1256
1119
|
});
|
|
1257
1120
|
}
|
|
1258
1121
|
}
|
|
1259
|
-
|
|
1260
|
-
case "non-json":
|
|
1261
|
-
throw new errors.PayabliError({
|
|
1262
|
-
statusCode: _response.error.statusCode,
|
|
1263
|
-
body: _response.error.rawBody,
|
|
1264
|
-
rawResponse: _response.rawResponse,
|
|
1265
|
-
});
|
|
1266
|
-
case "timeout":
|
|
1267
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/validate.");
|
|
1268
|
-
case "unknown":
|
|
1269
|
-
throw new errors.PayabliError({
|
|
1270
|
-
message: _response.error.errorMessage,
|
|
1271
|
-
rawResponse: _response.rawResponse,
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1122
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/MoneyIn/validate");
|
|
1274
1123
|
});
|
|
1275
1124
|
}
|
|
1276
1125
|
/**
|
|
1277
1126
|
* Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures. If a transaction has been settled, refund it instead.
|
|
1278
1127
|
*
|
|
1279
1128
|
* @param {string} transId - ReferenceId for the transaction (PaymentId).
|
|
1280
|
-
* @param {
|
|
1129
|
+
* @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1281
1130
|
*
|
|
1282
1131
|
* @throws {@link Payabli.BadRequestError}
|
|
1283
1132
|
* @throws {@link Payabli.UnauthorizedError}
|
|
@@ -1293,7 +1142,8 @@ class MoneyIn {
|
|
|
1293
1142
|
__void(transId, requestOptions) {
|
|
1294
1143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1295
1144
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1296
|
-
const
|
|
1145
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1146
|
+
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);
|
|
1297
1147
|
const _response = yield core.fetcher({
|
|
1298
1148
|
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, `MoneyIn/void/${core.url.encodePathParam(transId)}`),
|
|
1299
1149
|
method: "GET",
|
|
@@ -1326,28 +1176,8 @@ class MoneyIn {
|
|
|
1326
1176
|
});
|
|
1327
1177
|
}
|
|
1328
1178
|
}
|
|
1329
|
-
|
|
1330
|
-
case "non-json":
|
|
1331
|
-
throw new errors.PayabliError({
|
|
1332
|
-
statusCode: _response.error.statusCode,
|
|
1333
|
-
body: _response.error.rawBody,
|
|
1334
|
-
rawResponse: _response.rawResponse,
|
|
1335
|
-
});
|
|
1336
|
-
case "timeout":
|
|
1337
|
-
throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/void/{transId}.");
|
|
1338
|
-
case "unknown":
|
|
1339
|
-
throw new errors.PayabliError({
|
|
1340
|
-
message: _response.error.errorMessage,
|
|
1341
|
-
rawResponse: _response.rawResponse,
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
_getCustomAuthorizationHeaders() {
|
|
1347
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1348
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
1349
|
-
return { requestToken: apiKeyValue };
|
|
1179
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/MoneyIn/void/{transId}");
|
|
1350
1180
|
});
|
|
1351
1181
|
}
|
|
1352
1182
|
}
|
|
1353
|
-
exports.
|
|
1183
|
+
exports.MoneyInClient = MoneyInClient;
|
|
@@ -44,7 +44,11 @@ class CaptureError extends errors.PayabliError {
|
|
|
44
44
|
body: body,
|
|
45
45
|
rawResponse: rawResponse,
|
|
46
46
|
});
|
|
47
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
exports.CaptureError = CaptureError;
|