Conversation
Handle legacy CyberSource refund records where `transaction_id` only exists on the model field, and accept Secure Acceptance `req_amount` responses when creating transactions. Added coverage for both refund and amount parsing paths.
cp-at-mit
marked this pull request as ready for review
September 23, 2026 16:10
OpenAPI ChangesShow/hide changesUnexpected changes? Ensure your branch is up-to-date with |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
NA
Description (What does it do?)
Fixes an issue where we were incorrectly reading data from the cybersource JSON response. This was resulting in transactions being created with incorrect data. This PR also adds a fallback for reading the transaction ID from the Transaction model.
An example of a recent, incorrect, Transaction record is: https://mitxonline.mit.edu/admin/ecommerce/order/557540/change/?_changelist_filters=state__exact%3Dfulfilled
Notice how the amount of the Transaction shown is 0.
How can this be tested?
Complete a purchase and verify that the amount is correct populated.
Additional Context
The multi-gateway commit (Aug 5, 0b76b0b) changed create_transaction to branch by gateway type, and it reads the amount as: transaction_payload["amount"] = payment_data.get("amount", Decimal(0))
The CyberSource Secure Acceptance response (the request.POST from checkout) uses req_amount, not amount. The amount key only appears in CyberSource's REST API responses. So every SA checkout since Aug 5 stored Transaction.amount = 0.