pay 10.0.3 → 10.0.4

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: e9a03557a1292cbb8dcd8b3c8b43533b3c2f9a0cfc53481f99976579e1009dba
4
- data.tar.gz: f1d085db81f5132db3abb62bf07306ae7c4703343d46a39279fbef9eaf7692f7
3
+ metadata.gz: a2c55cf9e768d0706c1ea9cb6efa042bd4988655ff64ef8692950b2333352238
4
+ data.tar.gz: 33eefe08c1f201a4a58bee3d80705a2677aa6a064c4a00a1bf391965819e81be
5
5
  SHA512:
6
- metadata.gz: c8af553a1fffd442ed1bc19399b4e19df35404a41af7546a48737d45af2b9cb9aa7906b71ad9c2abd3b119d72048608afe9a4506ba7dc75f606eff89adc803d5
7
- data.tar.gz: b1de35982f96be48e20e8d514c0d14ccda50bcc25beb1f5238405931f8a4cc0331edad92160ab664b9a4031b5f9e3533fad3c1d2f529184cebc5bc4311ad19aa
6
+ metadata.gz: b136aa767deaa1ea0c37cc6d7e9e340e588005ba14d5b23c6ff7043e86b408720a9f86efc8e850308c52a665aa8d11182261d63a3c98f326243cffa1f26f9303
7
+ data.tar.gz: b9b7336acd10e8a956fc3d3911e81bf002d5003cf0f1283c21cee24fd79bef7b43cc331cdc6988ce0551ec8eb5fe99da976741595c939ad7e4a4c27c8d0aad55
@@ -6,16 +6,17 @@ module Pay
6
6
  # Event is of type "invoice" see:
7
7
  # https://stripe.com/docs/api/invoices/object
8
8
 
9
- object = event.data.object
9
+ invoice = event.data.object
10
+ subscription_id = invoice.parent.try(:subscription_details).try(:subscription)
10
11
 
11
12
  # Don't send email on incomplete Stripe subscriptions since they're just getting created and the JavaScript will handle SCA
12
- pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
13
+ pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, subscription_id)
13
14
  return if pay_subscription.nil? || pay_subscription.status == "incomplete"
14
15
 
15
16
  if Pay.send_email?(:payment_action_required, pay_subscription)
16
17
  Pay.mailer.with(
17
18
  pay_customer: pay_subscription.customer,
18
- payment_intent_id: event.data.object.payment_intent,
19
+ payment_intent_id: invoice.payment_intent,
19
20
  pay_subscription: pay_subscription
20
21
  ).payment_action_required.deliver_later
21
22
  end
@@ -6,16 +6,17 @@ module Pay
6
6
  # Event is of type "invoice" see:
7
7
  # https://stripe.com/docs/api/invoices/object
8
8
 
9
- object = event.data.object
9
+ invoice = event.data.object
10
+ subscription_id = invoice.parent.try(:subscription_details).try(:subscription)
10
11
 
11
12
  # Don't send email on incomplete Stripe subscriptions since they're just getting created and the JavaScript will handle SCA
12
- pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
13
+ pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, subscription_id)
13
14
  return if pay_subscription.nil? || pay_subscription.status == "incomplete"
14
15
 
15
16
  if Pay.send_email?(:payment_failed, pay_subscription)
16
17
  Pay.mailer.with(
17
18
  pay_customer: pay_subscription.customer,
18
- stripe_invoice: object
19
+ stripe_invoice: invoice
19
20
  ).payment_failed.deliver_now
20
21
  end
21
22
  end
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "10.0.3"
2
+ VERSION = "10.0.4"
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: 10.0.3
4
+ version: 10.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes