pay 6.0.1 → 6.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pay might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60ae2539f022f791877543b87528991b3a549a582e0b112110fd502b1bbb8482
4
- data.tar.gz: ce373070abf9fda58b15eeb8f19ce51f915f168d937020668e2cf2640502a698
3
+ metadata.gz: 1ffb1d86e804cae26df541cde3e1798a316c6176c271b1da5de66031f5ed99cc
4
+ data.tar.gz: a4fd5b34c5f873ef9c47d222688206ea318890cedc747c9059014001934f1c87
5
5
  SHA512:
6
- metadata.gz: 69f90f4002d0d47a51df89bb71de0ccfb07fa22b71ebe6b3246e23be47fd1ae8acb1f29358ff528d4420e72ab19cce585fa41693aa8cd61657225e1caa466224
7
- data.tar.gz: ac708cb4e3a63b3640099a175b99e0072af6df4098890e5cce660365ac2bff9869e76d37d1a75284ea085eff07a60d6651c83b67264d507605566302dad9933b
6
+ metadata.gz: d3c872342b43c5fa0ebc2aa797b7a145bdb99e310fd0db1019b6c19b9fe536fe8e242142ee5dc26edbf94a4bcdfca4e9b3aa7bb78444d1b1f3f3c35e3a2d236a
7
+ data.tar.gz: c3df896c8ba0056fcb0549c19e7b603322710ccf977832030414f2bfed5c0b14ed60a0574cf50ce237feaa56cc5bcab932cf6cc956fc0b33321d7d8117a6842b
@@ -261,6 +261,11 @@ module Pay
261
261
  stripe_options
262
262
  )
263
263
 
264
+ # Validate that swap was successful and handle SCA if needed
265
+ if (payment_intent = @stripe_subscription.latest_invoice.payment_intent)
266
+ Pay::Payment.new(payment_intent).validate
267
+ end
268
+
264
269
  pay_subscription.sync!(object: @stripe_subscription)
265
270
  rescue ::Stripe::StripeError => e
266
271
  raise Pay::Stripe::Error, e
@@ -295,9 +300,12 @@ module Pay
295
300
  ::Stripe::Invoice.upcoming(options.merge(subscription: processor_id), stripe_options)
296
301
  end
297
302
 
298
- # Retries the latest invoice for a Past Due subscription
303
+ # Retries the latest invoice for a Past Due subscription and attempts to pay it
299
304
  def retry_failed_payment
300
- subscription.latest_invoice.pay
305
+ payment_intent = ::Stripe::PaymentIntent.confirm(subscription.latest_invoice.payment_intent.id)
306
+ Pay::Payment.new(payment_intent).validate
307
+ rescue ::Stripe::StripeError => e
308
+ raise Pay::Stripe::Error, e
301
309
  end
302
310
 
303
311
  private
@@ -9,7 +9,8 @@ module Pay
9
9
 
10
10
  def call(event)
11
11
  object = event.data.object
12
- Pay::Stripe::Charge.sync(object.latest_charge, stripe_account: event.try(:account))
12
+ payment_intent = ::Stripe::PaymentIntent.retrieve({id: object.id}, {stripe_account: event.try(:account)}.compact)
13
+ Pay::Stripe::Charge.sync(payment_intent.latest_charge, stripe_account: event.try(:account))
13
14
  end
14
15
  end
15
16
  end
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "6.0.1"
2
+ VERSION = "6.0.3"
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: 6.0.1
4
+ version: 6.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes