Skip to content

Commit

Permalink
Merge pull request #317 from OXID-eSales/b-6.3.x-card-prevent-empy-UN…
Browse files Browse the repository at this point in the history
…ZER-484

B 6.3.x card prevent empy unzer 484
  • Loading branch information
mariolorenz authored Sep 12, 2024
2 parents 6a91d50 + cc233ed commit 2e09b71
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- fix: only OK, NOT_FINISHED or CANCEL in oxorder->oxtranstatus allowed
- fix showing correct amount when cancelling in admin
- default Amount for Unzer Payments between 1 Euro and 10.000 Euros
- prevent clicking buy now if no new or vaulted creditcard are selected

## [1.1.3] - 2023-11-14

Expand Down
32 changes: 30 additions & 2 deletions views/frontend/tpl/order/unzer_card.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
<script>
[{/if}]
[{capture assign="unzerCardJS"}]
let newCardCheckbox = $('input[name="newccard"]');
let savedCardsTableEl = $('#payment-saved-cards');
let paymentFormCardEl = $('#payment-form-card');
Expand All @@ -104,7 +103,6 @@
});
orderConfirmAgbBottom.submit(function(event) {
if ($(this).hasClass('new-card-selected') && !$(this).hasClass("submitable")) {
event.preventDefault();
paymentFormCardEl.submit();
Expand Down Expand Up @@ -231,7 +229,37 @@
}
[{/capture}]
[{capture assign="unzerCardPreventEmpty"}]
const submitButton = document.querySelector("#orderConfirmAgbBottom button.submitButton");
const radioButtons = document.querySelectorAll('input[type="radio"].paymenttypeid');
const overrideCheckbox1 = document.getElementById("oscunzersavepayment");
const overrideCheckbox2 = document.getElementById("newccard");
function updateSubmitButtonState() {
const isRadioSelected = Array.from(radioButtons).some(radio => radio.checked);
const isAnyCheckboxChecked = (overrideCheckbox1 && overrideCheckbox1.checked) ||
(overrideCheckbox2 && overrideCheckbox2.checked);
submitButton.disabled = !(isRadioSelected || isAnyCheckboxChecked);
}
if (radioButtons.length > 0) {
submitButton.disabled = true;
radioButtons.forEach(radio => {
radio.addEventListener('change', updateSubmitButtonState);
});
if (overrideCheckbox1) {
overrideCheckbox1.addEventListener('change', updateSubmitButtonState);
}
if (overrideCheckbox2) {
overrideCheckbox2.addEventListener('change', updateSubmitButtonState);
}
}
[{/capture}]
[{if false}]
</script>
[{/if}]
[{oxscript add=$unzerCardJS}]
[{oxscript add=$unzerCardPreventEmpty}]

0 comments on commit 2e09b71

Please sign in to comment.