Skip to content

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cwagdev
Copy link
Contributor

@cwagdev cwagdev commented Jul 15, 2015

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?

@@ -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"];
Copy link
Contributor Author

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?

Copy link
Contributor

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,

@y2chaits
Copy link
Contributor

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.

@skyzyx
Copy link

skyzyx commented Jul 29, 2015

[…] because we feel strings are easier for developers new to the SDK for debugging.

ಠ_ಠ

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

4 participants