Commit 64fd7eff authored by 李增强's avatar 李增强

Initial commit

parent 41959ddd
...@@ -5,11 +5,11 @@ import 'package:flutter/services.dart'; ...@@ -5,11 +5,11 @@ import 'package:flutter/services.dart';
class AlipayNoUtdid { class AlipayNoUtdid {
static const MethodChannel _channel = const MethodChannel('alipay_no_utdid'); static const MethodChannel _channel = const MethodChannel('alipay_no_utdid');
static Future<Map<String, String>> pay(String order, static Future<_Result> pay(String order,
{AliPayEvn payEnv = AliPayEvn.ONLINE}) async { {AliPayEvn payEnv = AliPayEvn.ONLINE}) async {
var map = await _channel var map = await _channel
.invokeMethod('pay', {"order": order, "payEnv": payEnv.index}); .invokeMethod('pay', {"order": order, "payEnv": payEnv.index});
return Map<String, String>.from(map); return _Result.fromJson(map);
} }
static Future<bool> isInstalled() { static Future<bool> isInstalled() {
...@@ -18,3 +18,22 @@ class AlipayNoUtdid { ...@@ -18,3 +18,22 @@ class AlipayNoUtdid {
} }
enum AliPayEvn { ONLINE, SANDBOX } enum AliPayEvn { ONLINE, SANDBOX }
class _Result {
String msg;
String code;
bool get isSuccessful => code == '9000';
_Result.fromJson(Map map) {
msg = map['memo'];
code = map['resultStatus'];
}
Map<String,dynamic> toMap(){
return {
"msg":msg,
"code":code,
"isSuccessful":isSuccessful,
};
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment