1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Change klarna integration according to Klarna's rules

This commit is contained in:
Lars Kusch 2022-12-08 08:55:58 +01:00 committed by GitHub
parent aecec21630
commit 0714228781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,16 +33,6 @@ class ProcessKlarna {
return this;
};
handleError = (message) => {
document.getElementById('pay-now').disabled = false;
document.querySelector('#pay-now > svg').classList.add('hidden');
document.querySelector('#pay-now > span').classList.remove('hidden');
this.errors.textContent = '';
this.errors.textContent = message;
this.errors.hidden = false;
};
handle = () => {
document.getElementById('pay-now').addEventListener('click', (e) => {
let errors = document.getElementById('errors');
@ -56,15 +46,15 @@ class ProcessKlarna {
{
payment_method: {
billing_details: {
name: document.getElementById("klarna-name").value,
email: document.querySelector('meta[name=email').content,
name: document.querySelector('meta[name=name]').content,
email: document.querySelector('meta[name=email]').content,
address: {
line1: document.querySelector('input[name=address1]').value,
line2: document.querySelector('input[name=address2]').value,
city: document.querySelector('input[name=city]').value,
postal_code: document.querySelector('input[name=postal_code]').value,
state: document.querySelector('input[name=state]').value,
country: document.querySelector('meta[name=country').content,
line1: document.querySelector('meta[name=address-1]').content,
line2: document.querySelector('meta[name=address-2]').content,
city: document.querySelector('meta[name=city]').content,
postal_code: document.querySelector('meta[name=plz]').content,
state: document.querySelector('meta[name=state]').content,
country: document.querySelector('meta[name=country]').content,
}
},
},
@ -72,12 +62,7 @@ class ProcessKlarna {
'meta[name="return-url"]'
).content,
}
).then((result) => {
if (result.hasOwnProperty('error')) {
return this.handleError(result.error.message);
}
});;
);
});
};
}