@blocklet/payment-types 1.24.4 → 1.25.1
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/lib/auto-recharge-config.d.ts +11 -0
- package/lib/checkout-session.d.ts +6 -0
- package/lib/exchange-rate-provider.d.ts +38 -0
- package/lib/index.d.ts +6 -0
- package/lib/payment-intent.d.ts +5 -0
- package/lib/price-quote.d.ts +87 -0
- package/lib/price.d.ts +6 -0
- package/lib/subscription.d.ts +11 -0
- package/lib/types.d.ts +57 -1
- package/package.json +2 -2
|
@@ -22,6 +22,13 @@ export declare class AutoRechargeConfig extends Model<InferAttributes<AutoRechar
|
|
|
22
22
|
attempt_count: number;
|
|
23
23
|
total_amount: string;
|
|
24
24
|
};
|
|
25
|
+
slippage_config?: {
|
|
26
|
+
mode?: 'percent' | 'rate';
|
|
27
|
+
percent?: number;
|
|
28
|
+
min_acceptable_rate?: string;
|
|
29
|
+
base_currency?: string;
|
|
30
|
+
updated_at_ms?: number;
|
|
31
|
+
} | null;
|
|
25
32
|
metadata?: Record<string, any>;
|
|
26
33
|
created_at: CreationOptional<Date>;
|
|
27
34
|
updated_at: CreationOptional<Date>;
|
|
@@ -106,6 +113,10 @@ export declare class AutoRechargeConfig extends Model<InferAttributes<AutoRechar
|
|
|
106
113
|
total_amount: string;
|
|
107
114
|
};
|
|
108
115
|
};
|
|
116
|
+
slippage_config: {
|
|
117
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
118
|
+
allowNull: boolean;
|
|
119
|
+
};
|
|
109
120
|
metadata: {
|
|
110
121
|
type: DataTypes.AbstractDataTypeConstructor;
|
|
111
122
|
allowNull: boolean;
|
|
@@ -24,6 +24,7 @@ export declare class CheckoutSession extends Model<InferAttributes<CheckoutSessi
|
|
|
24
24
|
line_items: LineItem[];
|
|
25
25
|
amount_subtotal: string;
|
|
26
26
|
amount_total: string;
|
|
27
|
+
slippage_percent?: number;
|
|
27
28
|
total_details?: {
|
|
28
29
|
amount_discount?: string;
|
|
29
30
|
amount_shipping?: string;
|
|
@@ -207,6 +208,11 @@ export declare class CheckoutSession extends Model<InferAttributes<CheckoutSessi
|
|
|
207
208
|
type: DataTypes.StringDataType;
|
|
208
209
|
allowNull: boolean;
|
|
209
210
|
};
|
|
211
|
+
slippage_percent: {
|
|
212
|
+
type: DataTypes.DecimalDataType;
|
|
213
|
+
allowNull: boolean;
|
|
214
|
+
defaultValue: number;
|
|
215
|
+
};
|
|
210
216
|
total_details: {
|
|
211
217
|
type: DataTypes.AbstractDataTypeConstructor;
|
|
212
218
|
allowNull: boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CreationOptional, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
|
|
2
|
+
import type { LiteralUnion } from 'type-fest';
|
|
3
|
+
export declare const nextExchangeRateProviderId: (size?: number) => string;
|
|
4
|
+
export declare class ExchangeRateProvider extends Model<InferAttributes<ExchangeRateProvider>, InferCreationAttributes<ExchangeRateProvider>> {
|
|
5
|
+
id: CreationOptional<string>;
|
|
6
|
+
name: string;
|
|
7
|
+
type: CreationOptional<LiteralUnion<'token-data' | 'coingecko' | 'coinmarketcap', string>>;
|
|
8
|
+
enabled: CreationOptional<boolean>;
|
|
9
|
+
priority: CreationOptional<number>;
|
|
10
|
+
status: CreationOptional<LiteralUnion<'active' | 'degraded' | 'paused' | 'inactive', string>>;
|
|
11
|
+
paused_reason: string | null;
|
|
12
|
+
config: Record<string, any> | null;
|
|
13
|
+
last_success_at: Date | null;
|
|
14
|
+
last_failure_at: Date | null;
|
|
15
|
+
failure_count: CreationOptional<number>;
|
|
16
|
+
created_at: CreationOptional<Date>;
|
|
17
|
+
updated_at: CreationOptional<Date>;
|
|
18
|
+
static initialize(sequelize: any): void;
|
|
19
|
+
static getActiveProviders(): Promise<ExchangeRateProvider[]>;
|
|
20
|
+
recordSuccess(): Promise<void>;
|
|
21
|
+
recordFailure(reason?: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Encrypt sensitive config data (API keys)
|
|
24
|
+
* Should be called before saving to database
|
|
25
|
+
*/
|
|
26
|
+
static encryptConfig(config: Record<string, any> | null): Record<string, any> | null;
|
|
27
|
+
/**
|
|
28
|
+
* Decrypt sensitive config data (API keys)
|
|
29
|
+
* Should be called after reading from database
|
|
30
|
+
*/
|
|
31
|
+
static decryptConfig(config: Record<string, any> | null): Record<string, any> | null;
|
|
32
|
+
/**
|
|
33
|
+
* Mask sensitive config data for display
|
|
34
|
+
* Returns config with API key partially masked
|
|
35
|
+
*/
|
|
36
|
+
static maskConfig(config: Record<string, any> | null): Record<string, any> | null;
|
|
37
|
+
}
|
|
38
|
+
export type TExchangeRateProvider = InferAttributes<ExchangeRateProvider>;
|
package/lib/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ import { MeterEvent, TMeterEvent } from './meter-event';
|
|
|
34
34
|
import { AutoRechargeConfig } from './auto-recharge-config';
|
|
35
35
|
import { ProductVendor } from './product-vendor';
|
|
36
36
|
import { TaxRate } from './tax-rate';
|
|
37
|
+
import { ExchangeRateProvider } from './exchange-rate-provider';
|
|
38
|
+
import { PriceQuote } from './price-quote';
|
|
37
39
|
declare const models: {
|
|
38
40
|
CheckoutSession: typeof CheckoutSession;
|
|
39
41
|
Coupon: typeof Coupon;
|
|
@@ -70,6 +72,8 @@ declare const models: {
|
|
|
70
72
|
AutoRechargeConfig: typeof AutoRechargeConfig;
|
|
71
73
|
ProductVendor: typeof ProductVendor;
|
|
72
74
|
TaxRate: typeof TaxRate;
|
|
75
|
+
ExchangeRateProvider: typeof ExchangeRateProvider;
|
|
76
|
+
PriceQuote: typeof PriceQuote;
|
|
73
77
|
};
|
|
74
78
|
export declare function initialize(sequelize: any): void;
|
|
75
79
|
export default models;
|
|
@@ -109,6 +113,8 @@ export * from './meter-event';
|
|
|
109
113
|
export * from './auto-recharge-config';
|
|
110
114
|
export * from './product-vendor';
|
|
111
115
|
export * from './tax-rate';
|
|
116
|
+
export * from './exchange-rate-provider';
|
|
117
|
+
export * from './price-quote';
|
|
112
118
|
export type TPriceExpanded = TPrice & {
|
|
113
119
|
object: 'price';
|
|
114
120
|
product: TProduct;
|
package/lib/payment-intent.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare class PaymentIntent extends Model<InferAttributes<PaymentIntent>,
|
|
|
31
31
|
review?: string;
|
|
32
32
|
payment_details?: PaymentDetails;
|
|
33
33
|
setup_future_usage?: LiteralUnion<'off_session' | 'on_session', string>;
|
|
34
|
+
quote_locked_at?: Date;
|
|
34
35
|
beneficiaries?: PaymentBeneficiary[];
|
|
35
36
|
created_at: CreationOptional<Date>;
|
|
36
37
|
updated_at: CreationOptional<Date>;
|
|
@@ -141,6 +142,10 @@ export declare class PaymentIntent extends Model<InferAttributes<PaymentIntent>,
|
|
|
141
142
|
type: DataTypes.EnumDataType<"off_session" | "on_session">;
|
|
142
143
|
allowNull: boolean;
|
|
143
144
|
};
|
|
145
|
+
quote_locked_at: {
|
|
146
|
+
type: DataTypes.DateDataTypeConstructor;
|
|
147
|
+
allowNull: boolean;
|
|
148
|
+
};
|
|
144
149
|
created_at: {
|
|
145
150
|
type: DataTypes.DateDataTypeConstructor;
|
|
146
151
|
defaultValue: DataTypes.AbstractDataTypeConstructor;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { CreationOptional, InferAttributes, InferCreationAttributes, Model, Transaction } from 'sequelize';
|
|
2
|
+
import type { LiteralUnion } from 'type-fest';
|
|
3
|
+
import { QuoteMetadata, QuoteStatus } from './types';
|
|
4
|
+
export declare const nextPriceQuoteId: (size?: number) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Create Quote Input (Final Freeze Architecture)
|
|
7
|
+
*
|
|
8
|
+
* Quote is created only at Submit time, directly as 'used' status.
|
|
9
|
+
* @see Intent: blocklets/core/ai/intent/20260112-dynamic-price.md
|
|
10
|
+
*/
|
|
11
|
+
export interface CreateQuoteInput {
|
|
12
|
+
price_id: string;
|
|
13
|
+
session_id?: string;
|
|
14
|
+
invoice_id?: string;
|
|
15
|
+
idempotency_key: string;
|
|
16
|
+
base_currency?: string;
|
|
17
|
+
base_amount: string;
|
|
18
|
+
target_currency_id: string;
|
|
19
|
+
rate_currency_symbol: string;
|
|
20
|
+
exchange_rate: string;
|
|
21
|
+
quoted_amount: string;
|
|
22
|
+
rate_provider_id: string;
|
|
23
|
+
rate_provider_name: string;
|
|
24
|
+
rate_timestamp_ms: number;
|
|
25
|
+
slippage_percent?: number;
|
|
26
|
+
max_payable_token?: string;
|
|
27
|
+
min_acceptable_rate?: string;
|
|
28
|
+
metadata?: QuoteMetadata;
|
|
29
|
+
}
|
|
30
|
+
export declare class PriceQuote extends Model<InferAttributes<PriceQuote>, InferCreationAttributes<PriceQuote>> {
|
|
31
|
+
id: CreationOptional<string>;
|
|
32
|
+
price_id: string;
|
|
33
|
+
session_id?: string;
|
|
34
|
+
invoice_id?: string;
|
|
35
|
+
idempotency_key: string;
|
|
36
|
+
base_currency: string;
|
|
37
|
+
base_amount: string;
|
|
38
|
+
target_currency_id: string;
|
|
39
|
+
rate_currency_symbol: string;
|
|
40
|
+
exchange_rate: string;
|
|
41
|
+
quoted_amount: string;
|
|
42
|
+
rate_provider_id: string;
|
|
43
|
+
rate_provider_name: string;
|
|
44
|
+
rate_timestamp_ms: number;
|
|
45
|
+
expires_at: number;
|
|
46
|
+
status: CreationOptional<LiteralUnion<QuoteStatus, string>>;
|
|
47
|
+
metadata: QuoteMetadata | null;
|
|
48
|
+
slippage_percent?: number;
|
|
49
|
+
max_payable_token?: string;
|
|
50
|
+
min_acceptable_rate?: string;
|
|
51
|
+
slippage_derived_at_ms?: number;
|
|
52
|
+
created_at: CreationOptional<Date>;
|
|
53
|
+
static initialize(sequelize: any): void;
|
|
54
|
+
static associate(models: any): void;
|
|
55
|
+
/**
|
|
56
|
+
* Check if Quote is usable for payment
|
|
57
|
+
* Final Freeze: 'used' status means Quote is ready for payment
|
|
58
|
+
*/
|
|
59
|
+
isUsable(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Check if Quote can be retried (payment_failed can be retried)
|
|
62
|
+
*/
|
|
63
|
+
canRetry(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Find Quote by idempotency key (for idempotent Submit)
|
|
66
|
+
* Returns any Quote with the given key regardless of status
|
|
67
|
+
*/
|
|
68
|
+
static findByIdempotencyKey(idempotencyKey: string): Promise<PriceQuote | null>;
|
|
69
|
+
/**
|
|
70
|
+
* Create Quote directly as 'used' (Final Freeze architecture)
|
|
71
|
+
*
|
|
72
|
+
* This is the ONLY way to create Quotes in the new architecture.
|
|
73
|
+
* Quotes are created at Submit time, never during Preview.
|
|
74
|
+
*/
|
|
75
|
+
static createUsedQuote(input: CreateQuoteInput, transaction?: Transaction): Promise<PriceQuote>;
|
|
76
|
+
/**
|
|
77
|
+
* Mark Quote as paid (payment completed successfully)
|
|
78
|
+
* Idempotent: if already paid, returns silently
|
|
79
|
+
*/
|
|
80
|
+
markAsPaid(transaction?: any): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Mark Quote as payment_failed
|
|
83
|
+
* Note: payment_failed does NOT mean Quote is invalid, can be retried
|
|
84
|
+
*/
|
|
85
|
+
markAsPaymentFailed(transaction?: any): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
export type TPriceQuote = InferAttributes<PriceQuote>;
|
package/lib/price.d.ts
CHANGED
|
@@ -47,6 +47,12 @@ export declare class Price extends Model<InferAttributes<Price>, InferCreationAt
|
|
|
47
47
|
quantity_sold: number;
|
|
48
48
|
quantity_limit_per_checkout: number;
|
|
49
49
|
tax_behavior?: LiteralUnion<'inclusive' | 'exclusive', string>;
|
|
50
|
+
pricing_type: LiteralUnion<'fixed' | 'dynamic', string>;
|
|
51
|
+
base_currency: string | null;
|
|
52
|
+
base_amount: string | null;
|
|
53
|
+
dynamic_pricing_config: {
|
|
54
|
+
lock_duration?: number;
|
|
55
|
+
} | null;
|
|
50
56
|
static readonly GENESIS_ATTRIBUTES: {
|
|
51
57
|
id: {
|
|
52
58
|
type: DataTypes.StringDataType;
|
package/lib/subscription.d.ts
CHANGED
|
@@ -59,6 +59,13 @@ export declare class Subscription extends Model<InferAttributes<Subscription>, I
|
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
payment_details?: PaymentDetails;
|
|
62
|
+
slippage_config?: {
|
|
63
|
+
mode?: 'percent' | 'rate';
|
|
64
|
+
percent?: number;
|
|
65
|
+
min_acceptable_rate?: string;
|
|
66
|
+
base_currency?: string;
|
|
67
|
+
updated_at_ms?: number;
|
|
68
|
+
} | null;
|
|
62
69
|
proration_behavior?: LiteralUnion<'always_invoice' | 'create_prorations' | 'none', string>;
|
|
63
70
|
payment_behavior?: LiteralUnion<'allow_incomplete' | 'error_if_incomplete' | 'pending_if_incomplete', string>;
|
|
64
71
|
service_actions?: ServiceAction[];
|
|
@@ -150,6 +157,10 @@ export declare class Subscription extends Model<InferAttributes<Subscription>, I
|
|
|
150
157
|
type: DataTypes.EnumDataType<"charge_automatically" | "send_invoice">;
|
|
151
158
|
allowNull: boolean;
|
|
152
159
|
};
|
|
160
|
+
slippage_config: {
|
|
161
|
+
type: DataTypes.AbstractDataTypeConstructor;
|
|
162
|
+
allowNull: boolean;
|
|
163
|
+
};
|
|
153
164
|
days_until_due: {
|
|
154
165
|
type: DataTypes.NumberDataTypeConstructor;
|
|
155
166
|
allowNull: boolean;
|
package/lib/types.d.ts
CHANGED
|
@@ -426,7 +426,7 @@ export type SubscriptionUpdateItem = {
|
|
|
426
426
|
price_id?: string;
|
|
427
427
|
quantity?: number;
|
|
428
428
|
};
|
|
429
|
-
export type EventType = LiteralUnion<'account.application.authorized' | 'account.application.deauthorized' | 'account.external_account.created' | 'account.external_account.deleted' | 'account.external_account.updated' | 'account.updated' | 'application_fee.created' | 'application_fee.refund.updated' | 'application_fee.refunded' | 'balance.available' | 'billing_portal.configuration.created' | 'billing_portal.configuration.updated' | 'billing_portal.session.created' | 'capability.updated' | 'cash_balance.funds_available' | 'charge.captured' | 'charge.dispute.closed' | 'charge.dispute.created' | 'charge.dispute.funds_reinstated' | 'charge.dispute.funds_withdrawn' | 'charge.dispute.updated' | 'charge.expired' | 'charge.failed' | 'charge.pending' | 'charge.refund.updated' | 'charge.refunded' | 'charge.succeeded' | 'charge.updated' | 'checkout.session.async_payment_failed' | 'checkout.session.async_payment_succeeded' | 'checkout.session.nft_minted' | 'checkout.session.completed' | 'checkout.session.expired' | 'checkout.session.created' | 'coupon.created' | 'coupon.deleted' | 'coupon.updated' | 'credit_note.created' | 'credit_note.updated' | 'credit_note.voided' | 'customer_cash_balance_transaction.created' | 'customer.created' | 'customer.deleted' | 'customer.discount.created' | 'customer.discount.deleted' | 'customer.discount.updated' | 'customer.source.created' | 'customer.source.deleted' | 'customer.source.expiring' | 'customer.source.updated' | 'customer.subscription.created' | 'customer.subscription.deleted' | 'customer.subscription.paused' | 'customer.subscription.past_due' | 'customer.subscription.pending_update_applied' | 'customer.subscription.pending_update_expired' | 'customer.subscription.resumed' | 'customer.subscription.renewed' | 'customer.subscription.recovered' | 'customer.subscription.upgraded' | 'customer.subscription.renew_failed' | 'customer.subscription.trial_start' | 'customer.subscription.trial_will_end' | 'customer.subscription.trial_end' | 'customer.subscription.started' | 'customer.subscription.updated' | 'customer.tax_id.created' | 'customer.tax_id.deleted' | 'customer.tax_id.updated' | 'customer.updated' | 'file.created' | 'financial_connections.account.created' | 'financial_connections.account.deactivated' | 'financial_connections.account.disconnected' | 'financial_connections.account.reactivated' | 'financial_connections.account.refreshed_balance' | 'identity.verification_session.canceled' | 'identity.verification_session.created' | 'identity.verification_session.processing' | 'identity.verification_session.redacted' | 'identity.verification_session.requires_input' | 'identity.verification_session.verified' | 'invoice.created' | 'invoice.deleted' | 'invoice.finalization_failed' | 'invoice.finalized' | 'invoice.marked_uncollectible' | 'invoice.paid' | 'invoice.payment_action_required' | 'invoice.payment_failed' | 'invoice.payment_succeeded' | 'invoice.sent' | 'invoice.upcoming' | 'invoice.updated' | 'invoice.voided' | 'invoiceitem.created' | 'invoiceitem.deleted' | 'issuing_authorization.created' | 'issuing_authorization.request' | 'issuing_authorization.updated' | 'issuing_card.created' | 'issuing_card.updated' | 'issuing_cardholder.created' | 'issuing_cardholder.updated' | 'issuing_dispute.closed' | 'issuing_dispute.created' | 'issuing_dispute.funds_reinstated' | 'issuing_dispute.submitted' | 'issuing_dispute.updated' | 'issuing_transaction.created' | 'issuing_transaction.updated' | 'mandate.updated' | 'order.created' | 'payment_intent.amount_capturable_updated' | 'payment_intent.canceled' | 'payment_intent.created' | 'payment_intent.partially_funded' | 'payment_intent.payment_failed' | 'payment_intent.processing' | 'payment_intent.requires_action' | 'payment_intent.succeeded' | 'payment_link.created' | 'payment_link.updated' | 'payment_method.attached' | 'payment_method.automatically_updated' | 'payment_method.detached' | 'payment_method.updated' | 'payout.canceled' | 'payout.created' | 'payout.failed' | 'payout.paid' | 'payout.reconciliation_completed' | 'payout.updated' | 'person.created' | 'person.deleted' | 'person.updated' | 'plan.created' | 'plan.deleted' | 'plan.updated' | 'price.created' | 'price.deleted' | 'price.updated' | 'product.created' | 'product.deleted' | 'product.updated' | 'promotion_code.created' | 'promotion_code.updated' | 'quote.accepted' | 'quote.canceled' | 'quote.created' | 'quote.finalized' | 'radar.early_fraud_warning.created' | 'radar.early_fraud_warning.updated' | 'recipient.created' | 'recipient.deleted' | 'recipient.updated' | 'refund.created' | 'refund.updated' | 'refund.succeeded' | 'refund.canceled' | 'reporting.report_run.failed' | 'reporting.report_run.succeeded' | 'reporting.report_type.updated' | 'review.closed' | 'review.opened' | 'setup_intent.canceled' | 'setup_intent.created' | 'setup_intent.requires_action' | 'setup_intent.setup_failed' | 'setup_intent.succeeded' | 'sigma.scheduled_query_run.created' | 'sku.created' | 'sku.deleted' | 'sku.updated' | 'source.canceled' | 'source.chargeable' | 'source.failed' | 'source.mandate_notification' | 'source.refund_attributes_required' | 'source.transaction.created' | 'source.transaction.updated' | 'subscription_schedule.aborted' | 'subscription_schedule.canceled' | 'subscription_schedule.completed' | 'subscription_schedule.created' | 'subscription_schedule.expiring' | 'subscription_schedule.released' | 'subscription_schedule.updated' | 'tax_rate.created' | 'tax_rate.updated' | 'tax.settings.updated' | 'terminal.reader.action_failed' | 'terminal.reader.action_succeeded' | 'test_helpers.test_clock.advancing' | 'test_helpers.test_clock.created' | 'test_helpers.test_clock.deleted' | 'test_helpers.test_clock.internal_failure' | 'test_helpers.test_clock.ready' | 'topup.canceled' | 'topup.created' | 'topup.failed' | 'topup.reversed' | 'topup.succeeded' | 'transfer.created' | 'transfer.reversed' | 'transfer.updated' | 'billing.discrepancy' | 'usage.report.empty' | 'customer.credit.insufficient' | 'customer.credit.low_balance' | 'customer.credit_grant.granted' | 'customer.credit_grant.depleted', string>;
|
|
429
|
+
export type EventType = LiteralUnion<'account.application.authorized' | 'account.application.deauthorized' | 'account.external_account.created' | 'account.external_account.deleted' | 'account.external_account.updated' | 'account.updated' | 'application_fee.created' | 'application_fee.refund.updated' | 'application_fee.refunded' | 'balance.available' | 'billing_portal.configuration.created' | 'billing_portal.configuration.updated' | 'billing_portal.session.created' | 'capability.updated' | 'cash_balance.funds_available' | 'charge.captured' | 'charge.dispute.closed' | 'charge.dispute.created' | 'charge.dispute.funds_reinstated' | 'charge.dispute.funds_withdrawn' | 'charge.dispute.updated' | 'charge.expired' | 'charge.failed' | 'charge.pending' | 'charge.refund.updated' | 'charge.refunded' | 'charge.succeeded' | 'charge.updated' | 'checkout.session.async_payment_failed' | 'checkout.session.async_payment_succeeded' | 'checkout.session.nft_minted' | 'checkout.session.completed' | 'checkout.session.expired' | 'checkout.session.created' | 'coupon.created' | 'coupon.deleted' | 'coupon.updated' | 'credit_note.created' | 'credit_note.updated' | 'credit_note.voided' | 'customer_cash_balance_transaction.created' | 'customer.created' | 'customer.deleted' | 'customer.discount.created' | 'customer.discount.deleted' | 'customer.discount.updated' | 'customer.source.created' | 'customer.source.deleted' | 'customer.source.expiring' | 'customer.source.updated' | 'customer.subscription.created' | 'customer.subscription.deleted' | 'customer.subscription.paused' | 'customer.subscription.past_due' | 'customer.subscription.pending_update_applied' | 'customer.subscription.pending_update_expired' | 'customer.subscription.resumed' | 'customer.subscription.renewed' | 'customer.subscription.recovered' | 'customer.subscription.upgraded' | 'customer.subscription.renew_failed' | 'customer.subscription.trial_start' | 'customer.subscription.trial_will_end' | 'customer.subscription.trial_end' | 'customer.subscription.started' | 'customer.subscription.updated' | 'customer.tax_id.created' | 'customer.tax_id.deleted' | 'customer.tax_id.updated' | 'customer.updated' | 'file.created' | 'financial_connections.account.created' | 'financial_connections.account.deactivated' | 'financial_connections.account.disconnected' | 'financial_connections.account.reactivated' | 'financial_connections.account.refreshed_balance' | 'identity.verification_session.canceled' | 'identity.verification_session.created' | 'identity.verification_session.processing' | 'identity.verification_session.redacted' | 'identity.verification_session.requires_input' | 'identity.verification_session.verified' | 'invoice.created' | 'invoice.deleted' | 'invoice.finalization_failed' | 'invoice.finalized' | 'invoice.marked_uncollectible' | 'invoice.paid' | 'invoice.payment_action_required' | 'invoice.payment_failed' | 'invoice.payment_succeeded' | 'invoice.sent' | 'invoice.upcoming' | 'invoice.updated' | 'invoice.voided' | 'invoiceitem.created' | 'invoiceitem.deleted' | 'issuing_authorization.created' | 'issuing_authorization.request' | 'issuing_authorization.updated' | 'issuing_card.created' | 'issuing_card.updated' | 'issuing_cardholder.created' | 'issuing_cardholder.updated' | 'issuing_dispute.closed' | 'issuing_dispute.created' | 'issuing_dispute.funds_reinstated' | 'issuing_dispute.submitted' | 'issuing_dispute.updated' | 'issuing_transaction.created' | 'issuing_transaction.updated' | 'mandate.updated' | 'order.created' | 'payment_intent.amount_capturable_updated' | 'payment_intent.canceled' | 'payment_intent.created' | 'payment_intent.partially_funded' | 'payment_intent.payment_failed' | 'payment_intent.processing' | 'payment_intent.requires_action' | 'payment_intent.succeeded' | 'payment_link.created' | 'payment_link.updated' | 'payment_method.attached' | 'payment_method.automatically_updated' | 'payment_method.detached' | 'payment_method.updated' | 'payout.canceled' | 'payout.created' | 'payout.failed' | 'payout.paid' | 'payout.reconciliation_completed' | 'payout.updated' | 'person.created' | 'person.deleted' | 'person.updated' | 'plan.created' | 'plan.deleted' | 'plan.updated' | 'price.created' | 'price.deleted' | 'price.updated' | 'product.created' | 'product.deleted' | 'product.updated' | 'promotion_code.created' | 'promotion_code.updated' | 'quote.accepted' | 'quote.canceled' | 'quote.created' | 'quote.finalized' | 'radar.early_fraud_warning.created' | 'radar.early_fraud_warning.updated' | 'recipient.created' | 'recipient.deleted' | 'recipient.updated' | 'refund.created' | 'refund.updated' | 'refund.succeeded' | 'refund.canceled' | 'reporting.report_run.failed' | 'reporting.report_run.succeeded' | 'reporting.report_type.updated' | 'review.closed' | 'review.opened' | 'setup_intent.canceled' | 'setup_intent.created' | 'setup_intent.requires_action' | 'setup_intent.setup_failed' | 'setup_intent.succeeded' | 'sigma.scheduled_query_run.created' | 'sku.created' | 'sku.deleted' | 'sku.updated' | 'source.canceled' | 'source.chargeable' | 'source.failed' | 'source.mandate_notification' | 'source.refund_attributes_required' | 'source.transaction.created' | 'source.transaction.updated' | 'subscription_schedule.aborted' | 'subscription_schedule.canceled' | 'subscription_schedule.completed' | 'subscription_schedule.created' | 'subscription_schedule.expiring' | 'subscription_schedule.released' | 'subscription_schedule.updated' | 'tax_rate.created' | 'tax_rate.updated' | 'tax.settings.updated' | 'terminal.reader.action_failed' | 'terminal.reader.action_succeeded' | 'test_helpers.test_clock.advancing' | 'test_helpers.test_clock.created' | 'test_helpers.test_clock.deleted' | 'test_helpers.test_clock.internal_failure' | 'test_helpers.test_clock.ready' | 'topup.canceled' | 'topup.created' | 'topup.failed' | 'topup.reversed' | 'topup.succeeded' | 'transfer.created' | 'transfer.reversed' | 'transfer.updated' | 'billing.discrepancy' | 'usage.report.empty' | 'customer.credit.insufficient' | 'customer.credit.low_balance' | 'customer.credit_grant.granted' | 'customer.credit_grant.depleted' | 'exchange_rate.providers_unavailable' | 'exchange_rate.spread_exceeded', string>;
|
|
430
430
|
export type StripeRefundReason = 'duplicate' | 'fraudulent' | 'requested_by_customer';
|
|
431
431
|
export type SettingType = LiteralUnion<'donate' | 'notification', string>;
|
|
432
432
|
export type NotificationFrequency = 'default' | 'daily' | 'weekly' | 'monthly';
|
|
@@ -563,4 +563,60 @@ export type CreditGrantChainDetail = {
|
|
|
563
563
|
};
|
|
564
564
|
voided_reason?: 'refund' | 'expired' | 'manual';
|
|
565
565
|
};
|
|
566
|
+
/**
|
|
567
|
+
* Quote Status (Final Freeze)
|
|
568
|
+
*
|
|
569
|
+
* - used: Quote created and consumed at Submit
|
|
570
|
+
* - paid: Payment completed successfully
|
|
571
|
+
* - payment_failed: Payment flow failed (does NOT mean Quote is invalid)
|
|
572
|
+
*
|
|
573
|
+
* Legacy statuses (deprecated, for backward compatibility only):
|
|
574
|
+
* - active, expired, cancelled, failed
|
|
575
|
+
*
|
|
576
|
+
* @see Intent: blocklets/core/ai/intent/20260112-dynamic-price.md
|
|
577
|
+
*/
|
|
578
|
+
/**
|
|
579
|
+
* Final Freeze: Quote only has 3 statuses
|
|
580
|
+
* - used: Quote created at Submit, ready for payment
|
|
581
|
+
* - paid: Payment completed successfully
|
|
582
|
+
* - payment_failed: Payment process failed (Quote still valid for retry)
|
|
583
|
+
*/
|
|
584
|
+
export type QuoteStatus = 'used' | 'paid' | 'payment_failed';
|
|
585
|
+
export interface QuoteMetadata {
|
|
586
|
+
calculation?: {
|
|
587
|
+
token_amount_raw?: string;
|
|
588
|
+
unit_amount_raw?: string;
|
|
589
|
+
total_base_amount_scaled?: string;
|
|
590
|
+
rate_scaled?: string;
|
|
591
|
+
quoted_amount_unit?: string;
|
|
592
|
+
};
|
|
593
|
+
rounding?: {
|
|
594
|
+
mode?: string;
|
|
595
|
+
token_decimals?: number;
|
|
596
|
+
};
|
|
597
|
+
risk?: {
|
|
598
|
+
anomaly_detected?: boolean;
|
|
599
|
+
deviation_percent?: number;
|
|
600
|
+
degraded?: boolean;
|
|
601
|
+
degraded_reason?: string | null;
|
|
602
|
+
};
|
|
603
|
+
rate?: {
|
|
604
|
+
consensus_method?: string;
|
|
605
|
+
providers?: Array<{
|
|
606
|
+
id?: string;
|
|
607
|
+
name?: string;
|
|
608
|
+
rate?: string;
|
|
609
|
+
timestamp_ms?: number;
|
|
610
|
+
degraded?: boolean;
|
|
611
|
+
degraded_reason?: string;
|
|
612
|
+
}>;
|
|
613
|
+
};
|
|
614
|
+
slippage?: {
|
|
615
|
+
percent?: number;
|
|
616
|
+
max_payable_token?: string;
|
|
617
|
+
min_acceptable_rate?: string;
|
|
618
|
+
derived_at_ms?: number;
|
|
619
|
+
};
|
|
620
|
+
context?: Record<string, any>;
|
|
621
|
+
}
|
|
566
622
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.1",
|
|
4
4
|
"description": "Typings for Payment Kit SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"types",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"sequelize": "^6.37.7",
|
|
49
49
|
"type-fest": "^4.41.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "87555132c62024e5c677fd0a39df0d90be06a543"
|
|
52
52
|
}
|