-
Notifications
You must be signed in to change notification settings - Fork 0
Use enums in place of kWPEnvironment
, kWPCardReaderStatus
, and kWPPaymentMethod
constants
#5
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
base: master
Are you sure you want to change the base?
Conversation
@@ -55,7 +64,7 @@ - (NSDictionary *) toDict | |||
NSMutableDictionary *dict = [NSMutableDictionary dictionary]; | |||
|
|||
[dict setValue:self.clientId ? self.clientId : [NSNull null] forKey:@"clientId"]; | |||
[dict setValue:self.environment ? self.environment : [NSNull null] forKey:@"environment"]; | |||
[dict setValue:@(self.environment) forKey:@"environment"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure about where this dictionary is used, should the value for the environment
key be something specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dictionary is only used for display purposes. The environment key does not need any special values, just whatever is set as the environment for the framework,
Thanks for the pull request @cwagdev - after discussing offline with you and the team here, we've decided to hold off on merging this pull request. We have made a conscious design decision to use strings instead of enums because we feel strings are easier for developers new to the SDK for debugging. However, we do agree that using Enums is generally a more robust way of handling constants, so we will revisit this topic in the (hopefully near) future. |
ಠ_ಠ |
|
I personally find enums to be safer/cleaner to use than string constants and this also allows for a cleaner interop with Swift.
Let me know what you think. This is would be a breaking change to the API, so I am not sure how you would want to adjust the version if you accept.
I attempted to run the test suite on the project against these changes but got some build errors, are there any tricks to getting the tests to run?