Skip to content
Closed
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
5 changes: 2 additions & 3 deletions src/hooks/useSearchBulkActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,8 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
const policyIDsWithVBBA = useMemo(() => {
const result = [];
for (const policy of Object.values(policies ?? {})) {
// Bulk pay funds from the workspace bank account when no account was picked in the menu, so a workspace only
// counts here if the workspace account is actually shared with the current user. Anyone else has to open the
// report and pick an account of their own. That includes a payer the account was never shared with.
// Only include a workspace in bulk pay when its bank account is shared with the current user.
// Otherwise, open the report to select another account.
if (!policy || !canAccessPolicyBankAccount(policy, bankAccountList)) {
continue;
}
Expand Down
4 changes: 1 addition & 3 deletions src/libs/ReportNameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,7 @@ function computeReportNameBasedOnReportAction({
if (isMoneyRequestAction(parentReportAction)) {
const originalMessage = getOriginalMessage(parentReportAction);

// Prefer the account stored on the action: the payer is not always the workspace payer, so the policy's
// ACH account can belong to a different bank account than the one the report was actually paid with, and
// attributing it to a non-payer admin's payment shows a different account to every other viewer.
// Use the account from the action to show the correct payment account.
const policyAccountNumber = wasPaidWithPolicyBankAccount(reportPolicy, parentReportAction?.actorAccountID) ? reportPolicy?.achAccount?.accountNumber : undefined;
const last4Digits = (originalMessage?.accountNumber ?? policyAccountNumber)?.slice(-4) ?? '';

Expand Down
4 changes: 1 addition & 3 deletions src/libs/actions/IOU/PayMoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@ function getPayMoneyRequestParams({

const shouldMoveScanFailedTransactions = !!full && isExpenseReport(iouReport) && shouldSplitScanFailedTransactions(reportTransactions, iouReport);

// Store the masked account actually paid with on the action itself, so every viewer resolves the same account.
// The paying admin may not be the workspace payer, so the account can be their own (looked up in `bankAccountList`)
// rather than the policy's ACH account; we fall back to the policy account when it is the one being used.
// Store the paid account on the action so every viewer sees the same one.
const paidWithBankAccount = getBankAccountFromID(bankAccountID);
const paidAccountNumber =
paidWithBankAccount?.accountData?.accountNumber ?? (bankAccountID === reportPolicy?.achAccount?.bankAccountID ? reportPolicy?.achAccount?.accountNumber : undefined);
Expand Down
4 changes: 1 addition & 3 deletions src/libs/actions/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,7 @@ function getPayActionCallback({
const paymentPolicy = snapshotPolicy ?? policy;

if (lastPolicyPaymentMethod !== CONST.IOU.PAYMENT_TYPE.ELSEWHERE) {
// One-tap pay here always funds the payment from the workspace bank account, so it's only valid for someone the
// account is actually shared with. Anyone else has to pay from an account of their own, so open the report and let
// them pick it instead of silently paying with (and reporting) the workspace one.
// One-tap pay requires access to the workspace bank account; otherwise, select another account in the report.
Comment thread
lorretheboy marked this conversation as resolved.
if (!canAccessPolicyBankAccount(paymentPolicy, bankAccountList)) {
goToItem();
return;
Expand Down
Loading