-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.ios.js
33 lines (31 loc) · 900 Bytes
/
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
'use strict';
import {
NativeModules
} from 'react-native';
const RCTBraintree = NativeModules.Braintree;
module.exports = {
setup(serverUrl, urlscheme) {
return new Promise(function(resolve, reject) {
RCTBraintree.setupWithURLScheme(serverUrl, urlscheme, function(success) {
success == true ? resolve(true) : reject('Invalid Token');
});
});
},
showPayPalViewController(amount, shippingRequired, currencyCode) {
return new Promise(function(resolve, reject) {
RCTBraintree.showPayPalViewController(
amount,
shippingRequired,
currencyCode,
function(err, nonce, email, firstName, lastName, shipping) {
nonce != null ? resolve({
nonce,
email,
firstName,
lastName,
shipping
}) : reject(err);
});
});
},
};