@boelabs/billete-sdk 1.1.0-canary.0 → 1.1.0-canary.2
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 +25 -3
- package/dist/client.js +36 -3
- package/dist/{errors-BHogREk2.d.ts → errors-Cge22x5-.d.ts} +41 -3
- package/dist/{events-CY9OmXuK.d.ts → events-71Q43Ni8.d.ts} +5 -1
- package/dist/{http-rXFglJqP.js → http-B3vk4X4A.js} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -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 RISK_LEVELS, A as INVOICE_REASONS, At as ListQuery, B as PaymentFailure, Bt as isLandlinePhone, C as Event, Ct as BankCode, D as FeatureReset, Dt as GRACE_PERIOD_DAYS, E as Feature, Et as Currency, F as LineItem, Ft as TAX_BEHAVIORS, G as Plan, Gt as TokenKind, H as PaymentSettlement, Ht as nationalPhone, I as PAYMENT_STATUSES, It as TaxBehavior, J as PortalSession, K as PlanFeatureValues, Kt as tokenEnvironment, L as PRODUCT_CATEGORIES, Lt as Timestamp, M as Invoice, Mt as MOBILE_PREFIXES, N as InvoiceReason, Nt as Metadata, O as FeatureType, Ot as GracePeriodDays, P as InvoiceStatus, Pt as MobilePrefix, Q as RESET_FREQUENCIES, R as Payment, Rt as VENEZUELAN_BANKS, S as CustomerSession, St as BILLING_MONTHS, T as FEATURE_TYPES, Tt as CURRENCIES, U as PaymentStatus, Ut as ENVIRONMENTS, V as PaymentLink, Vt as isMobilePhone, W as Payout, Wt as Environment, X as ProductCategory, Y as Product, Z as ProductVariant, _ as CurrencyAvailability, _t as PAYMENT_FAILURE_CODES, a as Actor, at as SUBSCRIPTION_STATUSES, b as CustomerDetails, bt as Address, c as BalanceAmount, ct as SubscriptionRenewal, d as CancellationFeedback, dt as WebhookEndpoint, et as Refund, f as Checkout, ft as Weekday, g as Coupon, gt as ApiErrorType, h as CollectSettings, ht as ApiErrorEnvelope, i as WebhookEvent, it as SUBMIT_LABELS, j as INVOICE_STATUSES, jt as MAX_QUANTITY, k as FeatureUsageResult, kt as List, l as CANCELLATION_FEEDBACK, lt as SubscriptionStatus, m as CheckoutPurpose, mt as ApiErrorBody, n as EventDataMap, nt as Retirement, o as AfterCompletion, ot as SubmitLabel, p as CheckoutItem, pt as API_ERROR_TYPES, q as PlanPrice, qt as tokenPrefix, r as EventType, rt as RiskLevel, s as Balance, st as Subscription, t as EVENT_TYPES, tt as ResetFrequency, u as CHECKOUT_PURPOSES, ut as USAGE_FEATURE_TYPES, v as CustomField, vt as PaymentFailureCode, w as ExchangeRate, wt as BillingMonths, x as CustomerFeature, xt as AddressInput, y as Customer, yt as ACCOUNT_NUMBER_LENGTH, z as PaymentAttempt, zt as findBank } from "./events-
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as RISK_LEVELS, A as INVOICE_REASONS, At as ListQuery, B as PaymentFailure, Bt as isLandlinePhone, C as Event, Ct as BankCode, D as FeatureReset, Dt as GRACE_PERIOD_DAYS, E as Feature, Et as Currency, F as LineItem, Ft as TAX_BEHAVIORS, G as Plan, Gt as TokenKind, H as PaymentSettlement, Ht as nationalPhone, I as PAYMENT_STATUSES, It as TaxBehavior, J as PortalSession, K as PlanFeatureValues, Kt as tokenEnvironment, L as PRODUCT_CATEGORIES, Lt as Timestamp, M as Invoice, Mt as MOBILE_PREFIXES, N as InvoiceReason, Nt as Metadata, O as FeatureType, Ot as GracePeriodDays, P as InvoiceStatus, Pt as MobilePrefix, Q as RESET_FREQUENCIES, R as Payment, Rt as VENEZUELAN_BANKS, S as CustomerSession, St as BILLING_MONTHS, T as FEATURE_TYPES, Tt as CURRENCIES, U as PaymentStatus, Ut as ENVIRONMENTS, V as PaymentLink, Vt as isMobilePhone, W as Payout, Wt as Environment, X as ProductCategory, Y as Product, Z as ProductVariant, _ as CurrencyAvailability, _t as PAYMENT_FAILURE_CODES, a as Actor, at as SUBSCRIPTION_STATUSES, b as CustomerDetails, bt as Address, c as BalanceAmount, ct as SubscriptionRenewal, d as CancellationFeedback, dt as WebhookEndpoint, et as Refund, f as Checkout, ft as Weekday, g as Coupon, gt as ApiErrorType, h as CollectSettings, ht as ApiErrorEnvelope, i as WebhookEvent, it as SUBMIT_LABELS, j as INVOICE_STATUSES, jt as MAX_QUANTITY, k as FeatureUsageResult, kt as List, l as CANCELLATION_FEEDBACK, lt as SubscriptionStatus, m as CheckoutPurpose, mt as ApiErrorBody, n as EventDataMap, nt as Retirement, o as AfterCompletion, ot as SubmitLabel, p as CheckoutItem, pt as API_ERROR_TYPES, q as PlanPrice, qt as tokenPrefix, r as EventType, rt as RiskLevel, s as Balance, st as Subscription, t as EVENT_TYPES, tt as ResetFrequency, u as CHECKOUT_PURPOSES, ut as USAGE_FEATURE_TYPES, v as CustomField, vt as PaymentFailureCode, w as ExchangeRate, wt as BillingMonths, x as CustomerFeature, xt as AddressInput, y as Customer, yt as ACCOUNT_NUMBER_LENGTH, z as PaymentAttempt, zt as findBank } from "./events-71Q43Ni8.js";
|
|
2
|
+
import { $ as PaymentNextAction, A as PlanCheckoutCreate, B as ProductUpdate, C as FeatureCreate, D as KEY_PATTERN, E as InvoiceLineInput, F as PlanUpdate, G as SubscriptionUpdate, H as RetireInput, I as PortalSessionCreate, J as WebhookEndpointUpdate, K as VariantInput, L as ProductCheckoutCreate, M as PlanFeaturesInput, N as PlanLinkCreate, O as PaymentLinkCreate, P as PlanPriceInput, Q as PaymentMethodOption, R as ProductCreate, S as EventSelector, T as InvoiceCreate, U as SubscriptionCancel, V as RefundCreate, W as SubscriptionCreate, X as PaymentInstructions, Y as CustomerSubscription, Z as PaymentMethodField, _ as CustomFieldInput, a as CheckoutCreate, at as PublicPaymentState, b as CustomerSessionCreate, c as ClientCheckoutUpdate, d as ClientPaymentCode, et as PaymentTestScenario, f as ClientSubscriptionCancel, g as CouponUpdate, h as CouponCreate, i as AfterCompletionInput, it as PublicPaymentLink, j as PlanCreate, k as PaymentLinkUpdate, l as ClientInvoicePay, m as CollectInput, n as RequestOptions, nt as PublicCheckout, o as CheckoutItemInput, ot as PublicPortal, p as ClientSubscriptionUpdate, q as WebhookEndpointCreate, r as TransportOptions, rt as PublicInvoice, s as ClientCheckoutPay, t as BilleteError, tt as PortalFeatures, u as ClientLinkCheckout, v as CustomerCreate, w as FeatureUpdate, x as CustomerUpdate, y as CustomerInput, z as ProductLinkCreate } from "./errors-Cge22x5-.js";
|
|
3
3
|
//#region src/create-client.d.ts
|
|
4
4
|
interface ClientOptions extends TransportOptions {
|
|
5
5
|
/**
|
|
@@ -21,6 +21,17 @@ interface ClientOptions extends TransportOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function createClient(options?: ClientOptions): {
|
|
23
23
|
checkouts: {
|
|
24
|
+
/** Authorizes the payment with the code; a wrong one fails with `payment_code_invalid`. */
|
|
25
|
+
submitPaymentCode: (id: string, input: ClientPaymentCode, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
26
|
+
/** Sends the payer a new code. */
|
|
27
|
+
resendPaymentCode: (id: string, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
28
|
+
/**
|
|
29
|
+
* Says the payer is still on the page that waits for their code. Once a page says so, a minute
|
|
30
|
+
* without hearing from it cancels the payment as `abandoned` (send it every 15 seconds).
|
|
31
|
+
*/
|
|
32
|
+
notePayerPresence: (id: string, options?: RequestOptions) => Promise<void>;
|
|
33
|
+
/** Goes back before authorizing: the payment fails as `canceled` and can be paid again. */
|
|
34
|
+
cancelPayment: (id: string, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
24
35
|
retrieve: (id: string, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
25
36
|
/** Changes quantity, variant, billing cycle or coupon on a payment link checkout. */
|
|
26
37
|
update: (id: string, changes: ClientCheckoutUpdate, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
@@ -30,6 +41,17 @@ export declare function createClient(options?: ClientOptions): {
|
|
|
30
41
|
pay: (id: string, input: ClientCheckoutPay, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
31
42
|
};
|
|
32
43
|
invoices: {
|
|
44
|
+
/** Authorizes the payment with the code; a wrong one fails with `payment_code_invalid`. */
|
|
45
|
+
submitPaymentCode: (id: string, input: ClientPaymentCode, options?: RequestOptions) => Promise<PublicInvoice>;
|
|
46
|
+
/** Sends the payer a new code. */
|
|
47
|
+
resendPaymentCode: (id: string, options?: RequestOptions) => Promise<PublicInvoice>;
|
|
48
|
+
/**
|
|
49
|
+
* Says the payer is still on the page that waits for their code. Once a page says so, a minute
|
|
50
|
+
* without hearing from it cancels the payment as `abandoned` (send it every 15 seconds).
|
|
51
|
+
*/
|
|
52
|
+
notePayerPresence: (id: string, options?: RequestOptions) => Promise<void>;
|
|
53
|
+
/** Goes back before authorizing: the payment fails as `canceled` and can be paid again. */
|
|
54
|
+
cancelPayment: (id: string, options?: RequestOptions) => Promise<PublicInvoice>;
|
|
33
55
|
retrieve: (id: string, options?: RequestOptions) => Promise<PublicInvoice>;
|
|
34
56
|
/** Methods that can pay this Cobro, with the converted amount and transfer details. */
|
|
35
57
|
paymentMethods: (id: string, options?: RequestOptions) => Promise<List<PaymentMethodOption>>;
|
|
@@ -67,4 +89,4 @@ export declare function createClient(options?: ClientOptions): {
|
|
|
67
89
|
};
|
|
68
90
|
type BilleteClient = ReturnType<typeof createClient>;
|
|
69
91
|
//#endregion
|
|
70
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BillingMonths, type CANCELLATION_FEEDBACK, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientSubscriptionCancel, 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 CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, 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 LineItem, type List, type ListQuery, type MAX_QUANTITY, 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 PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, 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 SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, 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 findBank, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix };
|
|
92
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BillingMonths, type CANCELLATION_FEEDBACK, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientSubscriptionCancel, 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 CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, 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 LineItem, type List, type ListQuery, type MAX_QUANTITY, 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 PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, 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 SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, 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 findBank, type isLandlinePhone, type isMobilePhone, type nationalPhone, 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-B3vk4X4A.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
|
|
@@ -18,6 +18,37 @@ function createClient(options = {}) {
|
|
|
18
18
|
token: typeof session === "function" ? session : () => session
|
|
19
19
|
});
|
|
20
20
|
const checkoutPath = (id) => `/v1/client/checkouts/${segment(id)}`;
|
|
21
|
+
/** A pending payment that waits for a code the payer received (`nextAction.type === "code"`). */
|
|
22
|
+
const paymentCode = (path) => ({
|
|
23
|
+
/** Authorizes the payment with the code; a wrong one fails with `payment_code_invalid`. */
|
|
24
|
+
submitPaymentCode: (id, input, options) => http.request({
|
|
25
|
+
method: "POST",
|
|
26
|
+
path: `${path(id)}/payment/code`,
|
|
27
|
+
body: input,
|
|
28
|
+
options
|
|
29
|
+
}),
|
|
30
|
+
/** Sends the payer a new code. */
|
|
31
|
+
resendPaymentCode: (id, options) => http.request({
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: `${path(id)}/payment/code/resend`,
|
|
34
|
+
options
|
|
35
|
+
}),
|
|
36
|
+
/**
|
|
37
|
+
* Says the payer is still on the page that waits for their code. Once a page says so, a minute
|
|
38
|
+
* without hearing from it cancels the payment as `abandoned` (send it every 15 seconds).
|
|
39
|
+
*/
|
|
40
|
+
notePayerPresence: (id, options) => http.request({
|
|
41
|
+
method: "POST",
|
|
42
|
+
path: `${path(id)}/payment/presence`,
|
|
43
|
+
options
|
|
44
|
+
}),
|
|
45
|
+
/** Goes back before authorizing: the payment fails as `canceled` and can be paid again. */
|
|
46
|
+
cancelPayment: (id, options) => http.request({
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: `${path(id)}/payment/cancel`,
|
|
49
|
+
options
|
|
50
|
+
})
|
|
51
|
+
});
|
|
21
52
|
const invoicePath = (id) => `/v1/client/invoices/${segment(id)}`;
|
|
22
53
|
return {
|
|
23
54
|
checkouts: {
|
|
@@ -45,7 +76,8 @@ function createClient(options = {}) {
|
|
|
45
76
|
path: `${checkoutPath(id)}/pay`,
|
|
46
77
|
body: input,
|
|
47
78
|
options
|
|
48
|
-
})
|
|
79
|
+
}),
|
|
80
|
+
...paymentCode(checkoutPath)
|
|
49
81
|
},
|
|
50
82
|
invoices: {
|
|
51
83
|
retrieve: (id, options) => http.request({
|
|
@@ -65,7 +97,8 @@ function createClient(options = {}) {
|
|
|
65
97
|
path: `${invoicePath(id)}/pay`,
|
|
66
98
|
body: input,
|
|
67
99
|
options
|
|
68
|
-
})
|
|
100
|
+
}),
|
|
101
|
+
...paymentCode(invoicePath)
|
|
69
102
|
},
|
|
70
103
|
paymentLinks: {
|
|
71
104
|
retrieve: (id, options) => http.request({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as PaymentFailure, D as FeatureReset, Et as Currency, F as LineItem, It as TaxBehavior, Lt as Timestamp, N as InvoiceReason, Nt as Metadata, Ot as GracePeriodDays, P as InvoiceStatus, U as PaymentStatus, Wt as Environment, X as ProductCategory, b as CustomerDetails, d as CancellationFeedback, gt as ApiErrorType, h as CollectSettings, m as CheckoutPurpose, mt as ApiErrorBody, o as AfterCompletion, ot as SubmitLabel, p as CheckoutItem, q as PlanPrice, r as EventType, st as Subscription, v as CustomField, wt as BillingMonths, xt as AddressInput } from "./events-
|
|
1
|
+
import { B as PaymentFailure, D as FeatureReset, Et as Currency, F as LineItem, It as TaxBehavior, Lt as Timestamp, N as InvoiceReason, Nt as Metadata, Ot as GracePeriodDays, P as InvoiceStatus, U as PaymentStatus, Wt as Environment, X as ProductCategory, b as CustomerDetails, d as CancellationFeedback, gt as ApiErrorType, h as CollectSettings, m as CheckoutPurpose, mt as ApiErrorBody, o as AfterCompletion, ot as SubmitLabel, p as CheckoutItem, q as PlanPrice, r as EventType, st as Subscription, v as CustomField, wt as BillingMonths, xt as AddressInput } from "./events-71Q43Ni8.js";
|
|
2
2
|
//#region ../contracts/src/client.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* A subscription as its customer sees it, in the browser: without the business's `metadata`, with
|
|
@@ -158,11 +158,37 @@ type PaymentNextAction = {
|
|
|
158
158
|
currency: Currency;
|
|
159
159
|
/** After this the payer must not send funds: the attempt fails if nothing arrived. */
|
|
160
160
|
expiresAt: Timestamp | null;
|
|
161
|
+
} | {
|
|
162
|
+
/**
|
|
163
|
+
* The payer has a code that verifies the charge (one their bank sent by SMS, or the reference
|
|
164
|
+
* of the transfer they made): they type it (`submitPaymentCode`), may ask for another when
|
|
165
|
+
* `resendable` (`resendPaymentCode`) or go back (`cancelPayment`).
|
|
166
|
+
*/
|
|
167
|
+
type: "code";
|
|
168
|
+
/** What the code is: "Clave de operaciones", "Referencia del pago". */
|
|
169
|
+
label: string;
|
|
170
|
+
/** How many digits it has, when the provider always sends the same length. */
|
|
171
|
+
length: number | null;
|
|
172
|
+
/**
|
|
173
|
+
* What to type, or where it was sent, masked: "Te la enviamos por SMS al 0414-•••3606".
|
|
174
|
+
*/
|
|
175
|
+
message: string | null;
|
|
176
|
+
/**
|
|
177
|
+
* The provider can send another (`resendPaymentCode`); `false` for what the payer already
|
|
178
|
+
* has, like the reference of a transfer they made.
|
|
179
|
+
*/
|
|
180
|
+
resendable: boolean;
|
|
181
|
+
/** After this the code no longer works: the attempt fails as expired. */
|
|
182
|
+
expiresAt: Timestamp | null;
|
|
161
183
|
};
|
|
162
184
|
interface PaymentMethodField {
|
|
163
185
|
key: string;
|
|
164
186
|
label: string;
|
|
165
|
-
|
|
187
|
+
/**
|
|
188
|
+
* `document`: a Venezuelan identity card, one of the letters in `options` and its number,
|
|
189
|
+
* sent as `V12345678`.
|
|
190
|
+
*/
|
|
191
|
+
type: "text" | "tel" | "date" | "select" | "document";
|
|
166
192
|
required: boolean;
|
|
167
193
|
placeholder: string | null;
|
|
168
194
|
options: Array<{
|
|
@@ -181,6 +207,12 @@ interface PaymentInstructions {
|
|
|
181
207
|
bankName: string | null;
|
|
182
208
|
accountNumber: string | null;
|
|
183
209
|
};
|
|
210
|
+
/**
|
|
211
|
+
* A QR code the payer scans with their bank app, with the recipient and amount already in it, as
|
|
212
|
+
* the provider draws it (`data:image/png;base64,…`). A method that only shows the QR leaves
|
|
213
|
+
* `recipient` empty.
|
|
214
|
+
*/
|
|
215
|
+
qrImage: string | null;
|
|
184
216
|
notes: string | null;
|
|
185
217
|
}
|
|
186
218
|
/** Deterministic inputs that trigger each outcome in the test environment. */
|
|
@@ -198,6 +230,8 @@ interface PaymentMethodOption {
|
|
|
198
230
|
currency: Currency;
|
|
199
231
|
exchangeRate: string | null;
|
|
200
232
|
fields: PaymentMethodField[];
|
|
233
|
+
/** After paying, the payer verifies it in a step of its own (`nextAction.type === "code"`). */
|
|
234
|
+
verification: boolean;
|
|
201
235
|
instructions: PaymentInstructions | null;
|
|
202
236
|
testScenarios: PaymentTestScenario[] | null;
|
|
203
237
|
}
|
|
@@ -531,6 +565,10 @@ interface ClientInvoicePay {
|
|
|
531
565
|
method: string;
|
|
532
566
|
fields?: Record<string, string>;
|
|
533
567
|
}
|
|
568
|
+
/** The code the payer received to authorize a charge (`nextAction.type === "code"`). */
|
|
569
|
+
interface ClientPaymentCode {
|
|
570
|
+
code: string;
|
|
571
|
+
}
|
|
534
572
|
interface ClientLinkCheckout {
|
|
535
573
|
variant?: string;
|
|
536
574
|
quantity?: number;
|
|
@@ -614,4 +652,4 @@ declare class BilleteError extends Error {
|
|
|
614
652
|
}, status: number);
|
|
615
653
|
}
|
|
616
654
|
//#endregion
|
|
617
|
-
export {
|
|
655
|
+
export { PaymentNextAction as $, PlanCheckoutCreate as A, ProductUpdate as B, FeatureCreate as C, KEY_PATTERN as D, InvoiceLineInput as E, PlanUpdate as F, SubscriptionUpdate as G, RetireInput as H, PortalSessionCreate as I, WebhookEndpointUpdate as J, VariantInput as K, ProductCheckoutCreate as L, PlanFeaturesInput as M, PlanLinkCreate as N, PaymentLinkCreate as O, PlanPriceInput as P, PaymentMethodOption as Q, ProductCreate as R, EventSelector as S, InvoiceCreate as T, SubscriptionCancel as U, RefundCreate as V, SubscriptionCreate as W, PaymentInstructions as X, CustomerSubscription as Y, PaymentMethodField as Z, CustomFieldInput as _, CheckoutCreate as a, PublicPaymentState as at, CustomerSessionCreate as b, ClientCheckoutUpdate as c, ClientPaymentCode as d, PaymentTestScenario as et, ClientSubscriptionCancel as f, CouponUpdate as g, CouponCreate as h, AfterCompletionInput as i, PublicPaymentLink as it, PlanCreate as j, PaymentLinkUpdate as k, ClientInvoicePay as l, CollectInput as m, RequestOptions as n, PublicCheckout as nt, CheckoutItemInput as o, PublicPortal as ot, ClientSubscriptionUpdate as p, WebhookEndpointCreate as q, TransportOptions as r, PublicInvoice as rt, ClientCheckoutPay as s, BilleteError as t, PortalFeatures as tt, ClientLinkCheckout as u, CustomerCreate as v, FeatureUpdate as w, CustomerUpdate as x, CustomerInput as y, ProductLinkCreate as z };
|
|
@@ -262,7 +262,11 @@ interface ApiErrorEnvelope {
|
|
|
262
262
|
/** Normalized payment failure codes, independent of the provider that produced them. */
|
|
263
263
|
declare const PAYMENT_FAILURE_CODES: readonly ["insufficient_funds", "payment_not_found", "amount_mismatch", "invalid_details", "declined", "provider_unavailable",
|
|
264
264
|
/** The payer did not complete the payment in time (an address or code to pay expired). */
|
|
265
|
-
"expired"
|
|
265
|
+
"expired",
|
|
266
|
+
/** The payer went back before authorizing it (to fix their details or pay another way). */
|
|
267
|
+
"canceled",
|
|
268
|
+
/** The payer left the page while it waited for their code, and did not come back in time. */
|
|
269
|
+
"abandoned"];
|
|
266
270
|
type PaymentFailureCode = (typeof PAYMENT_FAILURE_CODES)[number];
|
|
267
271
|
//#endregion
|
|
268
272
|
//#region ../contracts/src/resources.d.ts
|
|
@@ -18,7 +18,7 @@ var BilleteError = class extends Error {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/http.ts
|
|
21
|
-
const SDK_VERSION = "1.1.0-canary.
|
|
21
|
+
const SDK_VERSION = "1.1.0-canary.2";
|
|
22
22
|
const DEFAULT_BASE_URL = "https://api.billete.run";
|
|
23
23
|
const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
|
|
24
24
|
429,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as RISK_LEVELS, A as INVOICE_REASONS, At as ListQuery, B as PaymentFailure, Bt as isLandlinePhone, C as Event, Ct as BankCode, D as FeatureReset, Dt as GRACE_PERIOD_DAYS, E as Feature, Et as Currency, F as LineItem, Ft as TAX_BEHAVIORS, G as Plan, Gt as TokenKind, H as PaymentSettlement, Ht as nationalPhone, I as PAYMENT_STATUSES, It as TaxBehavior, J as PortalSession, K as PlanFeatureValues, Kt as tokenEnvironment, L as PRODUCT_CATEGORIES, Lt as Timestamp, M as Invoice, Mt as MOBILE_PREFIXES, N as InvoiceReason, Nt as Metadata, O as FeatureType, Ot as GracePeriodDays, P as InvoiceStatus, Pt as MobilePrefix, Q as RESET_FREQUENCIES, R as Payment, Rt as VENEZUELAN_BANKS, S as CustomerSession, St as BILLING_MONTHS, T as FEATURE_TYPES, Tt as CURRENCIES, U as PaymentStatus, Ut as ENVIRONMENTS, V as PaymentLink, Vt as isMobilePhone, W as Payout, Wt as Environment, X as ProductCategory, Y as Product, Z as ProductVariant, _ as CurrencyAvailability, _t as PAYMENT_FAILURE_CODES, a as Actor, at as SUBSCRIPTION_STATUSES, b as CustomerDetails, bt as Address, c as BalanceAmount, ct as SubscriptionRenewal, d as CancellationFeedback, dt as WebhookEndpoint, et as Refund, f as Checkout, ft as Weekday, g as Coupon, gt as ApiErrorType, h as CollectSettings, ht as ApiErrorEnvelope, i as WebhookEvent, it as SUBMIT_LABELS, j as INVOICE_STATUSES, jt as MAX_QUANTITY, k as FeatureUsageResult, kt as List, l as CANCELLATION_FEEDBACK, lt as SubscriptionStatus, m as CheckoutPurpose, mt as ApiErrorBody, n as EventDataMap, nt as Retirement, o as AfterCompletion, ot as SubmitLabel, p as CheckoutItem, pt as API_ERROR_TYPES, q as PlanPrice, qt as tokenPrefix, r as EventType, rt as RiskLevel, s as Balance, st as Subscription, t as EVENT_TYPES, tt as ResetFrequency, u as CHECKOUT_PURPOSES, ut as USAGE_FEATURE_TYPES, v as CustomField, vt as PaymentFailureCode, w as ExchangeRate, wt as BillingMonths, x as CustomerFeature, xt as AddressInput, y as Customer, yt as ACCOUNT_NUMBER_LENGTH, z as PaymentAttempt, zt as findBank } from "./events-
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as RISK_LEVELS, A as INVOICE_REASONS, At as ListQuery, B as PaymentFailure, Bt as isLandlinePhone, C as Event, Ct as BankCode, D as FeatureReset, Dt as GRACE_PERIOD_DAYS, E as Feature, Et as Currency, F as LineItem, Ft as TAX_BEHAVIORS, G as Plan, Gt as TokenKind, H as PaymentSettlement, Ht as nationalPhone, I as PAYMENT_STATUSES, It as TaxBehavior, J as PortalSession, K as PlanFeatureValues, Kt as tokenEnvironment, L as PRODUCT_CATEGORIES, Lt as Timestamp, M as Invoice, Mt as MOBILE_PREFIXES, N as InvoiceReason, Nt as Metadata, O as FeatureType, Ot as GracePeriodDays, P as InvoiceStatus, Pt as MobilePrefix, Q as RESET_FREQUENCIES, R as Payment, Rt as VENEZUELAN_BANKS, S as CustomerSession, St as BILLING_MONTHS, T as FEATURE_TYPES, Tt as CURRENCIES, U as PaymentStatus, Ut as ENVIRONMENTS, V as PaymentLink, Vt as isMobilePhone, W as Payout, Wt as Environment, X as ProductCategory, Y as Product, Z as ProductVariant, _ as CurrencyAvailability, _t as PAYMENT_FAILURE_CODES, a as Actor, at as SUBSCRIPTION_STATUSES, b as CustomerDetails, bt as Address, c as BalanceAmount, ct as SubscriptionRenewal, d as CancellationFeedback, dt as WebhookEndpoint, et as Refund, f as Checkout, ft as Weekday, g as Coupon, gt as ApiErrorType, h as CollectSettings, ht as ApiErrorEnvelope, i as WebhookEvent, it as SUBMIT_LABELS, j as INVOICE_STATUSES, jt as MAX_QUANTITY, k as FeatureUsageResult, kt as List, l as CANCELLATION_FEEDBACK, lt as SubscriptionStatus, m as CheckoutPurpose, mt as ApiErrorBody, n as EventDataMap, nt as Retirement, o as AfterCompletion, ot as SubmitLabel, p as CheckoutItem, pt as API_ERROR_TYPES, q as PlanPrice, qt as tokenPrefix, r as EventType, rt as RiskLevel, s as Balance, st as Subscription, t as EVENT_TYPES, tt as ResetFrequency, u as CHECKOUT_PURPOSES, ut as USAGE_FEATURE_TYPES, v as CustomField, vt as PaymentFailureCode, w as ExchangeRate, wt as BillingMonths, x as CustomerFeature, xt as AddressInput, y as Customer, yt as ACCOUNT_NUMBER_LENGTH, z as PaymentAttempt, zt as findBank } from "./events-71Q43Ni8.js";
|
|
2
|
+
import { $ as PaymentNextAction, A as PlanCheckoutCreate, B as ProductUpdate, C as FeatureCreate, D as KEY_PATTERN, E as InvoiceLineInput, F as PlanUpdate, G as SubscriptionUpdate, H as RetireInput, I as PortalSessionCreate, J as WebhookEndpointUpdate, K as VariantInput, L as ProductCheckoutCreate, M as PlanFeaturesInput, N as PlanLinkCreate, O as PaymentLinkCreate, P as PlanPriceInput, Q as PaymentMethodOption, R as ProductCreate, S as EventSelector, T as InvoiceCreate, U as SubscriptionCancel, V as RefundCreate, W as SubscriptionCreate, X as PaymentInstructions, Y as CustomerSubscription, Z as PaymentMethodField, _ as CustomFieldInput, a as CheckoutCreate, at as PublicPaymentState, b as CustomerSessionCreate, c as ClientCheckoutUpdate, d as ClientPaymentCode, et as PaymentTestScenario, f as ClientSubscriptionCancel, g as CouponUpdate, h as CouponCreate, i as AfterCompletionInput, it as PublicPaymentLink, j as PlanCreate, k as PaymentLinkUpdate, l as ClientInvoicePay, m as CollectInput, n as RequestOptions, nt as PublicCheckout, o as CheckoutItemInput, ot as PublicPortal, p as ClientSubscriptionUpdate, q as WebhookEndpointCreate, r as TransportOptions, rt as PublicInvoice, s as ClientCheckoutPay, t as BilleteError, tt as PortalFeatures, u as ClientLinkCheckout, v as CustomerCreate, w as FeatureUpdate, x as CustomerUpdate, y as CustomerInput, z as ProductLinkCreate } from "./errors-Cge22x5-.js";
|
|
3
3
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
4
4
|
//#region src/server.d.ts
|
|
5
5
|
type Filters<T> = ListQuery & T;
|
|
@@ -231,4 +231,4 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
231
231
|
/** The server client: what `createBillete` returns. */
|
|
232
232
|
type Billete = ReturnType<typeof createBillete>;
|
|
233
233
|
//#endregion
|
|
234
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientInvoicePay, type ClientLinkCheckout, type ClientSubscriptionCancel, 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 CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, 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 LineItem, type List, type ListQuery, type MAX_QUANTITY, 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 PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, 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 SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, 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 findBank, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
|
234
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientSubscriptionCancel, 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 CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type Feature, type FeatureCreate, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, 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 LineItem, type List, type ListQuery, type MAX_QUANTITY, 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 PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, 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 SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, 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 findBank, type isLandlinePhone, type isMobilePhone, type nationalPhone, 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-B3vk4X4A.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
3
|
//#region ../contracts/src/environment.ts
|
|
4
4
|
/**
|
package/dist/webhooks.d.ts
CHANGED