|
|
@@ -235,116 +235,117 @@ class StoreController extends BaseController implements PaymentStatusCallback {
|
|
|
}
|
|
|
|
|
|
void clickPayNow() {
|
|
|
- EventHandler.report(EventId.event_02004);
|
|
|
- if (selectedGoodsInfoItem == null) {
|
|
|
- ToastUtil.show(StringName.memberPleaseChoiceGoods);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (selectedPayWay == null) {
|
|
|
- ToastUtil.show(StringName.memberPleaseChoicePayment);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!isAgree.value) {
|
|
|
- MemberAgreementDialog.show(
|
|
|
- btnConfirm: () {
|
|
|
- isAgree.value = true;
|
|
|
- clickPayNow();
|
|
|
- },
|
|
|
- );
|
|
|
- return;
|
|
|
- }
|
|
|
- AtmobLog.d(tag, 'clickPayNow: ${selectedGoodsInfoItem!.toJson()}');
|
|
|
- final buyGoods = selectedGoodsInfoItem!;
|
|
|
- final buyPayWay = selectedPayWay!;
|
|
|
-
|
|
|
- selectedGoodsInfoItem?.realAmount = selectedGoodsInfoItem?.amount;
|
|
|
-
|
|
|
- if (selectedGoodsInfoItem?.discountPriceDesc != null && selectedGoodsInfoItem?.firstAmount != null) {
|
|
|
- if (isDiscount.value) {
|
|
|
- selectedGoodsInfoItem?.realAmount = selectedGoodsInfoItem?.firstAmount;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int goodsId = buyGoods.id;
|
|
|
- int payPlatform = buyPayWay.payPlatform;
|
|
|
- int payMethod = buyPayWay.payMethod;
|
|
|
- int payWayType = getPayWayType(
|
|
|
- payMethod: payMethod,
|
|
|
- payPlatform: payPlatform,
|
|
|
- );
|
|
|
-
|
|
|
- LoadingDialog.show(StringName.payLoading);
|
|
|
- storeRepository
|
|
|
- .submitAndRequestPay(
|
|
|
- goodsId: goodsId,
|
|
|
- payPlatform: payPlatform,
|
|
|
- payMethod: payMethod,
|
|
|
- )
|
|
|
- .then((response) {
|
|
|
- if (payWayType == PayWayType.paymentWayWechat) {
|
|
|
- _onWeChatPay(
|
|
|
- response.outTradeNo,
|
|
|
- response.wechatPayPrepayJson!,
|
|
|
- payMethod,
|
|
|
- buyGoods,
|
|
|
- buyPayWay,
|
|
|
- );
|
|
|
- } else if (payWayType == PayWayType.paymentWayWechatScan) {
|
|
|
- _onWechatScanPay(
|
|
|
- response.outTradeNo,
|
|
|
- response.wechatPayQrcodeUrl!,
|
|
|
- buyPayWay,
|
|
|
- buyGoods,
|
|
|
- );
|
|
|
- } else if (payWayType == PayWayType.paymentWayAlipay) {
|
|
|
- _onAliPay(
|
|
|
- response.outTradeNo,
|
|
|
- response.alipayOrderString!,
|
|
|
- payMethod,
|
|
|
- buyGoods,
|
|
|
- buyPayWay,
|
|
|
- );
|
|
|
- } else if (payWayType == PayWayType.paymentWayAlipayScan) {
|
|
|
- _onAliScanPay(
|
|
|
- response.outTradeNo,
|
|
|
- response.alipayQrcodeHtml!,
|
|
|
- buyPayWay,
|
|
|
- buyGoods,
|
|
|
- );
|
|
|
- } else if (payWayType == PayWayType.paymentWayApple) {
|
|
|
- _onApplePay(
|
|
|
- response.outTradeNo,
|
|
|
- response.appAccountToken ?? "",
|
|
|
- buyPayWay,
|
|
|
- buyGoods,
|
|
|
- );
|
|
|
- } else {
|
|
|
- ToastUtil.show(StringName.payNotSupport);
|
|
|
- }
|
|
|
- })
|
|
|
- .catchError((error) {
|
|
|
- LoadingDialog.hide();
|
|
|
- if (error is ServerErrorException) {
|
|
|
- if (error.code == ErrorCode.payOrderError) {
|
|
|
- refreshStoreData();
|
|
|
- ToastUtil.show(error.message);
|
|
|
- } else if (error.code == ErrorCode.noLoginError) {
|
|
|
- ToastUtil.show(StringName.accountNoLogin);
|
|
|
- LoginDialog.show();
|
|
|
- } else {
|
|
|
- ToastUtil.show(error.message);
|
|
|
- paymentFail();
|
|
|
- }
|
|
|
- } else {
|
|
|
- ToastUtil.show(StringName.memberPaymentFailed);
|
|
|
- paymentFail();
|
|
|
- }
|
|
|
- })
|
|
|
- .whenComplete(() {
|
|
|
- if (PlatformUtil.isAndroid) {
|
|
|
- LoadingDialog.hide();
|
|
|
- }
|
|
|
- });
|
|
|
+ MethodChanelIOSUtil.addASAPayReport(880.0);
|
|
|
+ // EventHandler.report(EventId.event_02004);
|
|
|
+ // if (selectedGoodsInfoItem == null) {
|
|
|
+ // ToastUtil.show(StringName.memberPleaseChoiceGoods);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (selectedPayWay == null) {
|
|
|
+ // ToastUtil.show(StringName.memberPleaseChoicePayment);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (!isAgree.value) {
|
|
|
+ // MemberAgreementDialog.show(
|
|
|
+ // btnConfirm: () {
|
|
|
+ // isAgree.value = true;
|
|
|
+ // clickPayNow();
|
|
|
+ // },
|
|
|
+ // );
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // AtmobLog.d(tag, 'clickPayNow: ${selectedGoodsInfoItem!.toJson()}');
|
|
|
+ // final buyGoods = selectedGoodsInfoItem!;
|
|
|
+ // final buyPayWay = selectedPayWay!;
|
|
|
+ //
|
|
|
+ // selectedGoodsInfoItem?.realAmount = selectedGoodsInfoItem?.amount;
|
|
|
+ //
|
|
|
+ // if (selectedGoodsInfoItem?.discountPriceDesc != null && selectedGoodsInfoItem?.firstAmount != null) {
|
|
|
+ // if (isDiscount.value) {
|
|
|
+ // selectedGoodsInfoItem?.realAmount = selectedGoodsInfoItem?.firstAmount;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // int goodsId = buyGoods.id;
|
|
|
+ // int payPlatform = buyPayWay.payPlatform;
|
|
|
+ // int payMethod = buyPayWay.payMethod;
|
|
|
+ // int payWayType = getPayWayType(
|
|
|
+ // payMethod: payMethod,
|
|
|
+ // payPlatform: payPlatform,
|
|
|
+ // );
|
|
|
+ //
|
|
|
+ // LoadingDialog.show(StringName.payLoading);
|
|
|
+ // storeRepository
|
|
|
+ // .submitAndRequestPay(
|
|
|
+ // goodsId: goodsId,
|
|
|
+ // payPlatform: payPlatform,
|
|
|
+ // payMethod: payMethod,
|
|
|
+ // )
|
|
|
+ // .then((response) {
|
|
|
+ // if (payWayType == PayWayType.paymentWayWechat) {
|
|
|
+ // _onWeChatPay(
|
|
|
+ // response.outTradeNo,
|
|
|
+ // response.wechatPayPrepayJson!,
|
|
|
+ // payMethod,
|
|
|
+ // buyGoods,
|
|
|
+ // buyPayWay,
|
|
|
+ // );
|
|
|
+ // } else if (payWayType == PayWayType.paymentWayWechatScan) {
|
|
|
+ // _onWechatScanPay(
|
|
|
+ // response.outTradeNo,
|
|
|
+ // response.wechatPayQrcodeUrl!,
|
|
|
+ // buyPayWay,
|
|
|
+ // buyGoods,
|
|
|
+ // );
|
|
|
+ // } else if (payWayType == PayWayType.paymentWayAlipay) {
|
|
|
+ // _onAliPay(
|
|
|
+ // response.outTradeNo,
|
|
|
+ // response.alipayOrderString!,
|
|
|
+ // payMethod,
|
|
|
+ // buyGoods,
|
|
|
+ // buyPayWay,
|
|
|
+ // );
|
|
|
+ // } else if (payWayType == PayWayType.paymentWayAlipayScan) {
|
|
|
+ // _onAliScanPay(
|
|
|
+ // response.outTradeNo,
|
|
|
+ // response.alipayQrcodeHtml!,
|
|
|
+ // buyPayWay,
|
|
|
+ // buyGoods,
|
|
|
+ // );
|
|
|
+ // } else if (payWayType == PayWayType.paymentWayApple) {
|
|
|
+ // _onApplePay(
|
|
|
+ // response.outTradeNo,
|
|
|
+ // response.appAccountToken ?? "",
|
|
|
+ // buyPayWay,
|
|
|
+ // buyGoods,
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
+ // ToastUtil.show(StringName.payNotSupport);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .catchError((error) {
|
|
|
+ // LoadingDialog.hide();
|
|
|
+ // if (error is ServerErrorException) {
|
|
|
+ // if (error.code == ErrorCode.payOrderError) {
|
|
|
+ // refreshStoreData();
|
|
|
+ // ToastUtil.show(error.message);
|
|
|
+ // } else if (error.code == ErrorCode.noLoginError) {
|
|
|
+ // ToastUtil.show(StringName.accountNoLogin);
|
|
|
+ // LoginDialog.show();
|
|
|
+ // } else {
|
|
|
+ // ToastUtil.show(error.message);
|
|
|
+ // paymentFail();
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // ToastUtil.show(StringName.memberPaymentFailed);
|
|
|
+ // paymentFail();
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .whenComplete(() {
|
|
|
+ // if (PlatformUtil.isAndroid) {
|
|
|
+ // LoadingDialog.hide();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
}
|
|
|
|
|
|
void paymentFail() {
|