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: 1 addition & 1 deletion src/components/KYCWall/BaseKYCWall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/components/SettlementButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/languages/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ type WorkspacesListRouteParams = {
};

type BusinessBankAccountParams = {
amount: string;
last4Digits: string;
amount?: string;
last4Digits?: string;
};

type WorkspaceRouteParams = {
Expand Down
30 changes: 17 additions & 13 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@
const parsedReportActionMessageCache: Record<string, string> = {};

let conciergeReportID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 889 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportID = value;
Expand All @@ -894,7 +894,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 897 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -912,7 +912,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 915 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -924,14 +924,14 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 927 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 934 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand All @@ -939,7 +939,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 942 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -976,14 +976,14 @@
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({

Check warning on line 979 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 986 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1009,7 +1009,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1012 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -1022,7 +1022,7 @@

let allReportMetadata: OnyxCollection<ReportMetadata>;
const allReportMetadataKeyValue: Record<string, ReportMetadata> = {};
Onyx.connect({

Check warning on line 1025 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_METADATA,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -4566,7 +4566,7 @@
}

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});
Expand Down Expand Up @@ -4600,7 +4600,6 @@

// 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) {
Expand All @@ -4626,7 +4625,7 @@
const payerDisplayName = isPreviewMessageForParentChatReport ? payerName : actualPayerName;

return translateLocal(translatePhraseKey, {
amount: formattedReimbursableAmount,
amount: '',
payer: payerDisplayName ?? '',
last4Digits: reportPolicy?.achAccount?.accountNumber?.slice(-4) ?? '',
});
Expand Down Expand Up @@ -5141,11 +5140,20 @@

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');
}
Expand Down Expand Up @@ -9211,12 +9219,6 @@

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) ?? '';

Expand All @@ -9227,19 +9229,21 @@
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';
}
Comment on lines +9235 to 9239
Copy link
Contributor

@ishpaul777 ishpaul777 Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{bz checklist #71287 } We are not checking if automaticAction true before using automaticallyPaidWithBusinessBankAccount translation key. And we ended up using the wrong translation key.

break;
default:
translationKey = 'iou.payerPaidAmount';
break;
}

return translateLocal(translationKey, {amount: formattedAmount, payer: '', last4Digits});
return translateLocal(translationKey, {amount: '', payer: '', last4Digits});
}

const amount = getTransactionAmount(transaction, !isEmptyObject(iouReport) && isExpenseReport(iouReport)) ?? 0;
Expand Down
Loading