[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Adding getStatus tests
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/378257 ) Change subject: Adding getStatus tests .. Adding getStatus tests Change-Id: Ie9eb0d1b7cab92acda1f01112aa93d3c2e0a74f8 --- M ingenico_gateway/ingenico.adapter.php M tests/phpunit/Adapter/Ingenico/IngenicoTest.php M tests/phpunit/BaseIngenicoTestCase.php 3 files changed, 163 insertions(+), 226 deletions(-) Approvals: jenkins-bot: Verified Ejegg: Looks good to me, approved diff --git a/ingenico_gateway/ingenico.adapter.php b/ingenico_gateway/ingenico.adapter.php index 8570127..daa88b7 100644 --- a/ingenico_gateway/ingenico.adapter.php +++ b/ingenico_gateway/ingenico.adapter.php @@ -92,7 +92,7 @@ ) ); - $this->transactions['getHostedCheckoutStatus'] = array( + $this->transactions['getHostedPaymentStatus'] = array( 'request' => array( 'hostedCheckoutId' ), 'response' => array( 'id', @@ -151,7 +151,7 @@ case 'createHostedCheckout': $result = $provider->createHostedPayment( $data ); break; - case 'getHostedCheckoutStatus': + case 'getHostedPaymentStatus': $result = $provider->getHostedPaymentStatus( $data['hostedCheckoutId'] ); @@ -230,10 +230,10 @@ protected function getOrderStatusFromProcessor() { // FIXME: sometimes we should use getPayment - return $this->do_transaction( 'getHostedCheckoutStatus' ); + return $this->do_transaction( 'getHostedPaymentStatus' ); } - protected function post_process_getHostedCheckoutStatus() { + protected function post_process_getHostedPaymentStatus() { return parent::post_process_get_orderstatus(); } diff --git a/tests/phpunit/Adapter/Ingenico/IngenicoTest.php b/tests/phpunit/Adapter/Ingenico/IngenicoTest.php index 225d261..127afd9 100644 --- a/tests/phpunit/Adapter/Ingenico/IngenicoTest.php +++ b/tests/phpunit/Adapter/Ingenico/IngenicoTest.php @@ -95,10 +95,9 @@ } /** -* Just run the GET_ORDERSTATUS transaction and make sure we load the data +* Just run the getHostedCheckoutStatus transaction and make sure we load the data */ - function testGetOrderStatus() { - $this->markTestSkipped( 'OrderStatus not implemented' ); + function testGetHostedPaymentStatus() { $init = $this->getDonorTestData(); $init['payment_method'] = 'cc'; $init['payment_submethod'] = 'visa'; @@ -106,11 +105,60 @@ $gateway = $this->getFreshGatewayObject( $init ); - $gateway->do_transaction( 'GET_ORDERSTATUS' ); + $this->hostedCheckoutProvider->expects( $this->once() ) + ->method( 'getHostedPaymentStatus' ) + ->willReturn( + array( + "createdPaymentOutput" => array( + "payment" => array( + "id" => "008915660725016821", + "paymentOutput" => array( + "amountOfMoney" => array( + "amount" => 2345, + "currencyCode" => "USD" + ), + "references" => array( + "paymentReference" => "0" + ), + "paymentMethod" => "card", + "cardPaymentMethodSpecificOutput" => array( + "paymentProductId" => 1, + "authorisationCode" => "123456", + "card" => array( + "cardNumber" => "7977", + "expiryDate" => "1220" + ), +
[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Adding getStatus tests
Mepps has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/378257 ) Change subject: Adding getStatus tests .. Adding getStatus tests Change-Id: Ie9eb0d1b7cab92acda1f01112aa93d3c2e0a74f8 --- M tests/phpunit/Adapter/Ingenico/IngenicoTest.php M tests/phpunit/BaseIngenicoTestCase.php 2 files changed, 20 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/57/378257/1 diff --git a/tests/phpunit/Adapter/Ingenico/IngenicoTest.php b/tests/phpunit/Adapter/Ingenico/IngenicoTest.php index 225d261..8b1998c 100644 --- a/tests/phpunit/Adapter/Ingenico/IngenicoTest.php +++ b/tests/phpunit/Adapter/Ingenico/IngenicoTest.php @@ -95,10 +95,9 @@ } /** -* Just run the GET_ORDERSTATUS transaction and make sure we load the data +* Just run the getHostedCheckoutStatus transaction and make sure we load the data */ - function testGetOrderStatus() { - $this->markTestSkipped( 'OrderStatus not implemented' ); + function testGetHostedCheckoutStatus() { $init = $this->getDonorTestData(); $init['payment_method'] = 'cc'; $init['payment_submethod'] = 'visa'; @@ -106,11 +105,11 @@ $gateway = $this->getFreshGatewayObject( $init ); - $gateway->do_transaction( 'GET_ORDERSTATUS' ); + $gateway->do_transaction( 'getHostedCheckoutStatus' ); $data = $gateway->getTransactionData(); - $this->assertEquals( 'N', $data['CVVRESULT'], 'CVV Result not loaded from XML response' ); + $this->assertEquals( 'N', $data['CVVRESULT'], 'CVV Result not loaded from JSON response' ); } /** @@ -119,7 +118,6 @@ * @group CvvResult */ function testConfirmCreditCardStatus25() { - $this->markTestSkipped( 'OrderStatus not implemented' ); $init = $this->getDonorTestData(); $init['payment_method'] = 'cc'; $init['payment_submethod'] = 'visa'; @@ -128,7 +126,11 @@ $this->setUpRequest( array( 'CVVRESULT' => 'M' ) ); $gateway = $this->getFreshGatewayObject( $init ); - $gateway::setDummyGatewayResponseCode( '25' ); +$this->hostedCheckoutProvider->expects( $this->once() ) +->method( 'Confirm_CreditCard' ) +->willReturn( +'25' +); $gateway->do_transaction( 'Confirm_CreditCard' ); $action = $gateway->getValidationAction(); @@ -140,7 +142,6 @@ * fraud scores. */ function testGetOrderstatusPostProcessFraud() { - $this->markTestSkipped( 'OrderStatus not implemented' ); $this->setMwGlobals( array( 'wgDonationInterfaceEnableCustomFilters' => true, 'wgIngenicoGatewayCustomFiltersFunctions' => array( @@ -157,7 +158,11 @@ $init['payment_method'] = 'cc'; $gateway = $this->getFreshGatewayObject( $init ); - $gateway::setDummyGatewayResponseCode( '600_badCvv' ); +$this->hostedCheckoutProvider->expects( $this->once() ) +->method( 'Confirm_CreditCard' ) +->willReturn( +'600_badCvv' +); $gateway->do_transaction( 'Confirm_CreditCard' ); $action = $gateway->getValidationAction(); diff --git a/tests/phpunit/BaseIngenicoTestCase.php b/tests/phpunit/BaseIngenicoTestCase.php index e6c8901..c9d336a 100644 --- a/tests/phpunit/BaseIngenicoTestCase.php +++ b/tests/phpunit/BaseIngenicoTestCase.php @@ -81,4 +81,10 @@ ), ) ); } + + public static function getDonorTestData($country = ''){ + $data = parent::getDonorTestData($country); + $data['gateway_session_id'] = mt_rand(); + return $data; +} } -- To view, visit https://gerrit.wikimedia.org/r/378257 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie9eb0d1b7cab92acda1f01112aa93d3c2e0a74f8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Mepps___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits