2022-03-25 14:28:27 +01:00
|
|
|
window.addEventListener('load', function() {
|
2022-04-12 15:09:28 +02:00
|
|
|
|
|
|
|
const getSessionIdFromJson = () => {
|
|
|
|
const form = document.querySelector('form.checkout');
|
|
|
|
if(!form) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-25 14:28:27 +01:00
|
|
|
const fncls = document.querySelector("[fncls='fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99']");
|
|
|
|
const fncls_params = JSON.parse(fncls.textContent);
|
2022-03-24 16:27:03 +01:00
|
|
|
|
2022-04-12 15:09:28 +02:00
|
|
|
if(document.querySelector("[name='fraudnet-session-id']") !== null) {
|
|
|
|
document.querySelector("[name='fraudnet-session-id']").remove();
|
|
|
|
}
|
|
|
|
|
2022-03-25 14:28:27 +01:00
|
|
|
const fraudnetSessionId = document.createElement('input');
|
|
|
|
fraudnetSessionId.setAttribute('type', 'hidden');
|
|
|
|
fraudnetSessionId.setAttribute('name', 'fraudnet-session-id');
|
|
|
|
fraudnetSessionId.setAttribute('value', fncls_params.f);
|
|
|
|
|
|
|
|
form.appendChild(fraudnetSessionId);
|
2022-04-12 15:09:28 +02:00
|
|
|
console.log(fncls_params)
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener('hosted_fields_loaded', (event) => {
|
|
|
|
getSessionIdFromJson();
|
|
|
|
});
|
2022-03-25 14:28:27 +01:00
|
|
|
|
2022-04-12 15:09:28 +02:00
|
|
|
getSessionIdFromJson();
|
2022-03-25 14:28:27 +01:00
|
|
|
})
|
2022-03-24 16:27:03 +01:00
|
|
|
|