def __init__(self, data, settings=settings()): """ Constructor @param data dictionary of transaction attribute values indexed by name @type data dict """ self.data = data # Paypal requires a 4-digit year, which is unusual current_year = str(datetime.utcnow().year) ed = str(self.data['exp_date']) new_year = current_year[:2] + ed[2:] # That's right, I'm assuming that the expiration is within 100 years. # Youwannafightaboutit???? if int(new_year) < int(current_year): new_year = str(int(current_year[:2]) + 1) + ed self.data['exp_date'] = ed[:2] + new_year # Enforce length limits as defined by Paypal self.data['invoice_number'] = self.data['invoice_number'][:127] self.data['address_label'] = self.data['address_label'][:100] self.data['first_name'] = self.data['first_name'][:25] self.data['last_name'] = self.data['last_name'][:25] self.data['country'] = self.data['country'][:2] self.data['state'] = self.data['state'][:40] self.data['city'] = self.data['city'][:40] self.data['zip'] = self.data['zip'][:20] self.settings = settings
def __init__(self, data, settings = settings()): """ Constructor @param data dictionary of transaction attribute values indexed by name @type data dict """ self.data = data # Paypal requires a 4-digit year, which is unusual current_year = str(datetime.utcnow().year) ed = str(self.data['exp_date']) new_year = current_year[:2] + ed[2:] # That's right, I'm assuming that the expiration is within 100 years. # Youwannafightaboutit???? if int(new_year) < int(current_year): new_year = str(int(current_year[:2]) + 1) + ed self.data['exp_date'] = ed[:2] + new_year # Enforce length limits as defined by Paypal self.data['invoice_number'] = self.data['invoice_number'][:127] self.data['address_label'] = self.data['address_label'][:100] self.data['first_name'] = self.data['first_name'][:25] self.data['last_name'] = self.data['last_name'][:25] self.data['country'] = self.data['country'][:2] self.data['state'] = self.data['state'][:40] self.data['city'] = self.data['city'][:40] self.data['zip'] = self.data['zip'][:20] self.settings = settings
def __init__(self, settings=settings()): self.settings = settings self.credentials = self.add_common_parameters({})
def __init__(self, settings = settings()): self.settings = settings self.credentials = self.add_common_parameters({})