Skip to Content
Menu
This question has been flagged

I'd like to make it so that a partner can manage which payment token their individual subscription(s) is using. I dug around in the odoo & odoo-enterprise code, and found that there actually is a "Manage Payment Method" button on the portal that was hidden, possibly by our own code.

I read some enterprise code, and found:

​main class="modal-body">
div id="payment_method" class="text-start">
t t-call="payment.manage">
t t-set="assign_token_route" t-value="'/my/subscription/assign_token/' + str(subscription.id)"/>
t t-set="landing_route" t-value="subscription.get_portal_url() + '&message=Your payment method has been changed for this subscription.&message_class=alert-success'"/>



This code seems to be calling this template in payment_templates.xml in odoo:


template id="manage" name="Payment Manage">
- 'acquirers' - The payment acquirers supporting tokenization
- 'tokens' - The set of payment tokens of the current partner
- 'default_token_id' - The id of the token that should be pre-selected. Optional
# - 'reference_prefix' - The custom prefix to compute the full transaction reference
- 'partner_id' - The id of the partner managing the tokens
# - 'access_token' - The access token used to authenticate the partner.
# - 'transaction_route' - The route used to create a validation transaction
- 'assign_token_route' - The route to call to assign a token to a record. If set, it
enables the token assignation mechanisms: creation of a new
token through a refunded transaction and assignation of an
existing token
- 'landing_route' - The route the user is redirected to at then end of the flow
- 'footer_template_id' - The template id for the submit button. Optional
form name="o_payment_manage"


When I click "Manage Payment Method", a dialog pops up, but its empty. I assume this is because the enterprise code isn't passing all the mentioned arguments to The payment.manage template.

How do I get the values that the 'reference_prefix', 'access_token', and 'transaction_route' fields are asking for so that I can let the partner manage their subscription's payment method?

I'm in Odoo v15. I apologise for any confusion about this post and its duplicate, I had some trouble making this post and getting the formatting to show code, so I thought I had deleted the post. I have updated it since, in a way that it will hopefully be more read-able.

Avatar
Discard
Best Answer

Hello, the most likely issue is that there is no compatible payment acquirer for the current user. If there is no available payment acquirer or payment token, the button is hidden and the modal is empty.

You can check on this runbot where I created a subscription for Joel Willis (login with portal; portal). The button opens the modal with available payment acquirers and tokens.

Avatar
Discard
Author

We have a payment acquirer set up, and the button still didn't show. How is the "acquirers" variable actually being set? Where does it look in order to get its value?

The `acquirers_sudo` variable is set here (https://github.com/odoo/enterprise/blob/15.0/sale_subscription/controllers/portal.py#L114-L120) and passed as `acquirers` to the template. In particular, it only considers acquirers that support tokenization ("save card for later"): https://www.odoo.com/documentation/15.0/applications/finance/payment_acquirers.html#supported-payment-acquirers

Author

We found the issue. Thank you for your help!

Author Best Answer

We've found the issue to be within our own custom code. Antoine Vandevenne has been correct about everything they have said here.

Avatar
Discard
Related Posts Replies Views Activity
0
May 23
1867
0
May 24
3545
0
Aug 24
1024
1
Jul 23
2357
0
Sep 23
1847