giftcon_dev/resources/views/web/payments/danal/finish_top_action.blade.php

44 lines
1.3 KiB
PHP

<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>결제 처리</title>
</head>
<body>
<script>
(async function () {
const action = @json($action ?? 'close_modal', JSON_INVALID_UTF8_SUBSTITUTE);
const message = @json($message ?? '', JSON_INVALID_UTF8_SUBSTITUTE);
const title = @json($title ?? '알림', JSON_INVALID_UTF8_SUBSTITUTE);
const redirect = @json($redirect ?? '', JSON_INVALID_UTF8_SUBSTITUTE);
const topWin = window.top || window;
try {
// 1) 모달 닫기
if (action === 'close_modal' && topWin.closePayModal) {
topWin.closePayModal({ keepFrame: true });
}
// 2) 공통 알림(showMsg 우선)
if (topWin.showMsg) {
await topWin.showMsg(message, { type:'alert', title:title });
} else if (message) {
alert(message);
}
console.log('[finish] redirect=', redirect);
if (redirect) topWin.location.href = redirect;
} finally {
if (redirect) {
try { topWin.location.assign(redirect); }
catch (e) { window.location.href = redirect; }
}
}
})();
</script>
</body>
</html>