Skip to content

Commit

Permalink
Version fix
Browse files Browse the repository at this point in the history
  • Loading branch information
krzGablo committed Jan 23, 2024
1 parent 891f480 commit ced024e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
19 changes: 10 additions & 9 deletions Model/ApiFacade/CardTransaction/CardOpen.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function __construct(TpayInterface $tpay, TpayTokensService $tokensServic
$this->tpayApi->authorization()->setClientName(implode(
'|',
[
'magento2:' . $this->getMagentoVersion(),
'tpay-com/tpay-openapi-php:' . $versions[0],
'tpay-com/tpay-php:' . $versions[1],
'PHP:' . phpversion()
'magento2:'.$this->getMagentoVersion(),
'tpay-com/tpay-openapi-php:'.$versions[0],
'tpay-com/tpay-php:'.$versions[1],
'PHP:'.phpversion(),
]
));
}
Expand Down Expand Up @@ -89,9 +89,9 @@ private function processSavedCardPayment(string $orderId, int $cardId): string
$paymentResult = $result['payments'] ?? [];

if (isset($paymentResult['status']) && 'declined' === $paymentResult['status']) {
$this->tpayService->addCommentToHistory($orderId, 'Failed to pay by saved card, Elavon rejection code: ' .$paymentResult['reason']);
$this->tpayService->addCommentToHistory($orderId, 'Failed to pay by saved card, Elavon rejection code: '.$paymentResult['reason']);
} else {
$this->tpayService->addCommentToHistory($orderId, 'Failed to pay by saved card, error: ' .$paymentResult['err_desc']);
$this->tpayService->addCommentToHistory($orderId, 'Failed to pay by saved card, error: '.$paymentResult['err_desc']);
}
} catch (Exception $e) {
return 'magento2basic/tpay/error';
Expand Down Expand Up @@ -132,7 +132,7 @@ private function processNewCardPayment(string $orderId, array $additionalPayment

if (isset($result['transactionPaymentUrl']) && 'pending' === $result['payments']['status']) {
$url3ds = $result['transactionPaymentUrl'];
$this->tpayService->addCommentToHistory($orderId, '3DS Transaction link ' .$url3ds);
$this->tpayService->addCommentToHistory($orderId, '3DS Transaction link '.$url3ds);
$this->addToPaymentData($orderId, 'transaction_url', $url3ds);
$this->saveCard($orderId, $saveCard, $additionalPaymentInformation);

Expand Down Expand Up @@ -204,10 +204,11 @@ private function getMagentoVersion()

private function getPackagesVersions()
{
$dir = __DIR__ .'/../../composer.json';
$dir = __DIR__.'/../../composer.json';
if (file_exists($dir)) {
$composerJson = json_decode(
file_get_contents(__DIR__ .'/../../composer.json'), true
file_get_contents(__DIR__.'/../../composer.json'),
true
)['require'] ?? [];

return [$composerJson['tpay-com/tpay-openapi-php'], $composerJson['tpay-com/tpay-php']];
Expand Down
13 changes: 7 additions & 6 deletions Model/ApiFacade/OpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public function __construct(TpayInterface $tpay)
$this->tpayApi->authorization()->setClientName(implode(
'|',
[
'magento2:' . $this->getMagentoVersion(),
'tpay-com/tpay-openapi-php:' . $versions[0],
'tpay-com/tpay-php:' . $versions[1],
'PHP:' . phpversion()
'magento2:'.$this->getMagentoVersion(),
'tpay-com/tpay-openapi-php:'.$versions[0],
'tpay-com/tpay-php:'.$versions[1],
'PHP:'.phpversion(),
]
));
}
Expand Down Expand Up @@ -195,10 +195,11 @@ private function getMagentoVersion()

private function getPackagesVersions()
{
$dir = __DIR__ .'/../../composer.json';
$dir = __DIR__.'/../../composer.json';
if (file_exists($dir)) {
$composerJson = json_decode(
file_get_contents(__DIR__ .'/../../composer.json'), true
file_get_contents(__DIR__.'/../../composer.json'),
true
)['require'] ?? [];

return [$composerJson['tpay-com/tpay-openapi-php'], $composerJson['tpay-com/tpay-php']];
Expand Down

0 comments on commit ced024e

Please sign in to comment.