(self)
Create a token for the current transaction.

        Note: self.ensure_one()

        :return: None
Create a token for the current transaction.
Create a token for the current transaction .
def _authorize_tokenize(self):
        """ Create a token for the current transaction.

        Note: self.ensure_one()

        :return: None
        """
        self.ensure_one()

        authorize_API = AuthorizeAPI(self.acquirer_id)
        cust_profile = authorize_API.create_customer_profile(
            self.partner_id, self.acquirer_reference
        )
        _logger.info("create_customer_profile request response:\n%s", pprint.pformat(cust_profile))
        if cust_profile:
            token = self.env['payment.token'].create({
                'acquirer_id': self.acquirer_id.id,
                'name': cust_profile.get('name'),
                'partner_id': self.partner_id.id,
                'acquirer_ref': cust_profile.get('payment_profile_id'),
                'authorize_profile': cust_profile.get('profile_id'),
                'authorize_payment_method_type': self.acquirer_id.authorize_payment_method_type,
                'verified': True,
            })
            self.write({
                'token_id': token.id,
                'tokenize': False,
            })
            _logger.info(
                "created token with id %s for partner with id %s", token.id, self.partner_id.id
            )
def _authorize_tokenize ( self ) : self . ensure_one ( ) authorize_API = AuthorizeAPI ( self . acquirer_id ) cust_profile = authorize_API . create_customer_profile ( self . partner_id , self . acquirer_reference ) _logger . info ( "create_customer_profile request response:\n%s" , pprint . pformat ( cust_profile ) ) if cust_profile : token = self . env [ 'payment.token' ] . create ( { 'acquirer_id' : self . acquirer_id . id , 'name' : cust_profile . get ( 'name' ) , 'partner_id' : self . partner_id . id , 'acquirer_ref' : cust_profile . get ( 'payment_profile_id' ) , 'authorize_profile' : cust_profile . get ( 'profile_id' ) , 'authorize_payment_method_type' : self . acquirer_id . authorize_payment_method_type , 'verified' : True , } ) self . write ( { 'token_id' : token . id , 'tokenize' : False , } ) _logger . info ( "created token with id %s for partner with id %s" , token . id , self . partner_id . id )