added recurly subscription null checks

this deals with a user who has an expired old subscription then
is added to a group subscription.
This commit is contained in:
Henry Oswald 2015-02-04 20:17:55 +00:00
parent 42d8f1f222
commit e4a54cbdfc

View file

@ -19,11 +19,11 @@ module.exports =
RecurlyWrapper.getSubscription subscription.recurlySubscription_id, (err, recurlySubscription)-> RecurlyWrapper.getSubscription subscription.recurlySubscription_id, (err, recurlySubscription)->
callback null, { callback null, {
name: plan.name name: plan.name
nextPaymentDueAt: SubscriptionFormatters.formatDate(recurlySubscription.current_period_ends_at) nextPaymentDueAt: SubscriptionFormatters.formatDate(recurlySubscription?.current_period_ends_at)
state: recurlySubscription.state state: recurlySubscription?.state
price: SubscriptionFormatters.formatPrice recurlySubscription.unit_amount_in_cents, recurlySubscription.currency price: SubscriptionFormatters.formatPrice recurlySubscription?.unit_amount_in_cents, recurlySubscription?.currency
planCode: subscription.planCode planCode: subscription.planCode
currency:recurlySubscription.currency currency:recurlySubscription?.currency
groupPlan: subscription.groupPlan groupPlan: subscription.groupPlan
}, memberSubscriptions }, memberSubscriptions
else else