Skip to content

Fix Payments tab redirect for awaiting_return and returned orders#14409

Open
NiftyGaloot wants to merge 1 commit into
openfoodfoundation:masterfrom
NiftyGaloot:14404-payments-tab-awaiting-return
Open

Fix Payments tab redirect for awaiting_return and returned orders#14409
NiftyGaloot wants to merge 1 commit into
openfoodfoundation:masterfrom
NiftyGaloot:14404-payments-tab-awaiting-return

Conversation

@NiftyGaloot

Copy link
Copy Markdown

What? Why?

  • Closes Payments tab redirects to Customer Details for orders with a return authorization #14404

  • When a Return Authorization is created against a completed order, the order state
    transitions to awaiting_return (or returned after the RMA is received). The
    Payments tab remains visible in the admin order edit page, but clicking it redirects
    to Customer Details with "Please fill in the customer details before proceeding to
    payment".

    The cause is can_transition_to_payment in PaymentsController, which only allows
    access for confirmation, payment, complete, canceled, and resumed states.
    Both awaiting_return and returned are post-completion states \u2014 the order has
    already passed through checkout \u2014 so their exclusion from the whitelist is accidental.

    Fix: add awaiting_return? and returned? to the guard condition.

What should we test?

  • Create a completed order with at least one line item and a shipment.

    • Go to Admin \u2192 Edit Order \u2192 Return Authorizations \u2192 New, and save a new RMA.
    • Click the Payments tab on the order.
    • Expected: Payments list loads normally.
    • Previously: redirected to Customer Details with a misleading flash notice.
  • Visit ... page.

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • [X ] User facing changes

The title of the pull request will be included in the release notes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: All the things 💤

Development

Successfully merging this pull request may close these issues.

Payments tab redirects to Customer Details for orders with a return authorization

1 participant