From cbf12baa7bc8c93f3454d1d13a6d748c3fec207f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fliger?= Date: Tue, 28 Jan 2025 15:37:24 +0100 Subject: [PATCH] asdf --- Belevo_Bezahl_Modul/module.php | 22 ++++++++++++---------- library.json | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Belevo_Bezahl_Modul/module.php b/Belevo_Bezahl_Modul/module.php index 7f6d796..ef91df8 100644 --- a/Belevo_Bezahl_Modul/module.php +++ b/Belevo_Bezahl_Modul/module.php @@ -81,22 +81,24 @@ class Belevo_Bezahl_Modul extends IPSModule paymentRequest.on("token", function(ev) { // Send the token to your server to charge it! - fetch("/charges", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({token: ev.token.id}), - }).then(function(response) { - if (response.ok) { + var xhr = new XMLHttpRequest(); + xhr.open("POST", "/api/"); + xhr.setRequestHeader("Content-Type", "application/json"); + xhr.send(JSON.stringify({ + "jsonrpc": "2.0", + "method": "SetValue", + "params": [' . $this->GetIDForIdent("AmountIsReserved") . ', true], + "id": 0 + })); + xhr.onload = function() { + if (xhr.status === 200) { ev.complete("success"); - SetValueBoolean(' . $this->GetIDForIdent("AmountIsReserved") . ', true); IPS_LogMessage("Belevo_Bezahl_Modul", "Reservierung erfolgreich."); } else { ev.complete("fail"); IPS_LogMessage("Belevo_Bezahl_Modul", "Reservierung fehlgeschlagen."); } - }); + }; });
'; diff --git a/library.json b/library.json index d0ead9a..cfcb75c 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "1.008", + "version": "1.009", "build": 0, "date": 0 } \ No newline at end of file