Skip to content
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

rename customer_details to match the API #57

Merged
merged 1 commit into from
Apr 10, 2019
Merged

rename customer_details to match the API #57

merged 1 commit into from
Apr 10, 2019

Conversation

balexand
Copy link
Contributor

@balexand balexand commented Apr 9, 2019

As in #54, the name of the field is not consistent with the API. The field is named customer in the API. See https://github.com/braintree/braintree_python/blob/9d672082bc2ecb9b699095afd6fed7afb15c87e7/braintree/transaction.py#L702

This is awkward since the official client libs (Python and Ruby) name this field customer_details and map the data from the customer field returned by the API. This means if a developer is referring to the Braintree docs for another language then they will expect to see a customer_details field (https://developers.braintreepayments.com/reference/response/transaction/python#customer_details).

Do you think that this library should be consistent with the official client libs and have names like customer_details? Or should it be consistent with the API and have names like customer? Also, should this library deserialize the customer into a Braintree.Customer struct?

There are similar issues with several other fields (like apple_pay_details). This pull-request doesn't address those, but I'd be happy to submit a pull-request once we have an answer to the above question.

Thanks ✨

Copy link
Owner

@sorentwo sorentwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only argument I see for straying away from the API is to match the docs for other languages. That doesn't feel convincing at this point, and I think is best to match the API directly rather than translating certain keys.

In several other places we convert the nested list of maps into the corresponding struct, so it would be nice to do that here for customers as well. That isn't necessary in this PR though.

@sorentwo sorentwo merged commit 4d57b19 into sorentwo:master Apr 10, 2019
@sorentwo
Copy link
Owner

Thanks for this! Any other modifications are welcome. We're still below 1.0 and the API can change a bit.

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.

2 participants