Roll a 7.x-3.x branch that refactors JS and utilizes the Commerce Braintree v3 API/SDKs

Comments

andyg5000 created an issue. See original summary.

bojanz’s picture

You can use the 8.x commit as a guideline. Wasn't too painful.

andyg5000’s picture

Great. I've already have most of it done on 7.x-3.x, but will use 8.x as a guide to clean up for consistency.

I also added commerce_braintree_express_checkout in 3.x if you all don't have that yet :)

valic’s picture

Status: Active » Needs review
StatusFileSize
new12.76 KB

Attached patch for D7 version module and SDK 3 support. It is patched against version 7.2.

andyg5000’s picture

@valic, it's been a while since I've been able to work on this, but have you looked at the 7.x-3.x branch? That was my intention to use that and it already has some features like Express Checkout added.

retrodans’s picture

Hello @andyg5000 any news on this, or even a list of things that are not ready in the 3.x branch? PSD2 comes into play later in the year, and Braintree have advised us that we must switch to V2 and enable 3DS prior to that, so we are desperately trying to work out next steps.

We are using the drop-in code to implement payments on our site, and if the basics of V3 are there, I may be able to help with the drop-in parts, as am in dialogue with Braintree at the moment as we need this there asap.

andyg5000’s picture

Hey @retrodans

The basics should be in place. I haven't had anyone with the need to push this any further, so I haven't been able to focus on it.

I'm happy to review any issues/patches you come up with. I'm also available for development sponsorship, if you're interested.

Thanks,
A

retrodans’s picture

Thanks for the response andy, I will have a bit of a look tomorrow locally to see where things are at, and how much work I would need to do to start things moving..

With regards "development sponsorship" do you have much information on that, as it is not something I have been involved with before.

retrodans’s picture

StatusFileSize
new10.89 KB

Hi Andy, I managed to spend some time on this today, and have an initial prototype working locally. I am running things through a custom module which focuses on subscriptions integration, but it uses a lot of the code in the main braintree module where possible, so it should all still be relevant.

The patch is attached to this comment (diff'd with the 7.x-3.x branch), so please do let me know your thoughts and areas you would like it improved. I hope to be looking at this again next Monday, so will address anything then, and hopefully we can get a release candidate closer along.

It might also be worth noting that the reasons this is a higher priority for us is due to PSD2, outlined below

retrodans’s picture

StatusFileSize
new12.14 KB

Improved patch file to fix when a bank doesn't yet support 3DS (fails with configurable error message)

chrisscrumping’s picture

I too am interested in getting 3DS 2.0 integrated with the Dropin UI.

Tested patches #9 & #10 and they seem to be working for 3DS, thanks @retrodans :) However unless I am missing something this does not cover 3DS 2.0?

There does not appear to be any clear docs either that shows how to start testing 3DS 2.0 with the Dropin UI?

All I can see is https://developers.braintreepayments.com/guides/3d-secure/migration/java... which is for hosted fields I think?

I have messaged my contact at Braintree too see if they can help at all...

chrisscrumping’s picture

StatusFileSize
new12.17 KB

Had some time to look into this again and no further advancements with PSD2 (aka 3DS 2) but I have done some further testing with patch 10 so we can start using v3 SDK ready for PSD2.

Its failing with PayPal payments (and I assume any payment that's not a 'CreditCard' although not tested others eg Apple Pay) because PayPal payment does not return payload.liabilityShiftPossible.

Created a new patch to extend the conditions to allow PayPal payments

chrisscrumping’s picture

Further to my previous comment @retrodans review page throws an exception for anonymous users when trying to checkout because "commerce_braintree_dropin_submit_form_elements" tries to unset customerId and save the user which is not possible for anonymous users.

I think there needs to be some sort of check here as I assume you're using the Braintree vault and maybe always dealing with logged in users?

a.dmitriiev’s picture

I have also noticed, that if Paypal option is not activated, this line:

$js_settings['options']['threeDSecure']['amount'] = commerce_currency_amount_to_decimal($amount['amount'], $amount['currency_code']);

is useless, because $amount variable is initialized only when Paypal is enabled. The piece of code is just above:


  // Add PayPal payment option if enabled.
  if (!empty($payment_method['settings']['paypal_flow'])) {
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    $amount = $order_wrapper->commerce_order_total->value();
    $js_settings['options']['paypal']['flow'] = $payment_method['settings']['paypal_flow'];
    $js_settings['options']['paypal']['amount'] = commerce_currency_amount_to_decimal($amount['amount'], $amount['currency_code']);
    $js_settings['options']['paypal']['currency'] = $amount['currency_code'];
  }

I suggest this part:

    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    $amount = $order_wrapper->commerce_order_total->value();

should go outside of `if (!empty($payment_method['settings']['paypal_flow'])) {` condition.

Thanks, btw, for the patch.

chrisscrumping’s picture

Thanks Artem, I had a look at this and I don't think this is an issue with my latest patch as its been updated for 3DS2.0 - moving this conversation to the other thread as this one is specifically for 3SDK https://www.drupal.org/project/commerce_braintree/issues/2496627

Could you take a look over there and see if the problem persists?

billspreston’s picture

I've recently received an email from Braintree saying that from May 1st there will be a requirement to use a minimum SDK version of 3.8.0. See here for more details:

https://developers.braintreepayments.com/reference/general/best-practice...

Given this state of affairs, should the priority of this ticket be bumped up?

fhelms’s picture

I am having the same problem. The old SDK stops working May 1st, 2020 and no alternative / solution for commerce is to be found.

andyg5000’s picture

Priority: Normal » Critical
Status: Needs review » Needs work

I reviewed the most recent patch a while back and it needed some work. I'm trying to secure funding to get this update done before May 1st. Once I have some updates I'll assign the issue to myself.

aajones’s picture

@andyg5000 I am in desperate need of a patch to this. What are you looking for regarding funding? Is there any progress on fixing this?

luksak’s picture

Hm, Braintree is putting some pressure on us:

To help you prepare for upcoming SCA requirements, part of the European Payment Services Directive (PSD2) regulations, Braintree recommends that merchants integrate 3DS 2 into their checkout experience by December 2020 to ensure there is no disruption to you or your customers at checkout.

Is there funding from Braintree to fix this?

damienmckenna’s picture

Status: Needs work » Fixed

The new 7.x-3.0 release supports the v3 API.

Status: Fixed » Closed (fixed)

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