Braintree uses different merchant account ids to support different currencies.

The nice thing is, if its NULL it just uses the default. This patch adds some extra form elements to the payments rule so you can enter your merchant account ids for the currencies you have enabled in commerce. It then just puts them in as the 'merchantAccountId' based on the $balance['currency_code']. If its NULL it just uses the default as standard.

Comments

haza’s picture

Patch seems nice.

It seems that Braintree doesn't support multiple merchant account on the Sandbox account. Do you know something about that ?

Do you use this patch in a live environnement ?

j0rd’s picture

@Haza you can get braintree to enable multiple merchant accounts in your sandbox. You need to email them.

haza’s picture

@j0rd : So I guess you have a multiple merchant account in your sandbox ? Did you test the patch above ?

j0rd’s picture

No, I have custom code that looks exactly the same though :)

Allows you to input a merchant account ID in processor settings for each currency you have enabled. During a sale if you don't have a merchant account ID associated with the currency used in the sale it will default to default currency in braintree by not sending the merchant account id.

There are other use cases on switching merchant account ID besides currencies, but I suspect this is the most common and it should be implemented as 7wonders has done it.

This code for me will be released in my COF-2.x patch coming this week.

gbisht’s picture

Issue summary: View changes
StatusFileSize
new4.51 KB

I need multi currency support for my project strandofsilk.com. Provided patch is working but needed reroll so here is the reroll for latest code.

luksak’s picture

What happened here? Is this ready to get committed? What about 7.x-2.x?

luksak’s picture

StatusFileSize
new3.47 KB

I rerolled the patch against 7.x-2.x. Please have a look.

luksak’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
haza’s picture

Status: Needs review » Reviewed & tested by the community

Right now, I am not able to test it. Still, I'll RTBC this as it seems to do the job.

If anyone have tested it in real condition, and saw some issues with that, please update here.

RTBC for a week, then commit if no issues cames from this.

luksak’s picture

Status: Reviewed & tested by the community » Needs review

I'll set it back to needs review since some else should test the functionality.

rickmanelius’s picture

I have my braintree account setup to allow multiple currencies, but it's been a while since I've setup Drupal Commerce to allow the specification of currency on checkout. Can one of you on this thread provide instructions (or a suitable reference link) so I can better verify/review this patch?

luksak’s picture

StatusFileSize
new4.31 KB

Since we just got #2449881: Add support for Drop-in UI for PCI SAQ A Compliance commited, we can now also support Drop-In UI multi-currency transactions. Attached is the updated patch.

@rickmanelius: give me a minute to provide you with steps to reproduce.

luksak’s picture

Steps to test the patch:

  1. Set up a Braintree sandbox account
  2. Under Settings -> Processing in the section Merchant Accounts create a new merchant account for EUR (there should already be one for USD) and remember the two merchant account IDs. You will need them later.
  3. Click the simplytest.me link next to the patch (you got dreditor enabled, right?!) and launch the sandbox
  4. Enable all modules of commerce core
  5. Enable EUR at admin/commerce/config/currency (USD should already be enabled)
  6. Enable the Transparent Redirect payment method at admin/commerce/config/payment-methods and provide it with the needed API keys and the merchant account for each currency you created in Braintree earlier
  7. Add a product field to the article content type at admin/structure/types/manage/article/fields
  8. Create on product for each currency with the currency set in the price field at admin/commerce/products/add/product
  9. Create an article for each product referencing it
  10. Now try to check out twice buying one product at a time for both payment methods using the Braintree testing credit cards: https://developers.braintreepayments.com/javascript+php/reference/genera...
  11. Now repeat from step 6 using the Drop-In UI payment method.
  12. In the Braintree sandbox go to the Transactions section and check that the transactions got processed properly.

Phew... This is it I think :) Happy testing!

rickmanelius’s picture

Status: Needs review » Needs work

Thanks Lukas! I ran through the tests for both the transparent redirect and the drop in UI. The transparent redirect worked perfectly, but the drop in UI kept defaulting to USD when I was attempting to charge in Euros. So given that we're trying to ensure compatibility with both, I'm setting this to "Needs Work" for now.

luksak’s picture

This happens when Braintree is provided with an invalid or no merchant account ID. Can you check what is being passed. Did you configure the Drop-In UI properly? Can you debug $sale_data inside commerce_braintree_dropin_submit_form_submit() to verify that the IDs are present? If so, everything should be working fine.

rickmanelius’s picture

Hi Lukas. I'll give those a try. I can confirm that I'm using the exact same credentials on both the Drop-In UI and the transparent redirect. When I get a chance, I'll do some additional debugging per your suggestions.

luksak’s picture

Status: Needs work » Needs review

I just recreated a fresh installation using my instructions in #13 and it worked. Could you please try to reproduce your bug? I would like to get this committed soon...

rickmanelius’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new65.34 KB

Hi Lukas. It would help if I was using the correct patch. :) My initial test was with #7 and I just tested with #12. I've attached the results from running USD then EUR transactions with both transparent redirect and then drop in UI. Looks like we're good on all 4 permutations. Marking RBTC. Thanks again for taking the time to provide the thorough testing instructions.

  • Lukas von Blarer committed 8cb4f2e on 7.x-2.x
    Issue #1900494 by Lukas von Blarer, 7wonders, gulab.bisht, rickmanelius...
luksak’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone!

andyg5000’s picture

Looks like this commit introduced a critical bug at least with the drop in ui integration. See #2500689: Single currency sites cannot create transacations

Status: Fixed » Closed (fixed)

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