pay 11.2.3 → 11.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71299748a825cda0c189c61f051f666840c413df3e33e177d126dffa9feaa2fe
4
- data.tar.gz: 3d6ad655b364d9fea688fbeae0e1f013bd6966e796559ec4cf1e2d5cb181dda0
3
+ metadata.gz: ebe9b67692268353c8f1f898d83ed6836cc22e82f040b7465d32d81fc8dc2540
4
+ data.tar.gz: 7b1f8b4b41cd8bdb7947573c10fdd718d3fc9241819e08d9d91365429bf3b85d
5
5
  SHA512:
6
- metadata.gz: 530ea9ae04118c33c7aa91e17bb945cb752b22d175b3bdc32eef915e7e304f97f2017409eb53c3adb4ebeb319abf5e9c698ffa618167065d230c548d64ac23df
7
- data.tar.gz: a39c4b305ce5083fcf44fdd8813de11292938bd2439a6288039d0f737e6f134b0ed869c61a06b99d1db4b105207e017de805c5a6cc86cbf9c2230add37dc69da
6
+ metadata.gz: f9b0bb4400a27d811f692152b7300490d2ad1db8d941586d13f8c825971ce2c7bf1f0a49934ab32e0d791453cb6228896658e9df14395cd69ef41635f7a4a391
7
+ data.tar.gz: 8933680fcf6be0cec427990d3a3a3e7701c26edb81a839c116d3194f68308cfbd7ad18e2e62cd421b3e4b4e94c296ece51763bf70aa530ad64b627ed27fb271e
@@ -48,8 +48,9 @@ module Pay
48
48
 
49
49
  # Associate charge with subscription if we can
50
50
  if object.payment_intent.present?
51
- invoice_payments = ::Stripe::InvoicePayment.list({payment: {type: :payment_intent, payment_intent: object.payment_intent}, status: :paid, expand: ["data.invoice.total_discount_amounts.discount"]}, {stripe_account: stripe_account}.compact)
52
- if invoice_payments.any? && (invoice = invoice_payments.first.invoice)
51
+ invoice_payments = ::Stripe::InvoicePayment.list({payment: {type: :payment_intent, payment_intent: object.payment_intent}, status: :paid}, {stripe_account: stripe_account}.compact)
52
+ if invoice_payments.any?
53
+ invoice = ::Stripe::Invoice.retrieve({id: invoice_payments.first.invoice, expand: ["total_discount_amounts.discount.source.coupon"]}, {stripe_account: stripe_account}.compact)
53
54
  attrs[:stripe_invoice] = invoice.to_hash
54
55
  attrs[:subtotal] = invoice.subtotal
55
56
  attrs[:tax] = invoice.total - invoice.total_excluding_tax.to_i
@@ -31,7 +31,7 @@ module Pay
31
31
  return
32
32
  end
33
33
 
34
- default_payment_method_id = pay_customer.api_record.invoice_settings.default_payment_method
34
+ default_payment_method_id = pay_customer.api_record.invoice_settings&.default_payment_method
35
35
  default = (id == default_payment_method_id)
36
36
 
37
37
  attributes = extract_attributes(object).merge(default: default, stripe_account: stripe_account)
@@ -279,7 +279,6 @@ module Pay
279
279
  unpause
280
280
  else
281
281
  @api_record = ::Stripe::Subscription.update(processor_id, {
282
- plan: processor_plan,
283
282
  trial_end: (on_trial? ? trial_ends_at.to_i : "now"),
284
283
  cancel_at_period_end: false
285
284
  }.merge(expand_options),
@@ -300,10 +299,9 @@ module Pay
300
299
  processor_id,
301
300
  {
302
301
  cancel_at_period_end: false,
303
- plan: plan,
302
+ items: [{id: subscription_items.first.id, plan: plan, quantity: quantity}],
304
303
  proration_behavior: proration_behavior,
305
- trial_end: (on_trial? ? trial_ends_at.to_i : "now"),
306
- quantity: quantity
304
+ trial_end: (on_trial? ? trial_ends_at.to_i : "now")
307
305
  }.merge(expand_options).merge(options),
308
306
  stripe_options
309
307
  )
data/lib/pay/receipts.rb CHANGED
@@ -70,8 +70,8 @@ module Pay
70
70
  items
71
71
  end
72
72
 
73
- def discount_description(discount)
74
- coupon = discount.discount.coupon
73
+ def discount_description(total_discount_amount)
74
+ coupon = total_discount_amount.discount.try(:source).try(:coupon) || total_discount_amount.discount.try(:coupon)
75
75
  name = coupon.name
76
76
 
77
77
  if (percent = coupon.percent_off)
data/lib/pay/stripe.rb CHANGED
@@ -27,7 +27,7 @@ module Pay
27
27
 
28
28
  extend Env
29
29
 
30
- REQUIRED_VERSION = "~> 15"
30
+ REQUIRED_VERSION = "~> 17"
31
31
 
32
32
  # A list of database model names that include Pay
33
33
  # Used for safely looking up models with client_reference_id
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "11.2.3"
2
+ VERSION = "11.3.1"
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: 11.2.3
4
+ version: 11.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  requirements: []
190
- rubygems_version: 3.7.1
190
+ rubygems_version: 3.7.2
191
191
  specification_version: 4
192
192
  summary: Payments engine for Ruby on Rails
193
193
  test_files: []