diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index 06e5fc2bcaa67..70e5bcab42297 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -228,7 +228,7 @@ function KYCWall({ } // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - if (paymentMethod || policy) { + if ((paymentMethod || policy) && !hasActivatedWallet) { setShouldShowAddPaymentMenu(false); selectPaymentMethod(paymentMethod, policy); return; diff --git a/src/components/SettlementButton/index.tsx b/src/components/SettlementButton/index.tsx index 96e26966ee879..36f05a780dd4f 100644 --- a/src/components/SettlementButton/index.tsx +++ b/src/components/SettlementButton/index.tsx @@ -123,7 +123,7 @@ function SettlementButton({ const hasMultiplePolicies = !isExpenseReport && activeAdminPolicies.length > 1; const lastPaymentMethodRef = useRef(lastPaymentMethod); const formattedPaymentMethods = formatPaymentMethods(bankAccountList, fundList, styles); - const hasIntentToPay = formattedPaymentMethods.length === 1 && !lastPaymentMethod; + const hasIntentToPay = ((formattedPaymentMethods.length === 1 && isIOUReport(iouReport)) || !!policy?.achAccount) && !lastPaymentMethod; useEffect(() => { if (isLoadingLastPaymentMethod) { @@ -262,7 +262,7 @@ function SettlementButton({ if (personalBankAccountList.length && canUsePersonalBankAccount) { buttonOptions.push({ text: translate('iou.settleWallet', {formattedAmount: ''}), - value: CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT, + value: CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT, icon: Expensicons.Wallet, }); } else if (canUsePersonalBankAccount) { @@ -293,7 +293,7 @@ function SettlementButton({ activeAdminPolicies.forEach((activePolicy) => { const policyName = activePolicy.name; buttonOptions.push({ - text: translate('iou.payWithPolicy', {policyName: truncate(policyName, {length: 20}), formattedAmount: ''}), + text: translate('iou.payWithPolicy', {policyName: truncate(policyName, {length: CONST.ADDITIONAL_ALLOWED_CHARACTERS}), formattedAmount: ''}), icon: Expensicons.Building, value: activePolicy.id, shouldUpdateSelectedIndex: false, @@ -535,7 +535,7 @@ function SettlementButton({ }; const customText = getCustomText(); - const secondaryText = getSecondaryText(); + const secondaryText = truncate(getSecondaryText(), {length: CONST.FORM_CHARACTER_LIMIT}); const defaultSelectedIndex = paymentButtonOptions.findIndex((paymentOption) => { if (lastPaymentMethod === CONST.IOU.PAYMENT_TYPE.ELSEWHERE) { diff --git a/src/languages/params.ts b/src/languages/params.ts index e03fb943cbf45..061c4cd7a455d 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -142,8 +142,8 @@ type WorkspacesListRouteParams = { }; type BusinessBankAccountParams = { - amount: string; - last4Digits: string; + amount?: string; + last4Digits?: string; }; type WorkspaceRouteParams = { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index e98acb5bafbe4..0d024cfff5d33 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4566,7 +4566,7 @@ function getReportPreviewMessage( } const containsNonReimbursable = hasNonReimbursableTransactions(report.reportID); - const {totalDisplaySpend: totalAmount, reimbursableSpend} = getMoneyRequestSpendBreakdown(report); + const {totalDisplaySpend: totalAmount} = getMoneyRequestSpendBreakdown(report); const parentReport = getParentReport(report); const policyName = getPolicyName({report: parentReport ?? report, policy}); @@ -4600,7 +4600,6 @@ function getReportPreviewMessage( // Show Paid preview message if it's settled or if the amount is paid & stuck at receivers end for only chat reports. if (isSettled(report.reportID) || (report.isWaitingOnBankAccount && isPreviewMessageForParentChatReport)) { - const formattedReimbursableAmount = convertToDisplayString(reimbursableSpend, report.currency); // A settled report preview message can come in three formats "paid ... elsewhere" or "paid ... with Expensify" let translatePhraseKey: TranslationPaths = 'iou.paidElsewhere'; if (isPreviewMessageForParentChatReport) { @@ -4626,7 +4625,7 @@ function getReportPreviewMessage( const payerDisplayName = isPreviewMessageForParentChatReport ? payerName : actualPayerName; return translateLocal(translatePhraseKey, { - amount: formattedReimbursableAmount, + amount: '', payer: payerDisplayName ?? '', last4Digits: reportPolicy?.achAccount?.accountNumber?.slice(-4) ?? '', }); @@ -5141,11 +5140,20 @@ function getReportNameInternal({ if (isMoneyRequestAction(parentReportAction)) { const originalMessage = getOriginalMessage(parentReportAction); + const reportPolicy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]; + const last4Digits = reportPolicy?.achAccount?.accountNumber.slice(-4) ?? ''; + if (originalMessage?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY) { if (originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.ELSEWHERE) { return translateLocal('iou.paidElsewhere'); } - if (originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.VBBA || originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY) { + if (originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.VBBA) { + if (originalMessage.automaticAction) { + return translateLocal('iou.automaticallyPaidWithBusinessBankAccount', {last4Digits}); + } + return translateLocal('iou.businessBankAccount', {last4Digits}); + } + if (originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY) { if (originalMessage.automaticAction) { return translateLocal('iou.automaticallyPaidWithExpensify'); } @@ -9211,12 +9219,6 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, let translationKey: TranslationPaths; if (originalMessage?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY) { - // The `REPORT_ACTION_TYPE.PAY` action type is used for both fulfilling existing requests and sending money. To - // differentiate between these two scenarios, we check if the `originalMessage` contains the `IOUDetails` - // property. If it does, it indicates that this is a 'Pay someone' action. - const {amount, currency} = originalMessage?.IOUDetails ?? originalMessage ?? {}; - const formattedAmount = convertToDisplayString(Math.abs(amount), currency) ?? ''; - const reportPolicy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]; const last4Digits = reportPolicy?.achAccount?.accountNumber.slice(-4) ?? ''; @@ -9227,11 +9229,13 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, case CONST.IOU.PAYMENT_TYPE.EXPENSIFY: case CONST.IOU.PAYMENT_TYPE.VBBA: if (isInvoice) { - return translateLocal(payAsBusiness ? 'iou.settleInvoiceBusiness' : 'iou.settleInvoicePersonal', {amount: formattedAmount, last4Digits}); + return translateLocal(payAsBusiness ? 'iou.settleInvoiceBusiness' : 'iou.settleInvoicePersonal', {amount: '', last4Digits}); } translationKey = 'iou.businessBankAccount'; - if (automaticAction) { + if (automaticAction && originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY) { translationKey = 'iou.automaticallyPaidWithExpensify'; + } else { + translationKey = 'iou.automaticallyPaidWithBusinessBankAccount'; } break; default: @@ -9239,7 +9243,7 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, break; } - return translateLocal(translationKey, {amount: formattedAmount, payer: '', last4Digits}); + return translateLocal(translationKey, {amount: '', payer: '', last4Digits}); } const amount = getTransactionAmount(transaction, !isEmptyObject(iouReport) && isExpenseReport(iouReport)) ?? 0;