@paid-ai/paid-node 1.0.1 → 1.2.0
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 +6 -2
- package/dist/cjs/Client.d.ts +9 -0
- package/dist/cjs/Client.js +29 -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 +23 -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/contacts/client/Client.d.ts +0 -2
- package/dist/cjs/api/resources/contacts/client/Client.js +0 -2
- package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.d.ts +13 -4
- package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.js +11 -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 +34 -0
- package/dist/cjs/api/resources/customers/client/Client.js +136 -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 +6 -0
- package/dist/cjs/api/resources/index.js +7 -1
- package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +12 -7
- package/dist/cjs/api/resources/orders/client/requests/UpdateOrderRequest.d.ts +10 -7
- package/dist/cjs/api/types/Checkout.d.ts +18 -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/Contact.d.ts +11 -0
- package/dist/cjs/api/types/Contact.js +11 -0
- package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +120 -0
- package/dist/cjs/api/types/CreateOrderLineAttributeRequest.js +73 -0
- package/dist/cjs/api/types/CreateOrderLineRequest.d.ts +9 -0
- package/dist/cjs/api/types/CreateOrderLineRequest.js +3 -0
- 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/Signal.d.ts +2 -0
- package/dist/cjs/api/types/UpdateContactRequest.d.ts +11 -0
- package/dist/cjs/api/types/UpdateContactRequest.js +11 -0
- package/dist/cjs/api/types/index.d.ts +13 -0
- package/dist/cjs/api/types/index.js +13 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +9 -0
- package/dist/esm/Client.mjs +17 -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 +23 -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/contacts/client/Client.d.mts +0 -2
- package/dist/esm/api/resources/contacts/client/Client.mjs +0 -2
- package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.d.mts +13 -4
- package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.mjs +10 -1
- 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 +34 -0
- package/dist/esm/api/resources/customers/client/Client.mjs +136 -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 +6 -0
- package/dist/esm/api/resources/index.mjs +6 -0
- package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +12 -7
- package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.d.mts +10 -7
- package/dist/esm/api/types/Checkout.d.mts +18 -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/Contact.d.mts +11 -0
- package/dist/esm/api/types/Contact.mjs +10 -1
- package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +120 -0
- package/dist/esm/api/types/CreateOrderLineAttributeRequest.mjs +70 -0
- package/dist/esm/api/types/CreateOrderLineRequest.d.mts +9 -0
- package/dist/esm/api/types/CreateOrderLineRequest.mjs +2 -0
- 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/Signal.d.mts +2 -0
- package/dist/esm/api/types/UpdateContactRequest.d.mts +11 -0
- package/dist/esm/api/types/UpdateContactRequest.mjs +10 -1
- package/dist/esm/api/types/index.d.mts +13 -0
- package/dist/esm/api/types/index.mjs +13 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +215 -215
- package/reference.md +512 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CustomerPortalStatus = void 0;
|
|
5
|
+
exports.CustomerPortalStatus = {
|
|
6
|
+
Active: "active",
|
|
7
|
+
Expired: "expired",
|
|
8
|
+
};
|
|
@@ -23,5 +23,8 @@ export interface Order {
|
|
|
23
23
|
metadata: Record<string, unknown> | null;
|
|
24
24
|
showPaymentLink: boolean | null;
|
|
25
25
|
showBankDetails: boolean | null;
|
|
26
|
+
autoPostInvoices: boolean | null;
|
|
27
|
+
autoSendBillingEmails: boolean | null;
|
|
28
|
+
autoSendPaymentEmails: boolean | null;
|
|
26
29
|
version: number;
|
|
27
30
|
}
|
|
@@ -3,6 +3,8 @@ export interface Signal {
|
|
|
3
3
|
eventName: string;
|
|
4
4
|
customer: Paid.CustomerAttribution;
|
|
5
5
|
attribution?: Paid.Attribution;
|
|
6
|
+
/** True event timestamp in RFC3339 format with timezone (e.g. 2026-01-31T23:00:00Z) */
|
|
7
|
+
timestamp?: string;
|
|
6
8
|
data?: Record<string, unknown>;
|
|
7
9
|
idempotencyKey?: string;
|
|
8
10
|
}
|
|
@@ -7,4 +7,15 @@ export interface UpdateContactRequest {
|
|
|
7
7
|
phone?: string | null;
|
|
8
8
|
billingAddress?: Paid.ContactBillingAddress | null;
|
|
9
9
|
externalId?: string | null;
|
|
10
|
+
roles?: UpdateContactRequest.Roles.Item[];
|
|
11
|
+
}
|
|
12
|
+
export declare namespace UpdateContactRequest {
|
|
13
|
+
type Roles = Roles.Item[];
|
|
14
|
+
namespace Roles {
|
|
15
|
+
const Item: {
|
|
16
|
+
readonly Billing: "BILLING";
|
|
17
|
+
readonly AccountsPayable: "ACCOUNTS_PAYABLE";
|
|
18
|
+
};
|
|
19
|
+
type Item = (typeof Item)[keyof typeof Item];
|
|
20
|
+
}
|
|
10
21
|
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.UpdateContactRequest = void 0;
|
|
5
|
+
var UpdateContactRequest;
|
|
6
|
+
(function (UpdateContactRequest) {
|
|
7
|
+
let Roles;
|
|
8
|
+
(function (Roles) {
|
|
9
|
+
Roles.Item = {
|
|
10
|
+
Billing: "BILLING",
|
|
11
|
+
AccountsPayable: "ACCOUNTS_PAYABLE",
|
|
12
|
+
};
|
|
13
|
+
})(Roles = UpdateContactRequest.Roles || (UpdateContactRequest.Roles = {}));
|
|
14
|
+
})(UpdateContactRequest || (exports.UpdateContactRequest = UpdateContactRequest = {}));
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
export * from "./Attribution.js";
|
|
2
2
|
export * from "./BulkSignalsResponse.js";
|
|
3
|
+
export * from "./Checkout.js";
|
|
4
|
+
export * from "./CheckoutListResponse.js";
|
|
5
|
+
export * from "./CheckoutProduct.js";
|
|
6
|
+
export * from "./CheckoutProductInput.js";
|
|
7
|
+
export * from "./CheckoutStatus.js";
|
|
3
8
|
export * from "./Contact.js";
|
|
4
9
|
export * from "./ContactBillingAddress.js";
|
|
5
10
|
export * from "./ContactListResponse.js";
|
|
11
|
+
export * from "./CreateOrderLineAttributeRequest.js";
|
|
12
|
+
export * from "./CreateOrderLineRequest.js";
|
|
13
|
+
export * from "./CreditBalance.js";
|
|
14
|
+
export * from "./CreditBalanceListResponse.js";
|
|
15
|
+
export * from "./CreditCurrency.js";
|
|
16
|
+
export * from "./CreditCurrencyListResponse.js";
|
|
6
17
|
export * from "./Customer.js";
|
|
7
18
|
export * from "./CustomerAttribution.js";
|
|
8
19
|
export * from "./CustomerBillingAddress.js";
|
|
@@ -10,6 +21,8 @@ export * from "./CustomerByExternalId.js";
|
|
|
10
21
|
export * from "./CustomerById.js";
|
|
11
22
|
export * from "./CustomerCreationState.js";
|
|
12
23
|
export * from "./CustomerListResponse.js";
|
|
24
|
+
export * from "./CustomerPortal.js";
|
|
25
|
+
export * from "./CustomerPortalStatus.js";
|
|
13
26
|
export * from "./EmptyResponse.js";
|
|
14
27
|
export * from "./ErrorResponse.js";
|
|
15
28
|
export * from "./Invoice.js";
|
|
@@ -16,9 +16,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Attribution.js"), exports);
|
|
18
18
|
__exportStar(require("./BulkSignalsResponse.js"), exports);
|
|
19
|
+
__exportStar(require("./Checkout.js"), exports);
|
|
20
|
+
__exportStar(require("./CheckoutListResponse.js"), exports);
|
|
21
|
+
__exportStar(require("./CheckoutProduct.js"), exports);
|
|
22
|
+
__exportStar(require("./CheckoutProductInput.js"), exports);
|
|
23
|
+
__exportStar(require("./CheckoutStatus.js"), exports);
|
|
19
24
|
__exportStar(require("./Contact.js"), exports);
|
|
20
25
|
__exportStar(require("./ContactBillingAddress.js"), exports);
|
|
21
26
|
__exportStar(require("./ContactListResponse.js"), exports);
|
|
27
|
+
__exportStar(require("./CreateOrderLineAttributeRequest.js"), exports);
|
|
28
|
+
__exportStar(require("./CreateOrderLineRequest.js"), exports);
|
|
29
|
+
__exportStar(require("./CreditBalance.js"), exports);
|
|
30
|
+
__exportStar(require("./CreditBalanceListResponse.js"), exports);
|
|
31
|
+
__exportStar(require("./CreditCurrency.js"), exports);
|
|
32
|
+
__exportStar(require("./CreditCurrencyListResponse.js"), exports);
|
|
22
33
|
__exportStar(require("./Customer.js"), exports);
|
|
23
34
|
__exportStar(require("./CustomerAttribution.js"), exports);
|
|
24
35
|
__exportStar(require("./CustomerBillingAddress.js"), exports);
|
|
@@ -26,6 +37,8 @@ __exportStar(require("./CustomerByExternalId.js"), exports);
|
|
|
26
37
|
__exportStar(require("./CustomerById.js"), exports);
|
|
27
38
|
__exportStar(require("./CustomerCreationState.js"), exports);
|
|
28
39
|
__exportStar(require("./CustomerListResponse.js"), exports);
|
|
40
|
+
__exportStar(require("./CustomerPortal.js"), exports);
|
|
41
|
+
__exportStar(require("./CustomerPortalStatus.js"), exports);
|
|
29
42
|
__exportStar(require("./EmptyResponse.js"), exports);
|
|
30
43
|
__exportStar(require("./ErrorResponse.js"), exports);
|
|
31
44
|
__exportStar(require("./Invoice.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0
|
|
1
|
+
export declare const SDK_VERSION = "1.2.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
|
|
1
2
|
import { Contacts } from "./api/resources/contacts/client/Client.mjs";
|
|
3
|
+
import { Credits } from "./api/resources/credits/client/Client.mjs";
|
|
4
|
+
import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
|
|
2
5
|
import { Customers } from "./api/resources/customers/client/Client.mjs";
|
|
3
6
|
import { Invoices } from "./api/resources/invoices/client/Client.mjs";
|
|
4
7
|
import { Orders } from "./api/resources/orders/client/Client.mjs";
|
|
@@ -19,6 +22,9 @@ export declare class PaidClient {
|
|
|
19
22
|
protected _orders: Orders | undefined;
|
|
20
23
|
protected _invoices: Invoices | undefined;
|
|
21
24
|
protected _signals: Signals | undefined;
|
|
25
|
+
protected _credits: Credits | undefined;
|
|
26
|
+
protected _checkouts: Checkouts | undefined;
|
|
27
|
+
protected _customerPortals: CustomerPortals | undefined;
|
|
22
28
|
constructor(_options: PaidClient.Options);
|
|
23
29
|
get products(): Products;
|
|
24
30
|
get customers(): Customers;
|
|
@@ -26,4 +32,7 @@ export declare class PaidClient {
|
|
|
26
32
|
get orders(): Orders;
|
|
27
33
|
get invoices(): Invoices;
|
|
28
34
|
get signals(): Signals;
|
|
35
|
+
get credits(): Credits;
|
|
36
|
+
get checkouts(): Checkouts;
|
|
37
|
+
get customerPortals(): CustomerPortals;
|
|
29
38
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
|
|
2
3
|
import { Contacts } from "./api/resources/contacts/client/Client.mjs";
|
|
4
|
+
import { Credits } from "./api/resources/credits/client/Client.mjs";
|
|
5
|
+
import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
|
|
3
6
|
import { Customers } from "./api/resources/customers/client/Client.mjs";
|
|
4
7
|
import { Invoices } from "./api/resources/invoices/client/Client.mjs";
|
|
5
8
|
import { Orders } from "./api/resources/orders/client/Client.mjs";
|
|
@@ -12,8 +15,8 @@ export class PaidClient {
|
|
|
12
15
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
13
16
|
"X-Fern-Language": "JavaScript",
|
|
14
17
|
"X-Fern-SDK-Name": "@paid-ai/paid-node",
|
|
15
|
-
"X-Fern-SDK-Version": "1.0
|
|
16
|
-
"User-Agent": "@paid-ai/paid-node/1.0
|
|
18
|
+
"X-Fern-SDK-Version": "1.2.0",
|
|
19
|
+
"User-Agent": "@paid-ai/paid-node/1.2.0",
|
|
17
20
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
18
21
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
19
22
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -42,4 +45,16 @@ export class PaidClient {
|
|
|
42
45
|
var _a;
|
|
43
46
|
return ((_a = this._signals) !== null && _a !== void 0 ? _a : (this._signals = new Signals(this._options)));
|
|
44
47
|
}
|
|
48
|
+
get credits() {
|
|
49
|
+
var _a;
|
|
50
|
+
return ((_a = this._credits) !== null && _a !== void 0 ? _a : (this._credits = new Credits(this._options)));
|
|
51
|
+
}
|
|
52
|
+
get checkouts() {
|
|
53
|
+
var _a;
|
|
54
|
+
return ((_a = this._checkouts) !== null && _a !== void 0 ? _a : (this._checkouts = new Checkouts(this._options)));
|
|
55
|
+
}
|
|
56
|
+
get customerPortals() {
|
|
57
|
+
var _a;
|
|
58
|
+
return ((_a = this._customerPortals) !== null && _a !== void 0 ? _a : (this._customerPortals = new CustomerPortals(this._options)));
|
|
59
|
+
}
|
|
45
60
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import * as Paid from "../../../index.mjs";
|
|
4
|
+
export declare namespace Checkouts {
|
|
5
|
+
interface Options extends BaseClientOptions {
|
|
6
|
+
}
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class Checkouts {
|
|
11
|
+
protected readonly _options: Checkouts.Options;
|
|
12
|
+
constructor(_options: Checkouts.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Get a list of checkouts for the organization
|
|
15
|
+
*
|
|
16
|
+
* @param {Paid.ListCheckoutsRequest} request
|
|
17
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link Paid.BadRequestError}
|
|
20
|
+
* @throws {@link Paid.ForbiddenError}
|
|
21
|
+
* @throws {@link Paid.InternalServerError}
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* await client.checkouts.listCheckouts()
|
|
25
|
+
*/
|
|
26
|
+
listCheckouts(request?: Paid.ListCheckoutsRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.CheckoutListResponse>;
|
|
27
|
+
private __listCheckouts;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a checkout link that generates a URL for a customer to complete a purchase
|
|
30
|
+
*
|
|
31
|
+
* @param {Paid.CreateCheckoutRequest} request
|
|
32
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
33
|
+
*
|
|
34
|
+
* @throws {@link Paid.BadRequestError}
|
|
35
|
+
* @throws {@link Paid.ForbiddenError}
|
|
36
|
+
* @throws {@link Paid.NotFoundError}
|
|
37
|
+
* @throws {@link Paid.InternalServerError}
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* await client.checkouts.createCheckout({
|
|
41
|
+
* products: [{
|
|
42
|
+
* id: "id"
|
|
43
|
+
* }],
|
|
44
|
+
* successUrl: "successUrl"
|
|
45
|
+
* })
|
|
46
|
+
*/
|
|
47
|
+
createCheckout(request: Paid.CreateCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.Checkout>;
|
|
48
|
+
private __createCheckout;
|
|
49
|
+
/**
|
|
50
|
+
* Get a checkout by ID
|
|
51
|
+
*
|
|
52
|
+
* @param {Paid.GetCheckoutRequest} request
|
|
53
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
54
|
+
*
|
|
55
|
+
* @throws {@link Paid.ForbiddenError}
|
|
56
|
+
* @throws {@link Paid.NotFoundError}
|
|
57
|
+
* @throws {@link Paid.InternalServerError}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await client.checkouts.getCheckout({
|
|
61
|
+
* id: "id"
|
|
62
|
+
* })
|
|
63
|
+
*/
|
|
64
|
+
getCheckout(request: Paid.GetCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.Checkout>;
|
|
65
|
+
private __getCheckout;
|
|
66
|
+
/**
|
|
67
|
+
* Archive a checkout by ID
|
|
68
|
+
*
|
|
69
|
+
* @param {Paid.ArchiveCheckoutRequest} request
|
|
70
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
71
|
+
*
|
|
72
|
+
* @throws {@link Paid.ForbiddenError}
|
|
73
|
+
* @throws {@link Paid.NotFoundError}
|
|
74
|
+
* @throws {@link Paid.InternalServerError}
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* await client.checkouts.archiveCheckout({
|
|
78
|
+
* id: "id"
|
|
79
|
+
* })
|
|
80
|
+
*/
|
|
81
|
+
archiveCheckout(request: Paid.ArchiveCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.EmptyResponse>;
|
|
82
|
+
private __archiveCheckout;
|
|
83
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
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 { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
12
|
+
import * as core from "../../../../core/index.mjs";
|
|
13
|
+
import * as environments from "../../../../environments.mjs";
|
|
14
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
15
|
+
import * as Paid from "../../../index.mjs";
|
|
16
|
+
export class Checkouts {
|
|
17
|
+
constructor(_options) {
|
|
18
|
+
this._options = _options;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a list of checkouts for the organization
|
|
22
|
+
*
|
|
23
|
+
* @param {Paid.ListCheckoutsRequest} request
|
|
24
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
25
|
+
*
|
|
26
|
+
* @throws {@link Paid.BadRequestError}
|
|
27
|
+
* @throws {@link Paid.ForbiddenError}
|
|
28
|
+
* @throws {@link Paid.InternalServerError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.checkouts.listCheckouts()
|
|
32
|
+
*/
|
|
33
|
+
listCheckouts(request = {}, requestOptions) {
|
|
34
|
+
return core.HttpResponsePromise.fromPromise(this.__listCheckouts(request, requestOptions));
|
|
35
|
+
}
|
|
36
|
+
__listCheckouts() {
|
|
37
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
39
|
+
const { limit, offset, status } = request;
|
|
40
|
+
const _queryParams = {};
|
|
41
|
+
if (limit != null) {
|
|
42
|
+
_queryParams.limit = limit.toString();
|
|
43
|
+
}
|
|
44
|
+
if (offset != null) {
|
|
45
|
+
_queryParams.offset = offset.toString();
|
|
46
|
+
}
|
|
47
|
+
if (status != null) {
|
|
48
|
+
_queryParams.status = status;
|
|
49
|
+
}
|
|
50
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
51
|
+
const _response = yield core.fetcher({
|
|
52
|
+
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, "checkouts/"),
|
|
53
|
+
method: "GET",
|
|
54
|
+
headers: _headers,
|
|
55
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
56
|
+
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,
|
|
57
|
+
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,
|
|
58
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
59
|
+
});
|
|
60
|
+
if (_response.ok) {
|
|
61
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
62
|
+
}
|
|
63
|
+
if (_response.error.reason === "status-code") {
|
|
64
|
+
switch (_response.error.statusCode) {
|
|
65
|
+
case 400:
|
|
66
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
67
|
+
case 403:
|
|
68
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
69
|
+
case 500:
|
|
70
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
71
|
+
default:
|
|
72
|
+
throw new errors.PaidError({
|
|
73
|
+
statusCode: _response.error.statusCode,
|
|
74
|
+
body: _response.error.body,
|
|
75
|
+
rawResponse: _response.rawResponse,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
switch (_response.error.reason) {
|
|
80
|
+
case "non-json":
|
|
81
|
+
throw new errors.PaidError({
|
|
82
|
+
statusCode: _response.error.statusCode,
|
|
83
|
+
body: _response.error.rawBody,
|
|
84
|
+
rawResponse: _response.rawResponse,
|
|
85
|
+
});
|
|
86
|
+
case "timeout":
|
|
87
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /checkouts/.");
|
|
88
|
+
case "unknown":
|
|
89
|
+
throw new errors.PaidError({
|
|
90
|
+
message: _response.error.errorMessage,
|
|
91
|
+
rawResponse: _response.rawResponse,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Creates a checkout link that generates a URL for a customer to complete a purchase
|
|
98
|
+
*
|
|
99
|
+
* @param {Paid.CreateCheckoutRequest} request
|
|
100
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
101
|
+
*
|
|
102
|
+
* @throws {@link Paid.BadRequestError}
|
|
103
|
+
* @throws {@link Paid.ForbiddenError}
|
|
104
|
+
* @throws {@link Paid.NotFoundError}
|
|
105
|
+
* @throws {@link Paid.InternalServerError}
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* await client.checkouts.createCheckout({
|
|
109
|
+
* products: [{
|
|
110
|
+
* id: "id"
|
|
111
|
+
* }],
|
|
112
|
+
* successUrl: "successUrl"
|
|
113
|
+
* })
|
|
114
|
+
*/
|
|
115
|
+
createCheckout(request, requestOptions) {
|
|
116
|
+
return core.HttpResponsePromise.fromPromise(this.__createCheckout(request, requestOptions));
|
|
117
|
+
}
|
|
118
|
+
__createCheckout(request, requestOptions) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
121
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
122
|
+
const _response = yield core.fetcher({
|
|
123
|
+
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, "checkouts/"),
|
|
124
|
+
method: "POST",
|
|
125
|
+
headers: _headers,
|
|
126
|
+
contentType: "application/json",
|
|
127
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
128
|
+
requestType: "json",
|
|
129
|
+
body: request,
|
|
130
|
+
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,
|
|
131
|
+
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,
|
|
132
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
133
|
+
});
|
|
134
|
+
if (_response.ok) {
|
|
135
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
136
|
+
}
|
|
137
|
+
if (_response.error.reason === "status-code") {
|
|
138
|
+
switch (_response.error.statusCode) {
|
|
139
|
+
case 400:
|
|
140
|
+
throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
|
|
141
|
+
case 403:
|
|
142
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
143
|
+
case 404:
|
|
144
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
145
|
+
case 500:
|
|
146
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
147
|
+
default:
|
|
148
|
+
throw new errors.PaidError({
|
|
149
|
+
statusCode: _response.error.statusCode,
|
|
150
|
+
body: _response.error.body,
|
|
151
|
+
rawResponse: _response.rawResponse,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
switch (_response.error.reason) {
|
|
156
|
+
case "non-json":
|
|
157
|
+
throw new errors.PaidError({
|
|
158
|
+
statusCode: _response.error.statusCode,
|
|
159
|
+
body: _response.error.rawBody,
|
|
160
|
+
rawResponse: _response.rawResponse,
|
|
161
|
+
});
|
|
162
|
+
case "timeout":
|
|
163
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /checkouts/.");
|
|
164
|
+
case "unknown":
|
|
165
|
+
throw new errors.PaidError({
|
|
166
|
+
message: _response.error.errorMessage,
|
|
167
|
+
rawResponse: _response.rawResponse,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get a checkout by ID
|
|
174
|
+
*
|
|
175
|
+
* @param {Paid.GetCheckoutRequest} request
|
|
176
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
177
|
+
*
|
|
178
|
+
* @throws {@link Paid.ForbiddenError}
|
|
179
|
+
* @throws {@link Paid.NotFoundError}
|
|
180
|
+
* @throws {@link Paid.InternalServerError}
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* await client.checkouts.getCheckout({
|
|
184
|
+
* id: "id"
|
|
185
|
+
* })
|
|
186
|
+
*/
|
|
187
|
+
getCheckout(request, requestOptions) {
|
|
188
|
+
return core.HttpResponsePromise.fromPromise(this.__getCheckout(request, requestOptions));
|
|
189
|
+
}
|
|
190
|
+
__getCheckout(request, requestOptions) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
193
|
+
const { id } = request;
|
|
194
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
195
|
+
const _response = yield core.fetcher({
|
|
196
|
+
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, `checkouts/${core.url.encodePathParam(id)}`),
|
|
197
|
+
method: "GET",
|
|
198
|
+
headers: _headers,
|
|
199
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
200
|
+
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,
|
|
201
|
+
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,
|
|
202
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
203
|
+
});
|
|
204
|
+
if (_response.ok) {
|
|
205
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
206
|
+
}
|
|
207
|
+
if (_response.error.reason === "status-code") {
|
|
208
|
+
switch (_response.error.statusCode) {
|
|
209
|
+
case 403:
|
|
210
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
211
|
+
case 404:
|
|
212
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
213
|
+
case 500:
|
|
214
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
215
|
+
default:
|
|
216
|
+
throw new errors.PaidError({
|
|
217
|
+
statusCode: _response.error.statusCode,
|
|
218
|
+
body: _response.error.body,
|
|
219
|
+
rawResponse: _response.rawResponse,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
switch (_response.error.reason) {
|
|
224
|
+
case "non-json":
|
|
225
|
+
throw new errors.PaidError({
|
|
226
|
+
statusCode: _response.error.statusCode,
|
|
227
|
+
body: _response.error.rawBody,
|
|
228
|
+
rawResponse: _response.rawResponse,
|
|
229
|
+
});
|
|
230
|
+
case "timeout":
|
|
231
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /checkouts/{id}.");
|
|
232
|
+
case "unknown":
|
|
233
|
+
throw new errors.PaidError({
|
|
234
|
+
message: _response.error.errorMessage,
|
|
235
|
+
rawResponse: _response.rawResponse,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Archive a checkout by ID
|
|
242
|
+
*
|
|
243
|
+
* @param {Paid.ArchiveCheckoutRequest} request
|
|
244
|
+
* @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
|
|
245
|
+
*
|
|
246
|
+
* @throws {@link Paid.ForbiddenError}
|
|
247
|
+
* @throws {@link Paid.NotFoundError}
|
|
248
|
+
* @throws {@link Paid.InternalServerError}
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* await client.checkouts.archiveCheckout({
|
|
252
|
+
* id: "id"
|
|
253
|
+
* })
|
|
254
|
+
*/
|
|
255
|
+
archiveCheckout(request, requestOptions) {
|
|
256
|
+
return core.HttpResponsePromise.fromPromise(this.__archiveCheckout(request, requestOptions));
|
|
257
|
+
}
|
|
258
|
+
__archiveCheckout(request, requestOptions) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
261
|
+
const { id } = request;
|
|
262
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
263
|
+
const _response = yield core.fetcher({
|
|
264
|
+
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, `checkouts/${core.url.encodePathParam(id)}`),
|
|
265
|
+
method: "DELETE",
|
|
266
|
+
headers: _headers,
|
|
267
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
268
|
+
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,
|
|
269
|
+
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,
|
|
270
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
271
|
+
});
|
|
272
|
+
if (_response.ok) {
|
|
273
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
274
|
+
}
|
|
275
|
+
if (_response.error.reason === "status-code") {
|
|
276
|
+
switch (_response.error.statusCode) {
|
|
277
|
+
case 403:
|
|
278
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
279
|
+
case 404:
|
|
280
|
+
throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
|
|
281
|
+
case 500:
|
|
282
|
+
throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
|
|
283
|
+
default:
|
|
284
|
+
throw new errors.PaidError({
|
|
285
|
+
statusCode: _response.error.statusCode,
|
|
286
|
+
body: _response.error.body,
|
|
287
|
+
rawResponse: _response.rawResponse,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
switch (_response.error.reason) {
|
|
292
|
+
case "non-json":
|
|
293
|
+
throw new errors.PaidError({
|
|
294
|
+
statusCode: _response.error.statusCode,
|
|
295
|
+
body: _response.error.rawBody,
|
|
296
|
+
rawResponse: _response.rawResponse,
|
|
297
|
+
});
|
|
298
|
+
case "timeout":
|
|
299
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /checkouts/{id}.");
|
|
300
|
+
case "unknown":
|
|
301
|
+
throw new errors.PaidError({
|
|
302
|
+
message: _response.error.errorMessage,
|
|
303
|
+
rawResponse: _response.rawResponse,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
_getAuthorizationHeader() {
|
|
309
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
310
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|