Skip to content

Commit

Permalink
tests - improve get3DFormData tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Nov 16, 2024
1 parent 970b98c commit 3d546af
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
1 change: 0 additions & 1 deletion tests/Functional/ToslaPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro
$this->pos->customQuery($customQuery, 'https://prepentegrasyon.tosla.com/api/Payment/GetCommissionAndInstallmentInfo');

$response = $this->pos->getResponse();
dump($response);
$this->assertIsArray($response);
$this->assertNotEmpty($response);
$this->assertArrayHasKey('BankCode', $response);
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Gateways/AkbankPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ public static function threeDFormDataProvider(): iterable
'order' => AkbankPosRequestDataMapperTest::threeDFormDataProvider()['3d_pay_form_data']['order'],
'paymentModel' => PosInterface::MODEL_3D_PAY,
'txType' => PosInterface::TX_TYPE_PAY_AUTH,
'isWithCard' => false,
'isWithCard' => true,
'formData' => AkbankPosRequestDataMapperTest::threeDFormDataProvider()['3d_pay_form_data']['expected'],
'gateway_url' => 'https://virtualpospaymentgateway.akbank.com/securepay',
];
Expand All @@ -873,7 +873,7 @@ public static function threeDFormDataProvider(): iterable
'order' => AkbankPosRequestDataMapperTest::threeDFormDataProvider()['3d_form_data']['order'],
'paymentModel' => PosInterface::MODEL_3D_SECURE,
'txType' => PosInterface::TX_TYPE_PAY_AUTH,
'isWithCard' => false,
'isWithCard' => true,
'formData' => AkbankPosRequestDataMapperTest::threeDFormDataProvider()['3d_form_data']['expected'],
'gateway_url' => 'https://virtualpospaymentgateway.akbank.com/securepay',
];
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Gateways/EstPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ public function testInit(): void
public function testGet3DFormData(
bool $isWithCard
): void {
$card = $isWithCard ? $this->card : null;
$order = ['id' => '124'];
$paymentModel = PosInterface::MODEL_3D_SECURE;
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$card = $isWithCard ? $this->card : null;
$paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST;
$order = ['id' => '124'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;

$this->requestMapperMock->expects(self::once())
->method('create3DFormData')
Expand Down
9 changes: 4 additions & 5 deletions tests/Unit/Gateways/GarantiPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,14 @@ public function testInit(): void

/**
* @testWith [true]
* [false]
*/
public function testGet3DFormData(
bool $isWithCard
): void {
$card = $isWithCard ? $this->card : null;
$order = ['id' => '124'];
$paymentModel = PosInterface::MODEL_3D_SECURE;
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$card = $isWithCard ? $this->card : null;
$paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST;
$order = ['id' => '124'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;

$this->requestMapperMock->expects(self::once())
->method('create3DFormData')
Expand Down
11 changes: 6 additions & 5 deletions tests/Unit/Gateways/InterPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ public function testInit(): void
public function testGet3DFormData(
bool $isWithCard
): void {
$card = $isWithCard ? $this->card : null;
$order = ['id' => '124'];
$paymentModel = PosInterface::MODEL_3D_SECURE;
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$card = $isWithCard ? $this->card : null;
$paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST;
$gatewayUrl = $isWithCard ? 'https://test.inter-vpos.com.tr/mpi/Default.aspx' : 'https://test.inter-vpos.com.tr/mpi/3DHost.aspx';
$order = ['id' => '124'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;

$this->requestMapperMock->expects(self::once())
->method('create3DFormData')
Expand All @@ -165,7 +166,7 @@ public function testGet3DFormData(
$order,
$paymentModel,
$txType,
'https://test.inter-vpos.com.tr/mpi/Default.aspx',
$gatewayUrl,
$card
)
->willReturn(['formData']);
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Gateways/PayFlexCPV4PosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function testGet3DFormDataSuccess(): void
{
$enrollmentResponse = PayFlexCPV4PosRequestDataMapperTest::threeDFormDataProvider()->current()['queryParams'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$paymentModel = PosInterface::MODEL_3D_SECURE;
$paymentModel = PosInterface::MODEL_3D_PAY;
$requestData = ['request-data'];
$card = $this->card;
$order = $this->order;
Expand Down Expand Up @@ -207,7 +207,7 @@ public function testGet3DFormDataSuccess(): void
public function testGet3DFormDataEnrollmentFail(): void
{
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$paymentModel = PosInterface::MODEL_3D_SECURE;
$paymentModel = PosInterface::MODEL_3D_PAY;
$card = $this->card;
$order = $this->order;
$requestData = ['request-data'];
Expand Down
1 change: 0 additions & 1 deletion tests/Unit/Gateways/PayForTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ public function testSetTestMode(): void

/**
* @testWith [true, "3d", "https://vpostest.qnbfinansbank.com/Gateway/Default.aspx"]
* [false, "3d", "https://vpostest.qnbfinansbank.com/Gateway/Default.aspx"]
* [false, "3d_host", "https://vpostest.qnbfinansbank.com/Gateway/3DHost.aspx"]
*/
public function testGet3DFormData(
Expand Down
3 changes: 1 addition & 2 deletions tests/Unit/Gateways/PosNetV1PosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,14 @@ public function testGetApiURLException(): void

/**
* @testWith [true]
* [false]
*/
public function testGet3DFormData(
bool $isWithCard
): void
{
$card = $isWithCard ? $this->card : null;
$paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST;
$order = ['id' => '124'];
$paymentModel = PosInterface::MODEL_3D_SECURE;
$txType = PosInterface::TX_TYPE_PAY_AUTH;

$this->requestMapperMock->expects(self::once())
Expand Down

0 comments on commit 3d546af

Please sign in to comment.