新增支付流程,新增支付页面等待倒计时,自动检查订单状态等
This commit is contained in:
@@ -18,4 +18,48 @@ class KRPurchaseOrderUrl {
|
||||
factory KRPurchaseOrderUrl.fromJson(Map<String, dynamic> json) {
|
||||
return KRPurchaseOrderUrl(url: json['checkout_url'] ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
/// Checkout 响应(参考 Tauri 项目)
|
||||
class KRCheckoutResponse {
|
||||
final String type; // "url" | "qr" | "stripe"
|
||||
final String? checkoutUrl;
|
||||
final KRStripePayment? stripe;
|
||||
|
||||
KRCheckoutResponse({
|
||||
required this.type,
|
||||
this.checkoutUrl,
|
||||
this.stripe,
|
||||
});
|
||||
|
||||
factory KRCheckoutResponse.fromJson(Map<String, dynamic> json) {
|
||||
return KRCheckoutResponse(
|
||||
type: json['type'] ?? 'url',
|
||||
checkoutUrl: json['checkout_url'],
|
||||
stripe: json['stripe'] != null
|
||||
? KRStripePayment.fromJson(json['stripe'])
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Stripe 支付信息
|
||||
class KRStripePayment {
|
||||
final String method;
|
||||
final String clientSecret;
|
||||
final String publishableKey;
|
||||
|
||||
KRStripePayment({
|
||||
required this.method,
|
||||
required this.clientSecret,
|
||||
required this.publishableKey,
|
||||
});
|
||||
|
||||
factory KRStripePayment.fromJson(Map<String, dynamic> json) {
|
||||
return KRStripePayment(
|
||||
method: json['method'] ?? '',
|
||||
clientSecret: json['client_secret'] ?? '',
|
||||
publishableKey: json['publishable_key'] ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user