@boelabs/billete-sdk 1.1.0-canary.2 → 1.1.0-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -75,6 +75,13 @@ const checkout = await billete.checkouts.create({
75
75
  Cuando el pago se confirma, Billete te avisa con el webhook `checkout.completed` (ver
76
76
  [Webhooks](#webhooks)).
77
77
 
78
+ Los productos físicos habilitan sus formas de entrega con `fulfillmentMethods`, por ejemplo
79
+ `["pickup", "shipping"]`; la lista está vacía por defecto. Cada método también debe estar activo
80
+ en la configuración del negocio. Desactivarlo conserva la selección de los productos. El checkout
81
+ ofrece «Acordar con el negocio» cuando los productos físicos tienen métodos habilitados y activos
82
+ en el negocio. Sin entrega habilitada, no exige datos para entregarla; respeta los que el enlace
83
+ solicite expresamente. En carritos, solo ofrece los demás métodos que todos los productos físicos admitan.
84
+
78
85
  ## Configuración
79
86
 
80
87
  ```ts
@@ -122,6 +129,7 @@ Todos los métodos devuelven promesas con el recurso tipado. Los recursos con li
122
129
  | `invoices` | `void` (cobros: renovaciones y cobros sueltos, con página de pago en `url`) |
123
130
  | `subscriptions` | `cancel`, `resume` |
124
131
  | `payments` | `refund`, `listRefunds` |
132
+ | `fulfillments` | `deliver`, `submitTracking` (entregas de productos físicos; también `retrieve`, `list` e `iterate`) |
125
133
  | `payouts` | — |
126
134
  | `balance` | `retrieve` |
127
135
  | `webhookEndpoints` | `delete` |
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-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";
1
+ import { $ as PaymentSettlement, $t as isMobilePhone, A as FULFILLMENT_METHODS, At as ACCOUNT_NUMBER_LENGTH, B as FulfillmentTracking, Bt as List, C as Customer, Ct as Weekday, D as Event, Dt as ApiErrorType, E as CustomerSession, Et as ApiErrorEnvelope, F as FeatureUsageResult, Ft as BillingMonths, G as InvoiceStatus, Gt as Metadata, H as INVOICE_STATUSES, Ht as ListSort, I as Fulfillment, It as CURRENCIES, J as PRODUCT_CATEGORIES, Jt as TaxBehavior, K as LineItem, Kt as MobilePrefix, L as FulfillmentChoice, Lt as Currency, M as Feature, Mt as AddressInput, N as FeatureReset, Nt as BILLING_MONTHS, O as ExchangeRate, Ot as PAYMENT_FAILURE_CODES, P as FeatureType, Pt as BankCode, Q as PaymentLink, Qt as isLandlinePhone, R as FulfillmentMethod, Rt as GRACE_PERIOD_DAYS, S as CustomField, St as WebhookEndpoint, T as CustomerFeature, Tt as ApiErrorBody, U as Invoice, Ut as MAX_QUANTITY, V as INVOICE_REASONS, Vt as ListQuery, W as InvoiceReason, Wt as MOBILE_PREFIXES, X as PaymentAttempt, Xt as VENEZUELAN_BANKS, Y as Payment, Yt as Timestamp, Z as PaymentFailure, Zt as findBank, _ as CheckoutItem, _t as SubmitLabel, a as Actor, an as tokenPrefix, at as PortalSession, b as Coupon, bt as SubscriptionStatus, c as BalanceAmount, ct as ProductVariant, d as CARRIER_TEST_SCENARIOS, dt as Refund, en as nationalPhone, et as PaymentStatus, f as CHECKOUT_PURPOSES, ft as ResetFrequency, g as Checkout, gt as SUBSCRIPTION_STATUSES, h as CarrierOffice, ht as SUBMIT_LABELS, i as WebhookEvent, in as tokenEnvironment, it as PlanPrice, j as FULFILLMENT_STATUSES, jt as Address, k as FEATURE_TYPES, kt as PaymentFailureCode, l as CANCELLATION_FEEDBACK, lt as RESET_FREQUENCIES, m as Carrier, mt as RiskLevel, n as EventDataMap, nn as Environment, nt as Plan, o as AfterCompletion, ot as Product, p as CancellationFeedback, pt as Retirement, q as PAYMENT_STATUSES, qt as TAX_BEHAVIORS, r as EventType, rn as TokenKind, rt as PlanFeatureValues, s as Balance, st as ProductCategory, t as EVENT_TYPES, tn as ENVIRONMENTS, tt as Payout, u as CARRIERS, ut as RISK_LEVELS, v as CheckoutPurpose, vt as Subscription, w as CustomerDetails, wt as API_ERROR_TYPES, x as CurrencyAvailability, xt as USAGE_FEATURE_TYPES, y as CollectSettings, yt as SubscriptionRenewal, z as FulfillmentStatus, zt as GracePeriodDays } from "./events-gkaUSC93.js";
2
+ import { $ as FulfillmentOption, A as KEY_PATTERN, B as ProductCheckoutCreate, C as EventSelector, D as FulfillmentTrackingInput, E as FulfillmentInput, F as PlanFeaturesInput, G as RetireInput, H as ProductLinkCreate, I as PlanLinkCreate, J as SubscriptionUpdate, K as SubscriptionCancel, L as PlanPriceInput, M as PaymentLinkUpdate, N as PlanCheckoutCreate, O as InvoiceCreate, P as PlanCreate, Q as CustomerSubscription, R as PlanUpdate, S as CustomerUpdate, T as FeatureUpdate, U as ProductUpdate, V as ProductCreate, W as RefundCreate, X as WebhookEndpointCreate, Y as VariantInput, Z as WebhookEndpointUpdate, _ as CouponUpdate, a as CheckoutCreate, at as PortalFeatures, b as CustomerInput, c as ClientCheckoutUpdate, ct as PublicInvoice, d as ClientLinkCheckout, dt as PublicPortal, et as PaymentInstructions, f as ClientPaymentCode, g as CouponCreate, h as CollectInput, i as AfterCompletionInput, it as PaymentTestScenario, j as PaymentLinkCreate, k as InvoiceLineInput, l as ClientFulfillmentProblem, lt as PublicPaymentLink, m as ClientSubscriptionUpdate, n as RequestOptions, nt as PaymentMethodOption, o as CheckoutItemInput, ot as PublicCheckout, p as ClientSubscriptionCancel, q as SubscriptionCreate, r as TransportOptions, rt as PaymentNextAction, s as ClientCheckoutPay, st as PublicFulfillment, t as BilleteError, tt as PaymentMethodField, u as ClientInvoicePay, ut as PublicPaymentState, v as CustomFieldInput, w as FeatureCreate, x as CustomerSessionCreate, y as CustomerCreate, z as PortalSessionCreate } from "./errors-BYNcqPf5.js";
3
3
  //#region src/create-client.d.ts
4
4
  interface ClientOptions extends TransportOptions {
5
5
  /**
@@ -20,6 +20,8 @@ interface ClientOptions extends TransportOptions {
20
20
  * ```
21
21
  */
22
22
  export declare function createClient(options?: ClientOptions): {
23
+ /** Offices offered by a carrier, refreshed daily by Billete. */
24
+ carrierOffices: (carrier: Carrier, options?: RequestOptions) => Promise<List<CarrierOffice>>;
23
25
  checkouts: {
24
26
  /** Authorizes the payment with the code; a wrong one fails with `payment_code_invalid`. */
25
27
  submitPaymentCode: (id: string, input: ClientPaymentCode, options?: RequestOptions) => Promise<PublicCheckout>;
@@ -58,6 +60,17 @@ export declare function createClient(options?: ClientOptions): {
58
60
  /** Submits the payment; the returned Cobro carries the payment status and any failure. */
59
61
  pay: (id: string, input: ClientInvoicePay, options?: RequestOptions) => Promise<PublicInvoice>;
60
62
  };
63
+ /**
64
+ * A purchase's delivery, as its customer follows it. The `token` comes in the link of the
65
+ * emails Billete sends them, and is the only credential.
66
+ */
67
+ fulfillments: {
68
+ retrieve: (token: string, options?: RequestOptions) => Promise<PublicFulfillment>;
69
+ /** The customer has it: the business gets its funds. */
70
+ confirmReceived: (token: string, options?: RequestOptions) => Promise<PublicFulfillment>;
71
+ /** Something went wrong: the funds stay held while Billete reviews it. */
72
+ reportProblem: (token: string, input: ClientFulfillmentProblem, options?: RequestOptions) => Promise<PublicFulfillment>;
73
+ };
61
74
  paymentLinks: {
62
75
  retrieve: (id: string, options?: RequestOptions) => Promise<PublicPaymentLink>;
63
76
  createCheckout: (id: string, selection?: ClientLinkCheckout, options?: RequestOptions) => Promise<PublicCheckout>;
@@ -89,4 +102,4 @@ export declare function createClient(options?: ClientOptions): {
89
102
  };
90
103
  type BilleteClient = ReturnType<typeof createClient>;
91
104
  //#endregion
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 };
105
+ 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 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 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 FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, 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 LineItem, type List, type ListQuery, type ListSort, 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 PublicFulfillment, 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-B3vk4X4A.js";
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-BrthUu05.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
@@ -50,7 +50,15 @@ function createClient(options = {}) {
50
50
  })
51
51
  });
52
52
  const invoicePath = (id) => `/v1/client/invoices/${segment(id)}`;
53
+ const fulfillmentPath = (token) => `/v1/client/fulfillments/${segment(token)}`;
53
54
  return {
55
+ /** Offices offered by a carrier, refreshed daily by Billete. */
56
+ carrierOffices: (carrier, options) => http.request({
57
+ method: "GET",
58
+ path: "/v1/client/carrier-offices",
59
+ query: { carrier },
60
+ options
61
+ }),
54
62
  checkouts: {
55
63
  retrieve: (id, options) => http.request({
56
64
  method: "GET",
@@ -100,6 +108,30 @@ function createClient(options = {}) {
100
108
  }),
101
109
  ...paymentCode(invoicePath)
102
110
  },
111
+ /**
112
+ * A purchase's delivery, as its customer follows it. The `token` comes in the link of the
113
+ * emails Billete sends them, and is the only credential.
114
+ */
115
+ fulfillments: {
116
+ retrieve: (token, options) => http.request({
117
+ method: "GET",
118
+ path: fulfillmentPath(token),
119
+ options
120
+ }),
121
+ /** The customer has it: the business gets its funds. */
122
+ confirmReceived: (token, options) => http.request({
123
+ method: "POST",
124
+ path: `${fulfillmentPath(token)}/received`,
125
+ options
126
+ }),
127
+ /** Something went wrong: the funds stay held while Billete reviews it. */
128
+ reportProblem: (token, input, options) => http.request({
129
+ method: "POST",
130
+ path: `${fulfillmentPath(token)}/problem`,
131
+ body: input,
132
+ options
133
+ })
134
+ },
103
135
  paymentLinks: {
104
136
  retrieve: (id, options) => http.request({
105
137
  method: "GET",
@@ -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-71Q43Ni8.js";
1
+ import { B as FulfillmentTracking, Dt as ApiErrorType, Ft as BillingMonths, G as InvoiceStatus, Gt as Metadata, I as Fulfillment, Jt as TaxBehavior, K as LineItem, Lt as Currency, Mt as AddressInput, N as FeatureReset, R as FulfillmentMethod, S as CustomField, Tt as ApiErrorBody, W as InvoiceReason, Yt as Timestamp, Z as PaymentFailure, _ as CheckoutItem, _t as SubmitLabel, et as PaymentStatus, h as CarrierOffice, it as PlanPrice, jt as Address, m as Carrier, nn as Environment, o as AfterCompletion, p as CancellationFeedback, r as EventType, st as ProductCategory, v as CheckoutPurpose, vt as Subscription, w as CustomerDetails, y as CollectSettings, z as FulfillmentStatus, zt as GracePeriodDays } from "./events-gkaUSC93.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
@@ -128,9 +128,15 @@ interface PublicCheckout {
128
128
  months: BillingMonths;
129
129
  amount: number;
130
130
  }> | null;
131
+ /** Required customer details, including name and phone whenever fulfillment is offered. */
131
132
  collect: CollectSettings;
132
133
  customFields: CustomField[];
133
134
  customerDetails: CustomerDetails;
135
+ /**
136
+ * How the customer may receive the physical products, chosen when paying (`fulfillment`);
137
+ * `null` when nothing in it needs handing over.
138
+ */
139
+ fulfillmentOptions: FulfillmentOption[] | null;
134
140
  submitLabel: SubmitLabel;
135
141
  /** What follows payment; a redirect's URL already has `{CHECKOUT_ID}` replaced. */
136
142
  afterCompletion: AfterCompletion;
@@ -139,6 +145,56 @@ interface PublicCheckout {
139
145
  expiresAt: Timestamp;
140
146
  payment: PublicPaymentState | null;
141
147
  }
148
+ /** A way to receive a purchase that the business offers, as its checkout shows it. */
149
+ interface FulfillmentOption {
150
+ method: FulfillmentMethod;
151
+ /** Where to pick it up (`pickup`) or where the business delivers (`delivery`). */
152
+ location: string | null;
153
+ /** The carriers a `shipping` goes with; their offices are listed by `carrierOffices`. */
154
+ carriers: Carrier[] | null;
155
+ /** What the business tells customers about it: hours, delivery fees, how it contacts them. */
156
+ instructions: string | null;
157
+ }
158
+ /**
159
+ * A purchase's delivery as its customer follows it, on the page their emails link to. The link
160
+ * carries the only credential (`token`).
161
+ */
162
+ interface PublicFulfillment {
163
+ id: string;
164
+ object: "fulfillment";
165
+ environment: Environment;
166
+ merchant: {
167
+ name: string;
168
+ supportEmail: string | null;
169
+ supportPhone: string | null;
170
+ };
171
+ method: FulfillmentMethod;
172
+ status: FulfillmentStatus;
173
+ option: FulfillmentOption;
174
+ recipient: {
175
+ name: string;
176
+ phone: string;
177
+ document: string | null;
178
+ };
179
+ address: Address | null;
180
+ office: CarrierOffice | null;
181
+ /** A shipment's tracking number and what the carrier reported. */
182
+ tracking: Pick<FulfillmentTracking, "number" | "carrierStatus" | "events"> | null;
183
+ notes: string | null;
184
+ items: CheckoutItem[];
185
+ currency: Currency;
186
+ total: number;
187
+ paidAt: Timestamp;
188
+ deliveredAt: Timestamp | null;
189
+ confirmBy: Timestamp | null;
190
+ receivedAt: Timestamp | null;
191
+ problem: {
192
+ comment: string;
193
+ reportedAt: Timestamp;
194
+ } | null;
195
+ canceledAt: Timestamp | null;
196
+ cancellationReason: Fulfillment["cancellationReason"];
197
+ }
142
198
  /**
143
199
  * The step a provider asks of the payer after starting a charge: leave for its page and come back
144
200
  * (`redirect`), or send the funds to what is shown, often as a QR code (`display`).
@@ -278,6 +334,7 @@ interface PublicPaymentLink {
278
334
  adjustableQuantity: boolean;
279
335
  /** Most units per purchase when `adjustableQuantity`; `null` leaves stock as the only limit. */
280
336
  maxQuantity: number | null;
337
+ /** Effective required details; fulfillment adds name and phone to the saved preferences. */
281
338
  collect: CollectSettings;
282
339
  customFields: CustomField[];
283
340
  allowCoupons: boolean;
@@ -325,6 +382,8 @@ interface ProductCreate {
325
382
  description?: string;
326
383
  imageUrl?: string;
327
384
  category?: ProductCategory;
385
+ /** How a physical product may be received; none by default. */
386
+ fulfillmentMethods?: FulfillmentMethod[];
328
387
  currency: Currency;
329
388
  /** Required without variants; with variants, each variant has its price. */
330
389
  amount?: number | null;
@@ -338,6 +397,8 @@ interface ProductUpdate {
338
397
  description?: string | null;
339
398
  imageUrl?: string | null;
340
399
  category?: ProductCategory;
400
+ /** How a physical product may be received; none by default. */
401
+ fulfillmentMethods?: FulfillmentMethod[];
341
402
  currency?: Currency;
342
403
  amount?: number | null;
343
404
  stock?: number | null;
@@ -620,6 +681,38 @@ interface ClientCheckoutPay {
620
681
  phone?: string;
621
682
  address?: AddressInput;
622
683
  customFields?: Record<string, string | number>;
684
+ /**
685
+ * How the customer receives the physical products, among the checkout's `fulfillmentOptions`.
686
+ * Required when it offers any; `name` and `phone` are then required too.
687
+ */
688
+ fulfillment?: FulfillmentInput;
689
+ }
690
+ type FulfillmentInput = {
691
+ method: "arrange";
692
+ notes?: string;
693
+ } | {
694
+ method: "pickup";
695
+ notes?: string;
696
+ } | {
697
+ method: "delivery";
698
+ address: AddressInput;
699
+ notes?: string;
700
+ } | {
701
+ method: "shipping";
702
+ carrier: Carrier;
703
+ /** The office's `code`, among `GET /v1/client/carrier-offices`. */
704
+ office: string;
705
+ /** The identity card the carrier asks for at the office: `V12345678`. */
706
+ document: string;
707
+ notes?: string;
708
+ };
709
+ /** The carrier's tracking number of a shipment, once the business sent it. */
710
+ interface FulfillmentTrackingInput {
711
+ number: string;
712
+ }
713
+ /** What went wrong with a purchase the business marked as delivered. */
714
+ interface ClientFulfillmentProblem {
715
+ comment: string;
623
716
  }
624
717
  //#endregion
625
718
  //#region src/http.d.ts
@@ -652,4 +745,4 @@ declare class BilleteError extends Error {
652
745
  }, status: number);
653
746
  }
654
747
  //#endregion
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 };
748
+ export { FulfillmentOption as $, KEY_PATTERN as A, ProductCheckoutCreate as B, EventSelector as C, FulfillmentTrackingInput as D, FulfillmentInput as E, PlanFeaturesInput as F, RetireInput as G, ProductLinkCreate as H, PlanLinkCreate as I, SubscriptionUpdate as J, SubscriptionCancel as K, PlanPriceInput as L, PaymentLinkUpdate as M, PlanCheckoutCreate as N, InvoiceCreate as O, PlanCreate as P, CustomerSubscription as Q, PlanUpdate as R, CustomerUpdate as S, FeatureUpdate as T, ProductUpdate as U, ProductCreate as V, RefundCreate as W, WebhookEndpointCreate as X, VariantInput as Y, WebhookEndpointUpdate as Z, CouponUpdate as _, CheckoutCreate as a, PortalFeatures as at, CustomerInput as b, ClientCheckoutUpdate as c, PublicInvoice as ct, ClientLinkCheckout as d, PublicPortal as dt, PaymentInstructions as et, ClientPaymentCode as f, CouponCreate as g, CollectInput as h, AfterCompletionInput as i, PaymentTestScenario as it, PaymentLinkCreate as j, InvoiceLineInput as k, ClientFulfillmentProblem as l, PublicPaymentLink as lt, ClientSubscriptionUpdate as m, RequestOptions as n, PaymentMethodOption as nt, CheckoutItemInput as o, PublicCheckout as ot, ClientSubscriptionCancel as p, SubscriptionCreate as q, TransportOptions as r, PaymentNextAction as rt, ClientCheckoutPay as s, PublicFulfillment as st, BilleteError as t, PaymentMethodField as tt, ClientInvoicePay as u, PublicPaymentState as ut, CustomFieldInput as v, FeatureCreate as w, CustomerSessionCreate as x, CustomerCreate as y, PortalSessionCreate as z };
@@ -27,8 +27,11 @@ declare const BILLING_MONTHS: readonly [1, 3, 6, 9, 12];
27
27
  type BillingMonths = (typeof BILLING_MONTHS)[number];
28
28
  /** Most units of one product a single purchase can take. */
29
29
  declare const MAX_QUANTITY = 999;
30
- /** Grace periods, in days, a merchant can grant after a renewal is missed. */
31
- declare const GRACE_PERIOD_DAYS: readonly [1, 3, 7];
30
+ /**
31
+ * Grace periods, in days, a merchant can grant after a renewal is missed. `0`, the default, is
32
+ * none: an unpaid subscription expires when its period ends.
33
+ */
34
+ declare const GRACE_PERIOD_DAYS: readonly [0, 1, 3, 7];
32
35
  type GracePeriodDays = (typeof GRACE_PERIOD_DAYS)[number];
33
36
  /** `inclusive`: the price already contains the account tax. `exclusive`: tax is added on top. */
34
37
  declare const TAX_BEHAVIORS: readonly ["inclusive", "exclusive"];
@@ -228,6 +231,8 @@ declare function nationalPhone(value: string): string;
228
231
  declare function isMobilePhone(value: string): boolean;
229
232
  /** `02121234567`: an area code starting with 02 and seven digits. */
230
233
  declare function isLandlinePhone(value: string): boolean;
234
+ /** A list's order by one field: ascending, or descending with `-` first (`-created`). */
235
+ type ListSort<F extends string> = F | `-${F}`;
231
236
  interface ListQuery {
232
237
  /** 1-100, default 20. */
233
238
  limit?: number;
@@ -314,6 +319,11 @@ interface Product extends Resource<"product">, Retirement {
314
319
  description: string | null;
315
320
  imageUrl: string | null;
316
321
  category: ProductCategory;
322
+ /**
323
+ * How a `physical` product may be received, among the ways the business offers. Empty: it is
324
+ * not handed over through Billete, and its purchases complete as any other.
325
+ */
326
+ fulfillmentMethods: FulfillmentMethod[];
317
327
  currency: Currency;
318
328
  /** Null when price and inventory belong to variants. */
319
329
  amount: number | null;
@@ -587,12 +597,153 @@ interface Checkout extends Resource<"checkout"> {
587
597
  customFields: CustomField[];
588
598
  customFieldValues: Record<string, string | number>;
589
599
  customerDetails: CustomerDetails;
600
+ /** How the customer receives a purchase with physical products, once paid. */
601
+ fulfillmentId: string | null;
590
602
  successUrl: string | null;
591
603
  cancelUrl: string | null;
592
604
  expiresAt: Timestamp;
593
605
  completedAt: Timestamp | null;
594
606
  metadata: Metadata;
595
607
  }
608
+ /**
609
+ * `pickup`: the customer collects it at the business. `delivery`: the business takes it to them.
610
+ * `shipping`: the business sends it through a carrier to the office the customer chose.
611
+ * `arrange`: they agree on it themselves (another carrier, a meeting point). Each product lists
612
+ * the ones it allows (`Product.fulfillmentMethods`).
613
+ */
614
+ declare const FULFILLMENT_METHODS: readonly ["pickup", "delivery", "shipping", "arrange"];
615
+ type FulfillmentMethod = (typeof FULFILLMENT_METHODS)[number];
616
+ /** Carriers a business can ship with. Their offices and tracking come from their own APIs. */
617
+ declare const CARRIERS: readonly ["zoom"];
618
+ type Carrier = (typeof CARRIERS)[number];
619
+ /**
620
+ * - `pending`: paid, waiting for the business to hand it over (or, when shipping, to send it
621
+ * and add its tracking number before `trackingDueAt`).
622
+ * - `in_transit`: shipped; the carrier is taking it to the office.
623
+ * - `ready_for_pickup`: at the office, waiting for the customer.
624
+ * - `delivered`: the business says it handed it over; the customer has until `confirmBy` to
625
+ * confirm or report a problem, after which it counts as received.
626
+ * - `received`: confirmed by the customer, by the carrier, or `confirmBy` passed. Its funds are
627
+ * released.
628
+ * - `problem`: the customer reported a problem, or the carrier is returning it; Billete reviews it
629
+ * and its funds stay held.
630
+ * - `canceled`: its payment was fully refunded, or it was not shipped in time.
631
+ */
632
+ declare const FULFILLMENT_STATUSES: readonly ["pending", "in_transit", "ready_for_pickup", "delivered", "received", "problem", "canceled"];
633
+ type FulfillmentStatus = (typeof FULFILLMENT_STATUSES)[number];
634
+ /**
635
+ * Tracking numbers that trigger each outcome in the test environment, where no carrier is asked.
636
+ * `ready`, `delivered`, `returning`: ends in 2, 3 or 4; `other_office`: ends in 8;
637
+ * `not_found`: starts with 9. Any other number is in transit.
638
+ */
639
+ declare const CARRIER_TEST_SCENARIOS: readonly [{
640
+ readonly number: "1000000001";
641
+ readonly description: "En camino";
642
+ }, {
643
+ readonly number: "1000000002";
644
+ readonly description: "Disponible en la oficina";
645
+ }, {
646
+ readonly number: "1000000003";
647
+ readonly description: "Entregada";
648
+ }, {
649
+ readonly number: "1000000004";
650
+ readonly description: "En devolución";
651
+ }, {
652
+ readonly number: "1000000008";
653
+ readonly description: "Va a otra oficina (se rechaza)";
654
+ }, {
655
+ readonly number: "9000000001";
656
+ readonly description: "No existe (se rechaza)";
657
+ }];
658
+ /** A carrier's office where a shipment can be picked up. */
659
+ interface CarrierOffice {
660
+ carrier: Carrier;
661
+ /** The carrier's own code for the office. */
662
+ code: string;
663
+ name: string;
664
+ address: string;
665
+ city: string;
666
+ state: string;
667
+ /** Opening hours as the carrier publishes them, one line per day. */
668
+ hours: string[];
669
+ }
670
+ /**
671
+ * A shipment's tracking number and what the carrier says about it. `verifying` until the carrier
672
+ * confirms the number exists and goes to the chosen office; a carrier that does not answer leaves
673
+ * it `verifying`, and the deadline waits for it.
674
+ */
675
+ interface FulfillmentTracking {
676
+ number: string;
677
+ /** When the deadline was paused for this verification. */
678
+ submittedAt: Timestamp;
679
+ status: "verifying" | "verified";
680
+ /** The carrier's latest status, in its words. */
681
+ carrierStatus: string | null;
682
+ /** What the carrier reported, oldest first. */
683
+ events: Array<{
684
+ at: Timestamp;
685
+ description: string;
686
+ office: string | null;
687
+ }>;
688
+ /** When the carrier was last asked. */
689
+ checkedAt: Timestamp | null;
690
+ }
691
+ /** How a customer receives a physical purchase. Its funds are held until it is received. */
692
+ interface Fulfillment extends Resource<"fulfillment"> {
693
+ checkoutId: string;
694
+ /** `null` when nothing was paid (a fully discounted purchase). */
695
+ paymentId: string | null;
696
+ customerId: string;
697
+ method: FulfillmentMethod;
698
+ status: FulfillmentStatus;
699
+ /**
700
+ * Who receives it and how the business reaches them. A shipment also carries the identity card
701
+ * the carrier asks for at the office (`V12345678`).
702
+ */
703
+ recipient: {
704
+ name: string;
705
+ phone: string;
706
+ document: string | null;
707
+ };
708
+ /** Where a `delivery` goes; `null` otherwise. */
709
+ address: Address | null;
710
+ /** The office a `shipping` goes to; `null` otherwise. */
711
+ office: CarrierOffice | null;
712
+ /** What the customer added: a landmark, a time that suits them. */
713
+ notes: string | null;
714
+ /** The physical items of the purchase. */
715
+ items: CheckoutItem[];
716
+ /** While a shipment is `pending`: when it is canceled if it has no tracking number. */
717
+ trackingDueAt: Timestamp | null;
718
+ tracking: FulfillmentTracking | null;
719
+ /** The last tracking number the carrier did not accept, and why; cleared by a valid one. */
720
+ trackingRejection: {
721
+ number: string;
722
+ reason: string;
723
+ } | null;
724
+ deliveredAt: Timestamp | null;
725
+ /** While `delivered`: when it counts as received if the customer says nothing. */
726
+ confirmBy: Timestamp | null;
727
+ receivedAt: Timestamp | null;
728
+ /**
729
+ * `customer`: they confirmed it. `timeout`: they said nothing before `confirmBy`. `carrier`: the
730
+ * carrier delivered it.
731
+ */
732
+ receivedBy: "customer" | "timeout" | "carrier" | null;
733
+ problem: {
734
+ comment: string;
735
+ reportedAt: Timestamp;
736
+ } | null;
737
+ canceledAt: Timestamp | null;
738
+ /**
739
+ * `refunded`: its payment was fully refunded. `not_shipped`: it had no valid tracking number by
740
+ * `trackingDueAt`; its funds stay held until the customer is refunded.
741
+ */
742
+ cancellationReason: "refunded" | "not_shipped" | null;
743
+ updatedAt: Timestamp;
744
+ }
745
+ /** What the customer chose when paying: how, and who receives it. */
746
+ type FulfillmentChoice = Pick<Fulfillment, "method" | "recipient" | "address" | "office" | "notes">;
596
747
  declare const INVOICE_STATUSES: readonly ["open", "paid", "void", "uncollectible"];
597
748
  type InvoiceStatus = (typeof INVOICE_STATUSES)[number];
598
749
  /** `checkout`: the record of a paid checkout. `subscription_cycle`: a renewal. `manual`: one-off. */
@@ -713,6 +864,8 @@ interface Balance {
713
864
  available: BalanceAmount[];
714
865
  /** Funds still inside the settlement hold. */
715
866
  pending: BalanceAmount[];
867
+ /** Funds of purchases the customer has not received yet; released when they do. */
868
+ held: BalanceAmount[];
716
869
  }
717
870
  interface Payout extends Resource<"payout"> {
718
871
  amount: number;
@@ -776,6 +929,20 @@ interface EventDataMap {
776
929
  "payment.succeeded": Payment;
777
930
  "payment.failed": Payment;
778
931
  "payment.refunded": Payment;
932
+ /** A paid purchase with physical products is waiting to be handed over. */
933
+ "fulfillment.created": Fulfillment;
934
+ /** The carrier confirmed its tracking number: it is on its way to the office. */
935
+ "fulfillment.shipped": Fulfillment;
936
+ /** It is at the office, waiting for the customer. */
937
+ "fulfillment.ready_for_pickup": Fulfillment;
938
+ /** The business handed it over; the customer is asked to confirm. */
939
+ "fulfillment.delivered": Fulfillment;
940
+ /** The customer confirmed it, or did not answer in time. Its funds are released. */
941
+ "fulfillment.received": Fulfillment;
942
+ /** The customer reported a problem; its funds stay held while Billete reviews it. */
943
+ "fulfillment.problem_reported": Fulfillment;
944
+ /** Its payment was fully refunded, or it was not shipped in time. */
945
+ "fulfillment.canceled": Fulfillment;
779
946
  "refund.created": Refund;
780
947
  /** The provider could not return the funds; the amount is back in the balance. */
781
948
  "refund.failed": Refund;
@@ -796,7 +963,7 @@ interface EventDataMap {
796
963
  "subscription.expired": Subscription;
797
964
  }
798
965
  type EventType = keyof EventDataMap;
799
- declare const EVENT_TYPES: readonly ["product.retired", "product.updated", "payment_link.retired", "customer.created", "customer.updated", "checkout.completed", "checkout.expired", "payment.succeeded", "payment.failed", "payment.refunded", "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"];
966
+ declare const EVENT_TYPES: readonly ["product.retired", "product.updated", "payment_link.retired", "customer.created", "customer.updated", "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", "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"];
800
967
  /** A delivered webhook, discriminated by `type` so `data` narrows automatically. */
801
968
  type WebhookEvent = { [TType in EventType]: {
802
969
  id: string;
@@ -807,4 +974,4 @@ type WebhookEvent = { [TType in EventType]: {
807
974
  data: EventDataMap[TType];
808
975
  }; }[EventType];
809
976
  //#endregion
810
- export { RISK_LEVELS as $, INVOICE_REASONS as A, ListQuery as At, PaymentFailure as B, isLandlinePhone as Bt, Event as C, BankCode as Ct, FeatureReset as D, GRACE_PERIOD_DAYS as Dt, Feature as E, Currency as Et, LineItem as F, TAX_BEHAVIORS as Ft, Plan as G, TokenKind as Gt, PaymentSettlement as H, nationalPhone as Ht, PAYMENT_STATUSES as I, TaxBehavior as It, PortalSession as J, PlanFeatureValues as K, tokenEnvironment as Kt, PRODUCT_CATEGORIES as L, Timestamp as Lt, Invoice as M, MOBILE_PREFIXES as Mt, InvoiceReason as N, Metadata as Nt, FeatureType as O, GracePeriodDays as Ot, InvoiceStatus as P, MobilePrefix as Pt, RESET_FREQUENCIES as Q, Payment as R, VENEZUELAN_BANKS as Rt, CustomerSession as S, BILLING_MONTHS as St, FEATURE_TYPES as T, CURRENCIES as Tt, PaymentStatus as U, ENVIRONMENTS as Ut, PaymentLink as V, isMobilePhone as Vt, Payout as W, Environment as Wt, ProductCategory as X, Product as Y, ProductVariant as Z, CurrencyAvailability as _, PAYMENT_FAILURE_CODES as _t, Actor as a, SUBSCRIPTION_STATUSES as at, CustomerDetails as b, Address as bt, BalanceAmount as c, SubscriptionRenewal as ct, CancellationFeedback as d, WebhookEndpoint as dt, Refund as et, Checkout as f, Weekday as ft, Coupon as g, ApiErrorType as gt, CollectSettings as h, ApiErrorEnvelope as ht, WebhookEvent as i, SUBMIT_LABELS as it, INVOICE_STATUSES as j, MAX_QUANTITY as jt, FeatureUsageResult as k, List as kt, CANCELLATION_FEEDBACK as l, SubscriptionStatus as lt, CheckoutPurpose as m, ApiErrorBody as mt, EventDataMap as n, Retirement as nt, AfterCompletion as o, SubmitLabel as ot, CheckoutItem as p, API_ERROR_TYPES as pt, PlanPrice as q, tokenPrefix as qt, EventType as r, RiskLevel as rt, Balance as s, Subscription as st, EVENT_TYPES as t, ResetFrequency as tt, CHECKOUT_PURPOSES as u, USAGE_FEATURE_TYPES as ut, CustomField as v, PaymentFailureCode as vt, ExchangeRate as w, BillingMonths as wt, CustomerFeature as x, AddressInput as xt, Customer as y, ACCOUNT_NUMBER_LENGTH as yt, PaymentAttempt as z, findBank as zt };
977
+ export { PaymentSettlement as $, isMobilePhone as $t, FULFILLMENT_METHODS as A, ACCOUNT_NUMBER_LENGTH as At, FulfillmentTracking as B, List as Bt, Customer as C, Weekday as Ct, Event as D, ApiErrorType as Dt, CustomerSession as E, ApiErrorEnvelope as Et, FeatureUsageResult as F, BillingMonths as Ft, InvoiceStatus as G, Metadata as Gt, INVOICE_STATUSES as H, ListSort as Ht, Fulfillment as I, CURRENCIES as It, PRODUCT_CATEGORIES as J, TaxBehavior as Jt, LineItem as K, MobilePrefix as Kt, FulfillmentChoice as L, Currency as Lt, Feature as M, AddressInput as Mt, FeatureReset as N, BILLING_MONTHS as Nt, ExchangeRate as O, PAYMENT_FAILURE_CODES as Ot, FeatureType as P, BankCode as Pt, PaymentLink as Q, isLandlinePhone as Qt, FulfillmentMethod as R, GRACE_PERIOD_DAYS as Rt, CustomField as S, WebhookEndpoint as St, CustomerFeature as T, ApiErrorBody as Tt, Invoice as U, MAX_QUANTITY as Ut, INVOICE_REASONS as V, ListQuery as Vt, InvoiceReason as W, MOBILE_PREFIXES as Wt, PaymentAttempt as X, VENEZUELAN_BANKS as Xt, Payment as Y, Timestamp as Yt, PaymentFailure as Z, findBank as Zt, CheckoutItem as _, SubmitLabel as _t, Actor as a, tokenPrefix as an, PortalSession as at, Coupon as b, SubscriptionStatus as bt, BalanceAmount as c, ProductVariant as ct, CARRIER_TEST_SCENARIOS as d, Refund as dt, nationalPhone as en, PaymentStatus as et, CHECKOUT_PURPOSES as f, ResetFrequency as ft, Checkout as g, SUBSCRIPTION_STATUSES as gt, CarrierOffice as h, SUBMIT_LABELS as ht, WebhookEvent as i, tokenEnvironment as in, PlanPrice as it, FULFILLMENT_STATUSES as j, Address as jt, FEATURE_TYPES as k, PaymentFailureCode as kt, CANCELLATION_FEEDBACK as l, RESET_FREQUENCIES as lt, Carrier as m, RiskLevel as mt, EventDataMap as n, Environment as nn, Plan as nt, AfterCompletion as o, Product as ot, CancellationFeedback as p, Retirement as pt, PAYMENT_STATUSES as q, TAX_BEHAVIORS as qt, EventType as r, TokenKind as rn, PlanFeatureValues as rt, Balance as s, ProductCategory as st, EVENT_TYPES as t, ENVIRONMENTS as tn, Payout as tt, CARRIERS as u, RISK_LEVELS as ut, CheckoutPurpose as v, Subscription as vt, CustomerDetails as w, API_ERROR_TYPES as wt, CurrencyAvailability as x, USAGE_FEATURE_TYPES as xt, CollectSettings as y, SubscriptionRenewal as yt, FulfillmentStatus as z, GracePeriodDays as zt };
@@ -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.2";
21
+ const SDK_VERSION = "1.1.0-canary.4";
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-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";
1
+ import { $ as PaymentSettlement, $t as isMobilePhone, A as FULFILLMENT_METHODS, At as ACCOUNT_NUMBER_LENGTH, B as FulfillmentTracking, Bt as List, C as Customer, Ct as Weekday, D as Event, Dt as ApiErrorType, E as CustomerSession, Et as ApiErrorEnvelope, F as FeatureUsageResult, Ft as BillingMonths, G as InvoiceStatus, Gt as Metadata, H as INVOICE_STATUSES, Ht as ListSort, I as Fulfillment, It as CURRENCIES, J as PRODUCT_CATEGORIES, Jt as TaxBehavior, K as LineItem, Kt as MobilePrefix, L as FulfillmentChoice, Lt as Currency, M as Feature, Mt as AddressInput, N as FeatureReset, Nt as BILLING_MONTHS, O as ExchangeRate, Ot as PAYMENT_FAILURE_CODES, P as FeatureType, Pt as BankCode, Q as PaymentLink, Qt as isLandlinePhone, R as FulfillmentMethod, Rt as GRACE_PERIOD_DAYS, S as CustomField, St as WebhookEndpoint, T as CustomerFeature, Tt as ApiErrorBody, U as Invoice, Ut as MAX_QUANTITY, V as INVOICE_REASONS, Vt as ListQuery, W as InvoiceReason, Wt as MOBILE_PREFIXES, X as PaymentAttempt, Xt as VENEZUELAN_BANKS, Y as Payment, Yt as Timestamp, Z as PaymentFailure, Zt as findBank, _ as CheckoutItem, _t as SubmitLabel, a as Actor, an as tokenPrefix, at as PortalSession, b as Coupon, bt as SubscriptionStatus, c as BalanceAmount, ct as ProductVariant, d as CARRIER_TEST_SCENARIOS, dt as Refund, en as nationalPhone, et as PaymentStatus, f as CHECKOUT_PURPOSES, ft as ResetFrequency, g as Checkout, gt as SUBSCRIPTION_STATUSES, h as CarrierOffice, ht as SUBMIT_LABELS, i as WebhookEvent, in as tokenEnvironment, it as PlanPrice, j as FULFILLMENT_STATUSES, jt as Address, k as FEATURE_TYPES, kt as PaymentFailureCode, l as CANCELLATION_FEEDBACK, lt as RESET_FREQUENCIES, m as Carrier, mt as RiskLevel, n as EventDataMap, nn as Environment, nt as Plan, o as AfterCompletion, ot as Product, p as CancellationFeedback, pt as Retirement, q as PAYMENT_STATUSES, qt as TAX_BEHAVIORS, r as EventType, rn as TokenKind, rt as PlanFeatureValues, s as Balance, st as ProductCategory, t as EVENT_TYPES, tn as ENVIRONMENTS, tt as Payout, u as CARRIERS, ut as RISK_LEVELS, v as CheckoutPurpose, vt as Subscription, w as CustomerDetails, wt as API_ERROR_TYPES, x as CurrencyAvailability, xt as USAGE_FEATURE_TYPES, y as CollectSettings, yt as SubscriptionRenewal, z as FulfillmentStatus, zt as GracePeriodDays } from "./events-gkaUSC93.js";
2
+ import { $ as FulfillmentOption, A as KEY_PATTERN, B as ProductCheckoutCreate, C as EventSelector, D as FulfillmentTrackingInput, E as FulfillmentInput, F as PlanFeaturesInput, G as RetireInput, H as ProductLinkCreate, I as PlanLinkCreate, J as SubscriptionUpdate, K as SubscriptionCancel, L as PlanPriceInput, M as PaymentLinkUpdate, N as PlanCheckoutCreate, O as InvoiceCreate, P as PlanCreate, Q as CustomerSubscription, R as PlanUpdate, S as CustomerUpdate, T as FeatureUpdate, U as ProductUpdate, V as ProductCreate, W as RefundCreate, X as WebhookEndpointCreate, Y as VariantInput, Z as WebhookEndpointUpdate, _ as CouponUpdate, a as CheckoutCreate, at as PortalFeatures, b as CustomerInput, c as ClientCheckoutUpdate, ct as PublicInvoice, d as ClientLinkCheckout, dt as PublicPortal, et as PaymentInstructions, f as ClientPaymentCode, g as CouponCreate, h as CollectInput, i as AfterCompletionInput, it as PaymentTestScenario, j as PaymentLinkCreate, k as InvoiceLineInput, l as ClientFulfillmentProblem, lt as PublicPaymentLink, m as ClientSubscriptionUpdate, n as RequestOptions, nt as PaymentMethodOption, o as CheckoutItemInput, ot as PublicCheckout, p as ClientSubscriptionCancel, q as SubscriptionCreate, r as TransportOptions, rt as PaymentNextAction, s as ClientCheckoutPay, st as PublicFulfillment, t as BilleteError, tt as PaymentMethodField, u as ClientInvoicePay, ut as PublicPaymentState, v as CustomFieldInput, w as FeatureCreate, x as CustomerSessionCreate, y as CustomerCreate, z as PortalSessionCreate } from "./errors-BYNcqPf5.js";
3
3
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
4
4
  //#region src/server.d.ts
5
5
  type Filters<T> = ListQuery & T;
@@ -52,12 +52,14 @@ export declare function createBillete(options: BilleteOptions): {
52
52
  active?: boolean;
53
53
  retired?: boolean;
54
54
  search?: string;
55
+ sort?: ListSort<"created" | "name">;
55
56
  }>, options?: RequestOptions) => Promise<List<Product>>;
56
57
  /** Iterates every item across pages: `for await (const item of iterate())`. */
57
58
  iterate: (query?: Filters<{
58
59
  active?: boolean;
59
60
  retired?: boolean;
60
61
  search?: string;
62
+ sort?: ListSort<"created" | "name">;
61
63
  }>) => AsyncGenerator<Product, any, any>;
62
64
  retire: (id: string, input?: RetireInput, options?: RequestOptions) => Promise<Product>;
63
65
  retireVariant: (product: string, variant: string, input?: RetireInput, options?: RequestOptions) => Promise<Product>;
@@ -69,20 +71,26 @@ export declare function createBillete(options: BilleteOptions): {
69
71
  list: (query?: Filters<{
70
72
  active?: boolean;
71
73
  search?: string;
74
+ sort?: ListSort<"created" | "name">;
72
75
  }>, options?: RequestOptions) => Promise<List<Plan>>;
73
76
  /** Iterates every item across pages: `for await (const item of iterate())`. */
74
77
  iterate: (query?: Filters<{
75
78
  active?: boolean;
76
79
  search?: string;
80
+ sort?: ListSort<"created" | "name">;
77
81
  }>) => AsyncGenerator<Plan, any, any>;
78
82
  };
79
83
  features: {
80
84
  create: (input: FeatureCreate, options?: RequestOptions) => Promise<Feature>;
81
85
  retrieve: (id: string, options?: RequestOptions) => Promise<Feature>;
82
86
  update: (id: string, input: FeatureUpdate, options?: RequestOptions) => Promise<Feature>;
83
- list: (query?: Filters<object>, options?: RequestOptions) => Promise<List<Feature>>;
87
+ list: (query?: Filters<{
88
+ sort?: ListSort<"created" | "name">;
89
+ }>, options?: RequestOptions) => Promise<List<Feature>>;
84
90
  /** Iterates every item across pages: `for await (const item of iterate())`. */
85
- iterate: (query?: Filters<object>) => AsyncGenerator<Feature, any, any>;
91
+ iterate: (query?: Filters<{
92
+ sort?: ListSort<"created" | "name">;
93
+ }>) => AsyncGenerator<Feature, any, any>;
86
94
  /** Current access to one feature. `customer` is a `cus_…` ID or your own `externalId`. */
87
95
  check: (customer: string, key: string, options?: RequestOptions) => Promise<CustomerFeature>;
88
96
  /** `true` when the customer can use a boolean feature (or has a limit feature). */
@@ -105,10 +113,12 @@ export declare function createBillete(options: BilleteOptions): {
105
113
  update: (id: string, input: CouponUpdate, options?: RequestOptions) => Promise<Coupon>;
106
114
  list: (query?: Filters<{
107
115
  search?: string;
116
+ sort?: ListSort<"created" | "code">;
108
117
  }>, options?: RequestOptions) => Promise<List<Coupon>>;
109
118
  /** Iterates every item across pages: `for await (const item of iterate())`. */
110
119
  iterate: (query?: Filters<{
111
120
  search?: string;
121
+ sort?: ListSort<"created" | "code">;
112
122
  }>) => AsyncGenerator<Coupon, any, any>;
113
123
  };
114
124
  checkouts: {
@@ -125,11 +135,13 @@ export declare function createBillete(options: BilleteOptions): {
125
135
  list: (query?: Filters<{
126
136
  retired?: boolean;
127
137
  search?: string;
138
+ sort?: ListSort<"created">;
128
139
  }>, options?: RequestOptions) => Promise<List<PaymentLink>>;
129
140
  /** Iterates every item across pages: `for await (const item of iterate())`. */
130
141
  iterate: (query?: Filters<{
131
142
  retired?: boolean;
132
143
  search?: string;
144
+ sort?: ListSort<"created">;
133
145
  }>) => AsyncGenerator<PaymentLink, any, any>;
134
146
  retire: (id: string, input?: RetireInput, options?: RequestOptions) => Promise<PaymentLink>;
135
147
  };
@@ -141,12 +153,16 @@ export declare function createBillete(options: BilleteOptions): {
141
153
  subscription?: string;
142
154
  status?: InvoiceStatus;
143
155
  search?: string;
156
+ /** `amount`: the total. */
157
+ sort?: ListSort<"created" | "amount">;
144
158
  }>, options?: RequestOptions) => Promise<List<Invoice>>;
145
159
  iterate: (query?: Filters<{
146
160
  customer?: string;
147
161
  subscription?: string;
148
162
  status?: InvoiceStatus;
149
163
  search?: string;
164
+ /** `amount`: the total. */
165
+ sort?: ListSort<"created" | "amount">;
150
166
  }>) => AsyncGenerator<Invoice, any, any>;
151
167
  /** Withdraws an open one-off Cobro; a renewal's is withdrawn by canceling its subscription. */
152
168
  void: (id: string, options?: RequestOptions) => Promise<Invoice>;
@@ -160,6 +176,7 @@ export declare function createBillete(options: BilleteOptions): {
160
176
  plan?: string;
161
177
  status?: SubscriptionStatus;
162
178
  search?: string;
179
+ sort?: ListSort<"created" | "amount">;
163
180
  }>, options?: RequestOptions) => Promise<List<Subscription>>;
164
181
  /** Iterates every item across pages: `for await (const item of iterate())`. */
165
182
  iterate: (query?: Filters<{
@@ -167,6 +184,7 @@ export declare function createBillete(options: BilleteOptions): {
167
184
  plan?: string;
168
185
  status?: SubscriptionStatus;
169
186
  search?: string;
187
+ sort?: ListSort<"created" | "amount">;
170
188
  }>) => AsyncGenerator<Subscription, any, any>;
171
189
  /** Cancels at period end by default; pass `{ atPeriodEnd: false }` to end it now. */
172
190
  cancel: (id: string, input?: SubscriptionCancel, options?: RequestOptions) => Promise<Subscription>;
@@ -178,22 +196,45 @@ export declare function createBillete(options: BilleteOptions): {
178
196
  customer?: string;
179
197
  status?: PaymentStatus;
180
198
  search?: string;
199
+ sort?: ListSort<"created" | "amount">;
181
200
  }>, options?: RequestOptions) => Promise<List<Payment>>;
182
201
  iterate: (query?: Filters<{
183
202
  customer?: string;
184
203
  status?: PaymentStatus;
185
204
  search?: string;
205
+ sort?: ListSort<"created" | "amount">;
186
206
  }>) => AsyncGenerator<Payment, any, any>;
187
207
  refund: (id: string, input?: RefundCreate, options?: RequestOptions) => Promise<Refund>;
188
208
  listRefunds: (id: string, options?: RequestOptions) => Promise<List<Refund>>;
189
209
  };
210
+ fulfillments: {
211
+ retrieve: (id: string, options?: RequestOptions) => Promise<Fulfillment>;
212
+ list: (query?: Filters<{
213
+ status?: FulfillmentStatus;
214
+ search?: string;
215
+ sort?: ListSort<"created">;
216
+ }>, options?: RequestOptions) => Promise<List<Fulfillment>>;
217
+ iterate: (query?: Filters<{
218
+ status?: FulfillmentStatus;
219
+ search?: string;
220
+ sort?: ListSort<"created">;
221
+ }>) => AsyncGenerator<Fulfillment, any, any>;
222
+ /** Sends a tracking number to be verified against the customer's chosen office. */
223
+ submitTracking: (id: string, input: FulfillmentTrackingInput, options?: RequestOptions) => Promise<Fulfillment>;
224
+ /** You handed it over: the customer has 48 hours to confirm it or report a problem. */
225
+ deliver: (id: string, options?: RequestOptions) => Promise<Fulfillment>;
226
+ };
190
227
  balance: {
191
228
  retrieve: (options?: RequestOptions) => Promise<Balance>;
192
229
  };
193
230
  payouts: {
194
231
  retrieve: (id: string, options?: RequestOptions) => Promise<Payout>;
195
- list: (query?: Filters<object>, options?: RequestOptions) => Promise<List<Payout>>;
196
- iterate: (query?: Filters<object>) => AsyncGenerator<Payout, any, any>;
232
+ list: (query?: Filters<{
233
+ sort?: ListSort<"created" | "amount">;
234
+ }>, options?: RequestOptions) => Promise<List<Payout>>;
235
+ iterate: (query?: Filters<{
236
+ sort?: ListSort<"created" | "amount">;
237
+ }>) => AsyncGenerator<Payout, any, any>;
197
238
  };
198
239
  webhookEndpoints: {
199
240
  create: (input: WebhookEndpointCreate, options?: RequestOptions) => Promise<WebhookEndpoint>;
@@ -231,4 +272,4 @@ export declare function createBillete(options: BilleteOptions): {
231
272
  /** The server client: what `createBillete` returns. */
232
273
  type Billete = ReturnType<typeof createBillete>;
233
274
  //#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 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 };
275
+ 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 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 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 FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, 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 LineItem, type List, type ListQuery, type ListSort, 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 PublicFulfillment, 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-B3vk4X4A.js";
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-BrthUu05.js";
2
2
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
3
3
  //#region ../contracts/src/environment.ts
4
4
  /**
@@ -225,6 +225,26 @@ create: (input, options) => http.request({
225
225
  options
226
226
  })
227
227
  };
228
+ const fulfillmentCrud = collection(http, "/v1/fulfillments");
229
+ /** How customers receive physical purchases; each one's funds are held until it is received. */
230
+ const fulfillments = {
231
+ retrieve: fulfillmentCrud.retrieve,
232
+ list: fulfillmentCrud.list,
233
+ iterate: fulfillmentCrud.iterate,
234
+ /** Sends a tracking number to be verified against the customer's chosen office. */
235
+ submitTracking: (id, input, options) => http.request({
236
+ method: "POST",
237
+ path: `/v1/fulfillments/${segment(id)}/tracking`,
238
+ body: input,
239
+ options
240
+ }),
241
+ /** You handed it over: the customer has 48 hours to confirm it or report a problem. */
242
+ deliver: (id, options) => http.request({
243
+ method: "POST",
244
+ path: `/v1/fulfillments/${segment(id)}/deliver`,
245
+ options
246
+ })
247
+ };
228
248
  const balance = { retrieve: (options) => http.request({
229
249
  method: "GET",
230
250
  path: "/v1/balance",
@@ -258,6 +278,7 @@ create: (input, options) => http.request({
258
278
  invoices,
259
279
  subscriptions,
260
280
  payments,
281
+ fulfillments,
261
282
  balance,
262
283
  payouts,
263
284
  webhookEndpoints,
@@ -1,4 +1,4 @@
1
- import { i as WebhookEvent } from "./events-71Q43Ni8.js";
1
+ import { i as WebhookEvent } from "./events-gkaUSC93.js";
2
2
  //#region src/webhooks.d.ts
3
3
  export declare class WebhookVerificationError extends Error {
4
4
  constructor(message: string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boelabs/billete-sdk",
3
- "version": "1.1.0-canary.2",
3
+ "version": "1.1.0-canary.4",
4
4
  "description": "Billete SDK: server client, browser client and webhook verification",
5
5
  "keywords": [
6
6
  "billete",