Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,17 @@ function redirectToEndUrl(returnUrl) {
}
if (secondsLeft === 0) {
setTimeout(function () {
window.location.href = returnUrl.toString();
try {
window.top.location.href = returnUrl.toString();
} catch (error) {
console.error(
"CRITICAL ERROR",
"Failed to redirect top document. Error - ",
error
);
console.info("Redirecting in current document");
window.location.href = returnUrl.toString();
}
}, 1000);
}
}, i * 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@
</svg>
</div>
<script>
{{logging_template}}
{{locale_template}}
{{rendered_js}}
{{payment_link_initiator}}
{{logging_template}}
</script>
{{ hyperloader_sdk_link }}
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if (!isFramed) {
});
var type =
paymentDetails.sdk_layout === "spaced_accordion" ||
paymentDetails.sdk_layout === "accordion"
paymentDetails.sdk_layout === "accordion"
? "accordion"
: paymentDetails.sdk_layout;

Expand Down Expand Up @@ -103,6 +103,35 @@ if (!isFramed) {
arr.splice(0, 3);
arr.unshift("status");
arr.unshift("payment_link");
window.location.href = window.location.origin + "/" + arr.join("/")+ "?locale=" + paymentDetails.locale;
let returnUrl =
window.location.origin +
"/" +
arr.join("/") +
"?locale=" +
paymentDetails.locale;
try {
window.top.location.href = returnUrl;

// Push logs to logs endpoint
} catch (error) {
var url = window.location.href;
var { paymentId, merchantId, attemptId, connector } = parseRoute(url);
var urlToPost = getEnvRoute(url);
var message = {
message: "CRITICAL ERROR - Failed to redirect top document. Falling back to redirecting using window.location",
reason: error.message,
}
var log = {
message,
url,
paymentId,
merchantId,
attemptId,
connector,
};
postLog(log, urlToPost);

window.location.href = returnUrl;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800"
/>
<script>
{{logging_template}}
{{locale_template}}
{{ rendered_js }}
{{logging_template}}
</script>
</head>
<body onload="boot()">
Expand Down
Loading