Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ const CONST = {
OPEN: 0,
PROCESSING: 1,
SUBMITTED: 2,
BILLING: 3,
},
STATUS: {
OPEN: 0,
Expand Down
5 changes: 3 additions & 2 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,9 @@ export default {
payerPaidAmount: ({payer, amount}) => `${payer} paid ${amount}`,
payerPaid: ({payer}) => `${payer} paid: `,
payerSettled: ({amount}) => `paid ${amount}`,
settledElsewhereWithAmount: ({amount}) => `paid ${amount} elsewhere`,
settledPaypalMeWithAmount: ({amount}) => `paid ${amount} using Paypal.me`,
paidElsewhereWithAmount: ({amount}) => `paid ${amount} elsewhere`,
paidUsingPaypalWithAmount: ({amount}) => `paid ${amount} using Paypal.me`,
paidUsingExpensifyWithAmount: ({amount}) => `paid ${amount} using Expensify`,
noReimbursableExpenses: 'This report has an invalid amount',
pendingConversionMessage: "Total will update when you're back online",
threadRequestReportName: ({formattedAmount, comment}) => `${formattedAmount} request${comment ? ` for ${comment}` : ''}`,
Expand Down
5 changes: 3 additions & 2 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,9 @@ export default {
payerPaidAmount: ({payer, amount}) => `${payer} pagó ${amount}`,
payerPaid: ({payer}) => `${payer} pagó: `,
payerSettled: ({amount}) => `pagó ${amount}`,
settledElsewhereWithAmount: ({amount}) => `pagó ${amount} de otra forma`,
settledPaypalMeWithAmount: ({amount}) => `pagó ${amount} con PayPal.me`,
paidElsewhereWithAmount: ({amount}) => `pagó ${amount} de otra forma`,
paidUsingPaypalWithAmount: ({amount}) => `pagó ${amount} con PayPal.me`,
paidUsingExpensifyWithAmount: ({amount}) => `pagó ${amount} con Expensify`,
noReimbursableExpenses: 'El monto de este informe es inválido',
pendingConversionMessage: 'El total se actualizará cuando estés online',
threadRequestReportName: ({formattedAmount, comment}) => `Solicitud de ${formattedAmount}${comment ? ` para ${comment}` : ''}`,
Expand Down
15 changes: 11 additions & 4 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,9 +1105,13 @@ function getReportPreviewMessage(report, reportAction = {}) {
const formattedAmount = CurrencyUtils.convertToDisplayString(totalAmount, report.currency);

if (isSettled(report.reportID)) {
// A settled message is in the format of either "paid $1.00 elsewhere" or "paid $1.00 using Paypal.me"
const isSettledPaypalMe = Boolean(reportActionMessage.match(/ Paypal.me$/));
const translatePhraseKey = isSettledPaypalMe ? 'iou.settledPaypalMeWithAmount' : 'iou.settledElsewhereWithAmount';
// A settled report preview message can come in three formats "paid ... using Paypal.me", "paid ... elsewhere" or "paid ... using Expensify"
let translatePhraseKey = 'iou.paidElsewhereWithAmount';
if (reportActionMessage.match(/ Paypal.me$/)) {
translatePhraseKey = 'iou.paidUsingPaypalWithAmount';
} else if (reportActionMessage.match(/ using Expensify$/)) {
translatePhraseKey = 'iou.paidUsingExpensifyWithAmount';
}
return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount});
}
return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount});
Expand Down Expand Up @@ -1533,12 +1537,15 @@ function buildOptimisticExpenseReport(chatReportID, policyID, payeeAccountID, to
*/
function getIOUReportActionMessage(type, total, comment, currency, paymentType = '', isSettlingUp = false) {
const currencyUnit = CurrencyUtils.getCurrencyUnit(currency);
const amount = NumberFormatUtils.format(preferredLocale, total / currencyUnit, {style: 'currency', currency});
const amount = NumberFormatUtils.format(preferredLocale, Math.abs(total) / currencyUnit, {style: 'currency', currency});
let paymentMethodMessage;
switch (paymentType) {
case CONST.IOU.PAYMENT_TYPE.ELSEWHERE:
paymentMethodMessage = ' elsewhere';
break;
case CONST.IOU.PAYMENT_TYPE.VBBA:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about PAYMENT_TYPE.EXPENSIFY?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The payment type is Expensify so this will Just Work

using ${paymentType};

paymentMethodMessage = ' using Expensify';
break;
default:
paymentMethodMessage = ` using ${paymentType}`;
break;
Expand Down