Clean code
This commit is contained in:
parent
79cbdf7fd1
commit
c0d4715bdb
@ -1607,43 +1607,40 @@ if (preg_match('/^dopayment/',$action))
|
|||||||
console.log(form);
|
console.log(form);
|
||||||
form.addEventListener('submit', function(event) {
|
form.addEventListener('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (empty($conf->global->STRIPE_USE_3DSECURE)) // Ask credit card directly, no 3DS test
|
if (empty($conf->global->STRIPE_USE_3DSECURE)) // Ask credit card directly, no 3DS test
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
/* Use token */
|
/* Use token */
|
||||||
stripe.createToken(card).then(function(result) {
|
stripe.createToken(card).then(function(result) {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
// Inform the user if there was an error
|
// Inform the user if there was an error
|
||||||
var errorElement = document.getElementById('card-errors');
|
var errorElement = document.getElementById('card-errors');
|
||||||
errorElement.textContent = result.error.message;
|
errorElement.textContent = result.error.message;
|
||||||
} else {
|
} else {
|
||||||
// Send the token to your server
|
// Send the token to your server
|
||||||
stripeTokenHandler(result.token);
|
stripeTokenHandler(result.token);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
else // Ask credit card with 3DS test
|
else // Ask credit card with 3DS test
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
/* Use 3DS source */
|
/* Use 3DS source */
|
||||||
stripe.createSource(card).then(function(result) {
|
stripe.createSource(card).then(function(result) {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
// Inform the user if there was an error
|
// Inform the user if there was an error
|
||||||
var errorElement = document.getElementById('card-errors');
|
var errorElement = document.getElementById('card-errors');
|
||||||
errorElement.textContent = result.error.message;
|
errorElement.textContent = result.error.message;
|
||||||
} else {
|
} else {
|
||||||
// Send the source to your server
|
// Send the source to your server
|
||||||
stripeSourceHandler(result.source);
|
stripeSourceHandler(result.source);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user