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
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ export default {
duplicateWaypointsErrorMessage: 'Please remove duplicate waypoints',
emptyWaypointsErrorMessage: 'Please enter at least two waypoints',
},
waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `Started settling up, payment is held until ${submitterDisplayName} enables their Wallet`,
enableWallet: 'Enable Wallet',
},
notificationPreferencesPage: {
header: 'Notification preferences',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ export default {
duplicateWaypointsErrorMessage: 'Por favor elimina los puntos de ruta duplicados',
emptyWaypointsErrorMessage: 'Por favor introduce al menos dos puntos de ruta',
},
waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `nicio el pago, pero no se procesará hasta que ${submitterDisplayName} active su Billetera`,
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.

@techievivek this should be Inició or inició, can you submit a PR to update please?

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.

@cead22 Added here: #30335

enableWallet: 'Habilitar Billetera',
},
notificationPreferencesPage: {
header: 'Preferencias de avisos',
Expand Down
65 changes: 53 additions & 12 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ import themeColors from '../../../styles/themes/default';
import ReportActionItemBasicMessage from './ReportActionItemBasicMessage';
import RenderHTML from '../../../components/RenderHTML';
import ReportAttachmentsContext from './ReportAttachmentsContext';
import ROUTES from '../../../ROUTES';
import Navigation from '../../../libs/Navigation/Navigation';
import KYCWall from '../../../components/KYCWall';
import userWalletPropTypes from '../../EnablePayments/userWalletPropTypes';

const propTypes = {
...windowDimensionsPropTypes,
Expand Down Expand Up @@ -114,6 +118,9 @@ const propTypes = {

/** Flag to show, hide the thread divider line */
shouldHideThreadDividerLine: PropTypes.bool,

/** The user's wallet account */
userWallet: userWalletPropTypes,
};

const defaultProps = {
Expand All @@ -125,6 +132,7 @@ const defaultProps = {
hasOutstandingIOU: false,
iouReport: undefined,
shouldHideThreadDividerLine: false,
userWallet: {},
};

function ReportActionItem(props) {
Expand Down Expand Up @@ -345,20 +353,50 @@ function ReportActionItem(props) {
);
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTQUEUED) {
const submitterDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(props.personalDetailsList, [props.report.ownerAccountID, 'displayName'], props.report.ownerEmail);
const shouldShowAddCreditBankAccountButton =
ReportUtils.isCurrentUserSubmitter(props.report.reportID) && !store.hasCreditBankAccount() && !ReportUtils.isSettled(props.report.reportID);
const paymentType = lodashGet(props.action, 'originalMessage.paymentType', '');

const isSubmitterOfUnsettledReport = ReportUtils.isCurrentUserSubmitter(props.report.reportID) && !ReportUtils.isSettled(props.report.reportID);
const shouldShowAddCreditBankAccountButton = isSubmitterOfUnsettledReport && !store.hasCreditBankAccount() && paymentType !== CONST.IOU.PAYMENT_TYPE.EXPENSIFY;
const shouldShowEnableWalletButton =
isSubmitterOfUnsettledReport &&
(_.isEmpty(props.userWallet) || props.userWallet.tierName === CONST.WALLET.TIER_NAME.SILVER) &&
paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY;

children = (
<ReportActionItemBasicMessage message={props.translate('iou.waitingOnBankAccount', {submitterDisplayName})}>
{shouldShowAddCreditBankAccountButton ? (
<Button
success
style={[styles.w100, styles.requestPreviewBox]}
text={props.translate('bankAccount.addBankAccount')}
onPress={() => BankAccounts.openPersonalBankAccountSetupView(props.report.reportID)}
pressOnEnter
/>
) : null}
<ReportActionItemBasicMessage
message={props.translate(paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY ? 'iou.waitingOnEnabledWallet' : 'iou.waitingOnBankAccount', {submitterDisplayName})}
>
<>
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.

This fragment should wrap both elements, the button and the KYCWall.

{shouldShowAddCreditBankAccountButton && (
<Button
success
style={[styles.w100, styles.requestPreviewBox]}
text={props.translate('bankAccount.addBankAccount')}
onPress={() => BankAccounts.openPersonalBankAccountSetupView(props.report.reportID)}
pressOnEnter
/>
)}
{shouldShowEnableWalletButton && (
<KYCWall
onSuccessfulKYC={() => Navigation.navigate(ROUTES.ENABLE_PAYMENTS)}
enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS}
addBankAccountRoute={ROUTES.BANK_ACCOUNT_PERSONAL}
addDebitCardRoute={ROUTES.SETTINGS_ADD_DEBIT_CARD}
chatReportID={props.report.reportID}
iouReport={props.iouReport}
>
{(triggerKYCFlow, buttonRef) => (
<Button
ref={buttonRef}
success
style={[styles.w100, styles.requestPreviewBox]}
text={props.translate('iou.enableWallet')}
onPress={triggerKYCFlow}
/>
)}
</KYCWall>
)}
</>
</ReportActionItemBasicMessage>
);
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE) {
Expand Down Expand Up @@ -702,6 +740,9 @@ export default compose(
key: ({action}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${action.reportActionID}`,
initialValue: {},
},
userWallet: {
key: ONYXKEYS.USER_WALLET,
},
}),
)(
memo(
Expand Down