66 lines
1.5 KiB
Dart
Executable File
66 lines
1.5 KiB
Dart
Executable File
class KRPurchaseOrderNo {
|
|
final String orderNo;
|
|
|
|
KRPurchaseOrderNo({required this.orderNo});
|
|
|
|
factory KRPurchaseOrderNo.fromJson(Map<String, dynamic> json) {
|
|
return KRPurchaseOrderNo(orderNo: json['order_no'] ?? '');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class KRPurchaseOrderUrl {
|
|
final String url;
|
|
|
|
KRPurchaseOrderUrl({required this.url});
|
|
|
|
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'] ?? '',
|
|
);
|
|
}
|
|
}
|