Change Stripe errors to use camelCased info instead of snake_case

This commit is contained in:
Vesa Luusua 2018-05-15 15:58:05 +03:00
parent 683fe6353c
commit 83ce3769d5
2 changed files with 3 additions and 3 deletions

View file

@ -388,7 +388,7 @@ export const createStripeAccount = payoutDetails => (dispatch, getState, sdk) =>
dispatch(stripeAccountCreateError(e));
const stripeMessage =
e.apiErrors && e.apiErrors.length > 0 && e.apiErrors[0].meta
? e.apiErrors[0].meta.stripe_message
? e.apiErrors[0].meta.stripeMessage
: null;
log.error(err, 'create-stripe-account-failed', { stripeMessage });
throw e;

View file

@ -115,7 +115,7 @@ export const isTransactionInitiateAmountTooLowError = error => {
try {
// TODO: This is a temporary solution until a proper error code
// for this specific error is received in the response.
const msg = apiError.meta.stripe_message;
const msg = apiError.meta.stripeMessage;
isAmountTooLow =
msg.startsWith('Amount must be at least') ||
msg.startsWith('Amount must convert to at least');
@ -168,7 +168,7 @@ export const isStripeInvalidPostalCode = error => {
return errorAPIErrors(error).some(apiError => {
// Stripe doesn't seem to give an error code for this specific
// case, so we have to recognize it from the message.
const msg = apiError.meta && apiError.meta.stripe_message ? apiError.meta.stripe_message : '';
const msg = apiError.meta && apiError.meta.stripeMessage ? apiError.meta.stripeMessage : '';
return msgRe.test(msg);
});
};