Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle payment_intent.payment_failed when card is not accepted #550

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

Nnachevvv
Copy link
Member

When payment is initiated with payment_intent.created event and the card is not accepted by some reason in Stripe, it sends payment_intent.payment_failed event which we currently don't handle.

This results in donations staying in status waiting, however the closest correct status should be 'declined'.

This PR fixes that

Closes #548

Motivation and context

Testing

Steps to test

  1. I followed the document which we have in order to setup stripe:
    https://github.com/podkrepi-bg/api/blob/master/TESTING.md

  2. Executed stripe trigger:

stripe trigger payment_intent.payment_failed --override payment_intent:metadata.campaignId=a57c8d72-39e0-45e8-ab59-ea84f371a35a --override payment_intent:currency=BGN

Donations that have been declined before executing the command above:
Screenshot 2023-09-18 at 0 06 11

Donations after executing the command above:
Screenshot 2023-09-18 at 0 07 30

@github-actions
Copy link

github-actions bot commented Sep 17, 2023

✅ Tests will run for this PR. Once they succeed it can be merged.

@igoychev igoychev added the run tests Allows running the tests workflows for forked repos label Sep 18, 2023
@github-actions github-actions bot removed the run tests Allows running the tests workflows for forked repos label Sep 18, 2023
@igoychev igoychev added the run tests Allows running the tests workflows for forked repos label Sep 18, 2023
@github-actions github-actions bot removed the run tests Allows running the tests workflows for forked repos label Sep 18, 2023
Copy link
Contributor

@igoychev igoychev left a comment

Choose a reason for hiding this comment

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

looks great, and also kudos for adding the test!

@igoychev igoychev merged commit 8fc54d1 into podkrepi-bg:master Sep 19, 2023
15 of 16 checks passed
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.

[Stripe] handle payment_intent.payment_failed
2 participants