Stripe Elements: Fix incorrect JavaScript and display loading indicator

This commit is contained in:
Raphael Michel
2017-11-24 09:42:26 +01:00
parent 65592dc42d
commit a62105fa28
3 changed files with 9 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ $(function () {
$(".checkout-button-row .btn-primary").click(
function (e) {
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[type=checkbox][name=payment]").length === 0)
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[type=checkbox][name=radio]").length === 0)
&& $("#stripe_token").val() == "") {
pretixstripe.start();
e.preventDefault();

View File

@@ -28,6 +28,9 @@ var pretixstripe = {
});
},
'load': function () {
if (pretixstripe.stripe !== null) {
return;
}
$('.stripe-container').closest("form").find(".btn-primary").prop("disabled", true);
$.ajax(
{
@@ -66,6 +69,9 @@ var pretixstripe = {
);
},
'load_checkout': function () {
if (pretixstripe.checkout_handler !== null) {
return;
}
$('.stripe-container').closest("form").find(".btn-primary").prop("disabled", true);
$.ajax(
{
@@ -151,7 +157,7 @@ $(function () {
$('.stripe-container').closest("form").submit(
function () {
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[name=payment][type=checkbox]").length === 0)
if (($("input[name=payment][value=stripe]").prop('checked') || $("input[name=payment][type=radio]").length === 0)
&& $("#stripe_token").val() == "") {
if ($("#stripe-checkout").length) {
pretixstripe.show_checkout();

View File

@@ -31,6 +31,7 @@
{% endif %}
<div id="stripe-card" class="form-control">
<span class="fa fa-spinner fa-spin"></span>
<!-- a Stripe Element will be inserted here. -->
</div>
<p class="help-block">