@@ -63,7 +63,6 @@ import {resolveSuggestedFollowup} from '@libs/actions/Report/SuggestedFollowup';
6363import { isPersonalCardBrokenConnection } from '@libs/CardUtils' ;
6464import { isChronosOOOListAction } from '@libs/ChronosUtils' ;
6565import ControlSelection from '@libs/ControlSelection' ;
66- import { convertToDisplayString } from '@libs/CurrencyUtils' ;
6766import { canUseTouchScreen } from '@libs/DeviceCapabilities' ;
6867import type { OnyxDataWithErrors } from '@libs/ErrorUtils' ;
6968import { getLatestErrorMessageField , isReceiptError } from '@libs/ErrorUtils' ;
@@ -73,7 +72,6 @@ import {isReportMessageAttachment} from '@libs/isReportMessageAttachment';
7372import Navigation from '@libs/Navigation/Navigation' ;
7473import type { PlatformStackNavigationProp } from '@libs/Navigation/PlatformStackNavigation/types' ;
7574import type { ReportsSplitNavigatorParamList } from '@libs/Navigation/types' ;
76- import { getBankAccountLastFourDigits } from '@libs/PaymentUtils' ;
7775import Permissions from '@libs/Permissions' ;
7876import { getDisplayNameOrDefault } from '@libs/PersonalDetailsUtils' ;
7977import { getCleanedTagName , isPolicyAdmin , isPolicyMember , isPolicyOwner } from '@libs/PolicyUtils' ;
@@ -248,6 +246,7 @@ import type {Errors} from '@src/types/onyx/OnyxCommon';
248246import type { JoinWorkspaceResolution } from '@src/types/onyx/OriginalMessage' ;
249247import { isEmptyObject , isEmptyValueObject } from '@src/types/utils/EmptyObject' ;
250248import ApprovalFlowContent , { isApprovalFlowAction } from './actionContents/ApprovalFlowContent' ;
249+ import PaymentContent from './actionContents/PaymentContent' ;
251250import SimpleMessageContent , { isSimpleMessageAction } from './actionContents/SimpleMessageContent' ;
252251import { RestrictedReadOnlyContextMenuActions } from './ContextMenu/ContextMenuActions' ;
253252import MiniReportActionContextMenu from './ContextMenu/MiniReportActionContextMenu' ;
@@ -1373,49 +1372,13 @@ function PureReportActionItem({
13731372 />
13741373 ) ;
13751374 } else if ( isActionOfType ( action , CONST . REPORT . ACTIONS . TYPE . IOU ) && getOriginalMessage ( action ) ?. type === CONST . IOU . REPORT_ACTION_TYPE . PAY ) {
1376- const wasAutoPaid = getOriginalMessage ( action ) ?. automaticAction ?? false ;
1377- const paymentType = getOriginalMessage ( action ) ?. paymentType ;
1378-
1379- if ( paymentType === CONST . IOU . PAYMENT_TYPE . ELSEWHERE ) {
1380- children = < ReportActionItemBasicMessage message = { translate ( 'iou.paidElsewhere' ) } /> ;
1381- } else if ( paymentType === CONST . IOU . PAYMENT_TYPE . VBBA ) {
1382- const originalMessage = getOriginalMessage ( action ) ;
1383- const last4Digits = getBankAccountLastFourDigits ( originalMessage ?. bankAccountID , bankAccountList , policy ) ;
1384- if ( wasAutoPaid ) {
1385- const translation = translate ( 'iou.automaticallyPaidWithBusinessBankAccount' , '' , last4Digits ) ;
1386-
1387- children = (
1388- < ReportActionItemBasicMessage >
1389- < RenderHTML html = { `<comment><muted-text>${ translation } </muted-text></comment>` } />
1390- </ ReportActionItemBasicMessage >
1391- ) ;
1392- } else {
1393- children = < ReportActionItemBasicMessage message = { translate ( 'iou.businessBankAccount' , '' , last4Digits ) } /> ;
1394- }
1395- } else if ( wasAutoPaid ) {
1396- children = (
1397- < ReportActionItemBasicMessage >
1398- < RenderHTML html = { `<comment><muted-text>${ translate ( 'iou.automaticallyPaidWithExpensify' ) } </muted-text></comment>` } />
1399- </ ReportActionItemBasicMessage >
1400- ) ;
1401- } else {
1402- const originalMessage = getOriginalMessage ( action ) ;
1403- const amount = convertToDisplayString ( Math . abs ( originalMessage ?. amount ?? 0 ) , originalMessage ?. currency ) ;
1404- if ( originalMessage ?. bankAccountID ) {
1405- const bankAccount = bankAccountList ?. [ originalMessage . bankAccountID ] ;
1406- children = (
1407- < ReportActionItemBasicMessage
1408- message = { translate (
1409- originalMessage ?. payAsBusiness ? 'iou.settleInvoiceBusiness' : 'iou.settleInvoicePersonal' ,
1410- amount ,
1411- bankAccount ?. accountData ?. accountNumber ?. slice ( - 4 ) ?? '' ,
1412- ) }
1413- />
1414- ) ;
1415- } else {
1416- children = < ReportActionItemBasicMessage message = { translate ( 'iou.paidWithExpensify' ) } /> ;
1417- }
1418- }
1375+ children = (
1376+ < PaymentContent
1377+ action = { action }
1378+ bankAccountList = { bankAccountList }
1379+ policy = { policy }
1380+ />
1381+ ) ;
14191382 } else if ( isActionOfType ( action , CONST . REPORT . ACTIONS . TYPE . REIMBURSED ) ) {
14201383 children = < ReportActionItemBasicMessage message = { getReimbursedMessage ( translate , action , report , currentUserAccountID ) } /> ;
14211384 } else if ( isSimpleMessageAction ( action ) ) {
0 commit comments