Skip to content

Commit

Permalink
Merge pull request #27006 from Expensify/vitfixPaidMessage
Browse files Browse the repository at this point in the history
Update the paid message to use same language as the button
  • Loading branch information
AndrewGable authored Sep 11, 2023
2 parents bdceb74 + df42bd6 commit 393475b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import type {
SettledAfterAddedBankAccountParams,
PaidElsewhereWithAmountParams,
PaidUsingPaypalWithAmountParams,
PaidUsingExpensifyWithAmountParams,
PaidWithExpensifyWithAmountParams,
ThreadRequestReportNameParams,
ThreadSentMoneyReportNameParams,
SizeExceededParams,
Expand Down Expand Up @@ -523,7 +523,7 @@ export default {
`${submitterDisplayName} added a bank account. The ${amount} payment has been made.`,
paidElsewhereWithAmount: ({amount}: PaidElsewhereWithAmountParams) => `paid ${amount} elsewhere`,
paidUsingPaypalWithAmount: ({amount}: PaidUsingPaypalWithAmountParams) => `paid ${amount} using Paypal.me`,
paidUsingExpensifyWithAmount: ({amount}: PaidUsingExpensifyWithAmountParams) => `paid ${amount} using Expensify`,
paidWithExpensifyWithAmount: ({amount}: PaidWithExpensifyWithAmountParams) => `paid ${amount} with Expensify`,
noReimbursableExpenses: 'This report has an invalid amount',
pendingConversionMessage: "Total will update when you're back online",
changedTheRequest: 'changed the request',
Expand Down
4 changes: 2 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import type {
SettledAfterAddedBankAccountParams,
PaidElsewhereWithAmountParams,
PaidUsingPaypalWithAmountParams,
PaidUsingExpensifyWithAmountParams,
PaidWithExpensifyWithAmountParams,
ThreadRequestReportNameParams,
ThreadSentMoneyReportNameParams,
SizeExceededParams,
Expand Down Expand Up @@ -524,7 +524,7 @@ export default {
`${submitterDisplayName} añadió una cuenta bancaria. El pago de ${amount} se ha realizado.`,
paidElsewhereWithAmount: ({amount}: PaidElsewhereWithAmountParams) => `pagó ${amount} de otra forma`,
paidUsingPaypalWithAmount: ({amount}: PaidUsingPaypalWithAmountParams) => `pagó ${amount} con PayPal.me`,
paidUsingExpensifyWithAmount: ({amount}: PaidUsingExpensifyWithAmountParams) => `pagó ${amount} con Expensify`,
paidWithExpensifyWithAmount: ({amount}: PaidWithExpensifyWithAmountParams) => `pagó ${amount} con Expensify`,
noReimbursableExpenses: 'El importe de este informe no es válido',
pendingConversionMessage: 'El total se actualizará cuando estés online',
changedTheRequest: 'cambió la solicitud',
Expand Down
4 changes: 2 additions & 2 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type PaidElsewhereWithAmountParams = {amount: string};

type PaidUsingPaypalWithAmountParams = {amount: string};

type PaidUsingExpensifyWithAmountParams = {amount: string};
type PaidWithExpensifyWithAmountParams = {amount: string};

type ThreadRequestReportNameParams = {formattedAmount: string; comment: string};

Expand Down Expand Up @@ -229,7 +229,7 @@ export type {
SettledAfterAddedBankAccountParams,
PaidElsewhereWithAmountParams,
PaidUsingPaypalWithAmountParams,
PaidUsingExpensifyWithAmountParams,
PaidWithExpensifyWithAmountParams,
ThreadRequestReportNameParams,
ThreadSentMoneyReportNameParams,
SizeExceededParams,
Expand Down
16 changes: 10 additions & 6 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ function getTransactionReportName(reportAction) {
* Get money request message for an IOU report
*
* @param {Object} report
* @param {Object} [reportAction={}]
* @param {Object} [reportAction={}] This can be either a report preview action or the IOU action
* @param {Boolean} [shouldConsiderReceiptBeingScanned=false]
* @returns {String}
*/
Expand Down Expand Up @@ -1447,12 +1447,15 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip
}

if (isSettled(report.reportID)) {
// A settled report preview message can come in three formats "paid ... using Paypal.me", "paid ... elsewhere" or "paid ... using Expensify"
// A settled report preview message can come in three formats "paid ... using Paypal.me", "paid ... elsewhere" or "paid ... with Expensify"
let translatePhraseKey = 'iou.paidElsewhereWithAmount';
if (reportActionMessage.match(/ Paypal.me$/)) {
if (reportAction.originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.PAYPAL_ME || reportActionMessage.match(/ PayPal.me$/)) {
translatePhraseKey = 'iou.paidUsingPaypalWithAmount';
} else if (reportActionMessage.match(/ using Expensify$/)) {
translatePhraseKey = 'iou.paidUsingExpensifyWithAmount';
} else if (
_.contains([CONST.IOU.PAYMENT_TYPE.VBBA, CONST.IOU.PAYMENT_TYPE.EXPENSIFY], reportAction.originalMessage.paymentType) ||
reportActionMessage.match(/ (with Expensify|using Expensify)$/)
) {
translatePhraseKey = 'iou.paidWithExpensifyWithAmount';
}
return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount});
}
Expand Down Expand Up @@ -2013,7 +2016,8 @@ function getIOUReportActionMessage(iouReportID, type, total, comment, currency,
paymentMethodMessage = ' elsewhere';
break;
case CONST.IOU.PAYMENT_TYPE.VBBA:
paymentMethodMessage = ' using Expensify';
case CONST.IOU.PAYMENT_TYPE.EXPENSIFY:
paymentMethodMessage = ' with Expensify';
break;
default:
paymentMethodMessage = ` using ${paymentType}`;
Expand Down

0 comments on commit 393475b

Please sign in to comment.