瀏覽代碼

1.优化微信支付

tags/0.0.7+3
“yanghuaxuan” 3 年之前
父節點
當前提交
173b72bf8b
共有 1 個文件被更改,包括 16 次插入5 次删除
  1. +16
    -5
      lib/util/wxpay_util.dart

+ 16
- 5
lib/util/wxpay_util.dart 查看文件

@@ -1,22 +1,33 @@
import 'dart:async';

import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:fluwx/fluwx.dart' as fluwx;

////微信支付简单封装
class WxPayUtil {
static StreamSubscription subscription;

////调用此方法
static Future<bool> toPay(Map<String, dynamic> params) async {
static toPay(Map<String, dynamic> params,Function (bool) callback) async {

subscription = fluwx.weChatResponseEventHandler.listen((res) {
if (res is fluwx.WeChatPaymentResponse) {
subscription.cancel();
callback(res.isSuccessful);
}
});

print(params);
var result = await payWithWeChat(
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']),
timeStamp: int.tryParse(params['timestamp']),
sign: params['sign'],
);

print(result);
return result;
// var payInfo = SyPayInfo();
// payInfo.appid = params['appid'];
// payInfo.noncestr = params['noncestr'];


Loading…
取消
儲存