@openrails/billing-ui 0.245.1 → 0.247.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/client/client.d.ts +12 -2
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +49 -1
- package/dist/client/generated/wire.d.ts +84 -4
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.d.ts +27 -1
- package/dist/{client-D5Af726I.js → client-CfiKK7wX.js} +89 -70
- package/dist/client-CfiKK7wX.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-CYjlHS28.js → hooks-Cz2L8c8F.js} +2 -2
- package/dist/{hooks-CYjlHS28.js.map → hooks-Cz2L8c8F.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/client-D5Af726I.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Low-balance lines
|
|
4
|
+
|
|
5
|
+
- `getAccount()` answers `low_balance_lines`: the line each balance is judged
|
|
6
|
+
at, with its `source`. `setLowBalanceLine()` sets the customer's own.
|
|
7
|
+
|
|
3
8
|
## Embeddable billing administration
|
|
4
9
|
|
|
5
10
|
- `@openrails/billing-ui/admin` exports `BillingAdmin`, `BillingCustomerSummary`,
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BillingError } from './errors';
|
|
2
|
-
import { Account, CustomerConfig, CustomerLink, NetworkLinkChallenge, PublicConfig, CurrencyScales, ListPage, NewCard, CardCaptureReference, NextAction, Cart, Order, OrderPaymentInput, Page, Payment, PaymentMethod, Product, Subscription, SubscriptionChange, SubscriptionChangePreview, Usage } from './types';
|
|
2
|
+
import { Account, CustomerConfig, CustomerLink, LowBalanceLine, NetworkLinkChallenge, PublicConfig, CurrencyScales, ListPage, NewCard, CardCaptureReference, NextAction, Cart, Order, OrderPaymentInput, Page, Payment, PaymentMethod, Product, Subscription, SubscriptionChange, SubscriptionChangePreview, Usage } from './types';
|
|
3
3
|
export interface BillingClientOptions {
|
|
4
4
|
/** OpenRails embedded mount. Default "/billing/v1". */
|
|
5
5
|
baseUrl?: string;
|
|
@@ -228,9 +228,19 @@ export declare function createBillingClient(options?: BillingClientOptions): {
|
|
|
228
228
|
}): Promise<ListPage<Payment>>;
|
|
229
229
|
/**
|
|
230
230
|
* The customer's summary: balance and amount owed per currency, the card
|
|
231
|
-
* that pays each currency, and
|
|
231
|
+
* that pays each currency, and the low-balance line of each balance.
|
|
232
232
|
*/
|
|
233
233
|
getAccount(signal?: AbortSignal): Promise<Account>;
|
|
234
|
+
/**
|
|
235
|
+
* Sets the customer's own low-balance line in one currency and answers
|
|
236
|
+
* the line its balance is judged at. `null` inherits the merchant's; 0
|
|
237
|
+
* turns that part off.
|
|
238
|
+
*/
|
|
239
|
+
setLowBalanceLine(input: {
|
|
240
|
+
currency: string;
|
|
241
|
+
amount: string | null;
|
|
242
|
+
runwayHours: number | null;
|
|
243
|
+
}): Promise<LowBalanceLine>;
|
|
234
244
|
/**
|
|
235
245
|
* A page of the customer's usage: its groups by total amount, largest
|
|
236
246
|
* first. Pass the answer's `next_cursor` as `cursor` for the next page.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type OpenRailsErrorCode = "admission_captured" | "admission_not_found" | "already_owned" | "application_required" | "as_of_required" | "authentication_required" | "authentication_unavailable" | "authorization_unavailable" | "billing_archive_integrity" | "billing_archive_invalid_artifact" | "billing_archive_merchant_mismatch" | "billing_archive_not_empty" | "billing_archive_unavailable" | "billing_archive_unsupported_state" | "billing_policy_not_found" | "cancel_unsupported_on_rail" | "captcha_invalid" | "captcha_required" | "card_attempts_blocked" | "card_declined" | "card_not_saved" | "card_requires_https" | "catalog_benefit_overlap" | "catalog_revision_conflict" | "checkout_attempt_closed" | "checkout_attempt_expired" | "checkout_attempts_exhausted" | "checkout_embed_origins_required" | "checkout_expired" | "checkout_not_found" | "credential_expired" | "credential_revoked" | "credit_grant_held" | "credit_grant_not_found" | "credit_grant_unavailable" | "csrf_origin_denied" | "currency_unsupported" | "custodian_capture_unavailable" | "customer_action_required" | "customer_email_required" | "customer_issuer_mismatch" | "customer_not_found" | "customer_payment_unsupported" | "customer_session_required" | "dashboard_invalid" | "database_busy" | "default_payment_method_invalid" | "default_payment_method_required" | "default_rate_card_not_found" | "finding_action_failed" | "finding_not_actionable" | "hold_not_found" | "host_event_not_found" | "host_principal_invalid" | "hosted_checkout_unavailable" | "idempotency_key_in_use" | "idempotency_key_required" | "idempotency_key_reused" | "insufficient_credits" | "insufficient_funds" | "internal_error" | "invalid_cursor" | "invalid_customer_id" | "invalid_host_event_request" | "invalid_param" | "invalid_payment_method" | "invalid_psp_reference" | "invalid_query" | "invalid_request_body" | "invalid_settlement_status_request" | "invoker_scoped_principal" | "merchant_config_read_only" | "merchant_mismatch" | "merchant_unresolved" | "meter_in_use" | "meter_rate_card_conflict" | "method_not_allowed" | "metrics_query_invalid" | "model_unavailable" | "network_account_linked" | "network_link_challenge_invalid" | "network_link_conflict" | "network_link_in_use" | "network_terms_required" | "order_action_not_allowed" | "order_has_recurring_line" | "order_line_unavailable" | "order_not_cancelable" | "order_not_payable" | "order_payment_in_progress" | "order_total_changed" | "payment_duplicate_refused" | "payment_exceeds_due" | "payment_failed" | "payment_idempotency_conflict" | "payment_in_progress" | "payment_method_delete_failed" | "payment_method_delete_unsupported" | "payment_method_not_psp_vaulted" | "payment_method_not_usable" | "payment_method_psp_mismatch" | "payment_method_required" | "payment_method_same_vault" | "payment_method_stale" | "payment_method_update_failed" | "payment_method_update_unsupported" | "payment_not_found" | "payment_not_refundable" | "payment_not_retryable" | "payment_option_unavailable" | "payment_provider_rejected" | "permission_required" | "price_change_currency_mismatch" | "price_change_target_archived" | "price_increase_notice_too_short" | "price_key_cadence_conflict" | "price_key_not_found" | "price_migration_not_found" | "price_not_found" | "price_not_sellable" | "product_in_use" | "product_not_found" | "product_tier_group_conflict" | "product_tier_group_in_use" | "provider_cancel_held" | "provider_outcome_unknown" | "psp_claim_requires_proof" | "psp_credentials_rejected" | "psp_exists" | "psp_key_taken" | "psp_last_active" | "psp_not_found" | "purchase_review_resolved" | "quantity_not_allowed" | "rate_card_product_not_found" | "rate_limit_exceeded" | "rebill_terms_committed" | "refund_failed" | "refund_rail_unavailable" | "refund_unsupported" | "request_body_too_large" | "resource_access_denied" | "resource_conflict" | "resource_not_found" | "revision_mismatch" | "route_not_found" | "running_charge_not_found" | "scheduled_change_exists" | "service_credential_customer_scope_denied" | "service_unavailable" | "solana_rpc_unavailable" | "solana_transaction_refused" | "step_up_required" | "step_up_unavailable" | "stored_credential_required" | "subscription_change_already_scheduled" | "subscription_change_cadence_unsupported" | "subscription_change_credit_exceeds_price" | "subscription_change_cycle_unknown" | "subscription_change_idempotency_conflict" | "subscription_change_idempotency_key_required" | "subscription_change_in_flight" | "subscription_change_period_unknown" | "subscription_change_provider_conflict" | "subscription_change_refused" | "subscription_change_renewal_due" | "subscription_change_requires_linked_plan" | "subscription_change_target_inactive" | "subscription_change_unsupported_on_rail" | "subscription_not_active" | "subscription_not_found" | "subscription_paid_through" | "subscription_resumable" | "trial_unsupported_on_rail" | "unknown_field" | "unsupported_media_type" | "usage_meter_invalid" | "usage_meter_not_found" | "usage_not_priced" | "usage_rate_card_invalid" | "webhook_account_mismatch" | "webhook_invalid";
|
|
1
|
+
export type OpenRailsErrorCode = "admission_captured" | "admission_not_found" | "already_owned" | "application_required" | "as_of_required" | "authentication_required" | "authentication_unavailable" | "authorization_unavailable" | "billing_archive_integrity" | "billing_archive_invalid_artifact" | "billing_archive_merchant_mismatch" | "billing_archive_not_empty" | "billing_archive_unavailable" | "billing_archive_unsupported_state" | "billing_policy_not_found" | "cancel_unsupported_on_rail" | "captcha_invalid" | "captcha_required" | "card_attempts_blocked" | "card_declined" | "card_not_saved" | "card_requires_https" | "catalog_benefit_overlap" | "catalog_revision_conflict" | "checkout_attempt_closed" | "checkout_attempt_expired" | "checkout_attempts_exhausted" | "checkout_embed_origins_required" | "checkout_expired" | "checkout_not_found" | "credential_expired" | "credential_revoked" | "credit_grant_held" | "credit_grant_not_found" | "credit_grant_unavailable" | "csrf_origin_denied" | "currency_unsupported" | "custodian_capture_unavailable" | "customer_action_required" | "customer_email_required" | "customer_issuer_mismatch" | "customer_not_found" | "customer_payment_unsupported" | "customer_session_required" | "dashboard_invalid" | "database_busy" | "default_payment_method_invalid" | "default_payment_method_required" | "default_rate_card_not_found" | "destructive_actions_held" | "finding_action_failed" | "finding_not_actionable" | "finding_requires_merchant_config" | "hold_not_found" | "host_event_not_found" | "host_principal_invalid" | "hosted_checkout_unavailable" | "idempotency_key_in_use" | "idempotency_key_required" | "idempotency_key_reused" | "insufficient_credits" | "insufficient_funds" | "internal_error" | "invalid_cursor" | "invalid_customer_id" | "invalid_host_event_request" | "invalid_param" | "invalid_payment_method" | "invalid_psp_reference" | "invalid_query" | "invalid_request_body" | "invalid_settlement_status_request" | "invoker_scoped_principal" | "merchant_config_read_only" | "merchant_mismatch" | "merchant_unresolved" | "meter_in_use" | "meter_rate_card_conflict" | "method_not_allowed" | "metrics_query_invalid" | "model_unavailable" | "network_account_linked" | "network_link_challenge_invalid" | "network_link_conflict" | "network_link_in_use" | "network_terms_required" | "order_action_not_allowed" | "order_has_recurring_line" | "order_line_unavailable" | "order_not_cancelable" | "order_not_payable" | "order_payment_in_progress" | "order_total_changed" | "payment_duplicate_refused" | "payment_exceeds_due" | "payment_failed" | "payment_idempotency_conflict" | "payment_in_progress" | "payment_method_delete_failed" | "payment_method_delete_unsupported" | "payment_method_not_psp_vaulted" | "payment_method_not_usable" | "payment_method_psp_mismatch" | "payment_method_required" | "payment_method_same_vault" | "payment_method_stale" | "payment_method_update_failed" | "payment_method_update_unsupported" | "payment_not_found" | "payment_not_refundable" | "payment_not_retryable" | "payment_option_unavailable" | "payment_provider_rejected" | "permission_required" | "price_change_currency_mismatch" | "price_change_target_archived" | "price_increase_notice_too_short" | "price_key_cadence_conflict" | "price_key_not_found" | "price_migration_not_found" | "price_not_found" | "price_not_sellable" | "product_in_use" | "product_not_found" | "product_tier_group_conflict" | "product_tier_group_in_use" | "provider_cancel_held" | "provider_outcome_unknown" | "provider_writes_held" | "psp_claim_requires_proof" | "psp_credentials_rejected" | "psp_exists" | "psp_key_taken" | "psp_last_active" | "psp_not_found" | "purchase_review_resolved" | "quantity_not_allowed" | "rate_card_product_not_found" | "rate_limit_exceeded" | "rebill_terms_committed" | "refund_failed" | "refund_rail_unavailable" | "refund_unsupported" | "request_body_too_large" | "resource_access_denied" | "resource_conflict" | "resource_not_found" | "revision_mismatch" | "route_not_found" | "running_charge_not_found" | "scheduled_change_exists" | "service_credential_customer_scope_denied" | "service_unavailable" | "solana_rpc_unavailable" | "solana_transaction_refused" | "step_up_required" | "step_up_unavailable" | "stored_credential_required" | "subscription_change_already_scheduled" | "subscription_change_cadence_unsupported" | "subscription_change_credit_exceeds_price" | "subscription_change_cycle_unknown" | "subscription_change_idempotency_conflict" | "subscription_change_idempotency_key_required" | "subscription_change_in_flight" | "subscription_change_period_unknown" | "subscription_change_provider_conflict" | "subscription_change_refused" | "subscription_change_renewal_due" | "subscription_change_requires_linked_plan" | "subscription_change_target_inactive" | "subscription_change_unsupported_on_rail" | "subscription_not_active" | "subscription_not_found" | "subscription_paid_through" | "subscription_resumable" | "trial_unsupported_on_rail" | "unknown_field" | "unsupported_media_type" | "usage_meter_invalid" | "usage_meter_not_found" | "usage_not_priced" | "usage_rate_card_invalid" | "webhook_account_mismatch" | "webhook_invalid";
|
|
2
2
|
export type OpenRailsErrorType = "api_error" | "authentication_error" | "authorization_error" | "card_error" | "invalid_request_error" | "rate_limit_error";
|
|
3
3
|
export declare const OPENRAILS_ERROR_CODES: Readonly<Record<OpenRailsErrorCode, {
|
|
4
4
|
status: number;
|
|
@@ -1231,6 +1231,20 @@ export declare const OPENRAILS_ROUTES: readonly [{
|
|
|
1231
1231
|
};
|
|
1232
1232
|
readonly errors: readonly [];
|
|
1233
1233
|
readonly errorSets: readonly ["tier:customer"];
|
|
1234
|
+
}, {
|
|
1235
|
+
readonly method: "PUT";
|
|
1236
|
+
readonly path: "/v1/me/low-balance-lines/{currency}";
|
|
1237
|
+
readonly group: "customer";
|
|
1238
|
+
readonly auth: "customer";
|
|
1239
|
+
readonly permission: null;
|
|
1240
|
+
readonly sensitive: false;
|
|
1241
|
+
readonly mountedWhen: null;
|
|
1242
|
+
readonly request: "SetLowBalanceLineParams";
|
|
1243
|
+
readonly responses: {
|
|
1244
|
+
readonly 200: "EffectiveLowBalanceLine";
|
|
1245
|
+
};
|
|
1246
|
+
readonly errors: readonly ["currency_unsupported", "invalid_param"];
|
|
1247
|
+
readonly errorSets: readonly ["tier:customer", "request"];
|
|
1234
1248
|
}, {
|
|
1235
1249
|
readonly method: "GET";
|
|
1236
1250
|
readonly path: "/v1/me/balance/transactions";
|
|
@@ -2046,6 +2060,40 @@ export declare const OPENRAILS_ROUTES: readonly [{
|
|
|
2046
2060
|
};
|
|
2047
2061
|
readonly errors: readonly ["as_of_required", "invalid_param", "invalid_psp_reference", "resource_conflict"];
|
|
2048
2062
|
readonly errorSets: readonly ["tier:merchant", "request"];
|
|
2063
|
+
}, {
|
|
2064
|
+
readonly method: "GET";
|
|
2065
|
+
readonly path: "/v1/merchant/destructive-holds";
|
|
2066
|
+
readonly group: "merchant_config";
|
|
2067
|
+
readonly auth: "merchant";
|
|
2068
|
+
readonly permission: {
|
|
2069
|
+
readonly merchant: "merchant:config:read";
|
|
2070
|
+
readonly root: "root:config:read";
|
|
2071
|
+
};
|
|
2072
|
+
readonly sensitive: false;
|
|
2073
|
+
readonly mountedWhen: null;
|
|
2074
|
+
readonly request: null;
|
|
2075
|
+
readonly responses: {
|
|
2076
|
+
readonly 200: "ListPage<DestructiveHold>";
|
|
2077
|
+
};
|
|
2078
|
+
readonly errors: readonly ["invalid_cursor", "service_unavailable"];
|
|
2079
|
+
readonly errorSets: readonly ["tier:merchant", "request"];
|
|
2080
|
+
}, {
|
|
2081
|
+
readonly method: "POST";
|
|
2082
|
+
readonly path: "/v1/merchant/destructive-holds/{id}/clear";
|
|
2083
|
+
readonly group: "merchant_config";
|
|
2084
|
+
readonly auth: "merchant";
|
|
2085
|
+
readonly permission: {
|
|
2086
|
+
readonly merchant: "merchant:config:manage";
|
|
2087
|
+
readonly root: "root:config:manage";
|
|
2088
|
+
};
|
|
2089
|
+
readonly sensitive: false;
|
|
2090
|
+
readonly mountedWhen: null;
|
|
2091
|
+
readonly request: "ClearDestructiveHoldParams";
|
|
2092
|
+
readonly responses: {
|
|
2093
|
+
readonly 200: "DestructiveHold";
|
|
2094
|
+
};
|
|
2095
|
+
readonly errors: readonly ["invalid_param", "permission_required", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
2096
|
+
readonly errorSets: readonly ["tier:merchant", "request"];
|
|
2049
2097
|
}, {
|
|
2050
2098
|
readonly method: "POST";
|
|
2051
2099
|
readonly path: "/v1/app/notification-consumers/{name}";
|
|
@@ -2279,7 +2327,7 @@ export declare const OPENRAILS_ROUTES: readonly [{
|
|
|
2279
2327
|
readonly responses: {
|
|
2280
2328
|
readonly 200: "FindingResolution";
|
|
2281
2329
|
};
|
|
2282
|
-
readonly errors: readonly ["finding_action_failed", "finding_not_actionable", "idempotency_key_reused", "invalid_param", "payment_not_found", "payment_not_refundable", "provider_cancel_held", "rebill_terms_committed", "refund_failed", "refund_rail_unavailable", "refund_unsupported", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
2330
|
+
readonly errors: readonly ["finding_action_failed", "finding_not_actionable", "finding_requires_merchant_config", "idempotency_key_reused", "invalid_param", "payment_not_found", "payment_not_refundable", "provider_cancel_held", "rebill_terms_committed", "refund_failed", "refund_rail_unavailable", "refund_unsupported", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
2283
2331
|
readonly errorSets: readonly ["tier:merchant", "request"];
|
|
2284
2332
|
}, {
|
|
2285
2333
|
readonly method: "GET";
|
|
@@ -171,8 +171,19 @@ export type BalanceHostEvent = {
|
|
|
171
171
|
available_amount: string;
|
|
172
172
|
owed_amount: string;
|
|
173
173
|
accrual_rate_per_hour: string;
|
|
174
|
+
usage_rate_per_hour: string;
|
|
175
|
+
low_balance_amount: string;
|
|
174
176
|
as_of: string;
|
|
175
|
-
depletes_at: string;
|
|
177
|
+
depletes_at: string | null;
|
|
178
|
+
runway_ends_at: string | null;
|
|
179
|
+
};
|
|
180
|
+
export type BalanceNoticeAmount = {
|
|
181
|
+
currency: string;
|
|
182
|
+
amount: string;
|
|
183
|
+
};
|
|
184
|
+
export type BalanceNoticeSettings = {
|
|
185
|
+
runway_hours?: number;
|
|
186
|
+
low_amounts?: BalanceNoticeAmount[];
|
|
176
187
|
};
|
|
177
188
|
export type BalanceTransaction = {
|
|
178
189
|
id: string;
|
|
@@ -366,6 +377,24 @@ export type CatalogFieldConflict = {
|
|
|
366
377
|
set_by: string;
|
|
367
378
|
set_at: string;
|
|
368
379
|
};
|
|
380
|
+
export type ChangeBasis = {
|
|
381
|
+
row_version: number | null;
|
|
382
|
+
absent_rail_id: string | null;
|
|
383
|
+
card_version_id: string | null;
|
|
384
|
+
};
|
|
385
|
+
export type ChangeEffects = {
|
|
386
|
+
ends_access: boolean;
|
|
387
|
+
moves_money: boolean;
|
|
388
|
+
provider_write: boolean;
|
|
389
|
+
};
|
|
390
|
+
export type ChangeEvidence = {
|
|
391
|
+
read: string;
|
|
392
|
+
provider: Record<string, unknown> | null;
|
|
393
|
+
};
|
|
394
|
+
export type ChangeSubject = {
|
|
395
|
+
type: string;
|
|
396
|
+
id: string;
|
|
397
|
+
};
|
|
369
398
|
export type ChangeSubscriptionParams = {
|
|
370
399
|
price_id?: string;
|
|
371
400
|
quantity?: number;
|
|
@@ -389,6 +418,9 @@ export type CheckoutRoutingRule = {
|
|
|
389
418
|
match?: CheckoutRoutingMatch;
|
|
390
419
|
prefer: string[];
|
|
391
420
|
};
|
|
421
|
+
export type ClearDestructiveHoldParams = {
|
|
422
|
+
reason?: string;
|
|
423
|
+
};
|
|
392
424
|
export type ConfirmOrderParams = {
|
|
393
425
|
signature?: string;
|
|
394
426
|
};
|
|
@@ -570,6 +602,7 @@ export type CustomerAccount = {
|
|
|
570
602
|
id: string;
|
|
571
603
|
balances: Balance[];
|
|
572
604
|
default_payment_methods: DefaultPaymentMethod[];
|
|
605
|
+
low_balance_lines: EffectiveLowBalanceLine[];
|
|
573
606
|
};
|
|
574
607
|
export type CustomerAmount = {
|
|
575
608
|
min_amount: string;
|
|
@@ -625,6 +658,7 @@ export type CustomerNetworkHostEvent = {
|
|
|
625
658
|
export type CustomerSettings = {
|
|
626
659
|
credit_limits: CreditLimit[];
|
|
627
660
|
trust_levels: TrustLevel[];
|
|
661
|
+
low_balance_lines: LowBalanceLine[];
|
|
628
662
|
billing_policy: string | null;
|
|
629
663
|
invoice_profile: InvoiceProfile | null;
|
|
630
664
|
};
|
|
@@ -717,6 +751,22 @@ export type DelinquencyHostEvent = {
|
|
|
717
751
|
grace_days: number;
|
|
718
752
|
amount_floor: string;
|
|
719
753
|
};
|
|
754
|
+
export type DestructiveHold = {
|
|
755
|
+
id: string;
|
|
756
|
+
merchant_id: string;
|
|
757
|
+
scope: string;
|
|
758
|
+
action: string;
|
|
759
|
+
window: string;
|
|
760
|
+
observed: number;
|
|
761
|
+
requested: number;
|
|
762
|
+
ceiling: number;
|
|
763
|
+
opened_at: string;
|
|
764
|
+
cleared_at: string | null;
|
|
765
|
+
};
|
|
766
|
+
export type DestructiveHoldEvent = {
|
|
767
|
+
hold_id: string;
|
|
768
|
+
scope: string;
|
|
769
|
+
};
|
|
720
770
|
export type DriftField = {
|
|
721
771
|
field: string;
|
|
722
772
|
openrails_value: string;
|
|
@@ -738,6 +788,12 @@ export type DunningTier = {
|
|
|
738
788
|
max_cycle_hours?: number;
|
|
739
789
|
retry_after_hours?: number[];
|
|
740
790
|
};
|
|
791
|
+
export type EffectiveLowBalanceLine = {
|
|
792
|
+
currency: string;
|
|
793
|
+
amount: string;
|
|
794
|
+
runway_hours: number;
|
|
795
|
+
source: "customer" | "default" | "merchant";
|
|
796
|
+
};
|
|
741
797
|
export type EntitlementChange = {
|
|
742
798
|
product_id: string;
|
|
743
799
|
product_key: string;
|
|
@@ -792,9 +848,23 @@ export type Finding = {
|
|
|
792
848
|
resolution: string | null;
|
|
793
849
|
resolved_by: string | null;
|
|
794
850
|
operator_notes: string | null;
|
|
851
|
+
source: "pull" | "verification" | null;
|
|
852
|
+
change: FindingChange | null;
|
|
853
|
+
approval_run_id: string | null;
|
|
795
854
|
created_at: string;
|
|
796
855
|
updated_at: string;
|
|
797
856
|
};
|
|
857
|
+
export type FindingChange = {
|
|
858
|
+
kind: "adopt_subscription" | "cancel_provider_schedule" | "cancel_subscription" | "collect_skipped_renewal" | "create_subscription" | "record_charge" | "record_refund" | "refund_charge_after_cancel" | "revoke_access" | "update_card";
|
|
859
|
+
subject: ChangeSubject;
|
|
860
|
+
customer_id: string | null;
|
|
861
|
+
from: Record<string, unknown> | null;
|
|
862
|
+
to: Record<string, unknown> | null;
|
|
863
|
+
effects: ChangeEffects;
|
|
864
|
+
basis: ChangeBasis;
|
|
865
|
+
observed_at: string;
|
|
866
|
+
evidence: ChangeEvidence;
|
|
867
|
+
};
|
|
798
868
|
export type FindingRecommendation = {
|
|
799
869
|
action: string;
|
|
800
870
|
params: Record<string, unknown> | null;
|
|
@@ -815,9 +885,10 @@ export type HeldEntitlements = {
|
|
|
815
885
|
truncated: boolean;
|
|
816
886
|
};
|
|
817
887
|
export type HostEvent = {
|
|
888
|
+
destructive_hold: DestructiveHoldEvent | null;
|
|
818
889
|
id: string;
|
|
819
890
|
merchant_id: string;
|
|
820
|
-
type: "balance.depleted" | "balance.low" | "customer.network_linked" | "customer.network_unlinked" | "delinquency.cleared" | "delinquency.entered" | "delinquency.grace" | "mandate.revoked" | "order.canceled" | "order.completed" | "order.expired" | "order.payment_failed" | "order.requires_action" | "order.voided" | "payment.settled" | "product.entitlements_changed";
|
|
891
|
+
type: "balance.depleted" | "balance.low" | "customer.network_linked" | "customer.network_unlinked" | "delinquency.cleared" | "delinquency.entered" | "delinquency.grace" | "destructive.hold_cleared" | "destructive.hold_opened" | "mandate.revoked" | "order.canceled" | "order.completed" | "order.expired" | "order.payment_failed" | "order.requires_action" | "order.voided" | "payment.settled" | "product.entitlements_changed";
|
|
821
892
|
occurred_at: string;
|
|
822
893
|
acknowledged_at: string | null;
|
|
823
894
|
payment: PaymentSettledEvent | null;
|
|
@@ -843,6 +914,11 @@ export type InvoiceProfile = {
|
|
|
843
914
|
billing_contacts: InvoiceContact[];
|
|
844
915
|
memo: string;
|
|
845
916
|
};
|
|
917
|
+
export type LowBalanceLine = {
|
|
918
|
+
currency: string;
|
|
919
|
+
amount: string | null;
|
|
920
|
+
runway_hours: number | null;
|
|
921
|
+
};
|
|
846
922
|
export type Mandate = {
|
|
847
923
|
id: string;
|
|
848
924
|
customer_id: string;
|
|
@@ -906,6 +982,7 @@ export type MerchantSettings = {
|
|
|
906
982
|
checkout_routing?: CheckoutRoutingRule[];
|
|
907
983
|
dunning_policy?: DunningPolicy;
|
|
908
984
|
checkout?: MerchantCheckoutSettings;
|
|
985
|
+
balance_notices?: BalanceNoticeSettings;
|
|
909
986
|
billing_policies?: BillingPolicy[];
|
|
910
987
|
billing_policy_bindings?: BillingPolicyBinding[];
|
|
911
988
|
delegated_invoker_wasted_spend_limits?: BudgetWindow[];
|
|
@@ -1670,7 +1747,6 @@ export type RunningCharge = {
|
|
|
1670
1747
|
posted_amount: string;
|
|
1671
1748
|
as_of: string;
|
|
1672
1749
|
overdraft_amount: string;
|
|
1673
|
-
low_balance_amount: string;
|
|
1674
1750
|
resource: string | null;
|
|
1675
1751
|
created_at: string;
|
|
1676
1752
|
updated_at: string;
|
|
@@ -1695,6 +1771,10 @@ export type SetDashboardParams = {
|
|
|
1695
1771
|
export type SetDefaultPaymentMethodParams = {
|
|
1696
1772
|
payment_method_id?: string;
|
|
1697
1773
|
};
|
|
1774
|
+
export type SetLowBalanceLineParams = {
|
|
1775
|
+
amount?: string | null;
|
|
1776
|
+
runway_hours?: number | null;
|
|
1777
|
+
};
|
|
1698
1778
|
export type SetMeterParams = {
|
|
1699
1779
|
event_type?: string;
|
|
1700
1780
|
value_property?: string;
|
|
@@ -1740,7 +1820,6 @@ export type StartRunningChargeParams = {
|
|
|
1740
1820
|
started_at?: string;
|
|
1741
1821
|
minimum_amount?: string;
|
|
1742
1822
|
overdraft_amount?: string;
|
|
1743
|
-
low_balance_amount?: string;
|
|
1744
1823
|
resource?: string;
|
|
1745
1824
|
};
|
|
1746
1825
|
export type StopRunningChargeParams = {
|
|
@@ -1853,6 +1932,7 @@ export type UpdateAlertWebhookParams = {
|
|
|
1853
1932
|
export type UpdateCustomerParams = {
|
|
1854
1933
|
credit_limits?: CreditLimit[];
|
|
1855
1934
|
trust_levels?: TrustLevel[];
|
|
1935
|
+
low_balance_lines?: LowBalanceLine[];
|
|
1856
1936
|
billing_policy?: string | null;
|
|
1857
1937
|
invoice_profile?: InvoiceProfile | null;
|
|
1858
1938
|
};
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CANCEL_REASON_MAX, CANCEL_REASON_MIN, createBillingClient, isWalletAction, isWalletRejection, RETRY_BUDGET_MS, signWalletAction, WalletRejectedError, type BillingClient, type BillingClientOptions, type ListOptions, type OrderResult, type ProductListOptions, type SendSolanaTransaction, type SubscriptionChangeInput, type UsageOptions, } from './client';
|
|
2
2
|
export { redeemAssertion, tokenSource, type RedeemAssertionOptions, type TokenResponse, type TokenSource, type TokenSourceOptions, } from './token-source';
|
|
3
3
|
export { BillingError, isBillingError, isServerError, readBillingError, toBillingError, type BillingErrorBody, } from './errors';
|
|
4
|
-
export type { Account, Balance, CaptchaConfig, CardSummary, Cart, Currency, CurrencyScales, CustomerConfig, CustomerLink, PaymentConfig, PaymentFailure, PublicConfig, PublicMerchant, ListPage, NetworkLinkChallenge, NewCard, CardCaptureReference, NextAction, Order, OrderLine, OrderLineRefusal, OrderPaymentInput, OrderPreviewLine, Page, Payment, PaymentMethod, PaymentRecovery, Price, Product, Subscription, SubscriptionDunning, SubscriptionProduct, SubscriptionStatus, SubscriptionChange, SubscriptionChangePreview, Usage, UsageRow, } from './types';
|
|
4
|
+
export type { Account, Balance, CaptchaConfig, CardSummary, Cart, Currency, CurrencyScales, CustomerConfig, CustomerLink, PaymentConfig, PaymentFailure, PublicConfig, PublicMerchant, ListPage, LowBalanceLine, NetworkLinkChallenge, NewCard, CardCaptureReference, NextAction, Order, OrderLine, OrderLineRefusal, OrderPaymentInput, OrderPreviewLine, Page, Payment, PaymentMethod, PaymentRecovery, Price, Product, Subscription, SubscriptionDunning, SubscriptionProduct, SubscriptionStatus, SubscriptionChange, SubscriptionChangePreview, Usage, UsageRow, } from './types';
|
|
5
5
|
export { amountToDecimal, decimalToAmount, formatAmount, type Amount, } from '../lib/money';
|
package/dist/client/types.d.ts
CHANGED
|
@@ -694,9 +694,25 @@ export declare const balanceSchema: z.ZodObject<{
|
|
|
694
694
|
depletes_at: z.ZodNullable<z.ZodString>;
|
|
695
695
|
}, z.core.$strip>;
|
|
696
696
|
export type Balance = z.infer<typeof balanceSchema>;
|
|
697
|
+
/**
|
|
698
|
+
* The low-balance line a balance is judged at: the customer is told when what
|
|
699
|
+
* it may spend is under the larger of `amount` and its burn rate times
|
|
700
|
+
* `runway_hours`. `source` is `customer`, `merchant` or `default`.
|
|
701
|
+
*/
|
|
702
|
+
export declare const lowBalanceLineSchema: z.ZodObject<{
|
|
703
|
+
currency: z.ZodString;
|
|
704
|
+
amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
705
|
+
runway_hours: z.ZodNumber;
|
|
706
|
+
source: z.ZodEnum<{
|
|
707
|
+
customer: "customer";
|
|
708
|
+
default: "default";
|
|
709
|
+
merchant: "merchant";
|
|
710
|
+
}>;
|
|
711
|
+
}, z.core.$strip>;
|
|
712
|
+
export type LowBalanceLine = z.infer<typeof lowBalanceLineSchema>;
|
|
697
713
|
/**
|
|
698
714
|
* The signed-in customer's summary (`GET /me`): money per currency, the
|
|
699
|
-
* default card of each currency, and
|
|
715
|
+
* default card of each currency, and the low-balance line of each balance.
|
|
700
716
|
*/
|
|
701
717
|
export declare const accountSchema: z.ZodObject<{
|
|
702
718
|
id: z.ZodString;
|
|
@@ -716,6 +732,16 @@ export declare const accountSchema: z.ZodObject<{
|
|
|
716
732
|
currency: z.ZodString;
|
|
717
733
|
payment_method_id: z.ZodString;
|
|
718
734
|
}, z.core.$strip>>;
|
|
735
|
+
low_balance_lines: z.ZodArray<z.ZodObject<{
|
|
736
|
+
currency: z.ZodString;
|
|
737
|
+
amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
738
|
+
runway_hours: z.ZodNumber;
|
|
739
|
+
source: z.ZodEnum<{
|
|
740
|
+
customer: "customer";
|
|
741
|
+
default: "default";
|
|
742
|
+
merchant: "merchant";
|
|
743
|
+
}>;
|
|
744
|
+
}, z.core.$strip>>;
|
|
719
745
|
}, z.core.$strip>;
|
|
720
746
|
export type Account = z.infer<typeof accountSchema>;
|
|
721
747
|
/**
|