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 (supportsauthorize
orcapture
). - Ensures route enforces
_entity_create_any_access
forcommerce_payment
.
- Route includes
-
Added
merchantReturnPage()
method toPaymentCheckoutController
:- 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 forPaymentGatewayException
. - Logs and reports a generic error for unexpected exceptions.
- Ignores
- Redirects the merchant back to the order’s payments collection page after handling the response.
- Validates that the selected payment gateway plugin implements
-
Improved inline documentation and error handling comments for clarity.
Closes #3538210