Commit a646ed94 by ethanlamzs

ios支付

1 parent bc389b39
...@@ -59,11 +59,13 @@ class XeCreateOrderHandler extends MessageHandler { ...@@ -59,11 +59,13 @@ class XeCreateOrderHandler extends MessageHandler {
// 1. 请求后端获取预支付订单信息 // 1. 请求后端获取预支付订单信息
final deviceType = Platform.isIOS?"ios":"andorid"; final deviceType = Platform.isIOS?"ios":"andorid";
print("[debug]. handleMessage 1 "+deviceType);
if (deviceType == 'andorid'){ if (deviceType == 'andorid'){
return await _wx_pay_proc_(userCode, tbxStuId, chargeCode, deviceType, phone, stuId, ext, duration, durationType, totalFee, renew, useCoin); return await _wx_pay_proc_(userCode, tbxStuId, chargeCode, deviceType, phone, stuId, ext, duration, durationType, totalFee, renew, useCoin);
}else if (deviceType == 'ios'){ }else if (deviceType == 'ios'){
// 暂时不支持使用学币扣减 // 暂时不支持使用学币扣减
// 执行ios支付
await _subService.initialize();
return await _ios_pay_proc_(userCode, tbxStuId, chargeCode, deviceType, phone, stuId, ext, duration, durationType, totalFee, renew, false); return await _ios_pay_proc_(userCode, tbxStuId, chargeCode, deviceType, phone, stuId, ext, duration, durationType, totalFee, renew, false);
} }
...@@ -201,6 +203,8 @@ class XeCreateOrderHandler extends MessageHandler { ...@@ -201,6 +203,8 @@ class XeCreateOrderHandler extends MessageHandler {
// 执行ios的微信支付 // 执行ios的微信支付
Future<dynamic> _ios_pay_proc_ (String userCode, tbxStuId, chargeCode,deviceType,phone,stuId,ext,int duration, durationType, totalFee,bool renew, useCoin) async{ Future<dynamic> _ios_pay_proc_ (String userCode, tbxStuId, chargeCode,deviceType,phone,stuId,ext,int duration, durationType, totalFee,bool renew, useCoin) async{
// 暂时用固定的价格 // 暂时用固定的价格
var result = await _userAuthRepository.createOrder(userCode, tbxStuId, chargeCode, duration, durationType, totalFee, var result = await _userAuthRepository.createOrder(userCode, tbxStuId, chargeCode, duration, durationType, totalFee,
renew, phone, stuId, ext, useCoin ? 1 : 0, deviceType); renew, phone, stuId, ext, useCoin ? 1 : 0, deviceType);
...@@ -227,8 +231,7 @@ class XeCreateOrderHandler extends MessageHandler { ...@@ -227,8 +231,7 @@ class XeCreateOrderHandler extends MessageHandler {
throw Exception('支付参数获取失败'); throw Exception('支付参数获取失败');
} }
// 执行ios支付
await _subService.initialize();
// 为了调试,先模拟 // 为了调试,先模拟
var product; var product;
......
...@@ -62,7 +62,8 @@ class SubscriptionService { ...@@ -62,7 +62,8 @@ class SubscriptionService {
await _fetchProducts(); await _fetchProducts();
// 4. 处理待处理的交易(应用被杀掉时未完成交易) // 4. 处理待处理的交易(应用被杀掉时未完成交易)
await _iap.restorePurchases(); // 订阅恢复也会触发 purchaseStream //await _iap.restorePurchases(); // 订阅恢复也会触发 purchaseStream
} }
// ---------- 获取产品信息 ---------- // ---------- 获取产品信息 ----------
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!