Issue #3619561: Move the flex-autosubmit dispatch below its submit listener

Closes #3619561

payer-authentication.js dispatched the synthetic submit event at line 16, but the listener that handles it was 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 happened.

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 did nothing the shopper was left with a blank checkout column: the pane renders nothing itself, the action button is hidden by js-hide, and the challenge iframe stayed at about:blank. No JavaScript error and no watchdog entry.

It only started working on a later Drupal.attachBehaviors(), because the listener bound by the previous pass caught the new dispatch. That is why applying a coupon appeared to fix it, and why a second enrollment showed up in the CyberSource logs.

Change

Moves the dispatch below the submit listener. Nothing else.

Testing

Verified against a sandbox account with payer authentication enabled and enrollment returning PENDING_AUTHENTICATION / veresEnrolled: Y:

  1. Without the change, the step-up iframe stays at about:blank and checkout stops at /checkout/N/review.
  2. With the change, the challenge renders on load, the one time code is accepted and the order completes.
  3. Frictionless and non-3DS cards are unchanged.
  4. Still exactly one StepUp request and one commerce_payment.notify request per order, including after a checkout AJAX rebuild.

Reproduced first on a clean Commerce Kickstart install with no custom code, then on a second site.

Edited by Adrian M.

Merge request reports

Loading
Loading