Skip to content

Commit

Permalink
Fix bug in quick checkouts.
Browse files Browse the repository at this point in the history
  • Loading branch information
QualityWorks-Dev committed Oct 26, 2017
1 parent 33087b3 commit e6b3ef7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,11 @@

<script type="text/javascript">
(function ($) {
function initiateMollieConfirmClick(confirm_button_exists) {
if (confirm_button_exists) {
$("#qc_confirm_order").click(function () {
$("#mollie_payment_form").submit();
});
} else {
$("#button-confirm").click(function () {
$("#mollie_payment_form").submit();
});
}
}
// Run after pageload.
$(function () {
var issuers = $("#mollie_issuers"),
confirm_button_exists = ($("#qc_confirm_order").length > 0);
if (issuers.find("option").length == 1) {
if (issuers.find("option").length === 1) {
$.post("<?php echo $set_issuer_url; ?>", {mollie_issuer_id: issuers.val()});
}
Expand All @@ -55,18 +42,13 @@
$("#mollie_payment_form").parent().show();
}
// render after change (for ajax checkouts)
initiateMollieConfirmClick(confirm_button_exists);
return;
}
// No confirmation button found. Show our own confirmation button.
$("#button-confirm").show().click(function () {
$("#mollie_payment_form").submit();
});
// default confirm button render
initiateMollieConfirmClick(confirm_button_exists);
});
})(window.jQuery || window.$);
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,35 @@
</div>

<script type="text/javascript">
(function ($) {
function initiateMollieConfirmClick(confirm_button_exists) {
if (confirm_button_exists) {
$("#qc_confirm_order").click(function () {
$("#mollie_payment_form").submit();
});
} else {
$("#button-confirm").click(function () {
$("#mollie_payment_form").submit();
});
}
}
// Run after pageload.
$(function () {
var issuers = $("#mollie_issuers"),
confirm_button_exists = ($("#qc_confirm_order").length > 0);
if (issuers.find("option").length == 1) {
$.post("{{ set_issuer_url }}", {mollie_issuer_id: issuers.val()});
}
issuers.bind("change", function () {
$.post("{{ set_issuer_url }}", {mollie_issuer_id: $(this).val()});
});
// See if we can find a a confirmation button on the page (i.e. ajax checkouts).
if (confirm_button_exists) {
// If we have issuers, show the form.
if (issuers.length) {
$("#mollie_payment_form").parent().show();
}
// render after change (for ajax checkouts)
initiateMollieConfirmClick(confirm_button_exists);
return;
}
// No confirmation button found. Show our own confirmation button.
$("#button-confirm").show().click(function () {
$("#mollie_payment_form").submit();
});
// default confirm button render
initiateMollieConfirmClick(confirm_button_exists);
});
})(window.jQuery || window.$);
(function ($) {
$(function () {
var issuers = $("#mollie_issuers"),
confirm_button_exists = ($("#qc_confirm_order").length > 0);
if (issuers.find("option").length === 1) {
$.post("{{ set_issuer_url }}", {mollie_issuer_id: issuers.val()});
}
issuers.bind("change", function () {
$.post("{{ set_issuer_url }}", {mollie_issuer_id: $(this).val()});
});
// See if we can find a a confirmation button on the page (i.e. ajax checkouts).
if (confirm_button_exists) {
// If we have issuers, show the form.
if (issuers.length) {
$("#mollie_payment_form").parent().show();
}
return;
}
// No confirmation button found. Show our own confirmation button.
$("#button-confirm").show().click(function () {
$("#mollie_payment_form").submit();
});
});
})(window.jQuery || window.$);
</script>
</form>
</div>

0 comments on commit e6b3ef7

Please sign in to comment.