Skip to content

[Due for payment 2025-06-23] [$250] Rules - "Auto-pay approved reports" feature does not work #62606

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.1.49-6
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: #60171
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to ND https://staging.new.expensify.com/
  2. Login with a gmail account
  3. Create a WS
  4. Go to the WS > More Features > Toggle on "Rules"
  5. Go to Rules > Toggle on "Auto-pay approved reports"
  6. Go to the WS chat
  7. Create an expense with amount 10, submit and approve it

Expected Result:

The expense should be auto-paid

Actual Result:

The expense is not auto-paid

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6839387_1747932693969.Screen_Recording_2025-05-22_at_1.46.05_PM.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021925688336725193077
  • Upwork Job ID: 1925688336725193077
  • Last Price Increase: 2025-05-29
  • Automatic offers:
    • gijoe0295 | Contributor | 107544481
Issue OwnerCurrent Issue Owner: @rushatgabhane

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 22, 2025
  2. melvin-bot commented on May 22, 2025

    @melvin-bot

    Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. twisterdotcom commented on May 22, 2025

    @twisterdotcom
    Contributor

    The feature auto-pays when you have a VBA, not just marks stuff as paid automatically right? So we should only allow that toggle when you have a VBA.

  4. gijoe0295 commented on May 22, 2025

    @gijoe0295
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-05-23 10:21:44 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The feature auto-pays when you have a VBA, not just marks stuff as paid automatically right? So we should only allow that toggle when you have a VBA.

    What is the root cause of that problem?

    We allow enabling that toggle when Make or track payment is enabled:

    disabled: autoPayApprovedReportsUnavailable,
    showLockIcon: autoPayApprovedReportsUnavailable,

    const autoPayApprovedReportsUnavailable = policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO;

    What changes do you think we should make in order to solve the problem?

    Modify the autoPayApprovedReportsUnavailable so that the reimbursement is different from REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES.

    Add another condition that the policy must have a VBBA and policy.areWorkflowsEnabled.

    App/src/libs/PolicyUtils.ts

    Lines 1218 to 1221 in 5935c96

    function hasVBBA(policyID: string | undefined) {
    const policy = getPolicy(policyID);
    return !!policy?.achAccount?.bankAccountID;
    }

    so when the workspace has no bank account, the toggle would show like this:

    Image

    We need to adjust the subtitle text style to match with other rules:

    Image

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can add an UI test for the rules in workspace rules page.

    What alternative solutions did you explore? (Optional)

    None

  5. twisterdotcom commented on May 22, 2025

    @twisterdotcom
    Contributor

    So we should only allow that toggle when you have a VBA.

    Yeah, I like this.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 22, 2025
  7. melvin-bot commented on May 22, 2025

    @melvin-bot
  8. changed the title [-]Rules - "Auto-pay approved reports" feature does not work[/-] [+][$250] Rules - "Auto-pay approved reports" feature does not work[/+] on May 22, 2025
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 22, 2025
  10. melvin-bot commented on May 22, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

  11. ChavdaSachin commented on May 23, 2025

    @ChavdaSachin
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-05-25 18:46:05 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Rules - "Auto-pay approved reports" feature does not work

    What is the root cause of that problem?

    Missing condition here.

    const autoPayApprovedReportsUnavailable = policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO;

    Currently we autoPayApprovedReportsUnavailable works as a flag to determine whether the toggle for auto approval should be locked or not. And this does not include any condition about VBBA.

    What changes do you think we should make in order to solve the problem?

    Update autoPayApprovedReportsUnavailable flag.

    const autoPayApprovedReportsUnavailable = policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && policy?.areWorkflowsEnabled; 

    Add additional flag hasPolicyVBBA here.

        const hasPolicyVBBA = hasVBBA(policyID);

    function hasVBBA(policyID: string | undefined) {

    Now use this new flag to conditionally disable the toggle option and pass a new subtitle.
    currently there are only two subtitles none of which are suitable for the condition when reimbursement choice is true but no bank account is configured.

    so add a new subtitle.(we could make add bank account clickable in case)

                    autoPayApprovedReportsMissingVBBASubtitle: 'Please add a bank account to use this feature',

    The exact line could be suggested by the design team.
    And update the Option Item

            {
                title: translate('workspace.rules.expenseReportRules.autoPayApprovedReportsTitle'),
                subtitle: autoPayApprovedReportsUnavailable
                    ? renderFallbackSubtitle({featureName: translate('common.payments').toLowerCase()})
                    : !hasPolicyVBBA
                    ? translate('workspace.rules.expenseReportRules.autoPayApprovedReportsMissingVBBASubtitle')
                    : translate('workspace.rules.expenseReportRules.autoPayApprovedReportsSubtitle'),
                switchAccessibilityLabel: translate('workspace.rules.expenseReportRules.autoPayApprovedReportsTitle'),
                onToggle: (isEnabled: boolean) => {
                    enablePolicyAutoReimbursementLimit(policyID, isEnabled);
                },
                disabled: autoPayApprovedReportsUnavailable || !hasPolicyVBBA,
                showLockIcon: autoPayApprovedReportsUnavailable || !hasPolicyVBBA,
                isActive: policy?.shouldShowAutoReimbursementLimitOption && !autoPayApprovedReportsUnavailable && hasPolicyVBBA,
                pendingAction: policy?.pendingFields?.shouldShowAutoReimbursementLimitOption,
                onToggle: (isEnabled: boolean) => {
                    enableAutoApprovalOptions(policyID, isEnabled);
                },

    {
    title: translate('workspace.rules.expenseReportRules.autoApproveCompliantReportsTitle'),
    subtitle: workflowApprovalsUnavailable
    ? renderFallbackSubtitle({featureName: translate('common.approvals').toLowerCase()})
    : translate('workspace.rules.expenseReportRules.autoApproveCompliantReportsSubtitle'),
    switchAccessibilityLabel: translate('workspace.rules.expenseReportRules.autoApproveCompliantReportsTitle'),
    isActive: policy?.shouldShowAutoApprovalOptions && !workflowApprovalsUnavailable,
    disabled: workflowApprovalsUnavailable,
    showLockIcon: workflowApprovalsUnavailable,
    pendingAction: policy?.pendingFields?.shouldShowAutoApprovalOptions,
    onToggle: (isEnabled: boolean) => {
    enableAutoApprovalOptions(policyID, isEnabled);
    },

    Note

    This proposal emphasize on adding an additional subtitle translation to better guide the user about the requirement to enable the feature. Code style could be improved during PR.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  12. mountiny commented on May 23, 2025

    @mountiny
    Contributor

    @nyomanjyotisa @ahmedGaber93 @Julesssss this is related to your PR I believe #60171

  13. 34 remaining items

  14. gijoe0295 commented on Jun 24, 2025

    @gijoe0295
    Contributor

    @twisterdotcom Payment is due.

  15. twisterdotcom commented on Jun 25, 2025

    @twisterdotcom
    Contributor

    Payment Summary:

  16. twisterdotcom commented on Jun 25, 2025

    @twisterdotcom
    Contributor

    Do we need a checklist @rushatgabhane?

  17. melvin-bot commented on Jun 30, 2025

    @melvin-bot

    @rushatgabhane Huh... This is 4 days overdue. Who can take care of this?

  18. twisterdotcom commented on Jul 1, 2025

    @twisterdotcom
    Contributor

    Bump here @rushatgabhane!

  19. rushatgabhane commented on Jul 1, 2025

    @rushatgabhane
    Member

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: Adjust copy for various report actions #60171 (comment)

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: Not critical

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/520743

    Regression Test Proposal

    Precondition:

    Test:

    1. Open workspace settings
    2. Go to More features
    3. Disable Workflows and enable Rules (upgrade to Control if needed)
    4. Go to Rules
    5. Verify "Auto-pay approved reports" toggle is locked and disabled
    6. Verify the toggle subtitle is "Go to more features and enable workflows, then add payments to unlock this feature."
    7. Go to More features > Enable Workflows
    8. Repeat steps 4 - 6
    9. Go to Workflows > Enable "Make or track payments"
    10. Repeat steps 4 - 6
    11. Go to Workflows > Connect bank account
    12. Complete connecting a bank account
    13. Go to Rules
    14. Verify "Auto-pay approved reports" is disabled and not locked
    15. Verify the toggle subtitle is "Configure which expense reports are eligible for auto-pay."

    Do we agree 👍 or 👎

  20. garrettmknight commented on Jul 3, 2025

    @garrettmknight
    Contributor

    $250 approved for @rushatgabhane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions