forked from allmaxgit/react-native-braintree-xplat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.android.js
47 lines (42 loc) · 1.15 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
'use strict';
import {NativeModules, processColor} from 'react-native';
var Braintree = NativeModules.Braintree;
module.exports = {
setup(token) {
return new Promise(function(resolve, reject) {
Braintree.setup(token, test => resolve(test), err => reject(err));
});
},
getCardNonce(cardNumber, expirationMonth, expirationYear, cvv) {
return new Promise(function(resolve, reject) {
Braintree.getCardNonce(
cardNumber,
expirationMonth,
expirationYear,
cvv,
nonce => resolve(nonce),
err => reject(err)
);
});
},
showPaymentViewController(config = {}) {
var options = {
callToActionText: config.callToActionText,
title: config.title,
description: config.description,
amount: config.amount,
};
return new Promise(function(resolve, reject) {
Braintree.paymentRequest(
options,
nonce => resolve(nonce),
error => reject(error)
);
});
},
showPayPalViewController() {
return new Promise(function(resolve, reject) {
Braintree.paypalRequest(nonce => resolve(nonce), error => reject(error));
});
},
};