Class: FiatStripe::Subscription
Defined Under Namespace
Classes: CancelStripeSubscriptionJob, CreateStripeSubscriptionJob, UpdateStripeSubscriptionJob
Instance Method Summary
collapse
Instance Method Details
#is_stripe_pricing_inaccurate? ⇒ Boolean
34
35
36
37
38
39
40
41
42
|
# File 'app/models/fiat_stripe/subscription.rb', line 34
def is_stripe_pricing_inaccurate?
if self.stripe_subscription
if self.stripe_subscription.items.first.plan.amount != (self.rate * 100)
true
else
false
end
end
end
|
#stripe_plan ⇒ Object
22
23
24
25
26
|
# File 'app/models/fiat_stripe/subscription.rb', line 22
def stripe_plan
if self.stripe_subscription
self.stripe_subscription.items.first.plan.id
end
end
|
#stripe_product ⇒ Object
28
29
30
31
32
|
# File 'app/models/fiat_stripe/subscription.rb', line 28
def stripe_product
if self.stripe_subscription
self.stripe_subscription.items.first.plan.product
end
end
|
#stripe_subscription ⇒ Object
14
15
16
17
18
19
20
|
# File 'app/models/fiat_stripe/subscription.rb', line 14
def stripe_subscription
if self.stripe_subscription_id?
Rails.cache.fetch("#{cache_key}/stripe_subscription", expires_in: 30.days) do
subscription = Stripe::Subscription.retrieve(self.stripe_subscription_id)
end
end
end
|