pay 11.3.0 → 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: 9edcf51b1a6346022cd5d504b2d6e730dadeb31580ae60da69b3f5c5414b97d8
4
- data.tar.gz: 9cd3ea459bdd0f853efab3a72f32af739125740f22e78f756da1e6ea2a059a5e
3
+ metadata.gz: ebe9b67692268353c8f1f898d83ed6836cc22e82f040b7465d32d81fc8dc2540
4
+ data.tar.gz: 7b1f8b4b41cd8bdb7947573c10fdd718d3fc9241819e08d9d91365429bf3b85d
5
5
  SHA512:
6
- metadata.gz: 3e92c7fd1cd767d5d67160abd1bda24d1d9a9c56a4ea3ea883a1be04e65bdaf21fc5a2ad4c9268cad9d37747e6927f79bfcc4beadecbf3f6c79e499d7c890c64
7
- data.tar.gz: ca5742925df0d3f6aaae8ed148a9710f5c1be43394c0918eb2f0afcba9cf3968546e9388768b98ff3181df8c8e9ddb83ad7ae8d27a5d1266100863e4dcb0b2d8
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
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/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "11.3.0"
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.3.0
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: []