From 285cd715aeae74e87e090bc293c199fffd081140 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 18 Jul 2023 17:07:10 +0100 Subject: [PATCH 1/5] Use Expensify in case of ACH payment method --- src/libs/ReportUtils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index eee3d7558666..e94821c791b5 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1509,6 +1509,9 @@ function getIOUReportActionMessage(type, total, comment, currency, paymentType = case CONST.IOU.PAYMENT_TYPE.ELSEWHERE: paymentMethodMessage = ' elsewhere'; break; + case CONST.IOU.PAYMENT_TYPE.VBBA: + paymentMethodMessage = ' Expensify'; + break; default: paymentMethodMessage = ` using ${paymentType}`; break; From ce297e9803280900698ebcaf6f6d6bb99b9773bd Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 18 Jul 2023 17:08:46 +0100 Subject: [PATCH 2/5] Use absolute value for the paid amount total --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index e94821c791b5..1c2054981acc 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1503,7 +1503,7 @@ 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: From 9138da86a74d55496fa299e91b26dd9999151077 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 18 Jul 2023 17:21:51 +0100 Subject: [PATCH 3/5] Update the language constants to be more in line with other iou messages --- src/languages/en.js | 4 ++-- src/languages/es.js | 4 ++-- src/libs/ReportUtils.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/languages/en.js b/src/languages/en.js index 2374604c4ba9..8b879f36bf03 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -365,8 +365,8 @@ 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`, noReimbursableExpenses: 'This report has an invalid amount', pendingConversionMessage: "Total will update when you're back online", threadRequestReportName: ({formattedAmount, comment}) => `${formattedAmount} request${comment ? ` for ${comment}` : ''}`, diff --git a/src/languages/es.js b/src/languages/es.js index 91a4592b2e29..c060cd5e9eac 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -364,8 +364,8 @@ 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`, 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}` : ''}`, diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 1c2054981acc..5dcd70eff424 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1101,7 +1101,7 @@ function getReportPreviewMessage(report, reportAction = {}) { 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'; + const translatePhraseKey = isSettledPaypalMe ? 'iou.paidUsingPaypalWithAmount' : 'iou.paidElsewhereWithAmount'; return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount}); } return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount}); @@ -1510,7 +1510,7 @@ function getIOUReportActionMessage(type, total, comment, currency, paymentType = paymentMethodMessage = ' elsewhere'; break; case CONST.IOU.PAYMENT_TYPE.VBBA: - paymentMethodMessage = ' Expensify'; + paymentMethodMessage = ' using Expensify'; break; default: paymentMethodMessage = ` using ${paymentType}`; From 5a8a80fe6d63ddd1a7722998c83b8a81f8dea51d Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 18 Jul 2023 23:05:56 +0100 Subject: [PATCH 4/5] Make sure correct payment messages are shown in LHN --- src/languages/en.js | 1 + src/libs/ReportUtils.js | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/languages/en.js b/src/languages/en.js index 55fb05fe4f96..54bc2e9bed1a 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -367,6 +367,7 @@ export default { payerSettled: ({amount}) => `paid ${amount}`, 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}` : ''}`, diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 5dcd70eff424..7091e32fefc0 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1099,9 +1099,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.paidUsingPaypalWithAmount' : 'iou.paidElsewhereWithAmount'; + // 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}); From d86d4bbd53980f828c1fee178f26d4ce913c3fcc Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 18 Jul 2023 23:10:44 +0100 Subject: [PATCH 5/5] Add Billing to the state options --- src/CONST.js | 1 + src/languages/es.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/CONST.js b/src/CONST.js index 9a45cd631a90..5e8eae0c57d9 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -593,6 +593,7 @@ const CONST = { OPEN: 0, PROCESSING: 1, SUBMITTED: 2, + BILLING: 3, }, STATUS: { OPEN: 0, diff --git a/src/languages/es.js b/src/languages/es.js index baa6a48ff3f6..df51b1cf95fc 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -366,6 +366,7 @@ export default { payerSettled: ({amount}) => `pagó ${amount}`, 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}` : ''}`,