fix: handle case-insensitive status check for Hubtel initialization#10
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Improves robustness of the Hubtel payment initialization flow by making the gateway status check case-insensitive, reducing failures caused by unexpected casing in Hubtel API responses.
Changes:
- Update the Hubtel initialization success condition to compare
statusin a case-insensitive way.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ); | ||
|
|
||
| if (data.status !== 'success') { | ||
| if (data.status?.toLowerCase() !== 'success') { |
There was a problem hiding this comment.
The new case-insensitive status handling is not covered by existing HubtelAdapter tests (current initiatePayment success test uses only lowercase 'success'). Add a unit test where the initiate endpoint returns status values like 'Success'/'SUCCESS' to prevent regressions.
Suggested change
| if (data.status?.toLowerCase() !== 'success') { | |
| const normalizedStatus = | |
| typeof data.status === 'string' ? data.status.toLowerCase() : ''; | |
| if (normalizedStatus !== 'success') { |
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.
This pull request makes a minor update to the Hubtel payment adapter to improve robustness in status checking. The change ensures that the status check is case-insensitive, reducing the risk of failures due to unexpected casing in API responses.