general: give same signature to all Payment object constructors (#10030)
This commit is contained in:
parent
3b3f63907d
commit
a7dcc7a5e5
|
@ -75,9 +75,9 @@ class Payment(object):
|
|||
|
||||
'''
|
||||
|
||||
def __init__(self, kind, options):
|
||||
def __init__(self, kind, options, logger=None):
|
||||
self.kind = kind
|
||||
self.backend = get_backend(kind)(options)
|
||||
self.backend = get_backend(kind)(options, logger=logger)
|
||||
|
||||
def request(self, amount, **kwargs):
|
||||
'''Request a payment to the payment backend.
|
||||
|
|
|
@ -83,8 +83,8 @@ class PaymentCommon(object):
|
|||
PATH = '/tmp'
|
||||
BANK_ID = '__bank_id'
|
||||
|
||||
def __init__(self, options):
|
||||
self.logger = logging.getLogger(self.__class__.__module__)
|
||||
def __init__(self, options, logger=None):
|
||||
self.logger = logger or logging.getLogger(self.__class__.__module__)
|
||||
self.logger.debug('initializing with options %s', options)
|
||||
for value in self.description['parameters']:
|
||||
key = value['name']
|
||||
|
|
|
@ -102,10 +102,10 @@ class Payment(PaymentCommon):
|
|||
],
|
||||
}
|
||||
|
||||
def __init__(self, options, logger=LOGGER):
|
||||
def __init__(self, options, logger=None):
|
||||
super(Payment, self).__init__(options, logger=logger)
|
||||
self.options = options
|
||||
self.binpath = self.options.pop(BINPATH)
|
||||
self.logger = logger
|
||||
self.logger.debug('initializing sips payment class with %s' % options)
|
||||
|
||||
def execute(self, executable, params):
|
||||
|
|
|
@ -112,9 +112,6 @@ class Payment(PaymentCommon):
|
|||
],
|
||||
}
|
||||
|
||||
def __init__(self, options, logger=None):
|
||||
super(Payment, self).__init__(options)
|
||||
|
||||
def encode_data(self, data):
|
||||
return u'|'.join(u'%s=%s' % (unicode(key), unicode(value))
|
||||
for key, value in data.iteritems())
|
||||
|
|
|
@ -256,12 +256,9 @@ class Payment(PaymentCommon):
|
|||
description['parameters'].append(x)
|
||||
|
||||
def __init__(self, options, logger=None):
|
||||
self.service_url = options.pop('service_url', self.service_url)
|
||||
self.secret_test = options.pop('secret_test')
|
||||
self.secret_production = options.pop('secret_production', None)
|
||||
super(Payment, self).__init__(options, logger=logger)
|
||||
options = add_vads(options)
|
||||
self.options = options
|
||||
self.logger = logger or logging.getLogger(__name__)
|
||||
|
||||
def request(self, amount, name=None, address=None, email=None, phone=None,
|
||||
orderid=None, info1=None, info2=None, info3=None,
|
||||
|
|
|
@ -54,11 +54,6 @@ class Payment(PaymentCommon):
|
|||
],
|
||||
}
|
||||
|
||||
def __init__(self, options, logger=LOGGER):
|
||||
self.service_url = options.pop('service_url', TIPI_URL)
|
||||
self.numcli = options.pop('numcli', '')
|
||||
self.logger = logger
|
||||
|
||||
def request(self, amount, next_url=None, exer=None, orderid=None,
|
||||
refdet=None, objet=None, email=None, saisie=None, **kwargs):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue