This commit is contained in:
2025-01-28 15:37:24 +01:00
parent 4c0e144aa9
commit cbf12baa7b
2 changed files with 13 additions and 11 deletions

View File

@@ -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.");
}
});
};
});
</script>
<div id="payment-request-button"></div>';

View File

@@ -6,7 +6,7 @@
"compatibility": {
"version": "7.1"
},
"version": "1.008",
"version": "1.009",
"build": 0,
"date": 0
}