新增支付流程,新增支付页面等待倒计时,自动检查订单状态等

This commit is contained in:
2025-10-22 17:47:07 +08:00
parent 15d2e1047b
commit 2e7e85fb27
8 changed files with 432 additions and 67 deletions
+2
View File
@@ -43,6 +43,8 @@ abstract class EntityFromJsonUtil {
return KRPurchaseOrderNo.fromJson(json) as T;
case "KRPurchaseOrderUrl":
return KRPurchaseOrderUrl.fromJson(json) as T;
case "KRCheckoutResponse":
return KRCheckoutResponse.fromJson(json) as T;
case "KROrderStatus":
return KROrderStatus.fromJson(json) as T;
case "KRAlreadySubscribeList":
@@ -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'] ?? '',
);
}
}