Problem/Motivation

In js/payer-authentication.js the submit event is dispatched at line 16, but the listener that handles
it is not attached until line 37. A synthetic submit event does not submit a form, it only runs listeners, so on the
first behavior attach nothing happens.

With auto_submit_review_step enabled and enrollment returning PENDING_AUTHENTICATION, that
dispatch is the only thing that submits the step-up form. When it does nothing the shopper gets a blank checkout
column: the pane renders nothing itself, the action button is hidden by js-hide, and the challenge
iframe stays at about:blank. No JavaScript error, no watchdog entry.

It works on any later Drupal.attachBehaviors(), because the listener from the previous pass catches the
new dispatch. That is why applying a coupon appears to fix it, and why a second enrollment appears in the
CyberSource logs.

Both enable_payer_authentication and auto_submit_review_step default to FALSE, and the
card has to actually be challenged, so most sites never hit it. Anything else causing a second behavior attach, such
as a BigPipe placeholder, hides it completely.

Steps to reproduce

  • Configure a Flex gateway against a merchant account with Payer Authentication enabled, and turn on both
    enable_payer_authentication and auto_submit_review_step.
  • Add the cybersource_flex_review pane at the review step.
  • Check out with a card the issuer will challenge, for example 4000000000002503.

Expected: the challenge is displayed. Actual: the checkout column is blank with no button. The step-up form is in
the DOM with a valid JWT and its iframe is still about:blank.

Running Drupal.attachBehaviors(document.body, drupalSettings) in the console displays the challenge
immediately.

Reproduced on a clean Commerce Kickstart install with no custom code.

Proposed resolution

Move the dispatch below the submit listener. Nothing else changes.

Diff moving the flex-autosubmit dispatch below the submit listener

Verified against a sandbox with enrollment returning PENDING_AUTHENTICATION. Without the change
checkout stops at /checkout/N/review. With it the challenge renders, the one time code is accepted and
the order completes. Frictionless and non-3DS cards are unaffected, and there is still one StepUp and one notify
request per order.

Remaining tasks

  • Review and commit the MR.
  • Separate issue: addEventListener runs on every attach with no once() guard, so an AJAX
    rebuild stacks duplicate handlers.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

adrianandres created an issue. See original summary.

adrianandres’s picture

adrianandres’s picture

Status: Active » Needs review

vmarchuk made their first commit to this issue’s fork.

vmarchuk’s picture

Version: 8.x-1.x-dev » 2.x-dev
vmarchuk’s picture

Assigned: vmarchuk » Unassigned
Status: Needs review » Reviewed & tested by the community

The fix looks good to me! I also updated the branch to version 2.x and changed the version to 2.x-dev.

  • adrianandres committed f0c09199 on 2.x
    Issue #3619561: Move the flex-autosubmit dispatch below its submit...