Skip to content

Issue #3538210: Add merchant-facing return route and controller handling for manual/off-site payments.

Issue #3538210: Add merchant-facing return route and controller handling for manual/off-site payments.

  • Introduced new route commerce_payment.add_form.return to handle payment gateway return requests when merchants use the "Add payment" form in the order admin UI.

    • Route includes {transaction_type} parameter (supports authorize or capture).
    • Ensures route enforces _entity_create_any_access for commerce_payment.
  • Added merchantReturnPage() method to PaymentCheckoutController:

    • Validates that the selected payment gateway plugin implements OffsitePaymentGatewayInterface.
    • Calls onReturn() on the gateway plugin to process the gateway response.
    • Associates the payment gateway with the order and persists changes.
    • Handles different failure scenarios:
      • Ignores NeedsRedirectException since the controller always redirects back to the payments collection.
      • Dispatches a FailedPaymentEvent and shows an error message for PaymentGatewayException.
      • Logs and reports a generic error for unexpected exceptions.
    • Redirects the merchant back to the order’s payments collection page after handling the response.
  • Improved inline documentation and error handling comments for clarity.

Closes #3538210

Merge request reports

Loading