Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abhipillai committed Oct 18, 2023
1 parent e63a88f commit 6923860
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions public/examples/ach.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,32 @@
}

async function tokenize(paymentMethod, options = {}) {
paymentMethod.addEventListener('ontokenization', async function (event) {
const { tokenResult, error } = event.detail;
if (error !== undefined) {
let errorMessage = `Tokenization failed with error: ${error}`;
throw new Error(errorMessage);
}
if (tokenResult.status === 'OK') {
const paymentResults = await createPayment(tokenResult.token);
displayPaymentResults('SUCCESS');

console.debug('Payment Success', paymentResults);
} else {
let errorMessage = `Tokenization failed with status: ${tokenResult.status}`;
if (tokenResult.errors) {
errorMessage += ` and errors: ${JSON.stringify(
tokenResult.errors
)}`;
paymentMethod.addEventListener(
'ontokenization',
async function (event) {
const { tokenResult, error } = event.detail;
if (error !== undefined) {
let errorMessage = `Tokenization failed with error: ${error}`;
throw new Error(errorMessage);
}
throw new Error(errorMessage);
if (tokenResult.status === 'OK') {
const paymentResults = await createPayment(tokenResult.token);
displayPaymentResults('SUCCESS');

console.debug('Payment Success', paymentResults);
} else {
let errorMessage = `Tokenization failed with status: ${tokenResult.status}`;
if (tokenResult.errors) {
errorMessage += ` and errors: ${JSON.stringify(
tokenResult.errors
)}`;
}
throw new Error(errorMessage);
}
});
paymentMethod.tokenize(options);
}
}
);
paymentMethod.tokenize(options);
}

// status is either SUCCESS or FAILURE;
function displayPaymentResults(status) {
Expand Down Expand Up @@ -95,7 +98,11 @@
const billingContact = getBillingContact(form);
const accountHolderName = `${billingContact.givenName} ${billingContact.familyName}`;

return { accountHolderName, intent: 'CHARGE', total: { amount: 100, currencyCode: 'USD' } };
return {
accountHolderName,
intent: 'CHARGE',
total: { amount: 100, currencyCode: 'USD' },
};
}

document.addEventListener('DOMContentLoaded', async function () {
Expand Down

0 comments on commit 6923860

Please sign in to comment.