Skip to content

Commit

Permalink
payflexv4pos - throw exception for unimplemented methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed Aug 17, 2024
1 parent d936c4e commit b333850
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Crypt/PayFlexCPV4Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function create3DHash(AbstractPosAccount $posAccount, array $requestData)
*/
public function check3DHash(AbstractPosAccount $posAccount, array $data): bool
{
return true;
throw new NotImplementedException();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ public function map3DPaymentData(array $raw3DAuthResponseData, ?array $rawPaymen
*/
public function map3DPayResponseData(array $raw3DAuthResponseData, string $txType, array $order): array
{
return $this->map3DPaymentData($raw3DAuthResponseData, $raw3DAuthResponseData, $txType, $order);
throw new NotImplementedException();
}

/**
* {@inheritdoc}
*/
public function map3DHostResponseData(array $raw3DAuthResponseData, string $txType, array $order): array
{
return $this->map3DPayResponseData($raw3DAuthResponseData, $txType, $order);
throw new NotImplementedException();
}

/**
Expand Down
19 changes: 17 additions & 2 deletions tests/Unit/Crypt/PayFlexCP4CryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

use Mews\Pos\Crypt\PayFlexCPV4Crypt;
use Mews\Pos\Entity\Account\PayFlexAccount;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\AccountFactory;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;

/**
* @covers \Mews\Pos\Crypt\PayFlexCPV4Crypt
* @covers \Mews\Pos\Crypt\AbstractCrypt
*/
class PayFlexCP4CryptTest extends TestCase
{
Expand Down Expand Up @@ -47,7 +49,20 @@ public function testCreate3DHash(array $requestData, string $expected): void
$this->assertSame($expected, $actual);
}

public function hashCreateDataProvider(): array
public function testCreateHash(): void
{
$this->expectException(NotImplementedException::class);
$this->crypt->createHash($this->account, []);
}

public function testCheck3DHash(): void
{
$this->expectException(NotImplementedException::class);

$this->crypt->check3DHash($this->account, []);
}

public static function hashCreateDataProvider(): array
{
return [
[
Expand All @@ -62,7 +77,7 @@ public function hashCreateDataProvider(): array
];
}

public function threeDHashCreateDataProvider(): array
public static function threeDHashCreateDataProvider(): array
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,18 @@ public function testCreate3DFormData(): void
$this->assertEquals($expectedValue, $actualData);
}

public function testCreateOrderHistoryRequestData(): void
{
$this->expectException(\Mews\Pos\Exceptions\NotImplementedException::class);
$this->requestDataMapper->createOrderHistoryRequestData($this->account, []);
}

public function testCreateHistoryRequestData(): void
{
$this->expectException(\Mews\Pos\Exceptions\NotImplementedException::class);
$this->requestDataMapper->createHistoryRequestData($this->account, []);
}

/**
* @return array
*/
Expand Down

0 comments on commit b333850

Please sign in to comment.