Skip to content

Handle payment_intent.canceled event#250

Merged
waiting-for-dev merged 1 commit into
masterfrom
waiting-for-dev/handle_payment_intent_canceled_event
Mar 30, 2023
Merged

Handle payment_intent.canceled event#250
waiting-for-dev merged 1 commit into
masterfrom
waiting-for-dev/handle_payment_intent_canceled_event

Conversation

@waiting-for-dev

Copy link
Copy Markdown
Contributor

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:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@codecov

codecov Bot commented Mar 23, 2023

Copy link
Copy Markdown

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%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rainerdema rainerdema left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Comment thread spec/requests/solidus_stripe/webhooks_controller/payment_intent/canceled_spec.rb Outdated
A `payment_intent.canceled` event is published [1] 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
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/handle_payment_intent_canceled_event branch from e5b1439 to 4079188 Compare March 29, 2023 14:41
@waiting-for-dev waiting-for-dev merged commit ca35cc2 into master Mar 30, 2023
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/handle_payment_intent_canceled_event branch March 30, 2023 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle payment_intent.canceled webhook event

2 participants