@@ -4566,7 +4566,7 @@ function getReportPreviewMessage(
45664566 }
45674567
45684568 const containsNonReimbursable = hasNonReimbursableTransactions ( report . reportID ) ;
4569- const { totalDisplaySpend : totalAmount } = getMoneyRequestSpendBreakdown ( report ) ;
4569+ const { totalDisplaySpend : totalAmount , reimbursableSpend } = getMoneyRequestSpendBreakdown ( report ) ;
45704570
45714571 const parentReport = getParentReport ( report ) ;
45724572 const policyName = getPolicyName ( { report : parentReport ?? report , policy} ) ;
@@ -4600,6 +4600,7 @@ function getReportPreviewMessage(
46004600
46014601 // Show Paid preview message if it's settled or if the amount is paid & stuck at receivers end for only chat reports.
46024602 if ( isSettled ( report . reportID ) || ( report . isWaitingOnBankAccount && isPreviewMessageForParentChatReport ) ) {
4603+ const formattedReimbursableAmount = convertToDisplayString ( reimbursableSpend , report . currency ) ;
46034604 // A settled report preview message can come in three formats "paid ... elsewhere" or "paid ... with Expensify"
46044605 let translatePhraseKey : TranslationPaths = 'iou.paidElsewhere' ;
46054606 if ( isPreviewMessageForParentChatReport ) {
@@ -4625,7 +4626,7 @@ function getReportPreviewMessage(
46254626 const payerDisplayName = isPreviewMessageForParentChatReport ? payerName : actualPayerName ;
46264627
46274628 return translateLocal ( translatePhraseKey , {
4628- amount : '' ,
4629+ amount : formattedReimbursableAmount ,
46294630 payer : payerDisplayName ?? '' ,
46304631 last4Digits : reportPolicy ?. achAccount ?. accountNumber ?. slice ( - 4 ) ?? '' ,
46314632 } ) ;
@@ -5140,20 +5141,11 @@ function getReportNameInternal({
51405141
51415142 if ( isMoneyRequestAction ( parentReportAction ) ) {
51425143 const originalMessage = getOriginalMessage ( parentReportAction ) ;
5143- const reportPolicy = allPolicies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ report ?. policyID } ` ] ;
5144- const last4Digits = reportPolicy ?. achAccount ?. accountNumber . slice ( - 4 ) ?? '' ;
5145-
51465144 if ( originalMessage ?. type === CONST . IOU . REPORT_ACTION_TYPE . PAY ) {
51475145 if ( originalMessage . paymentType === CONST . IOU . PAYMENT_TYPE . ELSEWHERE ) {
51485146 return translateLocal ( 'iou.paidElsewhere' ) ;
51495147 }
5150- if ( originalMessage . paymentType === CONST . IOU . PAYMENT_TYPE . VBBA ) {
5151- if ( originalMessage . automaticAction ) {
5152- return translateLocal ( 'iou.automaticallyPaidWithBusinessBankAccount' , { last4Digits} ) ;
5153- }
5154- return translateLocal ( 'iou.businessBankAccount' , { last4Digits} ) ;
5155- }
5156- if ( originalMessage . paymentType === CONST . IOU . PAYMENT_TYPE . EXPENSIFY ) {
5148+ if ( originalMessage . paymentType === CONST . IOU . PAYMENT_TYPE . VBBA || originalMessage . paymentType === CONST . IOU . PAYMENT_TYPE . EXPENSIFY ) {
51575149 if ( originalMessage . automaticAction ) {
51585150 return translateLocal ( 'iou.automaticallyPaidWithExpensify' ) ;
51595151 }
@@ -9219,6 +9211,12 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry<ReportAction>,
92199211
92209212 let translationKey : TranslationPaths ;
92219213 if ( originalMessage ?. type === CONST . IOU . REPORT_ACTION_TYPE . PAY ) {
9214+ // The `REPORT_ACTION_TYPE.PAY` action type is used for both fulfilling existing requests and sending money. To
9215+ // differentiate between these two scenarios, we check if the `originalMessage` contains the `IOUDetails`
9216+ // property. If it does, it indicates that this is a 'Pay someone' action.
9217+ const { amount, currency} = originalMessage ?. IOUDetails ?? originalMessage ?? { } ;
9218+ const formattedAmount = convertToDisplayString ( Math . abs ( amount ) , currency ) ?? '' ;
9219+
92229220 const reportPolicy = allPolicies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ report ?. policyID } ` ] ;
92239221 const last4Digits = reportPolicy ?. achAccount ?. accountNumber . slice ( - 4 ) ?? '' ;
92249222
@@ -9229,21 +9227,19 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry<ReportAction>,
92299227 case CONST . IOU . PAYMENT_TYPE . EXPENSIFY :
92309228 case CONST . IOU . PAYMENT_TYPE . VBBA :
92319229 if ( isInvoice ) {
9232- return translateLocal ( payAsBusiness ? 'iou.settleInvoiceBusiness' : 'iou.settleInvoicePersonal' , { amount : '' , last4Digits} ) ;
9230+ return translateLocal ( payAsBusiness ? 'iou.settleInvoiceBusiness' : 'iou.settleInvoicePersonal' , { amount : formattedAmount , last4Digits} ) ;
92339231 }
92349232 translationKey = 'iou.businessBankAccount' ;
9235- if ( automaticAction && originalMessage . paymentType === CONST . IOU . PAYMENT_TYPE . EXPENSIFY ) {
9233+ if ( automaticAction ) {
92369234 translationKey = 'iou.automaticallyPaidWithExpensify' ;
9237- } else {
9238- translationKey = 'iou.automaticallyPaidWithBusinessBankAccount' ;
92399235 }
92409236 break ;
92419237 default :
92429238 translationKey = 'iou.payerPaidAmount' ;
92439239 break ;
92449240 }
92459241
9246- return translateLocal ( translationKey , { amount : '' , payer : '' , last4Digits} ) ;
9242+ return translateLocal ( translationKey , { amount : formattedAmount , payer : '' , last4Digits} ) ;
92479243 }
92489244
92499245 const amount = getTransactionAmount ( transaction , ! isEmptyObject ( iouReport ) && isExpenseReport ( iouReport ) ) ?? 0 ;
0 commit comments