|
@@ -61,8 +61,13 @@ class PaymentStatusManager {
|
|
|
});
|
|
});
|
|
|
reportPaySuccess(storeItemBean.amount, orderNo, storeItemBean.name,
|
|
reportPaySuccess(storeItemBean.amount, orderNo, storeItemBean.name,
|
|
|
paymentWay.payMethod);
|
|
paymentWay.payMethod);
|
|
|
- }).catchError((error) {
|
|
|
|
|
|
|
+ }).catchError((error) async {
|
|
|
debugPrint('支付失败: orderNo = $orderNo, error = $error');
|
|
debugPrint('支付失败: orderNo = $orderNo, error = $error');
|
|
|
|
|
+ await _lock.synchronized(() {
|
|
|
|
|
+ callbackMap[orderNo]
|
|
|
|
|
+ ?.onPaymentError(error);
|
|
|
|
|
+ callbackMap.remove(orderNo);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
pollingSubscriptionMap[orderNo] = orderFuture;
|
|
pollingSubscriptionMap[orderNo] = orderFuture;
|
|
|
});
|
|
});
|
|
@@ -109,6 +114,8 @@ class PaymentStatusException implements Exception {
|
|
|
abstract class PaymentStatusCallback {
|
|
abstract class PaymentStatusCallback {
|
|
|
void onPaymentSuccess(
|
|
void onPaymentSuccess(
|
|
|
String orderNo, PaymentWay paymentWay, StoreItem storeItemBean);
|
|
String orderNo, PaymentWay paymentWay, StoreItem storeItemBean);
|
|
|
|
|
+
|
|
|
|
|
+ void onPaymentError(Error error);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
final paymentStatusManager = PaymentStatusManager._();
|
|
final paymentStatusManager = PaymentStatusManager._();
|