- ProviderInterface/AbstractProvider: Vorgang mit Uhrzeit+Session (payment_transactions), Mail und Warenkorb erst nach Zahlung, idempotentes markPaid, Betragsabgleich, shop_event + PG payment_log - Secrets verschluesselt (libsodium) in MySQL, Schluessel ausserhalb Docroot - Cashdesk: ?payment_return/?payment_cancel, Pending-Riegel, zahlung_erst_spaeter() - Backend Zahlart-Editor: Einstellungen speichern (war ohne Empfaenger), Secret-Felder - payment_webhook.php (Standalone), cli.php (init-key, secret, reconcile, status) - PayPal-v2-Blaupause vom Juli entfernt
44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Payments;
|
|
|
|
/**
|
|
* Ergebnis von onReturn()/onCancel(): sagt dem Cashdesk, was er dem Kunden zeigt.
|
|
*/
|
|
final class Result
|
|
{
|
|
public const PAID = 'paid'; // bezahlt -> Erfolgsseite
|
|
public const CANCELLED = 'cancelled'; // Kunde hat abgebrochen -> Kasse mit Hinweis
|
|
public const PENDING = 'pending'; // Anbieter noch nicht fertig -> Hinweis, Abgleicher zieht nach
|
|
public const ERROR = 'error'; // Fehler -> Hinweis, Warenkorb bleibt
|
|
|
|
public function __construct(
|
|
public readonly string $status,
|
|
public readonly int $orderId = 0,
|
|
public readonly string $orderNumber = '',
|
|
public readonly string $message = ''
|
|
) {
|
|
}
|
|
|
|
public static function paid(int $orderId, string $orderNumber): self
|
|
{
|
|
return new self(self::PAID, $orderId, $orderNumber);
|
|
}
|
|
|
|
public static function cancelled(int $orderId = 0, string $orderNumber = ''): self
|
|
{
|
|
return new self(self::CANCELLED, $orderId, $orderNumber);
|
|
}
|
|
|
|
public static function pending(int $orderId, string $orderNumber, string $message): self
|
|
{
|
|
return new self(self::PENDING, $orderId, $orderNumber, $message);
|
|
}
|
|
|
|
public static function error(string $message, int $orderId = 0, string $orderNumber = ''): self
|
|
{
|
|
return new self(self::ERROR, $orderId, $orderNumber, $message);
|
|
}
|
|
}
|