Add “Use order currency (multi currency support)” – option

Currently the currency to be used is set using a configuration option. This patch will add an option
“Use order currency (multi-currency support)” - that will be unchecked by default
When unchecked this new option will have no affect on the way the module functions.
When checked the module will do the following:
Check if the currency used by the order is supported by PayPal if it is use it.
Otherwise use the configuration selected currency as a fallback

This will improve support for multi currency sites.
also see http://drupal.org/node/1408244 for an alternative approach to this

Will try and put a patch up in the next week or so.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guy_schneerson’s picture

Status: Active » Needs review
FileSize
6.35 KB

This patch (for wpp & wps) adds a configuration option "Use order currency / multi-currency support." and fixes currency support for wps.

wpp: The new setting defaults to unchecked so will have no affect until checked.

wps: Did not set the currency at all so only worked for US shops (US$ is the default PayPal currency).
Added currency settings and updated the amount conversion function to be the same as wpp (as it didn’t support multi currency conversions).
The default is set to FALSE, however as the currency settings was not used it is possible a site may have the wrong currency configured, this is unlikely as USD is the default.

marcoka’s picture

pretty important, any news/opinions on this from the maintainers?

guy_schneerson’s picture

@e-anima, the patch is a bit old and needs testing to make sure the patch still works as other changes may have been done to code that will break the patch.
@e-anima did you try the patch? what PayPal module are you using?

Ill try and re test the patch in the next few days and chase @rszrama

guy_schneerson’s picture

actually looking like no commits for a long time so the patch should work.
Will try and go over the issue Q and the module this weekend to try and figure out what state things are at.

andyg5000’s picture

I've tested this patch and can confirm that it works.

andyg5000’s picture

Same issue in WPS #1603788: PayPal WPS - amount isn't converted if unsupported currency is used. doesn't include option to select and performs conversion automatically. Whichever route is taken should be consistent across WPP/WPS.

guy_schneerson’s picture

Hi @andyg5000
The patch in #1 standardizes the handling of Multiple Currencies for both WPS & WPP and provides configuration options for both.
What it does not do is provide a fallback for unsupported currencies as provided in issue 1603788 PayPal WPS - amount isn't converted if unsupported currency is used..

what i recommend is
1) commit this patch
2) update issue 1603788 to work with this patch and make sure it is consistent with wpp & wps (will be happy to help on this if @das-peter not available).

optionally the two patches can be combined into one upfront but i think we should commit the above first as the longer we wait it is more likely patches will not work as code changes and patches clash.

rszrama’s picture

Assigned: guy_schneerson » Unassigned
Status: Needs review » Fixed

Alrighty guys, I went through this code and closed out the other issue as a duplicate. This is the better approach, but I updated the interface text and simplified the logic for determining the proper currency code to use. Props to Guy for putting the patch together. I had to split it up because I realized I had made a critical error in a patch I committed yesterday and needed to put the fix up ASAP, so it's included in the first commit that also put the PayPal WPP feature from this issue in. : )

Commit 1: http://drupalcode.org/project/commerce_paypal.git/commitdiff/451e09c
Commit 2: http://drupalcode.org/project/commerce_paypal.git/commitdiff/74503ca

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.