summaryrefslogtreecommitdiff
path: root/billing/app/models/customer.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2013-10-18 00:18:03 -0700
committerazul <azul@riseup.net>2013-10-18 00:18:03 -0700
commit221532448ba4c435427ad2b5b3eca729b352c354 (patch)
tree1caa069380cb075155e97755d3d94d1274b4a9ea /billing/app/models/customer.rb
parentbf3b59e6807c8e4789b97232c7416093b07cccdf (diff)
parent92cb054d53aaac6864a6a805d9cdd3919f4a38bc (diff)
Merge pull request #98 from jessib/feature/billing-past-due-subscriptions
Feature/billing past due subscriptions
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