summaryrefslogtreecommitdiff
path: root/billing/app/models/customer.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-10-08 14:33:02 -0700
committerjessib <jessib@riseup.net>2013-10-08 14:33:02 -0700
commit4e471f6b35c012d2825f6be19e24ecd5fef8d636 (patch)
tree0b420eba4e89094e0f1407aa09094d40b068fa5b /billing/app/models/customer.rb
parent8b378d916caeaf7fd4b1da2aea45eab4b0ccbb39 (diff)
Consider pending & past due subscriptions as 'active' in the sense that they should prevent one from adding a new subscription.
Diffstat (limited to 'billing/app/models/customer.rb')
-rw-r--r--billing/app/models/customer.rb6
1 files changed, 3 insertions, 3 deletions
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