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

Respect shipping method type #107

Merged

Conversation

anentropic
Copy link
Contributor

I propose this fix for issue #106 ...basically, try to match shipping method returned from PayPal by name with a method defined in shipping Repository, in order to use the actual shipping method class and save order with correct code.

This PR also fixes a related problem I encountered when trying to match shipping method by name... my name had a ™ char in it. Since the response body is urlencoded the usual unicode handling doesn't work quite right... currently we have a double-encoded unicode type of bug so the incorrectly decoded string returned from PayPal couldn't be matched in the Repository.

We need to instead treat the response body as ascii bytes, give that to parse_qs to make a dict then decode the keys and values of the dict as utf8.

Supporting both Py 2 & 3 made the code a bit ugly but this was the minimum change I could find to make the new test pass.

@maiksprenger
Copy link
Member

That's lovely work, thank you.

maiksprenger added a commit that referenced this pull request Nov 4, 2015
@maiksprenger maiksprenger merged commit cccad8d into django-oscar:master Nov 4, 2015
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