forked from kraffslol/react-native-braintree-xplat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.android.js
44 lines (36 loc) · 1.48 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
'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) {
return new Promise(function(resolve, reject) {
Braintree.getCardNonce(cardNumber, expirationMonth, expirationYear, (nonce) => resolve(nonce), (err) => reject(err))
});
},
showPaymentViewController() {
return new Promise(function(resolve, reject) {
Braintree.paymentRequest((nonce) => resolve(nonce), (error) => reject(error));
});
},
showPayPalCheckoutController(amount, currency) {
return new Promise(function(resolve, reject) {
Braintree.payWithPayPal(amount, currency || "EUR", (nonce) => resolve(nonce), (error) => reject(error));
});
},
verify3DSecure(paymentNonce, amount) {
return new Promise(function(resolve, reject) {
Braintree.verify3DSecure(paymentNonce, amount, (nonce) => resolve(nonce), (error) => reject(error));
});
},
get3DSecureVerifiedCardNonce(cardNumber, expirationMonth, expirationYear, cvv, amount, verify) {
return new Promise(function(resolve, reject) {
Braintree.tokenizeCardAndVerify(cardNumber, expirationMonth, expirationYear, cvv, amount, !!verify,
(nonce) => resolve(nonce), (error) => reject(error));
});
},
};