From 4e471f6b35c012d2825f6be19e24ecd5fef8d636 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 8 Oct 2013 14:33:02 -0700 Subject: Consider pending & past due subscriptions as 'active' in the sense that they should prevent one from adding a new subscription. --- billing/app/models/customer.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'billing/app/models/customer.rb') diff --git a/billing/app/models/customer.rb b/billing/app/models/customer.rb index f01c300..1acc7a5 100644 --- a/billing/app/models/customer.rb +++ b/billing/app/models/customer.rb @@ -40,19 +40,19 @@ class Customer < CouchRest::Model::Base end # based on 2nd parameter, either returns the single active subscription (or nil if there isn't one), or an array of all subsciptions - def subscriptions(braintree_data=nil, only_active=true) + def subscriptions(braintree_data=nil, only_pending_active_pastdue=true) self.with_braintree_data! return unless has_payment_info? subscriptions = [] self.default_credit_card.subscriptions.each do |sub| - if only_active and sub.status == 'Active' + if only_pending_active_pastdue and ['Pending', 'Active','Past Due'].include? sub.status return sub else subscriptions << sub end end - only_active ? nil : subscriptions + only_pending_active_pastdue ? nil : subscriptions end end -- cgit v1.2.3