Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function addCreditCard({braintreeToken, creditCard, fetch=api.fetch,
BraintreeClient=braintree.api.Client,
processingId}) {
return (dispatch, getState) => {
dispatch(processingActions.beginProcessing(processingId));
var client = new BraintreeClient({
clientToken: braintreeToken,
});
client.tokenizeCard({
number: creditCard.number,
expirationDate: creditCard.expiration,
cvv: creditCard.cvv,
}, function(err, nonce) {
if (err) {
console.error('Braintree tokenization error:', err);
dispatch(notificationActions.showError(
{errorCode: errorCodes.BRAINTREE_TOKENIZATION_ERROR}));
} else {
export function addCreditCard({braintreeToken, creditCard, fetch=api.fetch,
BraintreeClient=braintree.api.Client,
processingId}) {
return (dispatch, getState) => {
dispatch(processingActions.beginProcessing(processingId));
var client = new BraintreeClient({
clientToken: braintreeToken,
});
client.tokenizeCard({
number: creditCard.number,
expirationDate: creditCard.expiration,
cvv: creditCard.cvv,
}, function(err, nonce) {
if (err) {
console.error('Braintree tokenization error:', err);
dispatch(notificationActions.showError(
{errorCode: errorCodes.BRAINTREE_TOKENIZATION_ERROR}));
} else {
export function processPayment({productId, braintreeToken, creditCard,
payMethodUri, processingId,
BraintreeClient=braintree.api.Client,
createSubscription=defaultCreateSubscription,
payOnce=_processOneTimePayment,
...args}) {
return (dispatch, getState) => {
dispatch(processingActions.beginProcessing(processingId));
var product = products.get(productId);
var payForProduct;
if (product.recurrence === 'monthly') {
console.log('calling _createSubscription for product',
product.id);
payForProduct = createSubscription;
} else {
console.log('calling _processOneTimePayment for product',
product.id);
payForProduct = payOnce;
export function processPayment({productId, braintreeToken, creditCard,
payMethodUri,
BraintreeClient=braintree.api.Client,
createSubscription=defaultCreateSubscription,
payOnce=processOneTimePayment,
...args}) {
return (dispatch, getState) => {
var product = products.get(productId);
var payForProduct;
if (product.recurrence === 'monthly') {
console.log('calling createSubscription for product',
product.id);
payForProduct = createSubscription;
} else {
console.log('calling processOneTimePayment for product',
product.id);
payForProduct = payOnce;
}
export function processPayment({productId, braintreeToken, creditCard,
payMethodUri, processingId,
BraintreeClient=braintree.api.Client,
createSubscription=defaultCreateSubscription,
payOnce=_processOneTimePayment,
...args}) {
return (dispatch, getState) => {
dispatch(processingActions.beginProcessing(processingId));
var product = products.get(productId);
var payForProduct;
if (product.recurrence === 'monthly') {
console.log('calling _createSubscription for product',
product.id);
payForProduct = createSubscription;
} else {
console.log('calling _processOneTimePayment for product',
product.id);
payForProduct = payOnce;