tangentlabs/django-oscar-paypal — pull request #65 by mghantous (2014-02-25 23:05:47+00:00)
Title: For upstream

This pull request contains two changes.

1) Allows you to import and use gateway even without django-oscar installed.

2) Fixes issue where URL encoding was showing up in the PayPal Manger.

Before fix, PayPal Manger showed:
Billing Address: 123+Fáke+Street
Email: someone%40somewhere.com

After fix:
Billing Address: 123 Fáke Street
Email: someone@somewhere.com

I found this older documentation which gave me a clue that the content-type should be text/namevalue instead of application/x-www-form-urlencoded:
https://merchant.paypal.com/cms_content/FR/fr_FR/files/developer/PP_WPPPF_HTTPSInterface_Guide.pdf

In the more recent documentation, I noticed that there was no url encoding in any of the examples (no characters such as % or plus):
https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_payflowpro_guide.pdf

So I changed the content-type to text/namevalue and swapped out the call to urllib.urlencode() with a line of my own code to build the name value pairs.