This commit is contained in:
Benjamin Beganović 2021-10-20 16:30:15 +02:00
parent c97b176171
commit 6711ab71e4

View File

@ -43,28 +43,12 @@ class SquareCreditCard {
} }
} }
// ,
// function(err,verification) {
// if (err == null) {
// console.log("no error");
// console.log(verification);
// verificationToken = verificationResults.token;
// }
// console.log(err);
// die("verify buyer");
// }
async completePaymentWithoutToken(e) { async completePaymentWithoutToken(e) {
document.getElementById('errors').hidden = true; document.getElementById('errors').hidden = true;
e.target.parentElement.disabled = true; e.target.parentElement.disabled = true;
let result = await this.card.tokenize(); let result = await this.card.tokenize();
console.log('square token = ' + result.token);
/* SCA */ /* SCA */
let verificationToken; let verificationToken;
@ -79,8 +63,6 @@ class SquareCreditCard {
intent: 'CHARGE', intent: 'CHARGE',
}; };
console.log(verificationDetails);
const verificationResults = await this.payments.verifyBuyer( const verificationResults = await this.payments.verifyBuyer(
result.token, result.token,
verificationDetails verificationDetails
@ -88,14 +70,8 @@ class SquareCreditCard {
verificationToken = verificationResults.token; verificationToken = verificationResults.token;
} catch (typeError) { } catch (typeError) {
console.error(typeError);
e.target.parentElement.disabled = true e.target.parentElement.disabled = true
} }
// console.log(" verification tokem = " + verificationToken.token);
// verificationToken = verificationResults.token;
console.debug('Verification Token:', verificationToken);
document.querySelector( document.querySelector(
'input[name="verificationToken"]' 'input[name="verificationToken"]'
@ -131,8 +107,6 @@ class SquareCreditCard {
/* SCA */ /* SCA */
async verifyBuyer(token) { async verifyBuyer(token) {
console.log('in verify buyer');
const verificationDetails = { const verificationDetails = {
amount: document.querySelector('meta[name=amount]').content, amount: document.querySelector('meta[name=amount]').content,
billingContact: document.querySelector('meta[name=square_contact]') billingContact: document.querySelector('meta[name=square_contact]')
@ -147,8 +121,6 @@ class SquareCreditCard {
verificationDetails verificationDetails
); );
console.log(' verification toke = ' + verificationResults.token);
return verificationResults.token; return verificationResults.token;
} }