Skip to content

Commit

Permalink
Merge pull request #3809 from Expensify/nmurray-update-IOU-growl
Browse files Browse the repository at this point in the history
Add an error Growl for failed IOU payments
  • Loading branch information
mountiny authored Jul 1, 2021
2 parents 870c3db + 205e3ed commit 5abb33c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export default {
paid: ({owner, manager}) => `${manager} paid ${owner}`,
split: ({amount}) => `Split ${amount}`,
choosePaymentMethod: 'Choose payment method:',
noReimbursableExpenses: 'This report has an invalid amount',
},
reportDetailsPage: {
notificationPreferencesDescription: 'How often should we notify you when there are new messages to catch up on in this room?',
Expand Down Expand Up @@ -319,6 +320,7 @@ export default {
address: 'Please enter a valid address',
dob: 'Please enter a valid date of birth',
ssnLast4: 'Please enter valid last 4 digits of SSN',
noDefaultDepositAccountOrDebitCardAvailable: 'Please add a default deposit bank account or debit card',
},
},
addPersonalBankAccountPage: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default {
paid: ({owner, manager}) => `${manager} pagó a ${owner}`,
split: ({amount}) => `Dividir ${amount}`,
choosePaymentMethod: 'Elige el método de pago:',
noReimbursableExpenses: 'El monto de este informe es inválido',
},
reportDetailsPage: {
notificationPreferencesDescription: 'Cada cuanto tiempo quieres que te avisemos que hay nuevos mensajes en este canal?',
Expand Down Expand Up @@ -312,6 +313,7 @@ export default {
address: 'Ingrese una dirección válida',
dob: 'Ingrese una fecha de nacimiento válida',
ssnLast4: 'Ingrese los últimos 4 dígitos del número de seguro social',
noDefaultDepositAccountOrDebitCardAvailable: 'Por favor agregue una cuenta bancaria para depósitos o una tarjeta de débito',
},
},
addPersonalBankAccountPage: {
Expand Down
14 changes: 13 additions & 1 deletion src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import ROUTES from '../../ROUTES';
import * as API from '../API';
import {getSimplifiedIOUReport, fetchChatReportsByIDs, fetchIOUReportByIDAndUpdateChatReport} from './Report';
import Navigation from '../Navigation/Navigation';
import Growl from '../Growl';
import {translateLocal} from '../translate';
import asyncOpenURL from '../asyncOpenURL';

/**
Expand Down Expand Up @@ -222,7 +224,17 @@ function payIOUReport({
fetchIOUReportByIDAndUpdateChatReport(reportID, chatReportID);
})
.catch((error) => {
console.error(`Error Paying iouReport: ${error}`);
switch (error.message) {
// eslint-disable-next-line max-len
case 'You cannot pay via Expensify Wallet until you have either a verified deposit bank account or debit card.':
Growl.error(translateLocal('bankAccount.error.noDefaultDepositAccountOrDebitCardAvailable'), 5000);
break;
case 'This report doesn\'t have reimbursable expenses.':
Growl.error(translateLocal('iou.noReimbursableExpenses'), 5000);
break;
default:
Growl.error(error.message, 5000);
}
Onyx.merge(ONYXKEYS.IOU, {error: true});
})
.finally(() => Onyx.merge(ONYXKEYS.IOU, {loading: false})),
Expand Down

0 comments on commit 5abb33c

Please sign in to comment.