solidusio / solidus_stripe

๐Ÿ’ณ Integrate Solidus with Stripe
https://stripe.com
BSD 3-Clause "New" or "Revised" License
36 stars 61 forks source link

Handle payment_intent.canceled event #250

Closed waiting-for-dev closed 1 year ago

waiting-for-dev commented 1 year ago

Summary

A payment_intent.canceled event is published when canceling a payment intent from the Stripe dashboard. At that point, we need to update the associated Solidus payment to be voided.

However, the webhook could also be received after voiding the payment from the Solidus admin interface, as it updates through Stripe's API. Therefore, we need to do nothing if the payment is already voided.

Closes #181

[1] - https://stripe.com/docs/api/events/types#event_types-payment_intent.canceled

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

codecov[bot] commented 1 year ago

Codecov Report

Merging #250 (4079188) into master (bad6ed0) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #250   +/-   ##
=======================================
  Coverage   99.79%   99.79%           
=======================================
  Files          24       24           
  Lines         478      485    +7     
=======================================
+ Hits          477      484    +7     
  Misses          1        1           
Impacted Files Coverage ฮ”
lib/solidus_stripe/webhook/event.rb 96.96% <รธ> (รธ)
...olidus_stripe/webhook/payment_intent_subscriber.rb 100.00% <100.00%> (รธ)

:mega: Weโ€™re building smart automated test selection to slash your CI/CD build times. Learn more