diff --git a/Model/ApiFacade/Refund/RefundApiFacade.php b/Model/ApiFacade/Refund/RefundApiFacade.php index 713de5a..88720f6 100755 --- a/Model/ApiFacade/Refund/RefundApiFacade.php +++ b/Model/ApiFacade/Refund/RefundApiFacade.php @@ -25,7 +25,7 @@ public function __construct(TpayInterface $tpay) { $this->tpay = $tpay; $this->createRefundOriginApiInstance($tpay); - $this->createOpenApiInstance($tpay->getOpenApiClientId(), $tpay->getOpenApiPassword(), !$tpay->useSandboxMode()); + $this->createOpenApiInstance($tpay); } public function makeRefund(InfoInterface $payment, float $amount) @@ -54,11 +54,10 @@ private function createRefundOriginApiInstance(TpayInterface $tpay) } } - private function createOpenApiInstance(string $clientId, string $apiPassword, bool $isProd) + private function createOpenApiInstance(TpayInterface $tpay) { try { - $this->openApi = new OpenApi($clientId, $apiPassword, $isProd); - $this->openApi->authorization(); + $this->openApi = new OpenApi($tpay); $this->useOpenApi = true; } catch (Exception $exception) { $this->openApi = null; diff --git a/Model/ApiFacade/Transaction/TransactionApiFacade.php b/Model/ApiFacade/Transaction/TransactionApiFacade.php index eece2d6..cc2ffe8 100755 --- a/Model/ApiFacade/Transaction/TransactionApiFacade.php +++ b/Model/ApiFacade/Transaction/TransactionApiFacade.php @@ -137,8 +137,7 @@ private function createOpenApiInstance(TpayInterface $tpay) } try { - $this->openApi = new OpenApi($tpay->getOpenApiClientId(), $tpay->getOpenApiPassword(), !$tpay->useSandboxMode()); - $this->openApi->authorization(); + $this->openApi = new OpenApi($tpay); $this->useOpenApi = true; } catch (Exception $exception) { $this->openApi = null;