-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.ios.js
65 lines (57 loc) · 1.38 KB
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict';
const {
setDebugMode,
handleOpenURLInIOS8,
handleOpenURLInIOS9,
createPayment,
} = require('react-native').NativeModules.PingPP;
class PingPlusPlus {
/**
* 设置为debug模式
* @method setDebugMode
* @static
* @param {Boolean} enabled
*/
static setDebugMode(enabled) {
setDebugMode(enabled);
return true;
}
/**
* 在appDelegate中调用,iOS8及以下版本使用
* @method handleOpenURLInIOS8
* @static
* @param {String} url
* @param {Function} callback
*/
static handleOpenURLInIOS8(url, callback) {
return handleOpenURLInIOS8(url, callback);
}
/**
* 在appDelegate中调用,iOS9及以上版本使用
* @method handleOpenURLInIOS9
* @static
* @param {String} url
* @param {String} source
* @param {Function} callback
*/
static handleOpenURLInIOS9(url, source, callback) {
return handleOpenURLInIOS9(url, source, callback);
}
/**
* 创建支付对象
* @method createPayment
* @static
* @param {Object} charge
* @param {String} schema
* @param {Function} callback
*/
static createPayment(charge, schema, callback) {
if (typeof callback === 'function') {
createPayment(charge, schema, callback);
} else {
return new Promise(
(resolve, reject) => createPayment(charge, schema, resolve));
}
}
}
module.exports = PingPlusPlus;