<?php
declare(strict_types=1);
namespace App\Domain\Payment\Model;
use Payum\Core\Model\Identity;
use Payum\Core\Security\TokenInterface;
use Payum\Core\Security\Util\Random;
use Payum\Core\Storage\IdentityInterface;
use Symfony\Component\Uid\Uuid;
class PaymentToken implements TokenInterface
{
private string $hash;
private string $afterUrl;
private string $targetUrl;
private string $gatewayName;
private object $details;
public function __construct()
{
$this->hash = Random::generateToken();
}
public function setDetails($details): void
{
if ($details instanceof IdentityInterface && $details->getId() instanceof Uuid) {
$details = new Identity((string) $details->getId(), $details->getClass());
}
$this->details = $details;
}
public function getHash(): string
{
return $this->hash;
}
public function setHash($hash): void
{
$this->hash = $hash;
}
public function getTargetUrl(): string
{
return $this->targetUrl;
}
public function setTargetUrl($targetUrl): void
{
$this->targetUrl = $targetUrl;
}
public function getAfterUrl(): string
{
return $this->afterUrl;
}
public function setAfterUrl($afterUrl): void
{
$this->afterUrl = $afterUrl;
}
public function getGatewayName(): string
{
return $this->gatewayName;
}
public function setGatewayName($gatewayName): void
{
$this->gatewayName = $gatewayName;
}
public function getDetails(): object
{
return $this->details;
}
}