-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PSPAYPAL-879 remove bug with vaulting checkout button
- Loading branch information
René Gust
committed
Jan 9, 2025
1 parent
0afa9f6
commit 706bbb1
Showing
6 changed files
with
38 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
resources/build/js/paypal-frontend-paypal-vault-checkout.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function registerClickListenerForSavedVaultRadioButtons() { | ||
document.querySelectorAll(".vaulting_paymentsource").forEach(function (paymentsource) { | ||
paymentsource.onclick = function () { | ||
if (paymentsource.checked) { | ||
document.getElementById("paypalVaultCheckoutButton").disabled = false; | ||
} | ||
}; | ||
}); | ||
} | ||
|
||
// clicking the vault checkout button will submit the form for payment | ||
function registerClickListenerForTheVaultCheckoutButton() { | ||
document.getElementById("paypalVaultCheckoutButton").onclick = function () { | ||
document.querySelectorAll(".vaulting_paymentsource").forEach(function (paymentsource) { | ||
if (paymentsource.checked) { | ||
document.getElementById("payment_oscpaypal").click(); | ||
|
||
let input = document.createElement("input"); | ||
input.type = "hidden"; | ||
input.name = "vaultingpaymentsource"; | ||
input.value = paymentsource.dataset.index; | ||
document.getElementById("payment").appendChild(input); | ||
|
||
document.getElementById("paymentNextStepBottom").click(); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", function() { | ||
registerClickListenerForSavedVaultRadioButtons(); | ||
registerClickListenerForTheVaultCheckoutButton(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters