From c0d4715bdb44ad3782dcd7c03d5cb9c1bd1640f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jun 2018 16:29:26 +0200 Subject: [PATCH] Clean code --- htdocs/public/payment/newpayment.php | 47 +++++++++++++--------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index a531a821d29..ec2f43841f5 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1607,43 +1607,40 @@ if (preg_match('/^dopayment/',$action)) console.log(form); form.addEventListener('submit', function(event) { event.preventDefault(); - - global->STRIPE_USE_3DSECURE)) // Ask credit card directly, no 3DS test { ?> - /* Use token */ - stripe.createToken(card).then(function(result) { - if (result.error) { - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // Send the token to your server - stripeTokenHandler(result.token); - } - }); + /* Use token */ + stripe.createToken(card).then(function(result) { + if (result.error) { + // Inform the user if there was an error + var errorElement = document.getElementById('card-errors'); + errorElement.textContent = result.error.message; + } else { + // Send the token to your server + stripeTokenHandler(result.token); + } + }); - /* Use 3DS source */ - stripe.createSource(card).then(function(result) { - if (result.error) { - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // Send the source to your server - stripeSourceHandler(result.source); - } - }); + /* Use 3DS source */ + stripe.createSource(card).then(function(result) { + if (result.error) { + // Inform the user if there was an error + var errorElement = document.getElementById('card-errors'); + errorElement.textContent = result.error.message; + } else { + // Send the source to your server + stripeSourceHandler(result.source); + } + }); - });