Example #1
0
    def __init__(self, success, message, result={}, **options):
        self.success = success
        self.message = message
        self.result  = result

        self.options     = default_dict(options).set_default(None)
        self.test          = options.setdefault('test', False)
        self.authorization = self.options['authorization']
        self.fraud_review  = self.options['fraud_review']
        self.is_test    = self.options['is_test']
        self.avs_result = self.options['avs_result']
        self.cvv_result = self.options['cvv_result']

        if self.avs_result:  self.avs_result = AVSResult(code=self.avs_result)  #  TODO  document if it was not in the inbound message it's None
        if self.cvv_result:  self.cvv_result = CVVResult(code=self.cvv_result)
 def add_address(self, post, **options):
     address = None
     if 'billing_address' in options:  #  TODO  use get
         address = options['billing_address']
     elif 'address' in options:
         address = options['address']
     if address:
         address = default_dict(address)
         post['address'] = str(address['address1'])
         post['company'] = str(address['company'])
         post['phone'] = str(address['phone'])
         post['zip'] = str(address['zip'])
         post['city'] = str(address['city'])
         post['country'] = str(address['country'])
         if self.is_blank(address['state']):
             post['state'] = 'n/a'
         else:
             post['state'] = address['state']
Example #3
0
 def add_address(self, post, **options):
     address = None
     if 'billing_address' in options:  #  TODO  use get
         address = options['billing_address']
     elif 'address' in options:
         address = options['address']
     if address:
         address = default_dict(address)
         post['address'] = str(address['address1'])
         post['company'] = str(address['company'])
         post['phone'] = str(address['phone'])
         post['zip'] = str(address['zip'])
         post['city'] = str(address['city'])
         post['country'] = str(address['country'])
         if self.is_blank(address['state']):
             post['state'] = 'n/a'
         else:
             post['state'] = address['state']