oca-ocb-core/odoo-bringout-oca-ocb-payment_stripe/payment_stripe/controllers/onboarding.py
Ernad Husremovic aee3ee8bf7 add missing payment providers and iot modules for 19.0
Add 19 payment provider modules needed by the sale module:
payment_adyen, payment_aps, payment_asiapay, payment_authorize,
payment_buckaroo, payment_demo, payment_dpo, payment_flutterwave,
payment_iyzico, payment_mercado_pago, payment_mollie, payment_nuvei,
payment_paymob, payment_paypal, payment_razorpay, payment_redsys,
payment_stripe, payment_worldline, payment_xendit

Add 3 IoT modules needed for point_of_sale:
iot_base, iot_box_image, iot_drivers

Note: Stripe test API keys replaced with placeholders.

🤖 assisted by claude
2026-03-09 15:45:22 +01:00

40 lines
2 KiB
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.http import request
class OnboardingController(http.Controller):
_onboarding_return_url = '/payment/stripe/onboarding/return'
_onboarding_refresh_url = '/payment/stripe/onboarding/refresh'
@http.route(_onboarding_return_url, type='http', methods=['GET'], auth='user')
def stripe_return_from_onboarding(self, provider_id, menu_id):
""" Redirect the user to the provider form of the onboarded Stripe account.
The user is redirected to this route by Stripe after or during (if the user clicks on a
dedicated button) the onboarding.
:param str provider_id: The provider linked to the Stripe account being onboarded, as a
`payment.provider` id
:param str menu_id: The menu from which the user started the onboarding step, as an
`ir.ui.menu` id
"""
url = f"/odoo/action-payment_stripe.action_payment_provider_onboarding/{provider_id}?menu_id={menu_id}"
return request.redirect(url)
@http.route(_onboarding_refresh_url, type='http', methods=['GET'], auth='user')
def stripe_refresh_onboarding(self, provider_id, account_id, menu_id):
""" Redirect the user to a new Stripe Connect onboarding link.
The user is redirected to this route by Stripe if the onboarding link they used was expired.
:param str provider_id: The provider linked to the Stripe account being onboarded, as a
`payment.provider` id
:param str account_id: The id of the connected account
:param str menu_id: The menu from which the user started the onboarding step, as an
`ir.ui.menu` id
"""
stripe_provider = request.env['payment.provider'].browse(int(provider_id))
account_link = stripe_provider._stripe_create_account_link(account_id, int(menu_id))
return request.redirect(account_link, local=False)