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

fix: Handle payment errors during user flow #2951

Merged
merged 5 commits into from
Nov 13, 2023

Conversation

zachaysan
Copy link
Contributor

@zachaysan zachaysan commented Nov 9, 2023

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Ticket reference

Before this PR we were treating all errors from the chargebee client as one thing and we responded to a user that was in the process of signing up by issuing a 500 error, we were also logging all the chargebee errors as exceptions even though a declined credit card shouldn't be. Now, if the error is payment related, a 400 error gets sent to the client with a message to contact their administrator.

How did you test this code?

A combination of manual probing through the code with the test suite on and two new tests.

Remaining TODOs

  • Figure out what other callsites there are that will be impacted by this change, if any.
  • See if there are any other other areas of the codebase with invite-related code need to handle payment failures.
  • Manually test this somehow. I have access to flagsmith-test.chargebee.com but I'm not sure what server it is connected to. Is that staging?
  • [ ] Team up with @novakzaballa and get the frontend hooked up so the change will actually matter.

Copy link

vercel bot commented Nov 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 0:10am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 0:10am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 0:10am

@github-actions github-actions bot added the api Issue related to the REST API label Nov 9, 2023
Copy link
Contributor

github-actions bot commented Nov 9, 2023

Uffizzi Preview deployment-40452 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Nov 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7d16197) 95.64% compared to head (9a65899) 95.65%.
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2951      +/-   ##
==========================================
+ Coverage   95.64%   95.65%   +0.01%     
==========================================
  Files        1012     1012              
  Lines       29173    29207      +34     
==========================================
+ Hits        27902    27938      +36     
+ Misses       1271     1269       -2     
Files Coverage Δ
api/organisations/chargebee/chargebee.py 99.03% <100.00%> (+0.04%) ⬆️
api/organisations/invites/tests/test_views.py 100.00% <100.00%> (ø)
api/organisations/subscriptions/exceptions.py 100.00% <100.00%> (ø)
...sations/chargebee/test_unit_chargebee_chargebee.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants