Support from Acquia helps fund testing for Drupal Acquia logo

Comments

czigor created an issue. See original summary.

czigor’s picture

If we choose Carinal Cruise, here's a link with example implementation links:
https://github.com/AuthorizeNet/accept-sample-app/blob/master/README-Car...

czigor’s picture

Status: Active » Needs work
FileSize
0 bytes

Preliminary patch for backup purposes.

czigor’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
24.37 KB

The patch adds 3DS support for accept.js. It adds a composer dependency for JWT handling.

czigor’s picture

FileSize
25.33 KB
6.15 KB

Better error handling. Also rounding the cardinal order amount since they need an integer.

mglaman’s picture

+++ b/src/PluginForm/AcceptJsAddForm.php
@@ -184,7 +184,7 @@
+        $element['#attached']['drupalSettings']['commerceAuthorizeNet']['orderAmount'] = round($order->getTotalPrice()->getNumber());

We should use the commerce rounder

+++ b/composer.json
@@ -12,6 +12,7 @@
+        "lcobucci/jwt": "~3.1"

Is this the same jwt library API-first is using? I think the simple_oauth has a JWT library

czigor’s picture

@mglaman The commerce Rounder still returns a float (e.g. "8.00") and we need a minor unit amount as integer (e.g. "8").

Yes, simple_auth is using the same lcobucci/jwt lib.

mglaman’s picture

  1. +++ b/commerce_authnet.libraries.yml
    @@ -56,3 +56,19 @@ form-visa-checkout-production:
    +  js: ¶
    ...
    +  js: ¶
    
    +++ b/js/commerce_authnet.accept.form.js
    @@ -14,8 +14,22 @@
    +    ¶
    
    @@ -39,9 +53,97 @@
    +            ¶
    

    White space nits

  2. +++ b/js/commerce_authnet.accept.form.js
    @@ -39,9 +53,97 @@
    +                        location.reload();
    ...
    +                        location.reload();
    ...
    +                    location.reload();
    ...
    +                  location.reload();
    ...
    +                location.reload();
    ...
    +            location.reload();
    

    Why would we reload versus showing an error, curious?

  3. +++ b/src/Controller/CcaValidation.php
    @@ -0,0 +1,65 @@
    +    $response_jwt = $this->requestStack->getCurrentRequest()->request->get('responseJwt');
    

    s/request/query?

  4. +++ b/src/Controller/CcaValidation.php
    @@ -0,0 +1,65 @@
    +    $gateway_id = $this->requestStack->getCurrentRequest()->request->get('gatewayId');
    

    s/request/query

  5. +++ b/src/Plugin/Commerce/PaymentGateway/AcceptJs.php
    @@ -60,6 +210,26 @@ class AcceptJs extends OnsiteBase implements SupportsRefundsInterface {
    +    if (isset($_SESSION['commerce_authnet'][$payment_method->id()])) {
    ...
    +          'authenticationIndicator' => $_SESSION['commerce_authnet'][$payment_method->id()]['eci'],
    ...
    +          'cardholderAuthenticationValue' => urlencode($_SESSION['commerce_authnet'][$payment_method->id()]['cavv']),
    ...
    +        unset($_SESSION['commerce_authnet'][$payment_method->id()]);
    
    @@ -217,6 +412,17 @@ class AcceptJs extends OnsiteBase implements SupportsRefundsInterface {
    +        $_SESSION['commerce_authnet'][$payment_method->id()]['cavv'] = $payload->getValue()->Payment->ExtendedData->CAVV;
    ...
    +        $_SESSION['commerce_authnet'][$payment_method->id()]['eci'] = $payload->getValue()->Payment->ExtendedData->ECIFlag;
    

    We shouldn't use $_SESSION directly but the session service.

czigor’s picture

@mglaman
1-2: Fixed
3-4: We send the jwt in POST, not in GET, so it should be ok the way it is.
5. Using tempstore.private service instead of $_SESSION now.

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

This looks awesome! Will merge later today :D

  • mglaman committed 189d726 on 8.x-1.x authored by czigor
    Issue #2950906 by czigor: Support for 3D Secure
    
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Committed! Awesome!

Status: Fixed » Closed (fixed)

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