This commit is contained in:
2026-07-12 04:33:48 +08:00
parent f8a90ad305
commit e7ce0f7bae
151 changed files with 2765 additions and 2947 deletions

View File

@@ -16,11 +16,10 @@ import '../../utils/utils.dart';
class StripePay extends StatefulWidget {
final Key key;
final Order order;
final PaymentPlatform paymentPlatform;
final StripePaymentMethod stripePaymentMethod;
const StripePay(this.order, this.paymentPlatform, {this.key, this.stripePaymentMethod});
final StripePaymentMethod? stripePaymentMethod;
const StripePay(this.order, this.paymentPlatform, {Key? key, this.stripePaymentMethod}) : super(key: key);
@override
State<StatefulWidget> createState() {
@@ -33,7 +32,7 @@ class StripePayState extends State<StripePay> {
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey();
bool isSubmitting;
bool isSubmitting = false;
@override
Widget build(BuildContext context) {
@@ -71,9 +70,9 @@ class StripePayState extends State<StripePay> {
}
_paymentWithPaymentMethod(BuildContext context) async {
Utils.stripePaymentIntent(widget.order, widget.stripePaymentMethod.customerId,
widget.stripePaymentMethod.paymentMethodId,
widget.stripePaymentMethod.paymentMethodType, (response){
Utils.stripePaymentIntent(widget.order, widget.stripePaymentMethod?.customerId,
widget.stripePaymentMethod!.paymentMethodId,
widget.stripePaymentMethod!.paymentMethodType, (response){
if (response.data['status'] == Constants.STRIPE_STATUS_REQUIRES_CONFIRMATION) {
StripePayment.confirmPaymentIntent(
@@ -84,8 +83,8 @@ class StripePayState extends State<StripePay> {
).then((paymentIntentResult) {
if (paymentIntentResult.status == Constants.STRIPE_STATUS_SUCCEDED) {
Utils.stripeChargedSuccess(widget.order,
widget.stripePaymentMethod.paymentMethodId,
paymentIntentResult.paymentIntentId,
widget.stripePaymentMethod!.paymentMethodId,
paymentIntentResult.paymentIntentId!,
(response) {
eventBus.fire(OnOrderUpdated());
Routes.router.navigateTo(context, '/orderdetail/${widget
@@ -107,7 +106,7 @@ class StripePayState extends State<StripePay> {
StripePayment.paymentRequestWithCardForm(
CardFormPaymentRequest()
).then((paymentMethod) {
Utils.stripePaymentIntent(widget.order, null, paymentMethod.id, paymentMethod.type, (response){
Utils.stripePaymentIntent(widget.order, null, paymentMethod.id!, paymentMethod.type!, (response){
if (response.data['status'] == Constants.STRIPE_STATUS_REQUIRES_CONFIRMATION) {
StripePayment.confirmPaymentIntent(
@@ -118,8 +117,8 @@ class StripePayState extends State<StripePay> {
).then((paymentIntentResult) {
if (paymentIntentResult.status == Constants.STRIPE_STATUS_SUCCEDED) {
Utils.stripeChargedSuccess(widget.order,
paymentMethod.id,
paymentIntentResult.paymentIntentId,
paymentMethod.id!,
paymentIntentResult.paymentIntentId!,
(response) {
eventBus.fire(OnOrderUpdated());
Routes.router.navigateTo(context, '/orderdetail/${widget
@@ -133,12 +132,12 @@ class StripePayState extends State<StripePay> {
}).catchError(showErrorDialog);
}
}, (showErrorDialog),
cardBrand: paymentMethod.card.brand,
cardCountry: paymentMethod.card.country,
cardExpMonth: paymentMethod.card.expMonth,
cardExpYear: paymentMethod.card.expYear,
cardFunding: paymentMethod.card.funding,
cardLast4: paymentMethod.card.last4,
cardBrand: paymentMethod.card!.brand,
cardCountry: paymentMethod.card!.country,
cardExpMonth: paymentMethod.card!.expMonth,
cardExpYear: paymentMethod.card!.expYear,
cardFunding: paymentMethod.card!.funding,
cardLast4: paymentMethod.card!.last4,
);
}).catchError(showErrorDialog);
isSubmitting = true;