pay 12.4.0 → 12.5.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 +13 -0
- data/lib/pay/stripe.rb +1 -1
- 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: 4fcf236ca20e7f572dc4e3cbf9670bf98a3f4013cfa62885f0aa8d02db549f66
|
|
4
|
+
data.tar.gz: ddb22f464e1e9ed66a47f02e7211782e7d5806dced0308ede3408cd104a8fe0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a541d444013a7a2b9e1867e484d53462bf930c8161dca6ace3b240adbb09acd25c3635be68d149bc73257be3bd83b199fe6fce29953e51b06b0b833cd315b036
|
|
7
|
+
data.tar.gz: f448557d4091cb6c1627809b1dd4bc0e2ede05bff80fedb2487a631173bcd2d1aedd6a05a107fffba3beea27a89867d2be94e6562c4875e275917d57496ee9e4
|
|
@@ -310,6 +310,12 @@ module Pay
|
|
|
310
310
|
options[:billing_cycle_anchor] = {type: options[:billing_cycle_anchor].to_s}
|
|
311
311
|
end
|
|
312
312
|
|
|
313
|
+
# Flexible billing mode keeps the anchor when the interval changes (monthly to yearly bills a partial year),
|
|
314
|
+
# so start the new interval today like classic mode does
|
|
315
|
+
if !options.key?(:billing_cycle_anchor) && !on_trial? && interval_changes?(plan)
|
|
316
|
+
options[:billing_cycle_anchor] = {type: "now"}
|
|
317
|
+
end
|
|
318
|
+
|
|
313
319
|
@api_record = ::Stripe::Subscription.update(
|
|
314
320
|
processor_id,
|
|
315
321
|
{
|
|
@@ -411,6 +417,13 @@ module Pay
|
|
|
411
417
|
def expand_options
|
|
412
418
|
self.class.expand_options
|
|
413
419
|
end
|
|
420
|
+
|
|
421
|
+
def interval_changes?(plan)
|
|
422
|
+
if (current = subscription_items.first.price.try(:recurring))
|
|
423
|
+
requested = ::Stripe::Price.retrieve(plan, stripe_options).recurring
|
|
424
|
+
requested.present? && [current.interval, current.interval_count] != [requested.interval, requested.interval_count]
|
|
425
|
+
end
|
|
426
|
+
end
|
|
414
427
|
end
|
|
415
428
|
end
|
|
416
429
|
end
|
data/lib/pay/stripe.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Pay
|
|
|
34
34
|
# Organizations API key. https://docs.stripe.com/keys/organization-api-keys
|
|
35
35
|
credential :public_key, :private_key, :context, :signing_secret, :webhook_receive_test_events
|
|
36
36
|
|
|
37
|
-
REQUIRED_VERSION = "~>
|
|
37
|
+
REQUIRED_VERSION = "~> 21"
|
|
38
38
|
|
|
39
39
|
# A list of database model names that include Pay
|
|
40
40
|
# Used for safely looking up models with client_reference_id
|
data/lib/pay/version.rb
CHANGED