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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a37f4ee9640c9f48545166512e3ce5dfd8f17555c6181794807db5a6cc88e4ac
4
- data.tar.gz: 994889fa6c1e3c55b836d3597f95046eaed46d1c551154c57c83543312153965
3
+ metadata.gz: '093c067bb867fddfbdb00486613ad7be4b9e1d3d0d5ff1e22ec3d892b6bb76b3'
4
+ data.tar.gz: d4b53a841c0e7cae39f6c73786dbfbe20bc61c81dbbfe3885cbe2a0b0f830936
5
5
  SHA512:
6
- metadata.gz: d6e97f172fb3a5fbb9b62e3867fb29e363f9c5ea3f1fc385ab22a9ea59f27547ea84ca357eac1473e2ca4b25584d0c28f58f9124ca80e729cd5fa1da465d5b71
7
- data.tar.gz: f455c3cc02a3b93f7eb5dd04c2edf0c67d0f72c3e2bddd3ced8e509a8b557705609b20dab00b0b40daab19734b46e097f2c4fcbe2f6aaf5df79f8291b75f6d3d
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? ? trial_ends_at : processor_subscription.next_payment[:date]
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[:next_payment][:date]))
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
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "3.0.18"
2
+ VERSION = "3.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.18
4
+ version: 3.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes