Skip to content

Commit

Permalink
fixing error when recurrence_period is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
monaddle committed Nov 14, 2014
1 parent 2d895de commit f421aac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def Subscribe(self, email, first_name, last_name, amount_cents, ip_addr, time,
_STR = dict(type='string')
_STR_optional = dict(type='string', required=False)

valid_recurrence_periods = ["monthly", "weekly", "yearly", ""]
valid_recurrence_periods = ["monthly", "weekly", ""]
PLEDGE_SCHEMA = dict(
type='object',
properties=dict(
Expand Down Expand Up @@ -312,10 +312,11 @@ def post(self):
# Do any server-side processing the payment processor needs.
stripe_customer_id = None
stripe_charge_id = None
print type(data.get('recurring', None))
if 'STRIPE' in data['payment'] and data.get('recurring', '') == True:
try:
logging.info('Trying to create a stripe customer enrolled in a plan with recurring subscription')
if data.get('recurrence_period', None) == None:
data['recurrence_period'] = 'monthly'
stripe_customer = env.stripe_backend.CreateCustomerWithPlan(
email=data['email'],
card_token=data['payment']['STRIPE']['token'],
Expand Down

0 comments on commit f421aac

Please sign in to comment.