Before this commit, zombie payment tokens (= tokens linked to disabled acquirers) could still 1) be used by internal users and 2) reactivated when the acquirer’s state changed to ‘test’ or ‘enabled’. This is not desirable because zombie tokens should neither be used, nor reactivated. After this commit, all tokens related to an acquirer are unassigned from linked documents and archived as soon as the acquirer’s state is changed to ‘disabled’. Creating a payment with an archived token is prohibited. In addition, archived tokens cannot be un-archived anymore. task-2649806 closes odoo/odoo#93774 Related: odoo/enterprise#28661 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
26 lines
783 B
Python
26 lines
783 B
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import logging
|
|
import pprint
|
|
|
|
from odoo import _, fields, models
|
|
from odoo.exceptions import UserError
|
|
|
|
from .authorize_request import AuthorizeAPI
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class PaymentToken(models.Model):
|
|
_inherit = 'payment.token'
|
|
|
|
authorize_profile = fields.Char(
|
|
string="Authorize.Net Profile ID",
|
|
help="The unique reference for the partner/token combination in the Authorize.net backend.")
|
|
authorize_payment_method_type = fields.Selection(
|
|
string="Authorize.Net Payment Type",
|
|
help="The type of payment method this token is linked to.",
|
|
selection=[("credit_card", "Credit Card"), ("bank_account", "Bank Account (USA Only)")],
|
|
)
|
|
|