Skip to content

Commit

Permalink
styling - run rector
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed Aug 17, 2024
1 parent d2cfa26 commit d740c95
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ private function mapHistoryOrderStatus(string $txStatus, ?string $txType): ?stri
if (null === $txType) {
return null;
}

// txStatus possible values:
// Basarili
// Basarisiz
Expand All @@ -648,19 +649,23 @@ private function mapHistoryOrderStatus(string $txStatus, ?string $txType): ?stri
if (PosInterface::TX_TYPE_CANCEL === $txType) {
return PosInterface::PAYMENT_STATUS_CANCELED;
}

if (PosInterface::TX_TYPE_REFUND === $txType) {
// todo how can we decide if order is partially or fully refunded?
return PosInterface::PAYMENT_STATUS_FULLY_REFUNDED;
}

if (PosInterface::TX_TYPE_PAY_AUTH === $txType || PosInterface::TX_TYPE_PAY_POST_AUTH === $txType) {
return PosInterface::PAYMENT_STATUS_PAYMENT_COMPLETED;
}

if (PosInterface::TX_TYPE_PAY_PRE_AUTH === $txType) {
return PosInterface::PAYMENT_STATUS_PRE_AUTH_COMPLETED;
}

return null;
}

if ('Iptal' === $txStatus) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public function mapPaymentResponse(array $rawPaymentResponseData, string $txType
if (\strlen($txTime) === 10) { // ziraat is sending host date without year
$txTime = date('Y').$txTime;
}

$commonResponse['transaction_time'] = new \DateTimeImmutable($txTime);
$commonResponse['auth_code'] = $rawPaymentResponseData['AuthCode'];
$commonResponse['ref_ret_num'] = $rawPaymentResponseData['TransactionId'];
Expand Down
1 change: 1 addition & 0 deletions src/Gateways/AbstractGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ public function refund(array $order): PosInterface
if (isset($order['order_amount']) && $order['amount'] < $order['order_amount']) {
$txType = PosInterface::TX_TYPE_REFUND_PARTIAL;
}

$requestData = $this->requestDataMapper->createRefundRequestData($this->account, $order, $txType);

$event = new RequestDataPreparedEvent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/**
* @covers \Mews\Pos\DataMapper\ResponseDataMapper\GarantiPosResponseDataMapper
* @covers \Mews\Pos\DataMapper\ResponseDataMapper\AbstractResponseDataMapper
*/
class GarantiPosResponseDataMapperTest extends TestCase
{
Expand Down Expand Up @@ -1789,6 +1790,7 @@ public static function historyTestDataProvider(): \Generator
new \DateTimeZone($item['transaction_time']['timezone'])
);
}

if (null !== $item['capture_time']) {
$item['capture_time'] = new \DateTimeImmutable(
$item['capture_time']['date'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD
} else {
$this->assertEquals($expectedData['transaction_time'], $actualData['transaction_time']);
}

unset($actualData['transaction_time'], $expectedData['transaction_time']);

$this->assertArrayHasKey('3d_all', $actualData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/**
* @covers \Mews\Pos\DataMapper\ResponseDataMapper\VakifKatilimPosResponseDataMapper
* @covers \Mews\Pos\DataMapper\ResponseDataMapper\AbstractResponseDataMapper
*/
class VakifKatilimPosResponseDataMapperTest extends TestCase
{
Expand Down Expand Up @@ -220,16 +221,22 @@ public function testMapHistoryResponseWithALotOfTxs(): void
$actualData = $this->responseDataMapper->mapHistoryResponse(json_decode($responseData, true));

$this->assertCount(31, $actualData['transactions']);
if (count($actualData['transactions']) <= 1) {
return;
}

if (count($actualData['transactions']) > 1
&& null !== $actualData['transactions'][0]['transaction_time']
&& null !== $actualData['transactions'][1]['transaction_time']
) {
$this->assertGreaterThan(
$actualData['transactions'][0]['transaction_time'],
$actualData['transactions'][1]['transaction_time'],
);
if (null === $actualData['transactions'][0]['transaction_time']) {
return;
}

if (null === $actualData['transactions'][1]['transaction_time']) {
return;
}

$this->assertGreaterThan(
$actualData['transactions'][0]['transaction_time'],
$actualData['transactions'][1]['transaction_time'],
);
}


Expand Down

0 comments on commit d740c95

Please sign in to comment.