fix: Fix constructor to properly retrieve capabilities values #813
+4
−4
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 kind of change does this PR introduce?
Error Description
The original constructor incorrectly retrieved the
mmsandsmsvalues due to case sensitivity in the array keys ('mms'and'sms'instead of'MMS'and'SMS'). This resulted in default values being returned as"false"(a string) rather thanfalse(a boolean), causing:Unexpected behavior in JSON serialization and comparisons.
Direct retrieval of class items (e.g.,
getSMS,getMMS, etc.) always returnedtruebecause the methods were enforced to return:bool. Since the allocated value was a string, it was evaluated astrue.Also the capabilities response does not include the
faxstatus causing to always default to falseFixed Issues Description
Updated the
PhoneNumberCapabilitiesconstructor to correctly retrieve the values formms,sms,voice, andfax. The case-sensitive keys forMMSandSMSwere changed to uppercase, and default values are nowfalseinstead of strings. This resolves the issue where incorrect values were being assigned to the capabilities properties.Unfixed Issue Description
The
faxvalue will still default tofalsebecause the capabilities response, whether retrieved through the SDK or the REST API, does not include the fax status. Therefore, even though the constructor attempts to retrievefax, it will always be set tofalse.Does this PR introduce a breaking change? (check one)
Related Issue
#783
Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.