pay 11.1.1 → 11.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: 683137bc5d05a03c2c9dac51eb73c81566f7f7843e1806d4701382bb9f1dd603
4
- data.tar.gz: 3974ae308b9eb16e473978fb7a6988dc2e62afbbf136bfe2a03a623dac6b0435
3
+ metadata.gz: 65a518434cfa0042025a7d66ccaef83ab3057315d349988f3a6030ec58b55112
4
+ data.tar.gz: f92aada3064d15eb96d94cbb21dc3fce497176b4c09f514b0b7ed3f87c17fff2
5
5
  SHA512:
6
- metadata.gz: 04b6d4956b0f68d82908793e4f075c1d197e62bdd9c805ee5f113495577c20278185a7d8f3c53db3a2e9c2346df151ec19619eb4f38e0d25fb29f4f9544259f1
7
- data.tar.gz: a5013d8bdefd8c1da3ab2be65fe6cce87095172c3bf7e6f1e137fd8b754fbf494606ef47fa29c2a16555bea62929481d443ed879db3e4483778f25b21b30087c
6
+ metadata.gz: c1861d93f6e98f1d2c4e48a0449d55b1099c20a5c61191b9d6ee1398ed169c0b0ee514d3d45d2079b4e196c043bce5d4e25eb8d28c40831b0237bf950e4be27a
7
+ data.tar.gz: 8aa5427869f976334156b802d5ef6320c151860510f78b0855a1c335b7152b5dce3b604e9545e08474770d2e8a8b257bea40c5d27286ae7fe5fe784f2275177d
@@ -47,13 +47,15 @@ module Pay
47
47
  }
48
48
 
49
49
  # Associate charge with subscription if we can
50
- 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)
51
- if invoice_payments.any? && (invoice = invoice_payments.first.invoice)
52
- attrs[:stripe_invoice] = invoice.to_hash
53
- attrs[:subtotal] = invoice.subtotal
54
- attrs[:tax] = invoice.total - invoice.total_excluding_tax.to_i
55
- if (subscription = invoice.parent.try(:subscription_details).try(:subscription))
56
- attrs[:subscription] = pay_customer.subscriptions.find_by(processor_id: subscription)
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)
53
+ attrs[:stripe_invoice] = invoice.to_hash
54
+ attrs[:subtotal] = invoice.subtotal
55
+ attrs[:tax] = invoice.total - invoice.total_excluding_tax.to_i
56
+ if (subscription = invoice.parent.try(:subscription_details).try(:subscription))
57
+ attrs[:subscription] = pay_customer.subscriptions.find_by(processor_id: subscription)
58
+ end
57
59
  end
58
60
  end
59
61
 
@@ -103,7 +103,13 @@ module Pay
103
103
  if (invoice = object.try(:latest_invoice))
104
104
  Array(invoice.try(:payments)).each do |invoice_payment|
105
105
  next unless invoice_payment.status == "paid"
106
- Pay::Stripe::Charge.sync_payment_intent(invoice_payment.payment.payment_intent, stripe_account: pay_subscription.stripe_account)
106
+
107
+ case invoice_payment.payment.type
108
+ when "payment_intent"
109
+ Pay::Stripe::Charge.sync_payment_intent(invoice_payment.payment.payment_intent, stripe_account: pay_subscription.stripe_account)
110
+ when "charge"
111
+ Pay::Stripe::Charge.sync(invoice_payment.payment.charge, stripe_account: pay_subscription.stripe_account)
112
+ end
107
113
  end
108
114
  end
109
115
 
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "11.1.1"
2
+ VERSION = "11.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: 11.1.1
4
+ version: 11.1.2
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.6.9
190
+ rubygems_version: 3.7.1
191
191
  specification_version: 4
192
192
  summary: Payments engine for Ruby on Rails
193
193
  test_files: []