pay 8.1.1 → 8.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b493128b8cda84a754699e14ae59d19c88948998591ba8e52494c201c4af12ad
4
- data.tar.gz: 85cdd057383abbd32ae348f0f05951f93a77dabf3221c220bdd6fa415fbf7c9f
3
+ metadata.gz: 2c9bcfe2386dfbf2f1aef6f5f531dfee84f79e7e46e8a50bfa1189d65cf968e9
4
+ data.tar.gz: 95d4b7d998ac2439ddcd8e3c174c0349aa4cb131b1477fc166948d1997ae67e5
5
5
  SHA512:
6
- metadata.gz: 56b5fdcb946e5f951a6169e61f954abcdb8a1f3e56bfbd0627752660305ec6ebe143837d014a8c6113e377a17ad46185232b0d0f18c0e81014b73271caafee36
7
- data.tar.gz: 3e3c5a3ae2664590ffa99a09c6e3ffbd9a622a0972509509cb020e78491e0993346801c0918f59978f4ebf241723e743beb99dd273ac29c11b06f6da61c1bfa2
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
 
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "8.1.1"
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.1
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-04 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
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  requirements: []
183
- rubygems_version: 3.5.18
183
+ rubygems_version: 3.5.16
184
184
  signing_key:
185
185
  specification_version: 4
186
186
  summary: Payments engine for Ruby on Rails