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

Minor fixes for the regular payment workflow #216

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jkachel
Copy link
Collaborator

@jkachel jkachel commented Feb 11, 2025

What are the relevant tickets?

mitodl/hq#6042

Description (What does it do?)

Fixes a few things that were noticed while working on refunds:

  • Zero-value baskets caused errors on checkout - the code was expecting to redirect, we need to send status back to the React app instead
  • import_product and update_product_data commands both didn't manage product versions correctly - for update_product_data, this fix is in the underlying API call that gets queued
  • refactored PendingOrder._get_or_create a bit to check to make sure the lines and versions match, or fail (and to move checking into a separate function to keep Ruff happy)
  • Added a BasketItem inline so you can see what's in the basket in Django Admin more easily
  • Updates the Order model to link directly to an IntegratedSystem. (We do this in baskets so we probably should have done this for orders too.)

How can this be tested?

Automated tests should pass.

Importing or updating a product should properly create a version.
Opening a basket that has stuff in it in the Django Admin should also show you the items in the basket.
Checking out a basket that is zero value (i.e. with a 100% off discount) should result in a success status, not redirecting you to elsewhere.
If you try to check out with a product that doesn't have versions for whatever reason, it should fail. (In practice this shouldn't happen.)
New orders should have an associated IntegratedSystem.

Should hopefully be cherry pick-able out into its own PR. Fixes for a few things that were problematic while getting stuff ready for refunds:
- Zero-value baskets caused errors on checkout - the code was expecting to redirect, we need to send status back to the React app instead
- import_product and update_product_data commands both didn't manage product versions correctly - for update_product_data, this fix is in the underlying API call that gets queued
- refactored PendingOrder._get_or_create a bit to check to make sure the lines and versions match, or fail (and to move checking into a separate function to keep Ruff happy)
- Added a BasketItem inline so you can see what's in the basket in Django Admin more easily
- Fix some tests with payment APIs
- Add hard system link to Orders - we're doing this in Basket anyway
@jkachel jkachel added the Needs Review An open Pull Request that is ready for review label Feb 11, 2025
@jkachel jkachel mentioned this pull request Feb 11, 2025
@cp-at-mit cp-at-mit self-assigned this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review An open Pull Request that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants