@boelabs/billete-sdk 4.1.0 → 4.3.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/dist/client.d.ts +24 -3
- package/dist/client.js +55 -3
- package/dist/{errors-AObvDES-.d.ts → errors-DCiynKkL.d.ts} +90 -4
- package/dist/{events-C0pKiZ_h.d.ts → events-CaNwG-EX.d.ts} +85 -4
- package/dist/{http-D1e4okoX.js → http-BfxFFQqw.js} +4 -4
- package/dist/index.d.ts +31 -3
- package/dist/index.js +26 -1
- package/dist/webhooks.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as ProductLinkCreate, A as EventSelector, At as API_VERSION_PATTERN, B as PaymentLinkCreate, Bt as isApiVersionRetired, C as CustomFieldInput, Ct as PublicFulfillment, D as CustomerMemberUpdate, Dt as PublicPortal, E as CustomerMemberCreate, Et as PublicPaymentState, F as FulfillmentInput, Ft as LatestApiVersion, G as PlanFeaturesInput, H as PlanCheckoutCreate, I as FulfillmentTrackingInput, It as apiVersionLifecycle, J as PlanUpdate, K as PlanLinkCreate, L as InvoiceCreate, Lt as apiVersionStage, M as FeatureOperationCommit, Mt as ApiVersionLifecycle, N as FeatureOperationCreate, Nt as ApiVersionStage, O as CustomerSessionCreate, Ot as API_VERSIONS, P as FeatureUpdate, Pt as LATEST_API_VERSION, Q as ProductCreate, R as InvoiceLineInput, Rt as currentApiVersion, S as CouponUpdate, St as PublicClaimSummary, T as CustomerInput, Tt as PublicPaymentLink, U as PlanCouponCreate, V as PaymentLinkUpdate, Vt as supportedApiVersions, W as PlanCreate, X as ProductCheckoutCreate, Y as PortalSessionCreate, Z as ProductCouponCreate, _ as ClientSubscriptionCancel, _t as PaymentNextAction, a as CheckoutCreate, at as SubscriptionChangePreviewInput, b as CollectInput, bt as PublicCheckout, c as ClaimRespond, ct as VariantInput, d as ClientClaimCreate, dt as CustomerSubscription, et as ProductUpdate, f as ClientCustomerClaimCreate, ft as CustomerSubscriptionChangeResult, g as ClientPaymentCode, gt as PaymentMethodOption, h as ClientLinkCheckout, ht as PaymentMethodField, i as AfterCompletionInput, it as SubscriptionChangeCreate, j as FeatureCreate, jt as ApiVersion, k as CustomerUpdate, kt as API_VERSION_HEADER, l as ClientCheckoutPay, lt as WebhookEndpointCreate, m as ClientInvoicePay, mt as PaymentInstructions, n as RequestOptions, nt as RetireInput, o as CheckoutItemInput, ot as SubscriptionCreate, p as ClientFulfillmentProblem, pt as FulfillmentOption, q as PlanPriceInput, r as TransportOptions, rt as SubscriptionCancel, s as ClaimResolve, st as SubscriptionUpdate, t as BilleteError, tt as RefundCreate, u as ClientCheckoutUpdate, ut as WebhookEndpointUpdate, v as ClientSubscriptionSeats, vt as PaymentTestScenario, w as CustomerCreate, wt as PublicInvoice, x as CouponCreate, xt as PublicClaim, y as ClientSubscriptionUpdate, yt as PortalFeatures, z as KEY_PATTERN, zt as isApiVersion } from "./errors-DCiynKkL.js";
|
|
2
|
+
import { $ as FulfillmentStatus, $t as ACCOUNT_NUMBER_LENGTH, A as Coupon, At as Retirement, B as ExchangeRate, Bt as SubscriptionStatus, C as CheckoutPurpose, Cn as nationalPhone, Ct as Product, D as ClaimReason, Dn as tokenEnvironment, Dt as RISK_LEVELS, E as ClaimOutcome, En as TokenKind, Et as RESET_FREQUENCIES, F as CustomerFeature, Ft as Subscription, G as FeatureOperation, Gt as ReceiptReference, H as FULFILLMENT_METHODS, Ht as USAGE_FEATURE_TYPES, I as CustomerMember, It as SubscriptionChange, J as FeatureType, Jt as ApiErrorBody, K as FeatureOperationResult, Kt as ReceiptSend, L as CustomerMemberList, Lt as SubscriptionChangePreview, M as CustomField, Mt as SUBMIT_LABELS, N as Customer, Nt as SUBSCRIPTION_STATUSES, O as ClaimStatus, On as tokenPrefix, Ot as Refund, P as CustomerDetails, Pt as SubmitLabel, Q as FulfillmentMethod, Qt as PaymentFailureCode, R as CustomerSession, Rt as SubscriptionChangeResult, S as CheckoutItem, Sn as isMobilePhone, St as PortalSession, T as ClaimMessage, Tn as Environment, Tt as ProductVariant, U as FULFILLMENT_STATUSES, Ut as WebhookEndpoint, V as FEATURE_TYPES, Vt as SubscriptionTerms, W as Feature, Wt as Weekday, X as Fulfillment, Xt as ApiErrorType, Y as FeatureUsageResult, Yt as ApiErrorEnvelope, Z as FulfillmentChoice, Zt as PAYMENT_FAILURE_CODES, _ as CLAIM_STATUSES, _n as TaxBehavior, _t as Payout, a as WEBHOOK_TEST_EVENT, an as CURRENCIES, at as InvoiceStatus, b as CarrierOffice, bn as findBank, bt as PlanPrice, c as AfterCompletion, cn as GracePeriodDays, ct as PAYMENT_STATUSES, d as CANCELLATION_FEEDBACK, dn as ListSort, dt as PaymentAttempt, en as Address, et as FulfillmentTracking, f as CARRIERS, fn as MAX_QUANTITY, ft as PaymentFailure, g as CLAIM_REASONS, gn as TAX_BEHAVIORS, gt as PaymentStatus, h as CLAIM_OUTCOMES, hn as MobilePrefix, ht as PaymentSettlement, i as SubscribableEventType, in as BillingMonths, it as InvoiceReason, j as CurrencyAvailability, jt as RiskLevel, k as CollectSettings, kt as ResetFrequency, l as Balance, ln as List, lt as PRODUCT_CATEGORIES, m as CHECKOUT_PURPOSES, mn as Metadata, mt as PaymentLink, n as EventDataMap, nn as BILLING_MONTHS, nt as INVOICE_STATUSES, o as WebhookEvent, on as Currency, ot as LineItem, p as CARRIER_TEST_SCENARIOS, pn as MOBILE_PREFIXES, pt as PaymentFeeDetails, q as FeatureReset, qt as API_ERROR_TYPES, r as EventType, rn as BankCode, rt as Invoice, s as Actor, sn as GRACE_PERIOD_DAYS, st as MAX_SEATS, t as EVENT_TYPES, tn as AddressInput, tt as INVOICE_REASONS, u as BalanceAmount, un as ListQuery, ut as Payment, v as CancellationFeedback, vn as Timestamp, vt as Plan, w as Claim, wn as ENVIRONMENTS, wt as ProductCategory, x as Checkout, xn as isLandlinePhone, xt as PlanSeats, y as Carrier, yn as VENEZUELAN_BANKS, yt as PlanFeatureValues, z as Event, zt as SubscriptionRenewal } from "./events-CaNwG-EX.js";
|
|
3
3
|
//#region src/create-client.d.ts
|
|
4
4
|
interface ClientOptions extends TransportOptions {
|
|
5
5
|
/**
|
|
@@ -41,6 +41,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
41
41
|
paymentMethods: (id: string, options?: RequestOptions) => Promise<List<PaymentMethodOption>>;
|
|
42
42
|
/** Submits the payment; the returned checkout carries the payment status and any failure. */
|
|
43
43
|
pay: (id: string, input: ClientCheckoutPay, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
44
|
+
openClaim: (id: string, input: ClientClaimCreate, options?: RequestOptions) => Promise<PublicClaim>;
|
|
44
45
|
};
|
|
45
46
|
invoices: {
|
|
46
47
|
/** Authorizes the payment with the code; a wrong one fails with `payment_code_invalid`. */
|
|
@@ -59,6 +60,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
59
60
|
paymentMethods: (id: string, options?: RequestOptions) => Promise<List<PaymentMethodOption>>;
|
|
60
61
|
/** Submits the payment; the returned Cobro carries the payment status and any failure. */
|
|
61
62
|
pay: (id: string, input: ClientInvoicePay, options?: RequestOptions) => Promise<PublicInvoice>;
|
|
63
|
+
openClaim: (id: string, input: ClientClaimCreate, options?: RequestOptions) => Promise<PublicClaim>;
|
|
62
64
|
};
|
|
63
65
|
/**
|
|
64
66
|
* A purchase's delivery, as its customer follows it. The `token` comes in the link of the
|
|
@@ -68,9 +70,26 @@ export declare function createClient(options: ClientOptions): {
|
|
|
68
70
|
retrieve: (token: string, options?: RequestOptions) => Promise<PublicFulfillment>;
|
|
69
71
|
/** The customer has it: the business gets its funds. */
|
|
70
72
|
confirmReceived: (token: string, options?: RequestOptions) => Promise<PublicFulfillment>;
|
|
73
|
+
/**
|
|
74
|
+
* Opens a claim about the payment that bought it, whatever the delivery's status; one not
|
|
75
|
+
* received yet goes to `problem` and its funds stay held. The delivery comes back with the
|
|
76
|
+
* claim (`claim`), whose page (`claim.url`) the customer follows.
|
|
77
|
+
*/
|
|
78
|
+
openClaim: (token: string, input: ClientClaimCreate, options?: RequestOptions) => Promise<PublicFulfillment>;
|
|
71
79
|
/** Something went wrong: the funds stay held while Billete reviews it. */
|
|
72
80
|
reportProblem: (token: string, input: ClientFulfillmentProblem, options?: RequestOptions) => Promise<PublicFulfillment>;
|
|
73
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* A claim about a payment, as its customer follows it. The `token` comes in its page's link
|
|
84
|
+
* (`url`), sent by email when it is opened, and is the only credential.
|
|
85
|
+
*/
|
|
86
|
+
claims: {
|
|
87
|
+
retrieve: (token: string, options?: RequestOptions) => Promise<PublicClaim>;
|
|
88
|
+
/** Writes to the business; the business is told. */
|
|
89
|
+
respond: (token: string, input: ClaimRespond, options?: RequestOptions) => Promise<PublicClaim>;
|
|
90
|
+
/** Drops it. A delivery it held stays held until it is confirmed received. */
|
|
91
|
+
withdraw: (token: string, options?: RequestOptions) => Promise<PublicClaim>;
|
|
92
|
+
};
|
|
74
93
|
paymentLinks: {
|
|
75
94
|
retrieve: (id: string, options?: RequestOptions) => Promise<PublicPaymentLink>;
|
|
76
95
|
createCheckout: (id: string, selection?: ClientLinkCheckout, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
@@ -101,10 +120,12 @@ export declare function createClient(options: ClientOptions): {
|
|
|
101
120
|
changeSeats: (id: string, input: ClientSubscriptionSeats, options?: RequestOptions) => Promise<CustomerSubscriptionChangeResult>;
|
|
102
121
|
/** Withdraws the mandate: renewals are then paid by hand from their Cobro. */
|
|
103
122
|
stopAutoCharge: (id: string, options?: RequestOptions) => Promise<CustomerSubscription>;
|
|
123
|
+
/** Opens a claim about one of the customer's payments (`PublicPortal.invoices[].payment`). */
|
|
124
|
+
openClaim: (input: ClientCustomerClaimCreate, options?: RequestOptions) => Promise<PublicClaim>;
|
|
104
125
|
features: (options?: RequestOptions) => Promise<List<CustomerFeature>>;
|
|
105
126
|
feature: (key: string, options?: RequestOptions) => Promise<CustomerFeature>;
|
|
106
127
|
};
|
|
107
128
|
};
|
|
108
129
|
type BilleteClient = ReturnType<typeof createClient>;
|
|
109
130
|
//#endregion
|
|
110
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix };
|
|
131
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentFeeDetails, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type SubscribableEventType, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WEBHOOK_TEST_EVENT, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix };
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-BfxFFQqw.js";
|
|
2
2
|
//#region src/create-client.ts
|
|
3
3
|
/**
|
|
4
4
|
* Browser client. It never holds a secret key: checkouts and Cobros are addressed by their
|
|
@@ -51,6 +51,14 @@ function createClient(options) {
|
|
|
51
51
|
});
|
|
52
52
|
const invoicePath = (id) => `/v1/client/invoices/${segment(id)}`;
|
|
53
53
|
const fulfillmentPath = (token) => `/v1/client/fulfillments/${segment(token)}`;
|
|
54
|
+
const claimPath = (token) => `/v1/client/claims/${segment(token)}`;
|
|
55
|
+
/** Opens a claim about the payment of a paid checkout or Cobro, from its page. */
|
|
56
|
+
const openClaim = (path) => (id, input, options) => http.request({
|
|
57
|
+
method: "POST",
|
|
58
|
+
path: `${path(id)}/claims`,
|
|
59
|
+
body: input,
|
|
60
|
+
options
|
|
61
|
+
});
|
|
54
62
|
return {
|
|
55
63
|
/** Offices offered by a carrier, refreshed daily by Billete. */
|
|
56
64
|
carrierOffices: (carrier, options) => http.request({
|
|
@@ -85,7 +93,8 @@ function createClient(options) {
|
|
|
85
93
|
body: input,
|
|
86
94
|
options
|
|
87
95
|
}),
|
|
88
|
-
...paymentCode(checkoutPath)
|
|
96
|
+
...paymentCode(checkoutPath),
|
|
97
|
+
openClaim: openClaim(checkoutPath)
|
|
89
98
|
},
|
|
90
99
|
invoices: {
|
|
91
100
|
retrieve: (id, options) => http.request({
|
|
@@ -106,7 +115,8 @@ function createClient(options) {
|
|
|
106
115
|
body: input,
|
|
107
116
|
options
|
|
108
117
|
}),
|
|
109
|
-
...paymentCode(invoicePath)
|
|
118
|
+
...paymentCode(invoicePath),
|
|
119
|
+
openClaim: openClaim(invoicePath)
|
|
110
120
|
},
|
|
111
121
|
/**
|
|
112
122
|
* A purchase's delivery, as its customer follows it. The `token` comes in the link of the
|
|
@@ -124,6 +134,17 @@ function createClient(options) {
|
|
|
124
134
|
path: `${fulfillmentPath(token)}/received`,
|
|
125
135
|
options
|
|
126
136
|
}),
|
|
137
|
+
/**
|
|
138
|
+
* Opens a claim about the payment that bought it, whatever the delivery's status; one not
|
|
139
|
+
* received yet goes to `problem` and its funds stay held. The delivery comes back with the
|
|
140
|
+
* claim (`claim`), whose page (`claim.url`) the customer follows.
|
|
141
|
+
*/
|
|
142
|
+
openClaim: (token, input, options) => http.request({
|
|
143
|
+
method: "POST",
|
|
144
|
+
path: `${fulfillmentPath(token)}/claims`,
|
|
145
|
+
body: input,
|
|
146
|
+
options
|
|
147
|
+
}),
|
|
127
148
|
/** Something went wrong: the funds stay held while Billete reviews it. */
|
|
128
149
|
reportProblem: (token, input, options) => http.request({
|
|
129
150
|
method: "POST",
|
|
@@ -132,6 +153,30 @@ function createClient(options) {
|
|
|
132
153
|
options
|
|
133
154
|
})
|
|
134
155
|
},
|
|
156
|
+
/**
|
|
157
|
+
* A claim about a payment, as its customer follows it. The `token` comes in its page's link
|
|
158
|
+
* (`url`), sent by email when it is opened, and is the only credential.
|
|
159
|
+
*/
|
|
160
|
+
claims: {
|
|
161
|
+
retrieve: (token, options) => http.request({
|
|
162
|
+
method: "GET",
|
|
163
|
+
path: claimPath(token),
|
|
164
|
+
options
|
|
165
|
+
}),
|
|
166
|
+
/** Writes to the business; the business is told. */
|
|
167
|
+
respond: (token, input, options) => http.request({
|
|
168
|
+
method: "POST",
|
|
169
|
+
path: `${claimPath(token)}/respond`,
|
|
170
|
+
body: input,
|
|
171
|
+
options
|
|
172
|
+
}),
|
|
173
|
+
/** Drops it. A delivery it held stays held until it is confirmed received. */
|
|
174
|
+
withdraw: (token, options) => http.request({
|
|
175
|
+
method: "POST",
|
|
176
|
+
path: `${claimPath(token)}/withdraw`,
|
|
177
|
+
options
|
|
178
|
+
})
|
|
179
|
+
},
|
|
135
180
|
paymentLinks: {
|
|
136
181
|
retrieve: (id, options) => http.request({
|
|
137
182
|
method: "GET",
|
|
@@ -211,6 +256,13 @@ list: (options) => http.request({
|
|
|
211
256
|
path: `/v1/client/customer/subscriptions/${segment(id)}/stop-auto-charge`,
|
|
212
257
|
options
|
|
213
258
|
}),
|
|
259
|
+
/** Opens a claim about one of the customer's payments (`PublicPortal.invoices[].payment`). */
|
|
260
|
+
openClaim: (input, options) => http.request({
|
|
261
|
+
method: "POST",
|
|
262
|
+
path: "/v1/client/customer/claims",
|
|
263
|
+
body: input,
|
|
264
|
+
options
|
|
265
|
+
}),
|
|
214
266
|
features: (options) => http.request({
|
|
215
267
|
method: "GET",
|
|
216
268
|
path: "/v1/client/customer/features",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as FulfillmentStatus, C as CheckoutPurpose, D as ClaimReason, E as ClaimOutcome, Ft as Subscription, Gt as ReceiptReference, Jt as ApiErrorBody, M as CustomField, O as ClaimStatus, Ot as Refund, P as CustomerDetails, Pt as SubmitLabel, Q as FulfillmentMethod, S as CheckoutItem, T as ClaimMessage, Tn as Environment, X as Fulfillment, Xt as ApiErrorType, _n as TaxBehavior, at as InvoiceStatus, b as CarrierOffice, bt as PlanPrice, c as AfterCompletion, cn as GracePeriodDays, en as Address, et as FulfillmentTracking, ft as PaymentFailure, gt as PaymentStatus, i as SubscribableEventType, in as BillingMonths, it as InvoiceReason, k as CollectSettings, mn as Metadata, on as Currency, ot as LineItem, q as FeatureReset, tn as AddressInput, v as CancellationFeedback, vn as Timestamp, wt as ProductCategory, xt as PlanSeats, y as Carrier } from "./events-CaNwG-EX.js";
|
|
2
2
|
//#region ../contracts/src/api-versions.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Billete API versions. Kept free of runtime dependencies: the dashboard, the API, the worker and
|
|
@@ -102,6 +102,8 @@ interface PublicPortal {
|
|
|
102
102
|
subscriptions: CustomerSubscription[];
|
|
103
103
|
/** The latest Cobros, newest first; open ones are paid on their page (`url`). */
|
|
104
104
|
invoices: PublicInvoice[];
|
|
105
|
+
/** The customer's latest claims, newest first; each is followed on its page (`url`). */
|
|
106
|
+
claims: PublicClaimSummary[];
|
|
105
107
|
}
|
|
106
108
|
/** Where a payment stands, as a payment page shows it. */
|
|
107
109
|
interface PublicPaymentState {
|
|
@@ -277,6 +279,8 @@ interface PublicFulfillment {
|
|
|
277
279
|
} | null;
|
|
278
280
|
canceledAt: Timestamp | null;
|
|
279
281
|
cancellationReason: Fulfillment["cancellationReason"];
|
|
282
|
+
/** The latest claim about it, followed on its page (`url`); `null` without one. */
|
|
283
|
+
claim: PublicClaimSummary | null;
|
|
280
284
|
}
|
|
281
285
|
/**
|
|
282
286
|
* The step a provider asks of the payer after starting a charge: leave for its page and come back
|
|
@@ -429,6 +433,59 @@ interface PublicPaymentLink {
|
|
|
429
433
|
allowCoupons: boolean;
|
|
430
434
|
submitLabel: SubmitLabel;
|
|
431
435
|
}
|
|
436
|
+
/** A claim as its customer sees it in a list: where it stands and the page to follow it. */
|
|
437
|
+
interface PublicClaimSummary {
|
|
438
|
+
id: string;
|
|
439
|
+
/** The claim's page; the link carries the only credential. */
|
|
440
|
+
url: string;
|
|
441
|
+
paymentId: string;
|
|
442
|
+
reason: ClaimReason;
|
|
443
|
+
status: ClaimStatus;
|
|
444
|
+
createdAt: Timestamp;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* A claim as its customer follows it, on the page their emails link to (`url`): the
|
|
448
|
+
* conversation with the business and how it ended. The link carries the only credential.
|
|
449
|
+
*/
|
|
450
|
+
interface PublicClaim extends PublicClaimSummary {
|
|
451
|
+
object: "claim";
|
|
452
|
+
environment: Environment;
|
|
453
|
+
merchant: {
|
|
454
|
+
name: string;
|
|
455
|
+
supportEmail: string | null;
|
|
456
|
+
supportPhone: string | null;
|
|
457
|
+
};
|
|
458
|
+
description: string;
|
|
459
|
+
messages: ClaimMessage[];
|
|
460
|
+
/** What the claim is about: the payment and what it bought. */
|
|
461
|
+
payment: {
|
|
462
|
+
amount: number;
|
|
463
|
+
currency: Currency;
|
|
464
|
+
paidAt: Timestamp;
|
|
465
|
+
items: Array<{
|
|
466
|
+
name: string;
|
|
467
|
+
quantity: number;
|
|
468
|
+
}>;
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* The delivery of the purchase, when it has one, and its page (`url`). A claim keeps a delivery
|
|
472
|
+
* not yet received in `problem`, with its funds held, until the customer confirms it there or
|
|
473
|
+
* the payment is refunded.
|
|
474
|
+
*/
|
|
475
|
+
fulfillment: {
|
|
476
|
+
method: FulfillmentMethod;
|
|
477
|
+
status: FulfillmentStatus;
|
|
478
|
+
url: string;
|
|
479
|
+
} | null;
|
|
480
|
+
resolution: {
|
|
481
|
+
outcome: ClaimOutcome;
|
|
482
|
+
note: string;
|
|
483
|
+
refund: Pick<Refund, "amount" | "currency" | "status"> | null;
|
|
484
|
+
resolvedAt: Timestamp;
|
|
485
|
+
} | null;
|
|
486
|
+
withdrawnAt: Timestamp | null;
|
|
487
|
+
updatedAt: Timestamp;
|
|
488
|
+
}
|
|
432
489
|
//#endregion
|
|
433
490
|
//#region ../contracts/src/inputs.d.ts
|
|
434
491
|
/** Identifiers merchants choose and use in code: `ai_tokens`, `export-pdf`. */
|
|
@@ -833,7 +890,7 @@ interface RefundCreate {
|
|
|
833
890
|
reason?: string;
|
|
834
891
|
}
|
|
835
892
|
/** An event type, or `*` for every event. */
|
|
836
|
-
type EventSelector = "*" |
|
|
893
|
+
type EventSelector = "*" | SubscribableEventType;
|
|
837
894
|
interface WebhookEndpointCreate {
|
|
838
895
|
url: string;
|
|
839
896
|
events: EventSelector[];
|
|
@@ -916,6 +973,35 @@ interface FulfillmentTrackingInput {
|
|
|
916
973
|
interface ClientFulfillmentProblem {
|
|
917
974
|
comment: string;
|
|
918
975
|
}
|
|
976
|
+
/** Opens a claim about a payment, from the customer's page of it. */
|
|
977
|
+
interface ClientClaimCreate {
|
|
978
|
+
reason: ClaimReason;
|
|
979
|
+
/** What went wrong, in the customer's words. */
|
|
980
|
+
description: string;
|
|
981
|
+
}
|
|
982
|
+
/** Opens a claim from the customer portal, about one of the customer's payments. */
|
|
983
|
+
interface ClientCustomerClaimCreate extends ClientClaimCreate {
|
|
984
|
+
/** The payment's ID (`pay_…`), as each Cobro of the portal shows it. */
|
|
985
|
+
payment: string;
|
|
986
|
+
}
|
|
987
|
+
/** A message added to a claim's conversation. */
|
|
988
|
+
interface ClaimRespond {
|
|
989
|
+
message: string;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Closes a claim. In the customer's favor it may refund the payment in the same step (`refund`:
|
|
993
|
+
* what is left of it, or `amount`), through the same refund as `POST /v1/payments/:payment/refunds`.
|
|
994
|
+
*/
|
|
995
|
+
type ClaimResolve = {
|
|
996
|
+
outcome: "customer";
|
|
997
|
+
note: string;
|
|
998
|
+
refund?: {
|
|
999
|
+
amount?: number;
|
|
1000
|
+
};
|
|
1001
|
+
} | {
|
|
1002
|
+
outcome: "business";
|
|
1003
|
+
note: string;
|
|
1004
|
+
};
|
|
919
1005
|
//#endregion
|
|
920
1006
|
//#region src/http.d.ts
|
|
921
1007
|
interface TransportOptions {
|
|
@@ -951,7 +1037,7 @@ declare class BilleteError extends Error {
|
|
|
951
1037
|
readonly requestId?: string;
|
|
952
1038
|
constructor(body: Omit<ApiErrorBody, "type"> & {
|
|
953
1039
|
type: ApiErrorType | "network";
|
|
954
|
-
}, status: number);
|
|
1040
|
+
}, status: number, options?: ErrorOptions);
|
|
955
1041
|
}
|
|
956
1042
|
//#endregion
|
|
957
|
-
export {
|
|
1043
|
+
export { ProductLinkCreate as $, EventSelector as A, API_VERSION_PATTERN as At, PaymentLinkCreate as B, isApiVersionRetired as Bt, CustomFieldInput as C, PublicFulfillment as Ct, CustomerMemberUpdate as D, PublicPortal as Dt, CustomerMemberCreate as E, PublicPaymentState as Et, FulfillmentInput as F, LatestApiVersion as Ft, PlanFeaturesInput as G, PlanCheckoutCreate as H, FulfillmentTrackingInput as I, apiVersionLifecycle as It, PlanUpdate as J, PlanLinkCreate as K, InvoiceCreate as L, apiVersionStage as Lt, FeatureOperationCommit as M, ApiVersionLifecycle as Mt, FeatureOperationCreate as N, ApiVersionStage as Nt, CustomerSessionCreate as O, API_VERSIONS as Ot, FeatureUpdate as P, LATEST_API_VERSION as Pt, ProductCreate as Q, InvoiceLineInput as R, currentApiVersion as Rt, CouponUpdate as S, PublicClaimSummary as St, CustomerInput as T, PublicPaymentLink as Tt, PlanCouponCreate as U, PaymentLinkUpdate as V, supportedApiVersions as Vt, PlanCreate as W, ProductCheckoutCreate as X, PortalSessionCreate as Y, ProductCouponCreate as Z, ClientSubscriptionCancel as _, PaymentNextAction as _t, CheckoutCreate as a, SubscriptionChangePreviewInput as at, CollectInput as b, PublicCheckout as bt, ClaimRespond as c, VariantInput as ct, ClientClaimCreate as d, CustomerSubscription as dt, ProductUpdate as et, ClientCustomerClaimCreate as f, CustomerSubscriptionChangeResult as ft, ClientPaymentCode as g, PaymentMethodOption as gt, ClientLinkCheckout as h, PaymentMethodField as ht, AfterCompletionInput as i, SubscriptionChangeCreate as it, FeatureCreate as j, ApiVersion as jt, CustomerUpdate as k, API_VERSION_HEADER as kt, ClientCheckoutPay as l, WebhookEndpointCreate as lt, ClientInvoicePay as m, PaymentInstructions as mt, RequestOptions as n, RetireInput as nt, CheckoutItemInput as o, SubscriptionCreate as ot, ClientFulfillmentProblem as p, FulfillmentOption as pt, PlanPriceInput as q, TransportOptions as r, SubscriptionCancel as rt, ClaimResolve as s, SubscriptionUpdate as st, BilleteError as t, RefundCreate as tt, ClientCheckoutUpdate as u, WebhookEndpointUpdate as ut, ClientSubscriptionSeats as v, PaymentTestScenario as vt, CustomerCreate as w, PublicInvoice as wt, CouponCreate as x, PublicClaim as xt, ClientSubscriptionUpdate as y, PortalFeatures as yt, KEY_PATTERN as z, isApiVersion as zt };
|
|
@@ -938,12 +938,24 @@ interface PaymentAttempt {
|
|
|
938
938
|
}
|
|
939
939
|
declare const PAYMENT_STATUSES: readonly ["pending", "failed", "succeeded", "refunded", "partially_refunded"];
|
|
940
940
|
type PaymentStatus = (typeof PAYMENT_STATUSES)[number];
|
|
941
|
-
/**
|
|
941
|
+
/** What makes up a settled payment's fee, in its settlement currency: `platform + method = fee`. */
|
|
942
|
+
interface PaymentFeeDetails {
|
|
943
|
+
/** Billete's fee. */
|
|
944
|
+
platform: number;
|
|
945
|
+
/** The payment method's fee (a percentage and a fixed part); `0` for payments before it existed. */
|
|
946
|
+
method: number;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* How the money actually moved: the charged currency, conversion, the fees the business pays
|
|
950
|
+
* (`fee`, Billete's and the payment method's together) and its net (`amount - fee`).
|
|
951
|
+
*/
|
|
942
952
|
interface PaymentSettlement {
|
|
943
953
|
amount: number;
|
|
944
954
|
currency: Currency;
|
|
945
955
|
exchangeRate: string | null;
|
|
946
956
|
fee: number;
|
|
957
|
+
/** `fee` split into Billete's and the payment method's. */
|
|
958
|
+
feeDetails?: PaymentFeeDetails;
|
|
947
959
|
net: number;
|
|
948
960
|
}
|
|
949
961
|
interface Payment extends Resource<"payment"> {
|
|
@@ -987,6 +999,58 @@ interface Refund extends Resource<"refund"> {
|
|
|
987
999
|
mode: "provider" | "manual";
|
|
988
1000
|
status: "pending" | "succeeded" | "failed";
|
|
989
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Why a customer opened a claim. `not_received`: they paid and nothing arrived. `overcharged`:
|
|
1004
|
+
* they were charged more than agreed. `unrecognized`: they do not recognize the payment.
|
|
1005
|
+
* `order_issue`: the purchase came damaged, incomplete or is not what they ordered. `other`.
|
|
1006
|
+
*/
|
|
1007
|
+
declare const CLAIM_REASONS: readonly ["not_received", "overcharged", "unrecognized", "order_issue", "other"];
|
|
1008
|
+
type ClaimReason = (typeof CLAIM_REASONS)[number];
|
|
1009
|
+
/**
|
|
1010
|
+
* - `open`: the customer opened it; the business has not answered yet.
|
|
1011
|
+
* - `under_review`: the business answered and is working on it.
|
|
1012
|
+
* - `resolved`: the business closed it, in the customer's favor or in its own (`resolution`).
|
|
1013
|
+
* - `withdrawn`: the customer withdrew it, or confirmed receiving the purchase it was about.
|
|
1014
|
+
*/
|
|
1015
|
+
declare const CLAIM_STATUSES: readonly ["open", "under_review", "resolved", "withdrawn"];
|
|
1016
|
+
type ClaimStatus = (typeof CLAIM_STATUSES)[number];
|
|
1017
|
+
/** In whose favor a claim was resolved. */
|
|
1018
|
+
declare const CLAIM_OUTCOMES: readonly ["customer", "business"];
|
|
1019
|
+
type ClaimOutcome = (typeof CLAIM_OUTCOMES)[number];
|
|
1020
|
+
/** One message of a claim's conversation between the customer and the business. */
|
|
1021
|
+
interface ClaimMessage {
|
|
1022
|
+
id: string;
|
|
1023
|
+
author: "customer" | "business";
|
|
1024
|
+
body: string;
|
|
1025
|
+
createdAt: Timestamp;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* A customer's claim about a payment ("reclamo"): what went wrong, the conversation with the
|
|
1029
|
+
* business and how it ended. Opening one never moves money; resolving it in the customer's favor
|
|
1030
|
+
* may refund the payment (`resolution.refundId`).
|
|
1031
|
+
*/
|
|
1032
|
+
interface Claim extends Resource<"claim"> {
|
|
1033
|
+
paymentId: string;
|
|
1034
|
+
/** The delivery it is about, when the payment's purchase has one. */
|
|
1035
|
+
fulfillmentId: string | null;
|
|
1036
|
+
customerId: string;
|
|
1037
|
+
reason: ClaimReason;
|
|
1038
|
+
/** What the customer said when opening it. */
|
|
1039
|
+
description: string;
|
|
1040
|
+
status: ClaimStatus;
|
|
1041
|
+
/** What the customer and the business wrote after opening it, oldest first. */
|
|
1042
|
+
messages: ClaimMessage[];
|
|
1043
|
+
resolution: {
|
|
1044
|
+
outcome: ClaimOutcome;
|
|
1045
|
+
/** What the business told the customer. */
|
|
1046
|
+
note: string;
|
|
1047
|
+
/** The refund issued when resolving it in the customer's favor. */
|
|
1048
|
+
refundId: string | null;
|
|
1049
|
+
resolvedAt: Timestamp;
|
|
1050
|
+
} | null;
|
|
1051
|
+
withdrawnAt: Timestamp | null;
|
|
1052
|
+
updatedAt: Timestamp;
|
|
1053
|
+
}
|
|
990
1054
|
interface BalanceAmount {
|
|
991
1055
|
amount: number;
|
|
992
1056
|
currency: Currency;
|
|
@@ -1018,7 +1082,7 @@ interface WebhookEndpoint extends Resource<"webhook_endpoint"> {
|
|
|
1018
1082
|
*/
|
|
1019
1083
|
apiVersion: string;
|
|
1020
1084
|
enabled: boolean;
|
|
1021
|
-
/** Returned only when the endpoint is created. */
|
|
1085
|
+
/** Returned only when the endpoint is created or its secret is rolled. */
|
|
1022
1086
|
secret?: string;
|
|
1023
1087
|
}
|
|
1024
1088
|
interface Event<TData = Record<string, unknown>> extends Resource<"event"> {
|
|
@@ -1090,6 +1154,14 @@ interface EventDataMap {
|
|
|
1090
1154
|
"fulfillment.problem_reported": Fulfillment;
|
|
1091
1155
|
/** Its payment was fully refunded, or it was not shipped in time. */
|
|
1092
1156
|
"fulfillment.canceled": Fulfillment;
|
|
1157
|
+
/** A customer opened a claim about a payment. Opening it moves no money. */
|
|
1158
|
+
"claim.created": Claim;
|
|
1159
|
+
/** A new message in its conversation, or the business started reviewing it. */
|
|
1160
|
+
"claim.updated": Claim;
|
|
1161
|
+
/** The business resolved it (`resolution`): in the customer's favor, maybe with a refund, or its own. */
|
|
1162
|
+
"claim.resolved": Claim;
|
|
1163
|
+
/** The customer withdrew it, or confirmed receiving the purchase it was about. */
|
|
1164
|
+
"claim.withdrawn": Claim;
|
|
1093
1165
|
"refund.created": Refund;
|
|
1094
1166
|
/** The provider could not return the funds; the amount is back in the balance. */
|
|
1095
1167
|
"refund.failed": Refund;
|
|
@@ -1108,9 +1180,18 @@ interface EventDataMap {
|
|
|
1108
1180
|
"subscription.canceled": Subscription;
|
|
1109
1181
|
/** Grace period over without payment; access is revoked. */
|
|
1110
1182
|
"subscription.expired": Subscription;
|
|
1183
|
+
/**
|
|
1184
|
+
* Sent on request to a single endpoint, to check that it receives and verifies deliveries.
|
|
1185
|
+
* Nothing happened in the business; it never reaches other endpoints and is not subscribable.
|
|
1186
|
+
*/
|
|
1187
|
+
"webhook_endpoint.test": WebhookEndpoint;
|
|
1111
1188
|
}
|
|
1112
1189
|
type EventType = keyof EventDataMap;
|
|
1113
|
-
|
|
1190
|
+
/** The event a business sends itself to try an endpoint. */
|
|
1191
|
+
declare const WEBHOOK_TEST_EVENT: "webhook_endpoint.test";
|
|
1192
|
+
/** What a webhook endpoint can subscribe to: everything that happens in a business. */
|
|
1193
|
+
type SubscribableEventType = Exclude<EventType, typeof WEBHOOK_TEST_EVENT>;
|
|
1194
|
+
declare const EVENT_TYPES: readonly ["product.retired", "product.updated", "payment_link.retired", "customer.created", "customer.updated", "customer.member_added", "customer.member_removed", "subscription.change_failed", "checkout.completed", "checkout.expired", "payment.succeeded", "payment.failed", "payment.refunded", "fulfillment.created", "fulfillment.shipped", "fulfillment.ready_for_pickup", "fulfillment.delivered", "fulfillment.received", "fulfillment.problem_reported", "fulfillment.canceled", "claim.created", "claim.updated", "claim.resolved", "claim.withdrawn", "refund.created", "refund.failed", "invoice.created", "invoice.paid", "invoice.voided", "invoice.uncollectible", "subscription.created", "subscription.updated", "subscription.renewal_due", "subscription.renewed", "subscription.past_due", "subscription.canceled", "subscription.expired"];
|
|
1114
1195
|
/** A delivered webhook, discriminated by `type` so `data` narrows automatically. */
|
|
1115
1196
|
type WebhookEvent = { [TType in EventType]: {
|
|
1116
1197
|
id: string;
|
|
@@ -1123,4 +1204,4 @@ type WebhookEvent = { [TType in EventType]: {
|
|
|
1123
1204
|
data: EventDataMap[TType];
|
|
1124
1205
|
}; }[EventType];
|
|
1125
1206
|
//#endregion
|
|
1126
|
-
export {
|
|
1207
|
+
export { FulfillmentStatus as $, ACCOUNT_NUMBER_LENGTH as $t, Coupon as A, Retirement as At, ExchangeRate as B, SubscriptionStatus as Bt, CheckoutPurpose as C, nationalPhone as Cn, Product as Ct, ClaimReason as D, tokenEnvironment as Dn, RISK_LEVELS as Dt, ClaimOutcome as E, TokenKind as En, RESET_FREQUENCIES as Et, CustomerFeature as F, Subscription as Ft, FeatureOperation as G, ReceiptReference as Gt, FULFILLMENT_METHODS as H, USAGE_FEATURE_TYPES as Ht, CustomerMember as I, SubscriptionChange as It, FeatureType as J, ApiErrorBody as Jt, FeatureOperationResult as K, ReceiptSend as Kt, CustomerMemberList as L, SubscriptionChangePreview as Lt, CustomField as M, SUBMIT_LABELS as Mt, Customer as N, SUBSCRIPTION_STATUSES as Nt, ClaimStatus as O, tokenPrefix as On, Refund as Ot, CustomerDetails as P, SubmitLabel as Pt, FulfillmentMethod as Q, PaymentFailureCode as Qt, CustomerSession as R, SubscriptionChangeResult as Rt, CheckoutItem as S, isMobilePhone as Sn, PortalSession as St, ClaimMessage as T, Environment as Tn, ProductVariant as Tt, FULFILLMENT_STATUSES as U, WebhookEndpoint as Ut, FEATURE_TYPES as V, SubscriptionTerms as Vt, Feature as W, Weekday as Wt, Fulfillment as X, ApiErrorType as Xt, FeatureUsageResult as Y, ApiErrorEnvelope as Yt, FulfillmentChoice as Z, PAYMENT_FAILURE_CODES as Zt, CLAIM_STATUSES as _, TaxBehavior as _n, Payout as _t, WEBHOOK_TEST_EVENT as a, CURRENCIES as an, InvoiceStatus as at, CarrierOffice as b, findBank as bn, PlanPrice as bt, AfterCompletion as c, GracePeriodDays as cn, PAYMENT_STATUSES as ct, CANCELLATION_FEEDBACK as d, ListSort as dn, PaymentAttempt as dt, Address as en, FulfillmentTracking as et, CARRIERS as f, MAX_QUANTITY as fn, PaymentFailure as ft, CLAIM_REASONS as g, TAX_BEHAVIORS as gn, PaymentStatus as gt, CLAIM_OUTCOMES as h, MobilePrefix as hn, PaymentSettlement as ht, SubscribableEventType as i, BillingMonths as in, InvoiceReason as it, CurrencyAvailability as j, RiskLevel as jt, CollectSettings as k, ResetFrequency as kt, Balance as l, List as ln, PRODUCT_CATEGORIES as lt, CHECKOUT_PURPOSES as m, Metadata as mn, PaymentLink as mt, EventDataMap as n, BILLING_MONTHS as nn, INVOICE_STATUSES as nt, WebhookEvent as o, Currency as on, LineItem as ot, CARRIER_TEST_SCENARIOS as p, MOBILE_PREFIXES as pn, PaymentFeeDetails as pt, FeatureReset as q, API_ERROR_TYPES as qt, EventType as r, BankCode as rn, Invoice as rt, Actor as s, GRACE_PERIOD_DAYS as sn, MAX_SEATS as st, EVENT_TYPES as t, AddressInput as tn, INVOICE_REASONS as tt, BalanceAmount as u, ListQuery as un, Payment as ut, CancellationFeedback as v, Timestamp as vn, Plan as vt, Claim as w, ENVIRONMENTS as wn, ProductCategory as wt, Checkout as x, isLandlinePhone as xn, PlanSeats as xt, Carrier as y, VENEZUELAN_BANKS as yn, PlanFeatureValues as yt, Event as z, SubscriptionRenewal as zt };
|
|
@@ -6,8 +6,8 @@ var BilleteError = class extends Error {
|
|
|
6
6
|
status;
|
|
7
7
|
param;
|
|
8
8
|
requestId;
|
|
9
|
-
constructor(body, status) {
|
|
10
|
-
super(body.message);
|
|
9
|
+
constructor(body, status, options) {
|
|
10
|
+
super(body.message, options);
|
|
11
11
|
this.name = "BilleteError";
|
|
12
12
|
this.type = body.type;
|
|
13
13
|
this.code = body.code;
|
|
@@ -18,7 +18,7 @@ var BilleteError = class extends Error {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/http.ts
|
|
21
|
-
const SDK_VERSION = "4.
|
|
21
|
+
const SDK_VERSION = "4.3.0";
|
|
22
22
|
const DEFAULT_BASE_URL = "https://api.billete.run";
|
|
23
23
|
const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
|
|
24
24
|
429,
|
|
@@ -91,7 +91,7 @@ function createTransport(options) {
|
|
|
91
91
|
type: "network",
|
|
92
92
|
code: "network_error",
|
|
93
93
|
message: `Could not reach Billete: ${response.message}`
|
|
94
|
-
}, 0);
|
|
94
|
+
}, 0, { cause: response });
|
|
95
95
|
if (!response.ok) throw await toError(response);
|
|
96
96
|
return response.status === 204 ? void 0 : await response.json();
|
|
97
97
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as ProductLinkCreate, A as EventSelector, At as API_VERSION_PATTERN, B as PaymentLinkCreate, Bt as isApiVersionRetired, C as CustomFieldInput, Ct as PublicFulfillment, D as CustomerMemberUpdate, Dt as PublicPortal, E as CustomerMemberCreate, Et as PublicPaymentState, F as FulfillmentInput, Ft as LatestApiVersion, G as PlanFeaturesInput, H as PlanCheckoutCreate, I as FulfillmentTrackingInput, It as apiVersionLifecycle, J as PlanUpdate, K as PlanLinkCreate, L as InvoiceCreate, Lt as apiVersionStage, M as FeatureOperationCommit, Mt as ApiVersionLifecycle, N as FeatureOperationCreate, Nt as ApiVersionStage, O as CustomerSessionCreate, Ot as API_VERSIONS, P as FeatureUpdate, Pt as LATEST_API_VERSION, Q as ProductCreate, R as InvoiceLineInput, Rt as currentApiVersion, S as CouponUpdate, St as PublicClaimSummary, T as CustomerInput, Tt as PublicPaymentLink, U as PlanCouponCreate, V as PaymentLinkUpdate, Vt as supportedApiVersions, W as PlanCreate, X as ProductCheckoutCreate, Y as PortalSessionCreate, Z as ProductCouponCreate, _ as ClientSubscriptionCancel, _t as PaymentNextAction, a as CheckoutCreate, at as SubscriptionChangePreviewInput, b as CollectInput, bt as PublicCheckout, c as ClaimRespond, ct as VariantInput, d as ClientClaimCreate, dt as CustomerSubscription, et as ProductUpdate, f as ClientCustomerClaimCreate, ft as CustomerSubscriptionChangeResult, g as ClientPaymentCode, gt as PaymentMethodOption, h as ClientLinkCheckout, ht as PaymentMethodField, i as AfterCompletionInput, it as SubscriptionChangeCreate, j as FeatureCreate, jt as ApiVersion, k as CustomerUpdate, kt as API_VERSION_HEADER, l as ClientCheckoutPay, lt as WebhookEndpointCreate, m as ClientInvoicePay, mt as PaymentInstructions, n as RequestOptions, nt as RetireInput, o as CheckoutItemInput, ot as SubscriptionCreate, p as ClientFulfillmentProblem, pt as FulfillmentOption, q as PlanPriceInput, r as TransportOptions, rt as SubscriptionCancel, s as ClaimResolve, st as SubscriptionUpdate, t as BilleteError, tt as RefundCreate, u as ClientCheckoutUpdate, ut as WebhookEndpointUpdate, v as ClientSubscriptionSeats, vt as PaymentTestScenario, w as CustomerCreate, wt as PublicInvoice, x as CouponCreate, xt as PublicClaim, y as ClientSubscriptionUpdate, yt as PortalFeatures, z as KEY_PATTERN, zt as isApiVersion } from "./errors-DCiynKkL.js";
|
|
2
|
+
import { $ as FulfillmentStatus, $t as ACCOUNT_NUMBER_LENGTH, A as Coupon, At as Retirement, B as ExchangeRate, Bt as SubscriptionStatus, C as CheckoutPurpose, Cn as nationalPhone, Ct as Product, D as ClaimReason, Dn as tokenEnvironment, Dt as RISK_LEVELS, E as ClaimOutcome, En as TokenKind, Et as RESET_FREQUENCIES, F as CustomerFeature, Ft as Subscription, G as FeatureOperation, Gt as ReceiptReference, H as FULFILLMENT_METHODS, Ht as USAGE_FEATURE_TYPES, I as CustomerMember, It as SubscriptionChange, J as FeatureType, Jt as ApiErrorBody, K as FeatureOperationResult, Kt as ReceiptSend, L as CustomerMemberList, Lt as SubscriptionChangePreview, M as CustomField, Mt as SUBMIT_LABELS, N as Customer, Nt as SUBSCRIPTION_STATUSES, O as ClaimStatus, On as tokenPrefix, Ot as Refund, P as CustomerDetails, Pt as SubmitLabel, Q as FulfillmentMethod, Qt as PaymentFailureCode, R as CustomerSession, Rt as SubscriptionChangeResult, S as CheckoutItem, Sn as isMobilePhone, St as PortalSession, T as ClaimMessage, Tn as Environment, Tt as ProductVariant, U as FULFILLMENT_STATUSES, Ut as WebhookEndpoint, V as FEATURE_TYPES, Vt as SubscriptionTerms, W as Feature, Wt as Weekday, X as Fulfillment, Xt as ApiErrorType, Y as FeatureUsageResult, Yt as ApiErrorEnvelope, Z as FulfillmentChoice, Zt as PAYMENT_FAILURE_CODES, _ as CLAIM_STATUSES, _n as TaxBehavior, _t as Payout, a as WEBHOOK_TEST_EVENT, an as CURRENCIES, at as InvoiceStatus, b as CarrierOffice, bn as findBank, bt as PlanPrice, c as AfterCompletion, cn as GracePeriodDays, ct as PAYMENT_STATUSES, d as CANCELLATION_FEEDBACK, dn as ListSort, dt as PaymentAttempt, en as Address, et as FulfillmentTracking, f as CARRIERS, fn as MAX_QUANTITY, ft as PaymentFailure, g as CLAIM_REASONS, gn as TAX_BEHAVIORS, gt as PaymentStatus, h as CLAIM_OUTCOMES, hn as MobilePrefix, ht as PaymentSettlement, i as SubscribableEventType, in as BillingMonths, it as InvoiceReason, j as CurrencyAvailability, jt as RiskLevel, k as CollectSettings, kt as ResetFrequency, l as Balance, ln as List, lt as PRODUCT_CATEGORIES, m as CHECKOUT_PURPOSES, mn as Metadata, mt as PaymentLink, n as EventDataMap, nn as BILLING_MONTHS, nt as INVOICE_STATUSES, o as WebhookEvent, on as Currency, ot as LineItem, p as CARRIER_TEST_SCENARIOS, pn as MOBILE_PREFIXES, pt as PaymentFeeDetails, q as FeatureReset, qt as API_ERROR_TYPES, r as EventType, rn as BankCode, rt as Invoice, s as Actor, sn as GRACE_PERIOD_DAYS, st as MAX_SEATS, t as EVENT_TYPES, tn as AddressInput, tt as INVOICE_REASONS, u as BalanceAmount, un as ListQuery, ut as Payment, v as CancellationFeedback, vn as Timestamp, vt as Plan, w as Claim, wn as ENVIRONMENTS, wt as ProductCategory, x as Checkout, xn as isLandlinePhone, xt as PlanSeats, y as Carrier, yn as VENEZUELAN_BANKS, yt as PlanFeatureValues, z as Event, zt as SubscriptionRenewal } from "./events-CaNwG-EX.js";
|
|
3
3
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
4
4
|
//#region src/server.d.ts
|
|
5
5
|
type Filters<T> = ListQuery & T;
|
|
@@ -274,6 +274,34 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
274
274
|
/** You handed it over: the customer has 48 hours to confirm it or report a problem. */
|
|
275
275
|
deliver: (id: string, options?: RequestOptions) => Promise<Fulfillment>;
|
|
276
276
|
};
|
|
277
|
+
claims: {
|
|
278
|
+
retrieve: (id: string, options?: RequestOptions) => Promise<Claim>;
|
|
279
|
+
list: (query?: Filters<{
|
|
280
|
+
status?: ClaimStatus;
|
|
281
|
+
/** A payment's claims (`pay_…`). */
|
|
282
|
+
payment?: string;
|
|
283
|
+
customer?: string;
|
|
284
|
+
/** `search`: part of the claim's or the payment's ID, or of the customer's name or email. */
|
|
285
|
+
search?: string;
|
|
286
|
+
sort?: ListSort<"created">;
|
|
287
|
+
}>, options?: RequestOptions) => Promise<List<Claim>>;
|
|
288
|
+
iterate: (query?: Filters<{
|
|
289
|
+
status?: ClaimStatus;
|
|
290
|
+
/** A payment's claims (`pay_…`). */
|
|
291
|
+
payment?: string;
|
|
292
|
+
customer?: string;
|
|
293
|
+
/** `search`: part of the claim's or the payment's ID, or of the customer's name or email. */
|
|
294
|
+
search?: string;
|
|
295
|
+
sort?: ListSort<"created">;
|
|
296
|
+
}>) => AsyncGenerator<Claim, any, any>;
|
|
297
|
+
/** Answers the customer, who gets it by email; the first answer puts it `under_review`. */
|
|
298
|
+
respond: (id: string, input: ClaimRespond, options?: RequestOptions) => Promise<Claim>;
|
|
299
|
+
/**
|
|
300
|
+
* Closes it with your decision. In the customer's favor, `refund` refunds the payment in the
|
|
301
|
+
* same step (what is left of it, or `amount`).
|
|
302
|
+
*/
|
|
303
|
+
resolve: (id: string, input: ClaimResolve, options?: RequestOptions) => Promise<Claim>;
|
|
304
|
+
};
|
|
277
305
|
balance: {
|
|
278
306
|
retrieve: (options?: RequestOptions) => Promise<Balance>;
|
|
279
307
|
};
|
|
@@ -322,4 +350,4 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
322
350
|
/** The server client: what `createBillete` returns. */
|
|
323
351
|
type Billete = ReturnType<typeof createBillete>;
|
|
324
352
|
//#endregion
|
|
325
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, WebhookVerificationError, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
|
353
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentFeeDetails, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type SubscribableEventType, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WEBHOOK_TEST_EVENT, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, WebhookVerificationError, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-BfxFFQqw.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
3
|
//#region ../contracts/src/environment.ts
|
|
4
4
|
/**
|
|
@@ -365,6 +365,30 @@ create: (input, options) => http.request({
|
|
|
365
365
|
options
|
|
366
366
|
})
|
|
367
367
|
};
|
|
368
|
+
const claimCrud = collection(http, "/v1/claims");
|
|
369
|
+
/** Your customers' claims about their payments: the conversation and how each one ends. */
|
|
370
|
+
const claims = {
|
|
371
|
+
retrieve: claimCrud.retrieve,
|
|
372
|
+
list: claimCrud.list,
|
|
373
|
+
iterate: claimCrud.iterate,
|
|
374
|
+
/** Answers the customer, who gets it by email; the first answer puts it `under_review`. */
|
|
375
|
+
respond: (id, input, options) => http.request({
|
|
376
|
+
method: "POST",
|
|
377
|
+
path: `/v1/claims/${segment(id)}/respond`,
|
|
378
|
+
body: input,
|
|
379
|
+
options
|
|
380
|
+
}),
|
|
381
|
+
/**
|
|
382
|
+
* Closes it with your decision. In the customer's favor, `refund` refunds the payment in the
|
|
383
|
+
* same step (what is left of it, or `amount`).
|
|
384
|
+
*/
|
|
385
|
+
resolve: (id, input, options) => http.request({
|
|
386
|
+
method: "POST",
|
|
387
|
+
path: `/v1/claims/${segment(id)}/resolve`,
|
|
388
|
+
body: input,
|
|
389
|
+
options
|
|
390
|
+
})
|
|
391
|
+
};
|
|
368
392
|
const balance = { retrieve: (options) => http.request({
|
|
369
393
|
method: "GET",
|
|
370
394
|
path: "/v1/balance",
|
|
@@ -400,6 +424,7 @@ create: (input, options) => http.request({
|
|
|
400
424
|
subscriptions,
|
|
401
425
|
payments,
|
|
402
426
|
fulfillments,
|
|
427
|
+
claims,
|
|
403
428
|
balance,
|
|
404
429
|
payouts,
|
|
405
430
|
webhookEndpoints,
|
package/dist/webhooks.d.ts
CHANGED