WIP: Error check in push notification #33
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.
Description
Error check in push notification in CreateNotificationWithHttpInfoAsync method in DefaultApi class to prevent false positive.
Details
When sending push notifications, the return is null, making it impossible to confirm the actual sending. The HTTP request made within OneSignal returns a false negative, the StatusCode of the request is 200, but there are errors within the payload. The error in question is invalid user ID but the user ID exists and the notification arrives.
We made a change, where we validate if there is an exception in the request and if the Status Code is different from OK, this works "correctly", not returning null, returning 200 but with an invalid user ID error.
Motivation
This PR is being opened to propose an error treatment in case the HTTP request made has a return other than 200, making it impossible to return null. Still, I believe the biggest problem is within the API, which I don't have access to contribute
Scope
Due to the invalid user ID error, even though there is a registration in the system, the project returns null, making it impossible to confirm that the push notification was sent effectively
Testing
Manual testing
I cloned the OneSignalAPI repository and did the imports locally, not depending on the NuGet import. This made it possible to perform a more effective debug and better understand what happened by detecting the effective and failed send scenarios by also using the mobile app to confirm receipt of push notifications and adding the StatusCode 200 check
Checklist
Overview
Testing
Final pass