Skip to content

Commit acf18a6

Browse files
authored
Merge pull request Expensify#89962 from Krishna2323/krishna2323/issue/87734-fix
[Payment due @situchan] Fix 'Pay with personal account' label to show 'Pay with wallet' when user has a linked bank account.
2 parents 92101fd + c9a3bdb commit acf18a6

4 files changed

Lines changed: 39 additions & 44 deletions

File tree

src/CONST/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,6 @@ const CONST = {
892892
BULK_EDIT: 'bulkEdit',
893893
NEW_MANUAL_EXPENSE_FLOW: 'newManualExpenseFlow',
894894
SUBMIT_2026: 'submit2026',
895-
BULK_SUBMIT_APPROVE_PAY: 'bulkSubmitApprovePay',
896895
},
897896
BUTTON_STATES: {
898897
DEFAULT: 'default',

src/components/MoneyReportHeaderActions/MoneyReportHeaderSelectionDropdown.tsx

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ function MoneyReportHeaderSelectionDropdown({reportID, primaryAction, isReportIn
8484
const {isOffline} = useNetwork();
8585
const {isBetaEnabled} = usePermissions();
8686
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
87-
const isBulkSubmitApprovePayBetaEnabled = isBetaEnabled(CONST.BETAS.BULK_SUBMIT_APPROVE_PAY);
8887
const activeAdminPolicies = useActiveAdminPolicies();
8988
const lastWorkspaceNumber = useLastWorkspaceNumber();
9089
const {convertToDisplayString} = useCurrencyListActions();
@@ -373,42 +372,40 @@ function MoneyReportHeaderSelectionDropdown({reportID, primaryAction, isReportIn
373372

374373
// Ref writes below are inside onSelected callbacks that only fire on user interaction, never during render.
375374

376-
const selectionModeReportLevelActions: Array<DropdownOption<string> & Pick<PopoverMenuItem, 'backButtonText' | 'rightIcon'>> = !isBulkSubmitApprovePayBetaEnabled
377-
? []
378-
: [
379-
...(hasSubmitAction && !shouldBlockSubmit
380-
? [
381-
{
382-
text: translate('common.submit'),
383-
icon: expensifyIcons.Send,
384-
value: CONST.REPORT.PRIMARY_ACTIONS.SUBMIT,
385-
onSelected: () => handleSubmitReport(true),
386-
},
387-
]
388-
: []),
389-
...(hasApproveAction && !isBlockSubmitDueToPreventSelfApproval
390-
? [
391-
{
392-
text: translate('iou.approve'),
393-
icon: expensifyIcons.ThumbsUp,
394-
value: CONST.REPORT.PRIMARY_ACTIONS.APPROVE,
395-
onSelected: () => confirmApproval(true),
396-
},
397-
]
398-
: []),
399-
...(hasPayAction && !(isOffline && !canAllowSettlement)
400-
? [
401-
{
402-
text: translate('iou.settlePayment', totalAmount),
403-
icon: expensifyIcons.Cash,
404-
value: CONST.REPORT.PRIMARY_ACTIONS.PAY as string,
405-
rightIcon: expensifyIcons.ArrowRight,
406-
backButtonText: translate('iou.settlePayment', totalAmount),
407-
subMenuItems: paymentSubMenuItems,
408-
},
409-
]
410-
: []),
411-
];
375+
const selectionModeReportLevelActions: Array<DropdownOption<string> & Pick<PopoverMenuItem, 'backButtonText' | 'rightIcon'>> = [
376+
...(hasSubmitAction && !shouldBlockSubmit
377+
? [
378+
{
379+
text: translate('common.submit'),
380+
icon: expensifyIcons.Send,
381+
value: CONST.REPORT.PRIMARY_ACTIONS.SUBMIT,
382+
onSelected: () => handleSubmitReport(true),
383+
},
384+
]
385+
: []),
386+
...(hasApproveAction && !isBlockSubmitDueToPreventSelfApproval
387+
? [
388+
{
389+
text: translate('iou.approve'),
390+
icon: expensifyIcons.ThumbsUp,
391+
value: CONST.REPORT.PRIMARY_ACTIONS.APPROVE,
392+
onSelected: () => confirmApproval(true),
393+
},
394+
]
395+
: []),
396+
...(hasPayAction && !(isOffline && !canAllowSettlement)
397+
? [
398+
{
399+
text: translate('iou.settlePayment', totalAmount),
400+
icon: expensifyIcons.Cash,
401+
value: CONST.REPORT.PRIMARY_ACTIONS.PAY as string,
402+
rightIcon: expensifyIcons.ArrowRight,
403+
backButtonText: translate('iou.settlePayment', totalAmount),
404+
subMenuItems: paymentSubMenuItems,
405+
},
406+
]
407+
: []),
408+
];
412409

413410
const mappedOptions = originalSelectedTransactionsOptions.map((option) => {
414411
if (option.value === CONST.REPORT.SECONDARY_ACTIONS.DELETE) {

src/hooks/usePaymentOptions.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,14 @@ function usePaymentOptions({
115115
const isInvoiceReport = (!isEmptyObject(iouReport) && isInvoiceReportUtil(iouReport)) || false;
116116
const shouldShowPayWithExpensifyOption = !shouldHidePaymentOptions;
117117
const shouldShowPayElsewhereOption = !shouldHidePaymentOptions && !isInvoiceReport;
118+
const hasPersonalBankAccount = Object.values(bankAccountList).some((account) => account?.accountData?.type === CONST.BANK_ACCOUNT.TYPE.PERSONAL);
118119
const paymentButtonOptions = useMemo(() => {
119120
const buttonOptions = [];
120121
const isExpenseReport = isExpenseReportUtil(iouReport);
121122
const paymentMethods = {
122123
[CONST.IOU.PAYMENT_TYPE.EXPENSIFY]: {
123-
text: hasActivatedWallet ? translate('iou.settleWallet', '') : translate('iou.settlePersonal', ''),
124-
icon: icons.User,
124+
text: hasActivatedWallet || hasPersonalBankAccount ? translate('iou.settleWallet', '') : translate('iou.settlePersonal', ''),
125+
icon: hasActivatedWallet || hasPersonalBankAccount ? icons.Wallet : icons.User,
125126
value: CONST.IOU.PAYMENT_TYPE.EXPENSIFY,
126127
},
127128
[CONST.IOU.PAYMENT_TYPE.VBBA]: {
@@ -265,6 +266,8 @@ function usePaymentOptions({
265266
onPress,
266267
onlyShowPayElsewhere,
267268
icons,
269+
hasActivatedWallet,
270+
hasPersonalBankAccount,
268271
]);
269272

270273
return paymentButtonOptions;

src/hooks/useSelectionModeReportActions.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ function useSelectionModeReportActions({
130130
const expensifyIcons = useMemoizedLazyExpensifyIcons(['Send', 'ThumbsUp', 'Cash', 'ArrowRight', 'Building'] as const);
131131

132132
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
133-
const isBulkSubmitApprovePayBetaEnabled = isBetaEnabled(CONST.BETAS.BULK_SUBMIT_APPROVE_PAY);
134133

135134
const currentUserEmail = session?.email;
136135
const hasViolations = hasViolationsReportUtils(report?.reportID, allTransactionViolations, currentUserAccountID, currentUserEmail ?? '');
@@ -496,9 +495,6 @@ function useSelectionModeReportActions({
496495
})();
497496

498497
const selectionModeReportLevelActions = (() => {
499-
if (!isBulkSubmitApprovePayBetaEnabled) {
500-
return [];
501-
}
502498
const actions: Array<DropdownOption<string> & Pick<PopoverMenuItem, 'backButtonText' | 'rightIcon' | 'subMenuItems'>> = [];
503499
let idx = 0;
504500
if (hasSubmitAction && !shouldBlockSubmit) {

0 commit comments

Comments
 (0)