In this commit, we take the opportunity to replace the previous unsecure
API with the new FlexCheckout API that implements payment methods
validation in a hosted page. Payment processing is still done with the
DirectLink API.
This commit also renames the module `payment_ingenico` to
`payment_ogone` as well as the referring strings ("Ogone" instead
of "Ingenico", ...).
A dedicated [MOV] commit is not used because neither the [MOV] commit
nor the adapted [REF] would be valid on its own.
See the merge commit for more details.
task-2333029
task-2313907
task-2334015
Co-authored-by: Antoine Vandevenne <anv@odoo.com>
27 lines
923 B
Python
27 lines
923 B
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import _, models
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
class PaymentToken(models.Model):
|
|
_inherit = 'payment.token'
|
|
|
|
def _handle_reactivation_request(self):
|
|
""" Override of payment to raise an error informing that Ogone tokens cannot be restored.
|
|
|
|
More specifically, permanents tokens are never deleted in Ogone's backend but we don't
|
|
distinguish them from temporary tokens which are archived at creation time. So we simply
|
|
block the reactivation of every token.
|
|
|
|
Note: self.ensure_one()
|
|
|
|
:return: None
|
|
:raise: UserError if the token is managed by Ogone
|
|
"""
|
|
super()._handle_reactivation_request()
|
|
if self.provider != 'ogone':
|
|
return
|
|
|
|
raise UserError(_("Saved payment methods cannot be restored once they have been archived."))
|