pay 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/pay/stripe/subscription.rb +8 -2
- data/app/models/pay/subscription.rb +2 -0
- data/lib/pay/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7200a013cb88ad073e1de38f397fa6b46e28892dbfd3e70426dd99308422a1f
|
4
|
+
data.tar.gz: 6397051e6cfaf375f5e66bb5eab4a13c4fd22a7204939876e08452bf4f1f9c55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cbc10ffdf3b6d277c833fe3bc51536f57f09d26fa524db6d2ea8fc876751926b04334e6ca530a2a8ff9911dbcbca672c67f83e7799519a174f2ac2164d86807
|
7
|
+
data.tar.gz: 81f0182087f30e15f90557cf78442425b2a44316d3db29f3ccc08f759183ad75bdb1bb64a03aa7d7515b953d5dc32b3e244d878308eaab09d5140333feb926d8
|
@@ -47,6 +47,8 @@ module Pay
|
|
47
47
|
if object.trial_end
|
48
48
|
trial_ended_at = [object.ended_at, object.trial_end].compact.min
|
49
49
|
attributes[:trial_ends_at] = Time.at(trial_ended_at)
|
50
|
+
else
|
51
|
+
attributes[:trial_ends_at] = nil
|
50
52
|
end
|
51
53
|
|
52
54
|
object.items.auto_paging_each do |subscription_item|
|
@@ -164,7 +166,7 @@ module Pay
|
|
164
166
|
cancel_now!
|
165
167
|
else
|
166
168
|
@api_record = ::Stripe::Subscription.update(processor_id, {cancel_at_period_end: true}.merge(expand_options), stripe_options)
|
167
|
-
update(ends_at:
|
169
|
+
update(ends_at: Time.at(@api_record.cancel_at))
|
168
170
|
end
|
169
171
|
rescue ::Stripe::StripeError => e
|
170
172
|
raise Pay::Stripe::Error, e
|
@@ -178,7 +180,11 @@ module Pay
|
|
178
180
|
return if canceled? && ends_at.past?
|
179
181
|
|
180
182
|
@api_record = ::Stripe::Subscription.cancel(processor_id, options.merge(expand_options), stripe_options)
|
181
|
-
update(
|
183
|
+
update(
|
184
|
+
trial_ends_at: (@api_record.trial_end ? Time.at(@api_record.trial_end) : nil),
|
185
|
+
ends_at: Time.at(@api_record.ended_at),
|
186
|
+
status: @api_record.status
|
187
|
+
)
|
182
188
|
rescue ::Stripe::StripeError => e
|
183
189
|
raise Pay::Stripe::Error, e
|
184
190
|
end
|
@@ -66,10 +66,12 @@ module Pay
|
|
66
66
|
|
67
67
|
# Does not include the last second of the trial
|
68
68
|
def on_trial?
|
69
|
+
return false if ended?
|
69
70
|
trial_ends_at? && trial_ends_at > Time.current
|
70
71
|
end
|
71
72
|
|
72
73
|
def trial_ended?
|
74
|
+
return true if ended?
|
73
75
|
trial_ends_at? && trial_ends_at <= Time.current
|
74
76
|
end
|
75
77
|
|
data/lib/pay/version.rb
CHANGED