@paid-ai/paid-node 1.1.0 → 1.2.1
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 +2 -0
- package/dist/cjs/Client.d.ts +12 -0
- package/dist/cjs/Client.js +34 -14
- package/dist/cjs/api/resources/checkouts/client/Client.d.ts +84 -0
- package/dist/cjs/api/resources/checkouts/client/Client.js +350 -0
- package/dist/cjs/api/resources/checkouts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/checkouts/client/index.js +17 -0
- package/dist/cjs/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.d.ts +9 -0
- package/dist/cjs/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.js +3 -0
- package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.ts +25 -0
- package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.js +3 -0
- package/dist/cjs/api/resources/checkouts/client/requests/GetCheckoutRequest.d.ts +9 -0
- package/dist/cjs/api/resources/checkouts/client/requests/GetCheckoutRequest.js +3 -0
- package/dist/cjs/api/resources/checkouts/client/requests/ListCheckoutsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/checkouts/client/requests/ListCheckoutsRequest.js +3 -0
- package/dist/cjs/api/resources/checkouts/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/checkouts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/checkouts/index.d.ts +2 -0
- package/dist/cjs/api/resources/checkouts/index.js +18 -0
- package/dist/cjs/api/resources/checkouts/types/ListCheckoutsRequestStatus.d.ts +6 -0
- package/dist/cjs/api/resources/checkouts/types/ListCheckoutsRequestStatus.js +9 -0
- package/dist/cjs/api/resources/checkouts/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/checkouts/types/index.js +17 -0
- package/dist/cjs/api/resources/credits/client/Client.d.ts +27 -0
- package/dist/cjs/api/resources/credits/client/Client.js +123 -0
- package/dist/cjs/api/resources/credits/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/credits/client/index.js +2 -0
- package/dist/cjs/api/resources/credits/index.d.ts +1 -0
- package/dist/cjs/api/resources/credits/index.js +17 -0
- package/dist/cjs/api/resources/customerPortals/client/Client.d.ts +30 -0
- package/dist/cjs/api/resources/customerPortals/client/Client.js +133 -0
- package/dist/cjs/api/resources/customerPortals/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/customerPortals/client/index.js +17 -0
- package/dist/cjs/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.js +3 -0
- package/dist/cjs/api/resources/customerPortals/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/customerPortals/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/customerPortals/index.d.ts +1 -0
- package/dist/cjs/api/resources/customerPortals/index.js +17 -0
- package/dist/cjs/api/resources/customers/client/Client.d.ts +36 -0
- package/dist/cjs/api/resources/customers/client/Client.js +142 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.d.ts +8 -0
- package/dist/cjs/api/resources/index.js +9 -1
- package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +11 -7
- package/dist/cjs/api/resources/orders/client/requests/UpdateOrderRequest.d.ts +10 -7
- package/dist/cjs/api/resources/valueReceipts/client/Client.d.ts +75 -0
- package/dist/cjs/api/resources/valueReceipts/client/Client.js +347 -0
- package/dist/cjs/api/resources/valueReceipts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/valueReceipts/client/index.js +17 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.ts +10 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.ts +9 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/valueReceipts/index.d.ts +1 -0
- package/dist/cjs/api/resources/valueReceipts/index.js +17 -0
- package/dist/cjs/api/types/Checkout.d.ts +19 -0
- package/dist/cjs/api/types/Checkout.js +3 -0
- package/dist/cjs/api/types/CheckoutListResponse.d.ts +5 -0
- package/dist/cjs/api/types/CheckoutListResponse.js +3 -0
- package/dist/cjs/api/types/CheckoutProduct.d.ts +3 -0
- package/dist/cjs/api/types/CheckoutProduct.js +3 -0
- package/dist/cjs/api/types/CheckoutProductInput.d.ts +3 -0
- package/dist/cjs/api/types/CheckoutProductInput.js +3 -0
- package/dist/cjs/api/types/CheckoutStatus.d.ts +7 -0
- package/dist/cjs/api/types/CheckoutStatus.js +10 -0
- package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +116 -1
- package/dist/cjs/api/types/CreateOrderLineAttributeRequest.js +70 -0
- package/dist/cjs/api/types/CreateOrderLineRequest.d.ts +3 -3
- package/dist/cjs/api/types/CreditBalance.d.ts +19 -0
- package/dist/cjs/api/types/CreditBalance.js +11 -0
- package/dist/cjs/api/types/CreditBalanceListResponse.d.ts +4 -0
- package/dist/cjs/api/types/CreditBalanceListResponse.js +3 -0
- package/dist/cjs/api/types/CreditCurrency.d.ts +9 -0
- package/dist/cjs/api/types/CreditCurrency.js +3 -0
- package/dist/cjs/api/types/CreditCurrencyListResponse.d.ts +4 -0
- package/dist/cjs/api/types/CreditCurrencyListResponse.js +3 -0
- package/dist/cjs/api/types/CustomerPortal.d.ts +10 -0
- package/dist/cjs/api/types/CustomerPortal.js +3 -0
- package/dist/cjs/api/types/CustomerPortalStatus.d.ts +5 -0
- package/dist/cjs/api/types/CustomerPortalStatus.js +8 -0
- package/dist/cjs/api/types/Order.d.ts +3 -0
- package/dist/cjs/api/types/ValueReceiptDetail.d.ts +19 -0
- package/dist/cjs/api/types/ValueReceiptDetail.js +3 -0
- package/dist/cjs/api/types/ValueReceiptListResponse.d.ts +5 -0
- package/dist/cjs/api/types/ValueReceiptListResponse.js +3 -0
- package/dist/cjs/api/types/ValueReceiptSummary.d.ts +16 -0
- package/dist/cjs/api/types/ValueReceiptSummary.js +3 -0
- package/dist/cjs/api/types/index.d.ts +14 -0
- package/dist/cjs/api/types/index.js +14 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +12 -0
- package/dist/esm/Client.mjs +22 -2
- package/dist/esm/api/resources/checkouts/client/Client.d.mts +84 -0
- package/dist/esm/api/resources/checkouts/client/Client.mjs +313 -0
- package/dist/esm/api/resources/checkouts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/checkouts/client/index.mjs +1 -0
- package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.d.mts +9 -0
- package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.mjs +2 -0
- package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +25 -0
- package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.mjs +2 -0
- package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.d.mts +9 -0
- package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.mjs +2 -0
- package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.d.mts +10 -0
- package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.mjs +2 -0
- package/dist/esm/api/resources/checkouts/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/checkouts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/checkouts/index.d.mts +2 -0
- package/dist/esm/api/resources/checkouts/index.mjs +2 -0
- package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.d.mts +6 -0
- package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.mjs +6 -0
- package/dist/esm/api/resources/checkouts/types/index.d.mts +1 -0
- package/dist/esm/api/resources/checkouts/types/index.mjs +1 -0
- package/dist/esm/api/resources/credits/client/Client.d.mts +27 -0
- package/dist/esm/api/resources/credits/client/Client.mjs +86 -0
- package/dist/esm/api/resources/credits/client/index.d.mts +1 -0
- package/dist/esm/api/resources/credits/client/index.mjs +1 -0
- package/dist/esm/api/resources/credits/index.d.mts +1 -0
- package/dist/esm/api/resources/credits/index.mjs +1 -0
- package/dist/esm/api/resources/customerPortals/client/Client.d.mts +30 -0
- package/dist/esm/api/resources/customerPortals/client/Client.mjs +96 -0
- package/dist/esm/api/resources/customerPortals/client/index.d.mts +1 -0
- package/dist/esm/api/resources/customerPortals/client/index.mjs +1 -0
- package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.d.mts +12 -0
- package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.mjs +2 -0
- package/dist/esm/api/resources/customerPortals/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/customerPortals/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/customerPortals/index.d.mts +1 -0
- package/dist/esm/api/resources/customerPortals/index.mjs +1 -0
- package/dist/esm/api/resources/customers/client/Client.d.mts +36 -0
- package/dist/esm/api/resources/customers/client/Client.mjs +142 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.d.mts +9 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/index.d.mts +8 -0
- package/dist/esm/api/resources/index.mjs +8 -0
- package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +11 -7
- package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.d.mts +10 -7
- package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +75 -0
- package/dist/esm/api/resources/valueReceipts/client/Client.mjs +310 -0
- package/dist/esm/api/resources/valueReceipts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/valueReceipts/client/index.mjs +1 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.mts +10 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.mts +10 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.mts +9 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/valueReceipts/index.d.mts +1 -0
- package/dist/esm/api/resources/valueReceipts/index.mjs +1 -0
- package/dist/esm/api/types/Checkout.d.mts +19 -0
- package/dist/esm/api/types/Checkout.mjs +2 -0
- package/dist/esm/api/types/CheckoutListResponse.d.mts +5 -0
- package/dist/esm/api/types/CheckoutListResponse.mjs +2 -0
- package/dist/esm/api/types/CheckoutProduct.d.mts +3 -0
- package/dist/esm/api/types/CheckoutProduct.mjs +2 -0
- package/dist/esm/api/types/CheckoutProductInput.d.mts +3 -0
- package/dist/esm/api/types/CheckoutProductInput.mjs +2 -0
- package/dist/esm/api/types/CheckoutStatus.d.mts +7 -0
- package/dist/esm/api/types/CheckoutStatus.mjs +7 -0
- package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +116 -1
- package/dist/esm/api/types/CreateOrderLineAttributeRequest.mjs +69 -1
- package/dist/esm/api/types/CreateOrderLineRequest.d.mts +3 -3
- package/dist/esm/api/types/CreditBalance.d.mts +19 -0
- package/dist/esm/api/types/CreditBalance.mjs +8 -0
- package/dist/esm/api/types/CreditBalanceListResponse.d.mts +4 -0
- package/dist/esm/api/types/CreditBalanceListResponse.mjs +2 -0
- package/dist/esm/api/types/CreditCurrency.d.mts +9 -0
- package/dist/esm/api/types/CreditCurrency.mjs +2 -0
- package/dist/esm/api/types/CreditCurrencyListResponse.d.mts +4 -0
- package/dist/esm/api/types/CreditCurrencyListResponse.mjs +2 -0
- package/dist/esm/api/types/CustomerPortal.d.mts +10 -0
- package/dist/esm/api/types/CustomerPortal.mjs +2 -0
- package/dist/esm/api/types/CustomerPortalStatus.d.mts +5 -0
- package/dist/esm/api/types/CustomerPortalStatus.mjs +5 -0
- package/dist/esm/api/types/Order.d.mts +3 -0
- package/dist/esm/api/types/ValueReceiptDetail.d.mts +19 -0
- package/dist/esm/api/types/ValueReceiptDetail.mjs +2 -0
- package/dist/esm/api/types/ValueReceiptListResponse.d.mts +5 -0
- package/dist/esm/api/types/ValueReceiptListResponse.mjs +2 -0
- package/dist/esm/api/types/ValueReceiptSummary.d.mts +16 -0
- package/dist/esm/api/types/ValueReceiptSummary.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +14 -0
- package/dist/esm/api/types/index.mjs +14 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -3
- package/reference.md +771 -0
|
@@ -345,6 +345,7 @@ class Customers {
|
|
|
345
345
|
* @param {Paid.DeleteCustomerByIdRequest} request
|
|
346
346
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
347
347
|
*
|
|
348
|
+
* @throws {@link Paid.BadRequestError}
|
|
348
349
|
* @throws {@link Paid.ForbiddenError}
|
|
349
350
|
* @throws {@link Paid.NotFoundError}
|
|
350
351
|
* @throws {@link Paid.InternalServerError}
|
|
@@ -376,6 +377,8 @@ class Customers {
|
|
|
376
377
|
}
|
|
377
378
|
if (_response.error.reason === "status-code") {
|
|
378
379
|
switch (_response.error.statusCode) {
|
|
380
|
+
case 400:
|
|
381
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
379
382
|
case 403:
|
|
380
383
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
381
384
|
case 404:
|
|
@@ -556,6 +559,7 @@ class Customers {
|
|
|
556
559
|
* @param {Paid.DeleteCustomerByExternalIdRequest} request
|
|
557
560
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
558
561
|
*
|
|
562
|
+
* @throws {@link Paid.BadRequestError}
|
|
559
563
|
* @throws {@link Paid.ForbiddenError}
|
|
560
564
|
* @throws {@link Paid.NotFoundError}
|
|
561
565
|
* @throws {@link Paid.InternalServerError}
|
|
@@ -587,6 +591,8 @@ class Customers {
|
|
|
587
591
|
}
|
|
588
592
|
if (_response.error.reason === "status-code") {
|
|
589
593
|
switch (_response.error.statusCode) {
|
|
594
|
+
case 400:
|
|
595
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
590
596
|
case 403:
|
|
591
597
|
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
592
598
|
case 404:
|
|
@@ -618,6 +624,142 @@ class Customers {
|
|
|
618
624
|
}
|
|
619
625
|
});
|
|
620
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Get current customer credit balances grouped by currency
|
|
629
|
+
*
|
|
630
|
+
* @param {Paid.GetCustomerCreditBalancesRequest} request
|
|
631
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
632
|
+
*
|
|
633
|
+
* @throws {@link Paid.ForbiddenError}
|
|
634
|
+
* @throws {@link Paid.NotFoundError}
|
|
635
|
+
* @throws {@link Paid.InternalServerError}
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* await client.customers.getCustomerCreditBalances({
|
|
639
|
+
* id: "id"
|
|
640
|
+
* })
|
|
641
|
+
*/
|
|
642
|
+
getCustomerCreditBalances(request, requestOptions) {
|
|
643
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerCreditBalances(request, requestOptions));
|
|
644
|
+
}
|
|
645
|
+
__getCustomerCreditBalances(request, requestOptions) {
|
|
646
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
647
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
648
|
+
const { id } = request;
|
|
649
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
650
|
+
const _response = yield core.fetcher({
|
|
651
|
+
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.PaidEnvironment.Default, `customers/${core.url.encodePathParam(id)}/credits/balances`),
|
|
652
|
+
method: "GET",
|
|
653
|
+
headers: _headers,
|
|
654
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
655
|
+
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,
|
|
656
|
+
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,
|
|
657
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
658
|
+
});
|
|
659
|
+
if (_response.ok) {
|
|
660
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
661
|
+
}
|
|
662
|
+
if (_response.error.reason === "status-code") {
|
|
663
|
+
switch (_response.error.statusCode) {
|
|
664
|
+
case 403:
|
|
665
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
666
|
+
case 404:
|
|
667
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
668
|
+
case 500:
|
|
669
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
670
|
+
default:
|
|
671
|
+
throw new errors.PaidError({
|
|
672
|
+
statusCode: _response.error.statusCode,
|
|
673
|
+
body: _response.error.body,
|
|
674
|
+
rawResponse: _response.rawResponse,
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
switch (_response.error.reason) {
|
|
679
|
+
case "non-json":
|
|
680
|
+
throw new errors.PaidError({
|
|
681
|
+
statusCode: _response.error.statusCode,
|
|
682
|
+
body: _response.error.rawBody,
|
|
683
|
+
rawResponse: _response.rawResponse,
|
|
684
|
+
});
|
|
685
|
+
case "timeout":
|
|
686
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/credits/balances.");
|
|
687
|
+
case "unknown":
|
|
688
|
+
throw new errors.PaidError({
|
|
689
|
+
message: _response.error.errorMessage,
|
|
690
|
+
rawResponse: _response.rawResponse,
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Get current customer credit balances grouped by currency, looked up by external ID
|
|
697
|
+
*
|
|
698
|
+
* @param {Paid.GetCustomerCreditBalancesByExternalIdRequest} request
|
|
699
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
700
|
+
*
|
|
701
|
+
* @throws {@link Paid.ForbiddenError}
|
|
702
|
+
* @throws {@link Paid.NotFoundError}
|
|
703
|
+
* @throws {@link Paid.InternalServerError}
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* await client.customers.getCustomerCreditBalancesByExternalId({
|
|
707
|
+
* externalId: "externalId"
|
|
708
|
+
* })
|
|
709
|
+
*/
|
|
710
|
+
getCustomerCreditBalancesByExternalId(request, requestOptions) {
|
|
711
|
+
return core.HttpResponsePromise.fromPromise(this.__getCustomerCreditBalancesByExternalId(request, requestOptions));
|
|
712
|
+
}
|
|
713
|
+
__getCustomerCreditBalancesByExternalId(request, requestOptions) {
|
|
714
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
715
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
716
|
+
const { externalId } = request;
|
|
717
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
718
|
+
const _response = yield core.fetcher({
|
|
719
|
+
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.PaidEnvironment.Default, `customers/external/${core.url.encodePathParam(externalId)}/credits/balances`),
|
|
720
|
+
method: "GET",
|
|
721
|
+
headers: _headers,
|
|
722
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
723
|
+
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,
|
|
724
|
+
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,
|
|
725
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
726
|
+
});
|
|
727
|
+
if (_response.ok) {
|
|
728
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
729
|
+
}
|
|
730
|
+
if (_response.error.reason === "status-code") {
|
|
731
|
+
switch (_response.error.statusCode) {
|
|
732
|
+
case 403:
|
|
733
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
734
|
+
case 404:
|
|
735
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
736
|
+
case 500:
|
|
737
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
738
|
+
default:
|
|
739
|
+
throw new errors.PaidError({
|
|
740
|
+
statusCode: _response.error.statusCode,
|
|
741
|
+
body: _response.error.body,
|
|
742
|
+
rawResponse: _response.rawResponse,
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
switch (_response.error.reason) {
|
|
747
|
+
case "non-json":
|
|
748
|
+
throw new errors.PaidError({
|
|
749
|
+
statusCode: _response.error.statusCode,
|
|
750
|
+
body: _response.error.rawBody,
|
|
751
|
+
rawResponse: _response.rawResponse,
|
|
752
|
+
});
|
|
753
|
+
case "timeout":
|
|
754
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/credits/balances.");
|
|
755
|
+
case "unknown":
|
|
756
|
+
throw new errors.PaidError({
|
|
757
|
+
message: _response.error.errorMessage,
|
|
758
|
+
rawResponse: _response.rawResponse,
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
}
|
|
621
763
|
_getAuthorizationHeader() {
|
|
622
764
|
return __awaiter(this, void 0, void 0, function* () {
|
|
623
765
|
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
@@ -3,6 +3,8 @@ export type { DeleteCustomerByExternalIdRequest } from "./DeleteCustomerByExtern
|
|
|
3
3
|
export type { DeleteCustomerByIdRequest } from "./DeleteCustomerByIdRequest.js";
|
|
4
4
|
export type { GetCustomerByExternalIdRequest } from "./GetCustomerByExternalIdRequest.js";
|
|
5
5
|
export type { GetCustomerByIdRequest } from "./GetCustomerByIdRequest.js";
|
|
6
|
+
export type { GetCustomerCreditBalancesByExternalIdRequest } from "./GetCustomerCreditBalancesByExternalIdRequest.js";
|
|
7
|
+
export type { GetCustomerCreditBalancesRequest } from "./GetCustomerCreditBalancesRequest.js";
|
|
6
8
|
export type { ListCustomersRequest } from "./ListCustomersRequest.js";
|
|
7
9
|
export type { UpdateCustomerByExternalIdRequest } from "./UpdateCustomerByExternalIdRequest.js";
|
|
8
10
|
export type { UpdateCustomerByIdRequest } from "./UpdateCustomerByIdRequest.js";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
export * from "./checkouts/client/requests/index.js";
|
|
2
|
+
export * as checkouts from "./checkouts/index.js";
|
|
3
|
+
export * from "./checkouts/types/index.js";
|
|
1
4
|
export * from "./contacts/client/requests/index.js";
|
|
2
5
|
export * as contacts from "./contacts/index.js";
|
|
6
|
+
export * as credits from "./credits/index.js";
|
|
7
|
+
export * from "./customerPortals/client/requests/index.js";
|
|
8
|
+
export * as customerPortals from "./customerPortals/index.js";
|
|
3
9
|
export * from "./customers/client/requests/index.js";
|
|
4
10
|
export * as customers from "./customers/index.js";
|
|
5
11
|
export * from "./invoices/client/requests/index.js";
|
|
@@ -10,3 +16,5 @@ export * from "./products/client/requests/index.js";
|
|
|
10
16
|
export * as products from "./products/index.js";
|
|
11
17
|
export * from "./signals/client/requests/index.js";
|
|
12
18
|
export * as signals from "./signals/index.js";
|
|
19
|
+
export * from "./valueReceipts/client/requests/index.js";
|
|
20
|
+
export * as valueReceipts from "./valueReceipts/index.js";
|
|
@@ -36,9 +36,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.signals = exports.products = exports.orders = exports.invoices = exports.customers = exports.contacts = void 0;
|
|
39
|
+
exports.valueReceipts = exports.signals = exports.products = exports.orders = exports.invoices = exports.customers = exports.customerPortals = exports.credits = exports.contacts = exports.checkouts = void 0;
|
|
40
|
+
__exportStar(require("./checkouts/client/requests/index.js"), exports);
|
|
41
|
+
exports.checkouts = __importStar(require("./checkouts/index.js"));
|
|
42
|
+
__exportStar(require("./checkouts/types/index.js"), exports);
|
|
40
43
|
__exportStar(require("./contacts/client/requests/index.js"), exports);
|
|
41
44
|
exports.contacts = __importStar(require("./contacts/index.js"));
|
|
45
|
+
exports.credits = __importStar(require("./credits/index.js"));
|
|
46
|
+
__exportStar(require("./customerPortals/client/requests/index.js"), exports);
|
|
47
|
+
exports.customerPortals = __importStar(require("./customerPortals/index.js"));
|
|
42
48
|
__exportStar(require("./customers/client/requests/index.js"), exports);
|
|
43
49
|
exports.customers = __importStar(require("./customers/index.js"));
|
|
44
50
|
__exportStar(require("./invoices/client/requests/index.js"), exports);
|
|
@@ -49,3 +55,5 @@ __exportStar(require("./products/client/requests/index.js"), exports);
|
|
|
49
55
|
exports.products = __importStar(require("./products/index.js"));
|
|
50
56
|
__exportStar(require("./signals/client/requests/index.js"), exports);
|
|
51
57
|
exports.signals = __importStar(require("./signals/index.js"));
|
|
58
|
+
__exportStar(require("./valueReceipts/client/requests/index.js"), exports);
|
|
59
|
+
exports.valueReceipts = __importStar(require("./valueReceipts/index.js"));
|
|
@@ -7,17 +7,21 @@ import type * as Paid from "../../../../index.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export interface CreateOrderRequest {
|
|
9
9
|
customerId: string;
|
|
10
|
-
billingCustomerId?: string
|
|
10
|
+
billingCustomerId?: string;
|
|
11
11
|
billingContactIds?: string[];
|
|
12
12
|
name?: string;
|
|
13
13
|
startDate?: string;
|
|
14
|
-
endDate?: string
|
|
15
|
-
subscriptionTerms?: number
|
|
14
|
+
endDate?: string;
|
|
15
|
+
subscriptionTerms?: number;
|
|
16
16
|
creationState?: Paid.OrderCreationState;
|
|
17
17
|
/** Day of month for billing anchor (1-31). Defaults to start date day if not provided. */
|
|
18
|
-
billingAnchor?: number
|
|
19
|
-
paymentTerms?: string
|
|
20
|
-
externalId?: string
|
|
21
|
-
metadata?: Record<string, unknown
|
|
18
|
+
billingAnchor?: number;
|
|
19
|
+
paymentTerms?: string;
|
|
20
|
+
externalId?: string;
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
|
+
currency?: string;
|
|
23
|
+
autoPostInvoices?: boolean;
|
|
24
|
+
autoSendBillingEmails?: boolean;
|
|
25
|
+
autoSendPaymentEmails?: boolean;
|
|
22
26
|
lines?: Paid.CreateOrderLineRequest[];
|
|
23
27
|
}
|
|
@@ -9,14 +9,17 @@ export interface UpdateOrderRequest {
|
|
|
9
9
|
id: string;
|
|
10
10
|
name?: string;
|
|
11
11
|
startDate?: string;
|
|
12
|
-
endDate?: string
|
|
13
|
-
subscriptionTerms?: number
|
|
12
|
+
endDate?: string;
|
|
13
|
+
subscriptionTerms?: number;
|
|
14
14
|
creationState?: Paid.OrderCreationState;
|
|
15
15
|
/** Day of month for billing anchor (1-31). Defaults to start date day if not provided. */
|
|
16
|
-
billingAnchor?: number
|
|
17
|
-
paymentTerms?: string
|
|
18
|
-
externalId?: string
|
|
19
|
-
metadata?: Record<string, unknown
|
|
20
|
-
billingCustomerId?: string
|
|
16
|
+
billingAnchor?: number;
|
|
17
|
+
paymentTerms?: string;
|
|
18
|
+
externalId?: string;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
billingCustomerId?: string;
|
|
21
21
|
billingContactIds?: string[];
|
|
22
|
+
autoPostInvoices?: boolean;
|
|
23
|
+
autoSendBillingEmails?: boolean;
|
|
24
|
+
autoSendPaymentEmails?: boolean;
|
|
22
25
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import * as core from "../../../../core/index.js";
|
|
3
|
+
import * as Paid from "../../../index.js";
|
|
4
|
+
export declare namespace ValueReceipts {
|
|
5
|
+
interface Options extends BaseClientOptions {
|
|
6
|
+
}
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ValueReceipts {
|
|
11
|
+
protected readonly _options: ValueReceipts.Options;
|
|
12
|
+
constructor(_options: ValueReceipts.Options);
|
|
13
|
+
/**
|
|
14
|
+
* List value receipts for the organization
|
|
15
|
+
*
|
|
16
|
+
* @param {Paid.ListValueReceiptsRequest} request
|
|
17
|
+
* @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link Paid.InternalServerError}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* await client.valueReceipts.listValueReceipts()
|
|
23
|
+
*/
|
|
24
|
+
listValueReceipts(request?: Paid.ListValueReceiptsRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptListResponse>;
|
|
25
|
+
private __listValueReceipts;
|
|
26
|
+
/**
|
|
27
|
+
* Get a value receipt by ID, including its publish/share state.
|
|
28
|
+
*
|
|
29
|
+
* @param {Paid.GetValueReceiptByIdRequest} request
|
|
30
|
+
* @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
|
|
31
|
+
*
|
|
32
|
+
* @throws {@link Paid.NotFoundError}
|
|
33
|
+
* @throws {@link Paid.InternalServerError}
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* await client.valueReceipts.getValueReceiptById({
|
|
37
|
+
* id: "id"
|
|
38
|
+
* })
|
|
39
|
+
*/
|
|
40
|
+
getValueReceiptById(request: Paid.GetValueReceiptByIdRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
|
|
41
|
+
private __getValueReceiptById;
|
|
42
|
+
/**
|
|
43
|
+
* Make a value receipt publicly accessible via URL.
|
|
44
|
+
*
|
|
45
|
+
* @param {Paid.PublishValueReceiptBody} request
|
|
46
|
+
* @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
|
|
47
|
+
*
|
|
48
|
+
* @throws {@link Paid.NotFoundError}
|
|
49
|
+
* @throws {@link Paid.InternalServerError}
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* await client.valueReceipts.publishValueReceipt({
|
|
53
|
+
* id: "id"
|
|
54
|
+
* })
|
|
55
|
+
*/
|
|
56
|
+
publishValueReceipt(request: Paid.PublishValueReceiptBody, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
|
|
57
|
+
private __publishValueReceipt;
|
|
58
|
+
/**
|
|
59
|
+
* Revoke public access to a value receipt.
|
|
60
|
+
*
|
|
61
|
+
* @param {Paid.UnpublishValueReceiptRequest} request
|
|
62
|
+
* @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
|
|
63
|
+
*
|
|
64
|
+
* @throws {@link Paid.NotFoundError}
|
|
65
|
+
* @throws {@link Paid.InternalServerError}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.valueReceipts.unpublishValueReceipt({
|
|
69
|
+
* id: "id"
|
|
70
|
+
* })
|
|
71
|
+
*/
|
|
72
|
+
unpublishValueReceipt(request: Paid.UnpublishValueReceiptRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
|
|
73
|
+
private __unpublishValueReceipt;
|
|
74
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
75
|
+
}
|