From 28d6af213a6447f9e7d128387c810121b798583a Mon Sep 17 00:00:00 2001
From: git <git@2831253.no-reply.drupal.org>
Date: Wed, 27 Jul 2016 09:24:11 +0200
Subject: [PATCH] Issue #2717999 by dpacassi: Enable continuing with another
 payment option if datatrans failed

---
 commerce_datatrans.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/commerce_datatrans.js b/commerce_datatrans.js
index de87ac3..11d3e79 100644
--- a/commerce_datatrans.js
+++ b/commerce_datatrans.js
@@ -7,9 +7,11 @@
       // multiple triggers.
       $('#paymentButton', context).once('datatrans', function() {
         $(this).click(function () {
-          $('form').submit(function (e) {
+          var disableSubmit = function(e) {
             e.preventDefault();
-          });
+          };
+
+          $('form').bind('submit', disableSubmit);
 
           Datatrans.startPayment({
             // Use the class selector here and not the id selector because of
@@ -23,6 +25,10 @@
               // @see commerce_checkout.js
               $(this.form + '[disabled]').remove();
               $(this.form).show();
+
+              // Also re-enable the form again, in case the user wants to proceed
+              // with another payment option.
+              $('form').unbind('submit', disableSubmit);
             }
           });
         });
-- 
GitLab