Skip to content

Commit

Permalink
Cleanup and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
s4ddly committed Jan 8, 2024
1 parent 519f55b commit 7b7a5f6
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 468 deletions.
6 changes: 3 additions & 3 deletions Model/ApiFacade/OpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ public function create(array $data): array
return $this->updateRedirectUrl($transaction);
}

public function createWithInstantRedirect(array $data)
public function createWithInstantRedirect(array $data): array
{
$transactionData = $this->handleDataStructure($data);
$transaction = $this->transactions()->createTransactionWithInstantRedirection($transactionData);

return $this->updateRedirectUrl($transaction);
}

public function makeRefund(InfoInterface $payment, string $amount): array
public function makeRefund(InfoInterface $payment, float $amount): array
{
return $this->Transactions->createRefundByTransactionId(['amount' => number_format($amount, 2)], $payment->getAdditionalInformation('transaction_id'));
return $this->transactions()->createRefundByTransactionId(['amount' => $amount], $payment->getAdditionalInformation('transaction_id'));
}

public function channels(): array
Expand Down
5 changes: 0 additions & 5 deletions Model/ApiFacade/TpayConfig/ConfigFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ class ConfigFacade

/** @var bool */
private $useOpenApi;
/**
* @var TpayInterface
*/
private $tpay;

public function __construct(TpayInterface $tpay, Repository $assetRepository, TpayTokensService $tokensService)
{
$this->tpay = $tpay;
$this->originApi = new ConfigOrigin($tpay, $assetRepository, $tokensService);
$this->createOpenApiInstance($tpay, $assetRepository, $tokensService);
}
Expand Down
10 changes: 5 additions & 5 deletions Model/ApiFacade/Transaction/TransactionApiFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ public function __construct(TpayInterface $tpay, CacheInterface $cache)
$this->cache = $cache;
}

public function isOpenApiUse()
public function isOpenApiUse(): bool
{
return $this->useOpenApi;
}

public function create(array $config)
public function create(array $config): array
{
return $this->getCurrentApi()->create($config);
}

public function createWithInstantRedirection(array $config)
public function createWithInstantRedirection(array $config): array
{
if (!$this->useOpenApi) {
throw new TpayException('OpenAPI not availabile - Failed to create transaction with instant redirection');
Expand All @@ -51,7 +51,7 @@ public function createWithInstantRedirection(array $config)
return $this->openApi->createWithInstantRedirect($config);
}

public function blik($blikTransactionId, $blikCode)
public function blik($blikTransactionId, $blikCode): array
{
return $this->originApi->blik($blikTransactionId, $blikCode);
}
Expand All @@ -72,7 +72,7 @@ public function channels(): array
return $channel['available'] === true && empty($channel['constraints']) === true;
});

$this->cache->save(json_encode($channels), self::CHANNELS_CACHE_KEY, []);
$this->cache->save(json_encode($channels), self::CHANNELS_CACHE_KEY, [], self::CACHE_LIFETIME);

return $channels;
}
Expand Down
120 changes: 0 additions & 120 deletions Model/GenericOnSiteConfigProvider.php

This file was deleted.

Loading

0 comments on commit 7b7a5f6

Please sign in to comment.