|
|
@@ -2,24 +2,36 @@ import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
|
|
|
|
////微信支付简单封装 |
|
|
|
class WxPayUtil { |
|
|
|
|
|
|
|
////调用此方法 |
|
|
|
static Future<bool> toPay(Map<String, dynamic> params) async { |
|
|
|
var payInfo = SyPayInfo(); |
|
|
|
payInfo.appid = params['appid']; |
|
|
|
payInfo.noncestr = params['noncestr']; |
|
|
|
payInfo.package = params['package']; |
|
|
|
payInfo.partnerid = params['partnerid']; |
|
|
|
payInfo.sign = params['sign']; |
|
|
|
payInfo.timestamp = params['timestamp']; |
|
|
|
payInfo.prepayid = params['prepayid']; |
|
|
|
print("发起微信支付"); |
|
|
|
SyPayResult result = await SyFlutterWechat.pay(payInfo); |
|
|
|
print(params); |
|
|
|
var result = await payWithWeChat( |
|
|
|
appId: params['appid'].toString(), |
|
|
|
partnerId: params['partnerid'].toString(), |
|
|
|
prepayId: params['prepayid'].toString(), |
|
|
|
packageValue: params['package'].toString(), |
|
|
|
nonceStr: params['noncestr'].toString(), |
|
|
|
timeStamp:int.tryParse(params['timestamp']), |
|
|
|
sign: params['sign'], |
|
|
|
); |
|
|
|
|
|
|
|
if (result == SyPayResult.success) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
} |
|
|
|
print(result); |
|
|
|
return result; |
|
|
|
// var payInfo = SyPayInfo(); |
|
|
|
// payInfo.appid = params['appid']; |
|
|
|
// payInfo.noncestr = params['noncestr']; |
|
|
|
// payInfo.package = params['package']; |
|
|
|
// payInfo.partnerid = params['partnerid']; |
|
|
|
// payInfo.sign = params['sign']; |
|
|
|
// payInfo.timestamp = params['timestamp']; |
|
|
|
// payInfo.prepayid = params['prepayid']; |
|
|
|
// print("发起微信支付"); |
|
|
|
// SyPayResult result = await SyFlutterWechat.pay(payInfo); |
|
|
|
// |
|
|
|
// if (result == SyPayResult.success) { |
|
|
|
// return true; |
|
|
|
// } else { |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
} |
|
|
|
} |