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

Shift4: Update response parsing to account for hostresponse #5261

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

jcreiff
Copy link
Contributor

@jcreiff jcreiff commented Sep 12, 2024

The response object returned from the Shift4 gateway seems to have changed hostResponse to hostresponse around August 26th, which causes all failed auth/purchase transactions to default to the fallback message of "Transaction declined"

This commit corrects the parsing to account for this change but also leaves hostResponse as an option, in case the change is reverted by Shift4 in the future.

Assertions were added to show that the refactoring still provides correct values for both message and error_code for the various response structures we receive. Shift4 does not return a host(r/R)esponse object in sandbox testing, so we have to rely on unit tests here.

CER-1740

LOCAL
6018 tests, 80340 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed

801 files inspected, no offenses detected

UNIT
29 tests, 190 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed

REMOTE
29 tests, 67 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed

@jcreiff jcreiff requested a review from a team September 12, 2024 19:48
Copy link
Contributor

@yunnydang yunnydang left a comment

Choose a reason for hiding this comment

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

great work!

The response object returned from the Shift4 gateway seems to have changed `hostResponse` to `hostresponse` around August 26th, which causes all failed auth/purchase transactions to default to the fallback message of "Transaction declined"

This commit corrects the parsing to account for this change but also leaves `hostResponse` as an option, in case the change is reverted by Shift4 in the future.

Assertions were added to show that the refactoring still provides correct values for both `message` and `error_code` for the various response structures we receive. Shift4 does not return a `host(r/R)esponse` object in sandbox testing, so we have to rely on unit tests here.

CER-1740

LOCAL
6018 tests, 80340 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

801 files inspected, no offenses detected

UNIT
29 tests, 190 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

REMOTE
29 tests, 67 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
@jcreiff jcreiff merged commit f4d4dfe into master Sep 13, 2024
5 checks passed
@jcreiff jcreiff deleted the shift_4_response_message branch September 13, 2024 16:22
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.

2 participants