Version 2.0.0 Beta

This commit is contained in:
2025-04-29 07:20:42 +02:00
parent 51de28b1c0
commit b7bb55b7fa
37 changed files with 3557 additions and 164 deletions

View File

@@ -0,0 +1,67 @@
# Manager_1
Beschreibung des Moduls.
### Inhaltsverzeichnis
1. [Funktionsumfang](#1-funktionsumfang)
2. [Voraussetzungen](#2-voraussetzungen)
3. [Software-Installation](#3-software-installation)
4. [Einrichten der Instanzen in IP-Symcon](#4-einrichten-der-instanzen-in-ip-symcon)
5. [Statusvariablen und Profile](#5-statusvariablen-und-profile)
6. [WebFront](#6-webfront)
7. [PHP-Befehlsreferenz](#7-php-befehlsreferenz)
### 1. Funktionsumfang
*
### 2. Voraussetzungen
- IP-Symcon ab Version 7.1
### 3. Software-Installation
* Über den Module Store das 'Manager_1'-Modul installieren.
* Alternativ über das Module Control folgende URL hinzufügen
### 4. Einrichten der Instanzen in IP-Symcon
Unter 'Instanz hinzufügen' kann das 'Manager_1'-Modul mithilfe des Schnellfilters gefunden werden.
- Weitere Informationen zum Hinzufügen von Instanzen in der [Dokumentation der Instanzen](https://www.symcon.de/service/dokumentation/konzepte/instanzen/#Instanz_hinzufügen)
__Konfigurationsseite__:
Name | Beschreibung
-------- | ------------------
|
|
### 5. Statusvariablen und Profile
Die Statusvariablen/Kategorien werden automatisch angelegt. Das Löschen einzelner kann zu Fehlfunktionen führen.
#### Statusvariablen
Name | Typ | Beschreibung
------ | ------- | ------------
| |
| |
#### Profile
Name | Typ
------ | -------
|
|
### 6. WebFront
Die Funktionalität, die das Modul im WebFront bietet.
### 7. PHP-Befehlsreferenz
`boolean GEF_BeispielFunktion(integer $InstanzID);`
Erklärung der Funktion.
Beispiel:
`GEF_BeispielFunktion(12345);`

View File

@@ -0,0 +1,22 @@
{
"elements":[
{
"type": "SelectVariable",
"name": "Reservate",
"caption": "Betrag reservieren",
"test": true
},
{
"type": "SelectVariable",
"name": "GetAmount",
"caption": "Betrag Abziehen",
"test": true
},
{
"type": "SelectVariable",
"name": "HTMLBox",
"caption": "HTMLBox",
"test": true
}
]
}

View File

@@ -0,0 +1,12 @@
{
"id": "{466A36DA-3C90-06E8-1D57-161D921B45EE}",
"name": "Belevo_Bezahl_Modul",
"type": 3,
"vendor": "Belevo AG",
"aliases": [],
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "GEF",
"url": ""
}

View File

@@ -0,0 +1,126 @@
<?php
class Belevo_Bezahl_Modul extends IPSModule
{
public function Create()
{
parent::Create();
$this->RegisterPropertyInteger("Reservate", 0);
$this->RegisterPropertyInteger("GetAmount", 0);
$this->RegisterPropertyInteger("HTMLBox", 0);
$this->RegisterVariableInteger("ReservationAmount", "ReservationAmount", '', 0);
$this->RegisterVariableBoolean("AmountIsReserved", "AmountIsReserved", '', false);
}
public function ApplyChanges()
{
parent::ApplyChanges();
$this->SetHTMLContent();
}
private function SetHTMLContent()
{
$apiKey = "pk_test_51Qkr79LJAcsNrpivA90lt7ULEzyXKR8l0pAqTBgfeuAIWlsLS4A3BdIBITc9UooFANbImvlJQ2F2jOZ0X5j8GI7Q00hNNasvQm"; // Test-API-Schlüssel
$html = "<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Google Pay mit Stripe</title>
<!-- Stripe.js -->
<script src='https://js.stripe.com/v3/'></script>
<!-- Google Pay API -->
<script src='https://pay.google.com/gp/p/js/pay.js' async></script>
</head>
<body>
<h1>Google Pay Integration mit Stripe</h1>
<button id='google-pay-button'>Mit Google Pay bezahlen</button>
<script>
// Stripe initialisieren
const stripe = Stripe('pk_test_51Qkr79LJAcsNrpivA90lt7ULEzyXKR8l0pAqTBgfeuAIWlsLS4A3BdIBITc9UooFANbImvlJQ2F2jOZ0X5j8GI7Q00hNNasvQm'); // Ersetze mit deinem Stripe-Publishable-Key
const googlePayButton = document.getElementById('google-pay-button');
// Google Pay-Konfiguration
const googlePayConfig = {
apiVersion: 2,
apiVersionMinor: 0,
allowedPaymentMethods: [
{
type: 'CARD',
parameters: {
allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
allowedCardNetworks: ['VISA', 'MASTERCARD'],
},
tokenizationSpecification: {
type: 'PAYMENT_GATEWAY',
parameters: {
gateway: 'stripe',
'stripe:version': '2020-08-27',
'stripe:publishableKey': 'pk_test_51Qkr79LJAcsNrpivA90lt7ULEzyXKR8l0pAqTBgfeuAIWlsLS4A3BdIBITc9UooFANbImvlJQ2F2jOZ0X5j8GI7Q00hNNasvQm', // Ersetze hier ebenfalls
},
},
},
],
merchantInfo: {
merchantId: 'TEST', // Für Testumgebungen
merchantName: 'Dein Unternehmen',
},
transactionInfo: {
totalPriceStatus: 'FINAL',
totalPrice: '100.00', // Betrag in CHF
currencyCode: 'CHF',
},
};
// Eventlistener für den Google Pay-Button
googlePayButton.addEventListener('click', async () => {
try {
const googlePayClient = new google.payments.api.PaymentsClient({ environment: 'TEST' });
// Prüfen, ob Google Pay verfügbar ist
const isReadyToPay = await googlePayClient.isReadyToPay(googlePayConfig);
if (!isReadyToPay.result) {
alert('Google Pay ist auf diesem Gerät nicht verfügbar.');
return;
}
// Google Pay PaymentData abrufen
const paymentData = await googlePayClient.loadPaymentData(googlePayConfig);
// Token aus dem PaymentData extrahieren
const paymentToken = paymentData.paymentMethodData.tokenizationData.token;
// Token an das Backend senden
const response = await fetch('/path-to-your-backend.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token: paymentToken }),
});
const result = await response.json();
if (result.clientSecret) {
// Zahlung mit Stripe abschließen
const stripeResult = await stripe.confirmCardPayment(result.clientSecret);
if (stripeResult.error) {
alert('Zahlung fehlgeschlagen: ' + stripeResult.error.message);
} else if (stripeResult.paymentIntent && stripeResult.paymentIntent.status === 'succeeded') {
alert('Zahlung erfolgreich abgeschlossen!');
}
} else {
alert('Ein Fehler ist im Backend aufgetreten.');
}
} catch (error) {
console.error('Fehler bei der Zahlung:', error);
alert('Ein Fehler ist aufgetreten: ' + error.message);
}
});
</script>
</body>
</html>";
SetValue($this->ReadPropertyInteger("HTMLBox"), $html);
}
}