@payabli/sdk-node 0.0.135 → 0.0.137
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/LICENSE.md +5 -6
- package/README.md +19 -13
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +52 -42
- package/dist/cjs/api/resources/ghostCard/client/Client.d.ts +70 -0
- package/dist/cjs/api/resources/ghostCard/client/Client.js +204 -0
- package/dist/cjs/api/resources/ghostCard/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/ghostCard/client/index.js +17 -0
- package/dist/cjs/api/resources/ghostCard/client/requests/CreateGhostCardRequestBody.d.ts +54 -0
- package/dist/cjs/api/resources/ghostCard/client/requests/CreateGhostCardRequestBody.js +3 -0
- package/dist/cjs/api/resources/ghostCard/client/requests/UpdateCardRequestBody.d.ts +14 -0
- package/dist/cjs/api/resources/ghostCard/client/requests/UpdateCardRequestBody.js +3 -0
- package/dist/cjs/api/resources/ghostCard/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/ghostCard/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/ghostCard/exports.d.ts +2 -0
- package/dist/cjs/api/resources/ghostCard/exports.js +21 -0
- package/dist/cjs/api/resources/ghostCard/index.d.ts +2 -0
- package/dist/cjs/api/resources/ghostCard/index.js +18 -0
- package/dist/cjs/api/resources/ghostCard/types/CardStatus.d.ts +8 -0
- package/dist/cjs/api/resources/ghostCard/types/CardStatus.js +11 -0
- package/dist/cjs/api/resources/ghostCard/types/CreateGhostCardResponse.d.ts +17 -0
- package/dist/cjs/api/resources/ghostCard/types/CreateGhostCardResponse.js +3 -0
- package/dist/cjs/api/resources/ghostCard/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/ghostCard/types/index.js +18 -0
- package/dist/cjs/api/resources/index.d.ts +6 -0
- package/dist/cjs/api/resources/index.js +7 -1
- package/dist/cjs/api/resources/payoutSubscription/client/Client.d.ts +156 -0
- package/dist/cjs/api/resources/payoutSubscription/client/Client.js +385 -0
- package/dist/cjs/api/resources/payoutSubscription/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/payoutSubscription/client/index.js +17 -0
- package/dist/cjs/api/resources/payoutSubscription/client/requests/RequestPayoutSchedule.d.ts +67 -0
- package/dist/cjs/api/resources/payoutSubscription/client/requests/RequestPayoutSchedule.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/payoutSubscription/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/payoutSubscription/exports.d.ts +2 -0
- package/dist/cjs/api/resources/payoutSubscription/exports.js +21 -0
- package/dist/cjs/api/resources/payoutSubscription/index.d.ts +2 -0
- package/dist/cjs/api/resources/payoutSubscription/index.js +18 -0
- package/dist/cjs/api/resources/payoutSubscription/types/AddPayoutSubscriptionResponse.d.ts +20 -0
- package/dist/cjs/api/resources/payoutSubscription/types/AddPayoutSubscriptionResponse.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/DeletePayoutSubscriptionResponse.d.ts +14 -0
- package/dist/cjs/api/resources/payoutSubscription/types/DeletePayoutSubscriptionResponse.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/GetPayoutSubscriptionResponse.d.ts +151 -0
- package/dist/cjs/api/resources/payoutSubscription/types/GetPayoutSubscriptionResponse.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutPaymentDetail.d.ts +31 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutPaymentDetail.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutScheduleDetail.d.ts +9 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutScheduleDetail.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSetPause.d.ts +4 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSetPause.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecord.d.ts +195 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecord.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecordPascal.d.ts +195 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecordPascal.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSubscriptionRequestBody.d.ts +69 -0
- package/dist/cjs/api/resources/payoutSubscription/types/PayoutSubscriptionRequestBody.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/QueryPayoutSubscriptionResponse.d.ts +155 -0
- package/dist/cjs/api/resources/payoutSubscription/types/QueryPayoutSubscriptionResponse.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionBody.d.ts +9 -0
- package/dist/cjs/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionBody.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionResponse.d.ts +15 -0
- package/dist/cjs/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionResponse.js +3 -0
- package/dist/cjs/api/resources/payoutSubscription/types/index.d.ts +12 -0
- package/dist/cjs/api/resources/payoutSubscription/types/index.js +28 -0
- package/dist/cjs/api/resources/query/client/Client.d.ts +46 -6
- package/dist/cjs/api/resources/query/client/Client.js +150 -6
- package/dist/cjs/api/resources/query/client/requests/ListPayoutSubscriptionsOrgRequest.d.ts +84 -0
- package/dist/cjs/api/resources/query/client/requests/ListPayoutSubscriptionsOrgRequest.js +3 -0
- package/dist/cjs/api/resources/query/client/requests/ListPayoutSubscriptionsRequest.d.ts +84 -0
- package/dist/cjs/api/resources/query/client/requests/ListPayoutSubscriptionsRequest.js +3 -0
- package/dist/cjs/api/resources/query/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/types/Remitaddress1.d.ts +1 -1
- package/dist/cjs/api/types/Remitaddress2.d.ts +1 -1
- package/dist/cjs/api/types/Remitcity.d.ts +1 -1
- package/dist/cjs/api/types/Remitcountry.d.ts +1 -1
- package/dist/cjs/api/types/Remitstate.d.ts +1 -1
- package/dist/cjs/api/types/Remitzip.d.ts +1 -1
- package/dist/cjs/api/types/VendorData.d.ts +6 -6
- package/dist/cjs/api/types/VendorEin.d.ts +1 -1
- package/dist/cjs/api/types/VendorName1.d.ts +1 -1
- package/dist/cjs/api/types/VendorName2.d.ts +1 -1
- package/dist/cjs/api/types/VendorNumber.d.ts +1 -1
- package/dist/cjs/api/types/VendorOutData.d.ts +9 -9
- package/dist/cjs/api/types/VendorQueryRecord.d.ts +1 -1
- package/dist/cjs/api/types/Vendorstatus.d.ts +5 -3
- package/dist/cjs/core/file/file.js +3 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +10 -0
- package/dist/esm/api/resources/ghostCard/client/Client.d.mts +70 -0
- package/dist/esm/api/resources/ghostCard/client/Client.mjs +167 -0
- package/dist/esm/api/resources/ghostCard/client/index.d.mts +1 -0
- package/dist/esm/api/resources/ghostCard/client/index.mjs +1 -0
- package/dist/esm/api/resources/ghostCard/client/requests/CreateGhostCardRequestBody.d.mts +54 -0
- package/dist/esm/api/resources/ghostCard/client/requests/CreateGhostCardRequestBody.mjs +2 -0
- package/dist/esm/api/resources/ghostCard/client/requests/UpdateCardRequestBody.d.mts +14 -0
- package/dist/esm/api/resources/ghostCard/client/requests/UpdateCardRequestBody.mjs +2 -0
- package/dist/esm/api/resources/ghostCard/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/ghostCard/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/ghostCard/exports.d.mts +2 -0
- package/dist/esm/api/resources/ghostCard/exports.mjs +3 -0
- package/dist/esm/api/resources/ghostCard/index.d.mts +2 -0
- package/dist/esm/api/resources/ghostCard/index.mjs +2 -0
- package/dist/esm/api/resources/ghostCard/types/CardStatus.d.mts +8 -0
- package/dist/esm/api/resources/ghostCard/types/CardStatus.mjs +8 -0
- package/dist/esm/api/resources/ghostCard/types/CreateGhostCardResponse.d.mts +17 -0
- package/dist/esm/api/resources/ghostCard/types/CreateGhostCardResponse.mjs +2 -0
- package/dist/esm/api/resources/ghostCard/types/index.d.mts +2 -0
- package/dist/esm/api/resources/ghostCard/types/index.mjs +2 -0
- package/dist/esm/api/resources/index.d.mts +6 -0
- package/dist/esm/api/resources/index.mjs +6 -0
- package/dist/esm/api/resources/payoutSubscription/client/Client.d.mts +156 -0
- package/dist/esm/api/resources/payoutSubscription/client/Client.mjs +348 -0
- package/dist/esm/api/resources/payoutSubscription/client/index.d.mts +1 -0
- package/dist/esm/api/resources/payoutSubscription/client/index.mjs +1 -0
- package/dist/esm/api/resources/payoutSubscription/client/requests/RequestPayoutSchedule.d.mts +67 -0
- package/dist/esm/api/resources/payoutSubscription/client/requests/RequestPayoutSchedule.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/payoutSubscription/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/payoutSubscription/exports.d.mts +2 -0
- package/dist/esm/api/resources/payoutSubscription/exports.mjs +3 -0
- package/dist/esm/api/resources/payoutSubscription/index.d.mts +2 -0
- package/dist/esm/api/resources/payoutSubscription/index.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/AddPayoutSubscriptionResponse.d.mts +20 -0
- package/dist/esm/api/resources/payoutSubscription/types/AddPayoutSubscriptionResponse.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/DeletePayoutSubscriptionResponse.d.mts +14 -0
- package/dist/esm/api/resources/payoutSubscription/types/DeletePayoutSubscriptionResponse.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/GetPayoutSubscriptionResponse.d.mts +151 -0
- package/dist/esm/api/resources/payoutSubscription/types/GetPayoutSubscriptionResponse.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutPaymentDetail.d.mts +31 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutPaymentDetail.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutScheduleDetail.d.mts +9 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutScheduleDetail.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSetPause.d.mts +4 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSetPause.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecord.d.mts +195 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecord.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecordPascal.d.mts +195 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSubscriptionQueryRecordPascal.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSubscriptionRequestBody.d.mts +69 -0
- package/dist/esm/api/resources/payoutSubscription/types/PayoutSubscriptionRequestBody.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/QueryPayoutSubscriptionResponse.d.mts +155 -0
- package/dist/esm/api/resources/payoutSubscription/types/QueryPayoutSubscriptionResponse.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionBody.d.mts +9 -0
- package/dist/esm/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionBody.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionResponse.d.mts +15 -0
- package/dist/esm/api/resources/payoutSubscription/types/UpdatePayoutSubscriptionResponse.mjs +2 -0
- package/dist/esm/api/resources/payoutSubscription/types/index.d.mts +12 -0
- package/dist/esm/api/resources/payoutSubscription/types/index.mjs +12 -0
- package/dist/esm/api/resources/query/client/Client.d.mts +46 -6
- package/dist/esm/api/resources/query/client/Client.mjs +150 -6
- package/dist/esm/api/resources/query/client/requests/ListPayoutSubscriptionsOrgRequest.d.mts +84 -0
- package/dist/esm/api/resources/query/client/requests/ListPayoutSubscriptionsOrgRequest.mjs +2 -0
- package/dist/esm/api/resources/query/client/requests/ListPayoutSubscriptionsRequest.d.mts +84 -0
- package/dist/esm/api/resources/query/client/requests/ListPayoutSubscriptionsRequest.mjs +2 -0
- package/dist/esm/api/resources/query/client/requests/index.d.mts +2 -0
- package/dist/esm/api/types/Remitaddress1.d.mts +1 -1
- package/dist/esm/api/types/Remitaddress2.d.mts +1 -1
- package/dist/esm/api/types/Remitcity.d.mts +1 -1
- package/dist/esm/api/types/Remitcountry.d.mts +1 -1
- package/dist/esm/api/types/Remitstate.d.mts +1 -1
- package/dist/esm/api/types/Remitzip.d.mts +1 -1
- package/dist/esm/api/types/VendorData.d.mts +6 -6
- package/dist/esm/api/types/VendorEin.d.mts +1 -1
- package/dist/esm/api/types/VendorName1.d.mts +1 -1
- package/dist/esm/api/types/VendorName2.d.mts +1 -1
- package/dist/esm/api/types/VendorNumber.d.mts +1 -1
- package/dist/esm/api/types/VendorOutData.d.mts +9 -9
- package/dist/esm/api/types/VendorQueryRecord.d.mts +1 -1
- package/dist/esm/api/types/Vendorstatus.d.mts +5 -3
- package/dist/esm/core/file/file.mjs +3 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +29 -7
- package/reference.md +685 -78
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as Payabli from "../../../index.mjs";
|
|
18
|
+
export class GhostCardClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates a ghost card, a multi-use virtual debit card issued to a vendor for recurring or discretionary spend.
|
|
24
|
+
*
|
|
25
|
+
* Unlike single-use virtual cards issued as part of a payout transaction, ghost cards aren't tied to a specific payout. They're issued directly to a vendor and can be reused up to a configurable number of times within the card's spending limits.
|
|
26
|
+
*
|
|
27
|
+
* Only one ghost card can exist per vendor per paypoint. To issue a new card to the same vendor, cancel the existing card first.
|
|
28
|
+
*
|
|
29
|
+
* @param {Payabli.Entry} entry
|
|
30
|
+
* @param {Payabli.CreateGhostCardRequestBody} request
|
|
31
|
+
* @param {GhostCardClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
|
+
*
|
|
33
|
+
* @throws {@link Payabli.BadRequestError}
|
|
34
|
+
* @throws {@link Payabli.UnauthorizedError}
|
|
35
|
+
* @throws {@link Payabli.InternalServerError}
|
|
36
|
+
* @throws {@link Payabli.ServiceUnavailableError}
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* await client.ghostCard.createGhostCard("8cfec2e0fa", {
|
|
40
|
+
* vendorId: 42,
|
|
41
|
+
* expenseLimit: 500,
|
|
42
|
+
* amount: 500,
|
|
43
|
+
* maxNumberOfUses: 3,
|
|
44
|
+
* exactAmount: false,
|
|
45
|
+
* expenseLimitPeriod: "monthly",
|
|
46
|
+
* billingCycle: "monthly",
|
|
47
|
+
* billingCycleDay: "1",
|
|
48
|
+
* dailyTransactionCount: 5,
|
|
49
|
+
* dailyAmountLimit: 200,
|
|
50
|
+
* transactionAmountLimit: 100,
|
|
51
|
+
* mcc: "5411",
|
|
52
|
+
* tcc: "R",
|
|
53
|
+
* misc1: "PO-98765",
|
|
54
|
+
* misc2: "Dept-Finance"
|
|
55
|
+
* })
|
|
56
|
+
*/
|
|
57
|
+
createGhostCard(entry, request, requestOptions) {
|
|
58
|
+
return core.HttpResponsePromise.fromPromise(this.__createGhostCard(entry, request, requestOptions));
|
|
59
|
+
}
|
|
60
|
+
__createGhostCard(entry, request, requestOptions) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
63
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
64
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
65
|
+
const _response = yield core.fetcher({
|
|
66
|
+
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, `MoneyOutCard/GhostCard/${core.url.encodePathParam(entry)}`),
|
|
67
|
+
method: "POST",
|
|
68
|
+
headers: _headers,
|
|
69
|
+
contentType: "application/json",
|
|
70
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
71
|
+
requestType: "json",
|
|
72
|
+
body: request,
|
|
73
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
74
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
75
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
76
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
77
|
+
logging: this._options.logging,
|
|
78
|
+
});
|
|
79
|
+
if (_response.ok) {
|
|
80
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
81
|
+
}
|
|
82
|
+
if (_response.error.reason === "status-code") {
|
|
83
|
+
switch (_response.error.statusCode) {
|
|
84
|
+
case 400:
|
|
85
|
+
throw new Payabli.BadRequestError(_response.error.body, _response.rawResponse);
|
|
86
|
+
case 401:
|
|
87
|
+
throw new Payabli.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
88
|
+
case 500:
|
|
89
|
+
throw new Payabli.InternalServerError(_response.error.body, _response.rawResponse);
|
|
90
|
+
case 503:
|
|
91
|
+
throw new Payabli.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
92
|
+
default:
|
|
93
|
+
throw new errors.PayabliError({
|
|
94
|
+
statusCode: _response.error.statusCode,
|
|
95
|
+
body: _response.error.body,
|
|
96
|
+
rawResponse: _response.rawResponse,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyOutCard/GhostCard/{entry}");
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Updates the status of a virtual card (including ghost cards) under a paypoint.
|
|
105
|
+
*
|
|
106
|
+
* @param {Payabli.Entry} entry
|
|
107
|
+
* @param {Payabli.UpdateCardRequestBody} request
|
|
108
|
+
* @param {GhostCardClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
109
|
+
*
|
|
110
|
+
* @throws {@link Payabli.BadRequestError}
|
|
111
|
+
* @throws {@link Payabli.UnauthorizedError}
|
|
112
|
+
* @throws {@link Payabli.InternalServerError}
|
|
113
|
+
* @throws {@link Payabli.ServiceUnavailableError}
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* await client.ghostCard.updateCard("8cfec2e0fa", {
|
|
117
|
+
* cardToken: "gc_abc123def456",
|
|
118
|
+
* status: "Cancelled"
|
|
119
|
+
* })
|
|
120
|
+
*/
|
|
121
|
+
updateCard(entry, request, requestOptions) {
|
|
122
|
+
return core.HttpResponsePromise.fromPromise(this.__updateCard(entry, request, requestOptions));
|
|
123
|
+
}
|
|
124
|
+
__updateCard(entry, request, requestOptions) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
127
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
128
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
129
|
+
const _response = yield core.fetcher({
|
|
130
|
+
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, `MoneyOutCard/card/${core.url.encodePathParam(entry)}`),
|
|
131
|
+
method: "PATCH",
|
|
132
|
+
headers: _headers,
|
|
133
|
+
contentType: "application/json",
|
|
134
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
135
|
+
requestType: "json",
|
|
136
|
+
body: request,
|
|
137
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
138
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
139
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
140
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
141
|
+
logging: this._options.logging,
|
|
142
|
+
});
|
|
143
|
+
if (_response.ok) {
|
|
144
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
145
|
+
}
|
|
146
|
+
if (_response.error.reason === "status-code") {
|
|
147
|
+
switch (_response.error.statusCode) {
|
|
148
|
+
case 400:
|
|
149
|
+
throw new Payabli.BadRequestError(_response.error.body, _response.rawResponse);
|
|
150
|
+
case 401:
|
|
151
|
+
throw new Payabli.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
152
|
+
case 500:
|
|
153
|
+
throw new Payabli.InternalServerError(_response.error.body, _response.rawResponse);
|
|
154
|
+
case 503:
|
|
155
|
+
throw new Payabli.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
156
|
+
default:
|
|
157
|
+
throw new errors.PayabliError({
|
|
158
|
+
statusCode: _response.error.statusCode,
|
|
159
|
+
body: _response.error.body,
|
|
160
|
+
rawResponse: _response.rawResponse,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/MoneyOutCard/card/{entry}");
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* vendorId: 42,
|
|
5
|
+
* expenseLimit: 500,
|
|
6
|
+
* amount: 500,
|
|
7
|
+
* maxNumberOfUses: 3,
|
|
8
|
+
* exactAmount: false,
|
|
9
|
+
* expenseLimitPeriod: "monthly",
|
|
10
|
+
* billingCycle: "monthly",
|
|
11
|
+
* billingCycleDay: "1",
|
|
12
|
+
* dailyTransactionCount: 5,
|
|
13
|
+
* dailyAmountLimit: 200,
|
|
14
|
+
* transactionAmountLimit: 100,
|
|
15
|
+
* mcc: "5411",
|
|
16
|
+
* tcc: "R",
|
|
17
|
+
* misc1: "PO-98765",
|
|
18
|
+
* misc2: "Dept-Finance"
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export interface CreateGhostCardRequestBody {
|
|
22
|
+
/** ID of the vendor who receives the card. The vendor must belong to the paypoint and have an active status. */
|
|
23
|
+
vendorId: number;
|
|
24
|
+
/** Spending limit for the card. Must be greater than `0` and can't exceed the paypoint's configured payout credit limit. */
|
|
25
|
+
expenseLimit: number;
|
|
26
|
+
/** Requested expiration date for the card. If not provided, defaults to 30 days from creation. */
|
|
27
|
+
expirationDate?: string;
|
|
28
|
+
/** Initial load amount for the card. */
|
|
29
|
+
amount: number;
|
|
30
|
+
/** Maximum number of times the card can be used. Ignored and set to `1` when `exactAmount` is `true`. */
|
|
31
|
+
maxNumberOfUses: number;
|
|
32
|
+
/** When `true`, restricts the card to a single use. `maxNumberOfUses` is automatically set to `1` regardless of any other value provided. */
|
|
33
|
+
exactAmount: boolean;
|
|
34
|
+
/** Time period over which `expenseLimit` applies (for example, `monthly` or `weekly`). */
|
|
35
|
+
expenseLimitPeriod: string;
|
|
36
|
+
/** Billing cycle identifier. */
|
|
37
|
+
billingCycle: string;
|
|
38
|
+
/** Day within the billing cycle. */
|
|
39
|
+
billingCycleDay: string;
|
|
40
|
+
/** Maximum number of transactions allowed per day. */
|
|
41
|
+
dailyTransactionCount: number;
|
|
42
|
+
/** Maximum total spend allowed per day. */
|
|
43
|
+
dailyAmountLimit: number;
|
|
44
|
+
/** Maximum spend allowed per single transaction. */
|
|
45
|
+
transactionAmountLimit: number;
|
|
46
|
+
/** Merchant Category Code to restrict where the card can be used. Must be a valid MCC if provided. */
|
|
47
|
+
mcc?: string;
|
|
48
|
+
/** Transaction Category Code to restrict where the card can be used. Must be a valid TCC if provided. */
|
|
49
|
+
tcc?: string;
|
|
50
|
+
/** Custom metadata field. Stored on the card record. */
|
|
51
|
+
misc1?: string;
|
|
52
|
+
/** Custom metadata field. Stored on the card record. */
|
|
53
|
+
misc2?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as Payabli from "../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* cardToken: "gc_abc123def456",
|
|
6
|
+
* status: "Cancelled"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface UpdateCardRequestBody {
|
|
10
|
+
/** Token that uniquely identifies the card. This is the `ReferenceId` returned when the card was created. */
|
|
11
|
+
cardToken: string;
|
|
12
|
+
/** The new status to set on the card. */
|
|
13
|
+
status?: Payabli.CardStatus;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The status to set on the card. Not all transitions are valid: `Active` can change to `Inactive`, `Cancelled`, or `Expired`. `Inactive` can change to `Active`. `Expired` can change to `Active` (renews the card). `Cancelled` is terminal and can't be changed. */
|
|
2
|
+
export declare const CardStatus: {
|
|
3
|
+
readonly Active: "Active";
|
|
4
|
+
readonly Inactive: "Inactive";
|
|
5
|
+
readonly Cancelled: "Cancelled";
|
|
6
|
+
readonly Expired: "Expired";
|
|
7
|
+
};
|
|
8
|
+
export type CardStatus = (typeof CardStatus)[keyof typeof CardStatus];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
/** The status to set on the card. Not all transitions are valid: `Active` can change to `Inactive`, `Cancelled`, or `Expired`. `Inactive` can change to `Active`. `Expired` can change to `Active` (renews the card). `Cancelled` is terminal and can't be changed. */
|
|
3
|
+
export const CardStatus = {
|
|
4
|
+
Active: "Active",
|
|
5
|
+
Inactive: "Inactive",
|
|
6
|
+
Cancelled: "Cancelled",
|
|
7
|
+
Expired: "Expired",
|
|
8
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as Payabli from "../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Response for creating a ghost card.
|
|
4
|
+
*/
|
|
5
|
+
export interface CreateGhostCardResponse {
|
|
6
|
+
isSuccess?: Payabli.IsSuccess | undefined;
|
|
7
|
+
responseText: Payabli.ResponseText;
|
|
8
|
+
responseData?: CreateGhostCardResponse.ResponseData | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace CreateGhostCardResponse {
|
|
11
|
+
interface ResponseData {
|
|
12
|
+
/** Card token for the ghost card. Use this value to reference the card in subsequent operations (update, cancel, etc.). */
|
|
13
|
+
ReferenceId?: string | undefined;
|
|
14
|
+
ResultCode?: Payabli.ResultCode | undefined;
|
|
15
|
+
ResultText?: Payabli.Resulttext | undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -18,6 +18,9 @@ export * as customer from "./customer/index.mjs";
|
|
|
18
18
|
export * from "./export/client/requests/index.mjs";
|
|
19
19
|
export * as export_ from "./export/index.mjs";
|
|
20
20
|
export * from "./export/types/index.mjs";
|
|
21
|
+
export * from "./ghostCard/client/requests/index.mjs";
|
|
22
|
+
export * as ghostCard from "./ghostCard/index.mjs";
|
|
23
|
+
export * from "./ghostCard/types/index.mjs";
|
|
21
24
|
export * from "./hostedPaymentPages/client/requests/index.mjs";
|
|
22
25
|
export * as hostedPaymentPages from "./hostedPaymentPages/index.mjs";
|
|
23
26
|
export * from "./import/client/requests/index.mjs";
|
|
@@ -52,6 +55,9 @@ export * from "./paymentLink/types/index.mjs";
|
|
|
52
55
|
export * from "./paymentMethodDomain/client/requests/index.mjs";
|
|
53
56
|
export * as paymentMethodDomain from "./paymentMethodDomain/index.mjs";
|
|
54
57
|
export * from "./paymentMethodDomain/types/index.mjs";
|
|
58
|
+
export * from "./payoutSubscription/client/requests/index.mjs";
|
|
59
|
+
export * as payoutSubscription from "./payoutSubscription/index.mjs";
|
|
60
|
+
export * from "./payoutSubscription/types/index.mjs";
|
|
55
61
|
export * from "./paypoint/client/requests/index.mjs";
|
|
56
62
|
export * as paypoint from "./paypoint/index.mjs";
|
|
57
63
|
export * from "./paypoint/types/index.mjs";
|
|
@@ -18,6 +18,9 @@ export * as customer from "./customer/index.mjs";
|
|
|
18
18
|
export * from "./export/client/requests/index.mjs";
|
|
19
19
|
export * as export_ from "./export/index.mjs";
|
|
20
20
|
export * from "./export/types/index.mjs";
|
|
21
|
+
export * from "./ghostCard/client/requests/index.mjs";
|
|
22
|
+
export * as ghostCard from "./ghostCard/index.mjs";
|
|
23
|
+
export * from "./ghostCard/types/index.mjs";
|
|
21
24
|
export * from "./hostedPaymentPages/client/requests/index.mjs";
|
|
22
25
|
export * as hostedPaymentPages from "./hostedPaymentPages/index.mjs";
|
|
23
26
|
export * from "./import/client/requests/index.mjs";
|
|
@@ -52,6 +55,9 @@ export * from "./paymentLink/types/index.mjs";
|
|
|
52
55
|
export * from "./paymentMethodDomain/client/requests/index.mjs";
|
|
53
56
|
export * as paymentMethodDomain from "./paymentMethodDomain/index.mjs";
|
|
54
57
|
export * from "./paymentMethodDomain/types/index.mjs";
|
|
58
|
+
export * from "./payoutSubscription/client/requests/index.mjs";
|
|
59
|
+
export * as payoutSubscription from "./payoutSubscription/index.mjs";
|
|
60
|
+
export * from "./payoutSubscription/types/index.mjs";
|
|
55
61
|
export * from "./paypoint/client/requests/index.mjs";
|
|
56
62
|
export * as paypoint from "./paypoint/index.mjs";
|
|
57
63
|
export * from "./paypoint/types/index.mjs";
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as Payabli from "../../../index.mjs";
|
|
5
|
+
export declare namespace PayoutSubscriptionClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class PayoutSubscriptionClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<PayoutSubscriptionClient.Options>;
|
|
12
|
+
constructor(options?: PayoutSubscriptionClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Creates a payout subscription to automatically send payouts to a vendor on a recurring schedule. See [Manage payout subscriptions](/guides/pay-out-developer-payout-subscriptions-manage) for a step-by-step guide.
|
|
15
|
+
*
|
|
16
|
+
* @param {Payabli.RequestPayoutSchedule} request
|
|
17
|
+
* @param {PayoutSubscriptionClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link Payabli.BadRequestError}
|
|
20
|
+
* @throws {@link Payabli.UnauthorizedError}
|
|
21
|
+
* @throws {@link Payabli.InternalServerError}
|
|
22
|
+
* @throws {@link Payabli.ServiceUnavailableError}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* await client.payoutSubscription.createPayoutSubscription({
|
|
26
|
+
* body: {
|
|
27
|
+
* entryPoint: "d193cf9a46",
|
|
28
|
+
* paymentMethod: {
|
|
29
|
+
* method: "ach",
|
|
30
|
+
* achHolder: "Herman Coatings",
|
|
31
|
+
* achRouting: "021000021",
|
|
32
|
+
* achAccount: "3453445666",
|
|
33
|
+
* achAccountType: "checking"
|
|
34
|
+
* },
|
|
35
|
+
* paymentDetails: {
|
|
36
|
+
* totalAmount: 500,
|
|
37
|
+
* serviceFee: 0,
|
|
38
|
+
* currency: "USD"
|
|
39
|
+
* },
|
|
40
|
+
* vendorData: {
|
|
41
|
+
* vendorId: 1501
|
|
42
|
+
* },
|
|
43
|
+
* billData: [{
|
|
44
|
+
* invoiceNumber: "INV-5001",
|
|
45
|
+
* netAmount: "500",
|
|
46
|
+
* invoiceDate: "2025-08-01",
|
|
47
|
+
* dueDate: "2025-08-15"
|
|
48
|
+
* }],
|
|
49
|
+
* scheduleDetails: {
|
|
50
|
+
* startDate: "09/01/2025",
|
|
51
|
+
* endDate: "09/01/2026",
|
|
52
|
+
* frequency: "monthly"
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* })
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* await client.payoutSubscription.createPayoutSubscription({
|
|
59
|
+
* body: {
|
|
60
|
+
* entryPoint: "d193cf9a46",
|
|
61
|
+
* paymentMethod: {
|
|
62
|
+
* method: "vcard"
|
|
63
|
+
* },
|
|
64
|
+
* paymentDetails: {
|
|
65
|
+
* totalAmount: 250,
|
|
66
|
+
* serviceFee: 0
|
|
67
|
+
* },
|
|
68
|
+
* vendorData: {
|
|
69
|
+
* vendorId: 1501
|
|
70
|
+
* },
|
|
71
|
+
* billData: [{
|
|
72
|
+
* invoiceNumber: "INV-7820",
|
|
73
|
+
* netAmount: "250",
|
|
74
|
+
* invoiceDate: "2025-08-15",
|
|
75
|
+
* dueDate: "2025-09-01"
|
|
76
|
+
* }],
|
|
77
|
+
* scheduleDetails: {
|
|
78
|
+
* startDate: "09/01/2025",
|
|
79
|
+
* frequency: "weekly",
|
|
80
|
+
* endDate: "untilcancelled"
|
|
81
|
+
* }
|
|
82
|
+
* }
|
|
83
|
+
* })
|
|
84
|
+
*/
|
|
85
|
+
createPayoutSubscription(request: Payabli.RequestPayoutSchedule, requestOptions?: PayoutSubscriptionClient.RequestOptions): core.HttpResponsePromise<Payabli.AddPayoutSubscriptionResponse>;
|
|
86
|
+
private __createPayoutSubscription;
|
|
87
|
+
/**
|
|
88
|
+
* Retrieves a single payout subscription's details. See [Manage payout subscriptions](/guides/pay-out-developer-payout-subscriptions-manage) for more information.
|
|
89
|
+
*
|
|
90
|
+
* @param {number} id - The payout subscription ID.
|
|
91
|
+
* @param {PayoutSubscriptionClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
92
|
+
*
|
|
93
|
+
* @throws {@link Payabli.BadRequestError}
|
|
94
|
+
* @throws {@link Payabli.UnauthorizedError}
|
|
95
|
+
* @throws {@link Payabli.InternalServerError}
|
|
96
|
+
* @throws {@link Payabli.ServiceUnavailableError}
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* await client.payoutSubscription.getPayoutSubscription(42)
|
|
100
|
+
*/
|
|
101
|
+
getPayoutSubscription(id: number, requestOptions?: PayoutSubscriptionClient.RequestOptions): core.HttpResponsePromise<Payabli.GetPayoutSubscriptionResponse>;
|
|
102
|
+
private __getPayoutSubscription;
|
|
103
|
+
/**
|
|
104
|
+
* Updates a payout subscription's details. See [Manage payout subscriptions](/guides/pay-out-developer-payout-subscriptions-manage) for more information.
|
|
105
|
+
*
|
|
106
|
+
* @param {number} id - The payout subscription ID.
|
|
107
|
+
* @param {Payabli.UpdatePayoutSubscriptionBody} request
|
|
108
|
+
* @param {PayoutSubscriptionClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
109
|
+
*
|
|
110
|
+
* @throws {@link Payabli.BadRequestError}
|
|
111
|
+
* @throws {@link Payabli.UnauthorizedError}
|
|
112
|
+
* @throws {@link Payabli.InternalServerError}
|
|
113
|
+
* @throws {@link Payabli.ServiceUnavailableError}
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* await client.payoutSubscription.updatePayoutSubscription(42, {
|
|
117
|
+
* setPause: true
|
|
118
|
+
* })
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* await client.payoutSubscription.updatePayoutSubscription(42, {
|
|
122
|
+
* setPause: false
|
|
123
|
+
* })
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* await client.payoutSubscription.updatePayoutSubscription(42, {
|
|
127
|
+
* paymentDetails: {
|
|
128
|
+
* serviceFee: 0,
|
|
129
|
+
* totalAmount: 750
|
|
130
|
+
* },
|
|
131
|
+
* scheduleDetails: {
|
|
132
|
+
* endDate: "12/31/2026",
|
|
133
|
+
* frequency: "monthly",
|
|
134
|
+
* startDate: "01/01/2026"
|
|
135
|
+
* }
|
|
136
|
+
* })
|
|
137
|
+
*/
|
|
138
|
+
updatePayoutSubscription(id: number, request: Payabli.UpdatePayoutSubscriptionBody, requestOptions?: PayoutSubscriptionClient.RequestOptions): core.HttpResponsePromise<Payabli.UpdatePayoutSubscriptionResponse>;
|
|
139
|
+
private __updatePayoutSubscription;
|
|
140
|
+
/**
|
|
141
|
+
* Deletes a payout subscription and prevents future payouts. See [Manage payout subscriptions](/guides/pay-out-developer-payout-subscriptions-manage) for more information.
|
|
142
|
+
*
|
|
143
|
+
* @param {number} id - The payout subscription ID.
|
|
144
|
+
* @param {PayoutSubscriptionClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
145
|
+
*
|
|
146
|
+
* @throws {@link Payabli.BadRequestError}
|
|
147
|
+
* @throws {@link Payabli.UnauthorizedError}
|
|
148
|
+
* @throws {@link Payabli.InternalServerError}
|
|
149
|
+
* @throws {@link Payabli.ServiceUnavailableError}
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* await client.payoutSubscription.deletePayoutSubscription(42)
|
|
153
|
+
*/
|
|
154
|
+
deletePayoutSubscription(id: number, requestOptions?: PayoutSubscriptionClient.RequestOptions): core.HttpResponsePromise<Payabli.DeletePayoutSubscriptionResponse>;
|
|
155
|
+
private __deletePayoutSubscription;
|
|
156
|
+
}
|