Skip to content

Commit

Permalink
fix ACH example to stop erroring with achButton not defined (#243)
Browse files Browse the repository at this point in the history
Fixes the scope of the achButton disable/enable to collaborate with the
achButton definition.

- [X] [Individual Contributor License Agreement
(CLA)](https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1)
signed
  • Loading branch information
nwilmessquare authored May 24, 2024
1 parent f053159 commit 37ef6c0
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions public/examples/ach.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,24 @@
return;
}

async function handlePaymentMethodSubmission(
event,
paymentMethod,
options,
) {
event.preventDefault();

try {
achButton.disabled = true;
await tokenize(paymentMethod, options);
} catch (e) {
achButton.disabled = false;
displayPaymentResults('FAILURE');
console.error(e.message);
if (ach) {
async function handlePaymentMethodSubmission(
event,
paymentMethod,
options,
) {
event.preventDefault();

try {
achButton.disabled = true;
await tokenize(paymentMethod, options);
} catch (e) {
achButton.disabled = false;
displayPaymentResults('FAILURE');
console.error(e.message);
}
}
}

if (ach) {
const achButton = document.getElementById('ach-button');
achButton.addEventListener('click', async function (event) {
const paymentForm = document.getElementById('payment-form');
Expand Down

0 comments on commit 37ef6c0

Please sign in to comment.