From 8704cd26912c08e0a8ae76f1b313a40b1eff527f Mon Sep 17 00:00:00 2001 From: "Julio C. Menendez" Date: Sun, 12 May 2013 09:05:47 -0600 Subject: [PATCH 1/3] Adds support for 'x_email_customer'. --- billing/gateways/authorize_net_gateway.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/billing/gateways/authorize_net_gateway.py b/billing/gateways/authorize_net_gateway.py index 832b7f4a..5ca0083a 100644 --- a/billing/gateways/authorize_net_gateway.py +++ b/billing/gateways/authorize_net_gateway.py @@ -136,6 +136,9 @@ def add_customer_data(self, post, options): post['email'] = options['email'] post['email_customer'] = True + if 'email_customer' in options: + post['email_customer'] = bool(options['email_customer']) + if 'customer' in options: post['cust_id'] = options['customer'] From 96834b131e59fad31aa2ca704efe95811486c20a Mon Sep 17 00:00:00 2001 From: "Julio C. Menendez" Date: Sun, 12 May 2013 09:55:40 -0600 Subject: [PATCH 2/3] Removes duplicated email_customer option read. --- billing/gateways/authorize_net_gateway.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/billing/gateways/authorize_net_gateway.py b/billing/gateways/authorize_net_gateway.py index 2bf6b8d3..41c81965 100644 --- a/billing/gateways/authorize_net_gateway.py +++ b/billing/gateways/authorize_net_gateway.py @@ -136,9 +136,6 @@ def add_customer_data(self, post, options): post['email'] = options['email'] post['email_customer'] = bool(options.get('email_customer', True)) - if 'email_customer' in options: - post['email_customer'] = bool(options['email_customer']) - if 'customer' in options: post['cust_id'] = options['customer'] From 820a97aa7e043895a7d87db08569c84ef2a33304 Mon Sep 17 00:00:00 2001 From: "Julio C. Menendez" Date: Sat, 1 Jun 2013 10:41:00 -0600 Subject: [PATCH 3/3] Fixes ValueError exception when CC number contains non numeric chars --- billing/utils/credit_card.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/billing/utils/credit_card.py b/billing/utils/credit_card.py index dc2207c4..850a2100 100644 --- a/billing/utils/credit_card.py +++ b/billing/utils/credit_card.py @@ -32,7 +32,10 @@ def __init__(self, **kwargs): def is_luhn_valid(self): """Checks the validity of card number by using Luhn Algorithm. Please see http://en.wikipedia.org/wiki/Luhn_algorithm for details.""" - num = [int(x) for x in str(self.number)] + try: + num = [int(x) for x in str(self.number)] + except ValueError: + return False return not sum(num[::-2] + [sum(divmod(d * 2, 10)) for d in num[-2::-2]]) % 10 def is_expired(self):