pay 8.1.0 → 8.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fe510d1e6a11611a8cd4678e965e1051f6e69ad6c404f55c3fa96312dfff51a
4
- data.tar.gz: 54b73170c35476916fd17dc4ca11a7bc5d117888a04385e0947ef26dfd069e8f
3
+ metadata.gz: 2c9bcfe2386dfbf2f1aef6f5f531dfee84f79e7e46e8a50bfa1189d65cf968e9
4
+ data.tar.gz: 95d4b7d998ac2439ddcd8e3c174c0349aa4cb131b1477fc166948d1997ae67e5
5
5
  SHA512:
6
- metadata.gz: b55b7a23acd69d6f1a795805ba707f3cdbbceca636359ea509419a7a547764e048ce3c36c82f58b0fd34a97e2dac0561b76266ae42b7d62f39d6d9ce38f25944
7
- data.tar.gz: ed7f92af40c8bfe066668a8c20212df7c316eb237db7091a5d44ca60e728c037e12d5e846ec6e4b87b3087cf22733568f101ceda2132ff945367b9245a46975a
6
+ metadata.gz: e6f8ac8309e3d664980c0a6991440197b01de09d8de04c352bd20d6b3a97127fed7dad70f4511056fee585fd45c8014d1af796b75f9da21b2b8a1ef500162856
7
+ data.tar.gz: 41b2c842364d6517c4fe40c253424d4a7c45f47aa0fa35dd3dfe7c5ef3f4c79cdcc2fefef53294689986264b09ad3310f3079e3dd63736dc6bf9ab7533154deb
@@ -9,7 +9,7 @@ module Pay
9
9
 
10
10
  attributes = {
11
11
  current_period_end: object.renews_at,
12
- ends_at: (object.ends_at ? Time.parse(object..ends_at) : nil),
12
+ ends_at: (object.ends_at ? Time.parse(object.ends_at) : nil),
13
13
  pause_starts_at: (object.pause&.resumes_at ? Time.parse(object.pause.resumes_at) : nil),
14
14
  status: object.status,
15
15
  processor_plan: object.first_subscription_item.price_id,
@@ -24,7 +24,7 @@ module Pay
24
24
  pc
25
25
  else
26
26
  pc = ::Paddle::Customer.create(email: email, name: customer_name)
27
- update!(processor_id: sc.id)
27
+ update!(processor_id: pc.id)
28
28
  pc
29
29
  end
30
30
  rescue ::Paddle::Error => e
@@ -102,7 +102,11 @@ module Pay
102
102
  quantity: quantity
103
103
  }]
104
104
 
105
- ::Paddle::Subscription.update(id: processor_id, items: items, proration_billing_mode: "prorated_immediately")
105
+ ::Paddle::Subscription.update(
106
+ id: processor_id,
107
+ items: items,
108
+ proration_billing_mode: options.delete(:proration_billing_mode) || "prorated_immediately"
109
+ )
106
110
  update(quantity: quantity)
107
111
  rescue ::Paddle::Error => e
108
112
  raise Pay::PaddleBilling::Error, e
@@ -148,12 +152,18 @@ module Pay
148
152
  end
149
153
 
150
154
  def swap(plan, **options)
155
+ raise ArgumentError, "plan must be a string" unless plan.is_a?(String)
156
+
151
157
  items = [{
152
158
  price_id: plan,
153
159
  quantity: quantity || 1
154
160
  }]
155
161
 
156
- ::Paddle::Subscription.update(id: processor_id, items: items, proration_billing_mode: "prorated_immediately")
162
+ ::Paddle::Subscription.update(
163
+ id: processor_id,
164
+ items: items,
165
+ proration_billing_mode: options.delete(:proration_billing_mode) || "prorated_immediately"
166
+ )
157
167
  update(processor_plan: plan, ends_at: nil, status: :active)
158
168
  end
159
169
 
@@ -332,7 +332,7 @@ module Pay
332
332
 
333
333
  # Retries the latest invoice for a Past Due subscription and attempts to pay it
334
334
  def retry_failed_payment(payment_intent_id: nil)
335
- payment_intent_id ||= subscription.latest_invoice.payment_intent.id
335
+ payment_intent_id ||= api_record.latest_invoice.payment_intent.id
336
336
  payment_intent = ::Stripe::PaymentIntent.retrieve({id: payment_intent_id}, stripe_options)
337
337
 
338
338
  payment_intent = if payment_intent.status == "requires_payment_method"
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "8.1.0"
2
+ VERSION = "8.1.2"
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: 8.1.0
4
+ version: 8.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-10-02 00:00:00.000000000 Z
13
+ date: 2024-10-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails