2020-07-07 20:10:43 +08:00
|
|
|
|
import { NativeModules, Platform } from 'react-native';
|
2020-07-07 17:44:10 +08:00
|
|
|
|
|
2020-07-07 20:10:43 +08:00
|
|
|
|
export default class Alipay {
|
|
|
|
|
/**
|
2020-07-14 15:39:41 +08:00
|
|
|
|
* 支付
|
2020-07-07 20:10:43 +08:00
|
|
|
|
* @param orderInfo 支付详情
|
2020-07-14 15:39:41 +08:00
|
|
|
|
* @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301
|
2020-07-07 20:10:43 +08:00
|
|
|
|
*/
|
2020-07-14 14:52:13 +08:00
|
|
|
|
static alipay(orderInfo) {
|
2020-07-14 22:53:43 +08:00
|
|
|
|
return NativeModules.RNAlipay.alipay(orderInfo);
|
2020-07-07 20:10:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-13 22:01:03 +08:00
|
|
|
|
/**
|
2020-07-14 15:39:41 +08:00
|
|
|
|
* 快速登录授权
|
|
|
|
|
* @param authInfoStr 验证详情
|
|
|
|
|
* @returns result 支付宝回调结果 详情见 https://opendocs.alipay.com/open/218/105325
|
|
|
|
|
*/
|
|
|
|
|
static authInfo(authInfoStr) {
|
2020-07-14 22:53:43 +08:00
|
|
|
|
return NativeModules.RNAlipay.authInfo(authInfoStr)
|
2020-07-14 15:39:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前版本号
|
|
|
|
|
* @return 当前版本字符串
|
2020-07-13 22:01:03 +08:00
|
|
|
|
*/
|
2020-07-14 15:39:41 +08:00
|
|
|
|
static getVersion() {
|
2020-07-14 22:53:43 +08:00
|
|
|
|
return NativeModules.RNAlipay.getVersion()
|
2020-07-13 22:01:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-07 20:10:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* 设置支付宝跳转Scheme,仅 iOS
|
|
|
|
|
* @param scheme
|
2020-07-23 23:53:36 +08:00
|
|
|
|
* @platform ios
|
2020-07-07 20:10:43 +08:00
|
|
|
|
*/
|
|
|
|
|
static setAlipayScheme(scheme) {
|
|
|
|
|
if (Platform.OS === 'ios') {
|
2020-07-14 22:53:43 +08:00
|
|
|
|
NativeModules.RNAlipay.setAlipayScheme(scheme);
|
2020-07-07 20:10:43 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-08 10:21:49 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置支付宝沙箱环境,仅 Android
|
|
|
|
|
* @param isSandBox
|
2020-07-23 23:53:36 +08:00
|
|
|
|
* @platform android
|
2020-07-08 10:21:49 +08:00
|
|
|
|
*/
|
2020-07-09 18:56:50 +08:00
|
|
|
|
static setAlipaySandbox(isSandBox) {
|
2020-07-08 10:21:49 +08:00
|
|
|
|
if (Platform.OS === 'android') {
|
2020-07-14 22:53:43 +08:00
|
|
|
|
NativeModules.RNAlipay.setAlipaySandbox(isSandBox);
|
2020-07-08 10:21:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-07 20:10:43 +08:00
|
|
|
|
}
|