[FIX] payment_mollie: mollie shows 404 page when only one payment method is active
Mollie supports multiple payments methods, these payment methods can be enabled/disabled from the mollie dashboard. When you activate only one payment method from mollie dashboard, you will get 404 page instead of payment page. This commit will fix that issue by providing necessary query parameters in url. closes odoo/odoo#92637 X-original-commit: 500be5b85d99ee4fa9590c18d3795977fbf48c4f Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
committed by
Antoine Vandevenne (anv)
parent
a35c71690a
commit
760b4a5c14
@@ -38,7 +38,14 @@ class PaymentTransaction(models.Model):
|
||||
# The acquirer reference is set now to allow fetching the payment status after redirection
|
||||
self.acquirer_reference = payment_data.get('id')
|
||||
|
||||
return {'api_url': payment_data['_links']['checkout']['href']}
|
||||
# Extract the checkout URL from the payment data and add it with its query parameters to the
|
||||
# rendering values. Passing the query parameters separately is necessary to prevent them
|
||||
# from being stripped off when redirecting the user to the checkout URL, which can happen
|
||||
# when only one payment method is enabled on Mollie and query parameters are provided.
|
||||
checkout_url = payment_data['_links']['checkout']['href']
|
||||
parsed_url = urls.url_parse(checkout_url)
|
||||
url_params = urls.url_decode(parsed_url.query)
|
||||
return {'api_url': checkout_url, 'url_params': url_params}
|
||||
|
||||
def _mollie_prepare_payment_request_payload(self):
|
||||
""" Create the payload for the payment request based on the transaction values.
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
<template id="redirect_form">
|
||||
<!-- Mollie generates a unique URL for each payment request -->
|
||||
<form t-att-action="api_url" method="get"></form>
|
||||
<form t-att-action="api_url" method="get">
|
||||
<t t-foreach="url_params" t-as="param">
|
||||
<input type="hidden" t-att-name="param" t-att-value="url_params[param]" />
|
||||
</t>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user