Skip to content

Commit

Permalink
fix pipeline issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Feb 12, 2025
1 parent d0c5c9a commit 56dd714
Show file tree
Hide file tree
Showing 113 changed files with 231 additions and 110 deletions.
18 changes: 0 additions & 18 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ parameters:
count: 1
path: src/Client/HttpClient.php

-
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, array\<int\<0, max\>, float\|int\|string\> given\.$#'
identifier: argument.type
count: 1
path: src/Crypt/EstV3PosCrypt.php

-
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, list\<float\|int\|string\> given\.$#'
identifier: argument.type
count: 1
path: src/Crypt/EstV3PosCrypt.php

-
message: '#^Default value of the parameter \#3 \$order \(array\{\}\) of method Mews\\Pos\\Crypt\\PosNetCrypt\:\:createHash\(\) is incompatible with type array\{amount\: int, currency\: string, id\: string\}\.$#'
identifier: parameter.defaultValue
Expand Down Expand Up @@ -156,12 +144,6 @@ parameters:
count: 1
path: src/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapper.php

-
message: '#^Property Mews\\Pos\\DataMapper\\ResponseDataMapper\\AbstractResponseDataMapper\:\:\$secureTypeMappings \(array\<string, ''3d''\|''3d_host''\|''3d_pay''\|''3d_pay_hosting''\|''regular''\>\) does not accept non\-empty\-array\<1\|2\|3\|string, ''3d''\|''3d_host''\|''3d_pay''\|''3d_pay_hosting''\|''regular''\>\.$#'
identifier: assign.propertyType
count: 1
path: src/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapper.php

-
message: '#^Method Mews\\Pos\\Factory\\PosFactory\:\:createPosGateway\(\) should return Mews\\Pos\\PosInterface but returns object\.$#'
identifier: return.type
Expand Down
2 changes: 1 addition & 1 deletion src/Crypt/AbstractCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function buildHashString(array $data, array $paramNames, string $separ
$paramsVal = \implode($separator, $this->buildHashData($data, $paramNames));

if (null !== $storeKey) {
$paramsVal = $this->concatenateHashKey($storeKey, $paramsVal);
return $this->concatenateHashKey($storeKey, $paramsVal);
}

return $paramsVal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
abstract class AbstractRequestDataMapper implements RequestDataMapperInterface
{
protected EventDispatcherInterface $eventDispatcher;

protected RequestValueMapperInterface $valueMapper;

protected RequestValueFormatterInterface $valueFormatter;

protected CryptInterface $crypt;

protected bool $testMode = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function formatDateTime(\DateTimeInterface $dateTime, string $fieldName =
if ('timeSpan' === $fieldName) {
return $dateTime->format('YmdHis');
}

if ('transactionDate' === $fieldName) {
return $dateTime->format('Ymd');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getSecureTypeMappings(): array
*/
public function mapSecureType(string $paymentModel): string
{
if (0 === count($this->secureTypeMappings)) {
if ([] === $this->secureTypeMappings) {
throw new \LogicException('Security type mappings are not supported.');
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public function getRecurringOrderFrequencyMappings(): array
*/
public function mapRecurringFrequency(string $period): string
{
if (0 === count($this->recurringOrderFrequencyMappings)) {
if ([] === $this->recurringOrderFrequencyMappings) {
throw new \LogicException('Recurring frequency mappings are not supported.');
}

Expand All @@ -134,7 +134,7 @@ public function mapRecurringFrequency(string $period): string
*/
public function mapLang(string $lang): string
{
if (0 === count($this->langMappings)) {
if ([] === $this->langMappings) {
throw new \LogicException('Language mappings are not supported.');
}

Expand Down Expand Up @@ -162,7 +162,7 @@ public function getCardTypeMappings(): array
*/
public function mapCardType(string $cardType): string
{
if (0 === count($this->cardTypeMappings)) {
if ([] === $this->cardTypeMappings) {
throw new \LogicException('Card type mappings are not supported.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ private function mapSingleOrderHistoryTransaction(array $rawTx): array
if (null !== $transTime) {
$defaultResponse['transaction_time'] = $this->valueFormatter->formatDateTime($transTime, $txType);
}

$defaultResponse['capture_time'] = null !== $rawTx['AuthDate'] ? $this->valueFormatter->formatDateTime($rawTx['AuthDate'], $txType) : null;
$amount = $rawTx['AuthAmount'];
$defaultResponse['capture_amount'] = null !== $amount ? $this->valueFormatter->formatAmount($amount, $txType) : null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

class AbstractResponseValueFormatter implements ResponseValueFormatterInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

class BasicResponseValueFormatter extends AbstractResponseValueFormatter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\PosInterface;
Expand All @@ -17,11 +19,9 @@ public function formatInstallment(?string $installment, string $txType): int
return 0;
}

if (PosInterface::TX_TYPE_HISTORY === $txType) {
// history response
if ('Pesin' === $installment || '1' === $installment) {
return 0;
}
// history response
if (PosInterface::TX_TYPE_HISTORY === $txType && ('Pesin' === $installment || '1' === $installment)) {
return 0;
}

return parent::formatInstallment($installment, $txType);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\Exceptions\NotImplementedException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueFormatter;

use Mews\Pos\Exceptions\NotImplementedException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @license MIT
*/
Expand Down Expand Up @@ -32,15 +33,15 @@ public function __construct(
array $currencyMappings,
array $txTypeMappings,
array $secureTypeMappings
)
{
) {
if ([] !== $currencyMappings) {
$this->currencyMappings = \array_flip($currencyMappings);
}

if ([] !== $txTypeMappings) {
$this->txTypeMappings = $txTypeMappings;
}

if ([] !== $secureTypeMappings) {
$this->secureTypeMappings = \array_flip($secureTypeMappings);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @license MIT
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

class InterPosResponseValueMapper extends AbstractResponseValueMapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

class PayFlexCPV4PosResponseValueMapper extends AbstractResponseValueMapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

class PayForPosResponseValueMapper extends AbstractResponseValueMapper
{

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

class PosNetResponseValueMapper extends AbstractResponseValueMapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @license MIT
*/

namespace Mews\Pos\DataMapper\ResponseValueMapper;

use Mews\Pos\PosInterface;
Expand Down
3 changes: 1 addition & 2 deletions src/Factory/ResponseDataMapperFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public static function createGatewayResponseMapper(
ResponseValueFormatterInterface $valueFormatter,
ResponseValueMapperInterface $valueMapper,
LoggerInterface $logger
): ResponseDataMapperInterface
{
): ResponseDataMapperInterface {
$classMappings = [
AkbankPos::class => AkbankPosResponseDataMapper::class,
EstPos::class => EstPosResponseDataMapper::class,
Expand Down
1 change: 1 addition & 0 deletions src/Factory/ResponseValueFormatterFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @license MIT
*/
Expand Down
1 change: 1 addition & 0 deletions src/Factory/ResponseValueMapperFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @license MIT
*/
Expand Down
Loading

0 comments on commit 56dd714

Please sign in to comment.