pay 3.0.18 → 3.0.19
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pay might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/pay/paddle/subscription.rb +9 -2
- 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: '093c067bb867fddfbdb00486613ad7be4b9e1d3d0d5ff1e22ec3d892b6bb76b3'
|
4
|
+
data.tar.gz: d4b53a841c0e7cae39f6c73786dbfbe20bc61c81dbbfe3885cbe2a0b0f830936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cee4d5e1b4ed8954e7004b121165c5e4b4dc69f5a39a01b4f9b90197ef4a8dc04cca5660488b7b2da2975a78d9cf0e5356cd30e84923af56e2460277c6c79979
|
7
|
+
data.tar.gz: 261fdecca8eb33582d279ce18f76fe4c80e3efe5fb95c479549c8c4232e53b6096a69decd3915ac12fe7792035e14e88122ef35a459090b5f4e8a710588a2b80
|
@@ -75,7 +75,14 @@ module Pay
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def cancel
|
78
|
-
ends_at = on_trial?
|
78
|
+
ends_at = if on_trial?
|
79
|
+
trial_ends_at
|
80
|
+
elsif paused?
|
81
|
+
paddle_paused_from
|
82
|
+
else
|
83
|
+
processor_subscription.next_payment&.fetch(:date) || Time.current
|
84
|
+
end
|
85
|
+
|
79
86
|
PaddlePay::Subscription::User.cancel(processor_id)
|
80
87
|
pay_subscription.update(status: :canceled, ends_at: ends_at)
|
81
88
|
|
@@ -106,7 +113,7 @@ module Pay
|
|
106
113
|
def pause
|
107
114
|
attributes = {pause: true}
|
108
115
|
response = PaddlePay::Subscription::User.update(processor_id, attributes)
|
109
|
-
pay_subscription.update(paddle_paused_from: Time.zone.parse(response
|
116
|
+
pay_subscription.update(paddle_paused_from: Time.zone.parse(response.dig(:next_payment, :date)))
|
110
117
|
rescue ::PaddlePay::PaddlePayError => e
|
111
118
|
raise Pay::Paddle::Error, e
|
112
119
|
end
|
data/lib/pay/version.rb
CHANGED