{"id":1391,"date":"2026-04-09T20:04:38","date_gmt":"2026-04-09T20:04:38","guid":{"rendered":"https:\/\/rafty.dk\/redirect-test-copy\/"},"modified":"2026-04-09T20:38:36","modified_gmt":"2026-04-09T20:38:36","slug":"redirect","status":"publish","type":"page","link":"https:\/\/rafty.dk\/da\/redirect\/","title":{"rendered":"Redirect"},"content":{"rendered":"<script>\n\nfunction updatePaymentStatus(_status){\n\n}\t\n\ndocument.addEventListener(\"DOMContentLoaded\", function(e) {\t\n\tconst urlParams = new URLSearchParams(window.location.search);\n\tlet order_id = urlParams.get('order_id');\n\tlet bookingId = sessionStorage.getItem('bookingId');\n\tlet debug = false;\n\tlet count = 0;\n\tif (debug) console.log(\"bookingId: \" + bookingId);\n\tif (!order_id || bookingId == null){\n\t\twindow.location.replace(\"\/\");\n\t}else{\n\t\tconst checkInterval = setInterval(async () => {\n\t\t\ttry {\n\t\t\t\t\/\/ Kald din egen PHP-fil, som tjekker databasen\n\t\t\t\tconst rawResponse = await fetch('\/wp-content\/plugins\/rafty-booking\/rafty_check_status.php', {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: {\n\t\t\t\t\t'Accept': 'application\/json',\n\t\t\t\t\t'Content-Type': 'application\/json'\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify({booking_id: bookingId})\n\t\t\t\t});\n\t\t\t\tconst content = await rawResponse.json();\n\t\t\t\tif (content.result != \"ok\" || content.last_access_datetime != \"0000-00-00 00:00\"){\n\t\t\t\t\tclearTimeout(checkInterval);\n\t\t\t\t\twindow.location.replace(\"\/\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (content.payment_status === 'AUTHORIZED') {\n\t\t\t\t\tclearTimeout(checkInterval);\n\t\t\t\t\twindow.location.href = \"\/payment-authorized\";\n\t\t\t\t}else\n\t\t\t\tif (content.payment_status === 'ERROR') {\n\t\t\t\t\tsessionStorage.setItem('error',  content.error);\n\t\t\t\t\tclearTimeout(checkInterval);\n\t\t\t\t\twindow.location.href = \"\/payment-error\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} catch (error) {\n\t\t\t\tclearTimeout(checkInterval);\n\t\t\t\tconsole.error(\"Fejl ved tjek af status:\", error);\n\t\t\t}\n\t\t}, 2000);\t\t\t\t\n\t}\n});\n\n<\/script>\n<div class=\"loader\"><\/div>\n<h2>Vi bekr\u00e6fter din betaling...<\/h2>\n<p>Vent et \u00f8jeblik, mens vi modtager bekr\u00e6ftelsen fra appen<\/p>\n\n\n<!-- wp:themify-builder\/canvas \/-->","protected":false},"excerpt":{"rendered":"","protected":false},"author":5,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1391","page","type-page","status-publish","hentry","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"builder_content":"","_links":{"self":[{"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/pages\/1391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/comments?post=1391"}],"version-history":[{"count":5,"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/pages\/1391\/revisions"}],"predecessor-version":[{"id":1396,"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/pages\/1391\/revisions\/1396"}],"wp:attachment":[{"href":"https:\/\/rafty.dk\/da\/wp-json\/wp\/v2\/media?parent=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}