forked from appchoose/react-native-braintree-custom-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.android.js
57 lines (53 loc) · 1.4 KB
/
index.android.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
'use strict';
import {
NativeModules
} from 'react-native';
import { mapParameters } from './utils';
const Braintree = NativeModules.Braintree;
module.exports = {
setup(token) {
return new Promise(function (resolve, reject) {
Braintree.setup(token, test => resolve(test), err => reject(err));
});
},
setupWithToken(token) {
return new Promise(function (resolve, reject) {
Braintree.setupWithToken(token, test => resolve(test), err => reject(err));
});
},
getCardNonce(parameters = {}) {
return new Promise(function (resolve, reject) {
Braintree.getCardNonce(
mapParameters(parameters),
nonce => resolve(nonce),
err => reject(err)
);
});
},
check3DSecure(parameters = {}) {
return new Promise(function (resolve, reject) {
console.log(parameters)
Braintree.check3DSecure(parameters, nonce => resolve(nonce),
err => reject(err));
});
},
showPayPalViewController(amount, shippingrequired) {
return new Promise(function (resolve, reject) {
Braintree.paypalRequest(amount, (nonce
// ,
// email,
// firstName,
// lastName,
// billingAddress,
// shippingAddress
) => resolve({
nonce,
// email,
// firstName,
// lastName,
// billingAddress,
// shippingAddress
}), error => reject(error));
});
},
};