diff --git a/src/api/VariableSymbolApiHandler.php b/src/api/VariableSymbolApiHandler.php index 6e3a076..691ee45 100644 --- a/src/api/VariableSymbolApiHandler.php +++ b/src/api/VariableSymbolApiHandler.php @@ -29,7 +29,7 @@ public function params() */ public function handle(ApiAuthorizationInterface $authorization) { - $response = new JsonResponse(['status' => 'ok', 'variable_symbol' => $this->variableSymbol->getNew()]); + $response = new JsonResponse(['status' => 'ok', 'variable_symbol' => $this->variableSymbol->getNew(null)]); $response->setHttpCode(Response::S200_OK); return $response; diff --git a/src/model/Repositories/PaymentsRepository.php b/src/model/Repositories/PaymentsRepository.php index acd15f7..5cfb753 100644 --- a/src/model/Repositories/PaymentsRepository.php +++ b/src/model/Repositories/PaymentsRepository.php @@ -110,7 +110,7 @@ final public function add( 'status' => self::STATUS_FORM, 'created_at' => new DateTime(), 'modified_at' => new DateTime(), - 'variable_symbol' => $variableSymbol ? $variableSymbol : $this->variableSymbol->getNew(), + 'variable_symbol' => $variableSymbol ? $variableSymbol : $this->variableSymbol->getNew($paymentGateway), 'ip' => Request::getIp(), 'user_agent' => Request::getUserAgent(), 'referer' => $referer, diff --git a/src/model/Repositories/VariableSymbol.php b/src/model/Repositories/VariableSymbol.php index 3b8a105..bb74a1a 100644 --- a/src/model/Repositories/VariableSymbol.php +++ b/src/model/Repositories/VariableSymbol.php @@ -4,12 +4,13 @@ use Crm\ApplicationModule\Repository; use Crm\PaymentsModule\VariableSymbolInterface; +use Nette\Database\Table\ActiveRow; class VariableSymbol extends Repository implements VariableSymbolInterface { protected $tableName = 'variable_symbols'; - public function getNew(): string + public function getNew(?ActiveRow $paymentGateway): string { do { $variableSymbol = $this->generateRandom(); diff --git a/src/model/VariableSymbolInterface.php b/src/model/VariableSymbolInterface.php index 01c1ab6..9055a6f 100644 --- a/src/model/VariableSymbolInterface.php +++ b/src/model/VariableSymbolInterface.php @@ -2,7 +2,9 @@ namespace Crm\PaymentsModule; +use Nette\Database\Table\ActiveRow; + interface VariableSymbolInterface { - public function getNew(): string; + public function getNew(?ActiveRow $paymentGateway): string; }