class KRPurchaseOrderNo { final String orderNo; KRPurchaseOrderNo({required this.orderNo}); factory KRPurchaseOrderNo.fromJson(Map json) { return KRPurchaseOrderNo(orderNo: json['order_no'] ?? ''); } } class KRPurchaseOrderUrl { final String url; KRPurchaseOrderUrl({required this.url}); factory KRPurchaseOrderUrl.fromJson(Map 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 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 json) { return KRStripePayment( method: json['method'] ?? '', clientSecret: json['client_secret'] ?? '', publishableKey: json['publishable_key'] ?? '', ); } }