Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/368832 )
Change subject: Merge commit '14ed96cff' into deployment ...................................................................... Merge commit '14ed96cff' into deployment 14ed96cff Order sequence numbers start at 1, not 0 Change-Id: If6394218de80458cf0efa2ea7105f332bd23eca9 --- D tests/phpunit/Adapter/Adyen/AdyenApiTest.php D tests/phpunit/Adapter/Adyen/AdyenTest.php D tests/phpunit/Adapter/Amazon/AmazonApiTest.php D tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php D tests/phpunit/includes/Responses/amazon/authorize.json D tests/phpunit/includes/Responses/amazon/authorizeOnBillingAgreement.json D tests/phpunit/includes/Responses/amazon/authorize_AmazonRejected.json D tests/phpunit/includes/Responses/amazon/authorize_InvalidPaymentMethod.json D tests/phpunit/includes/Responses/amazon/authorize_TransactionTimedOut.json D tests/phpunit/includes/Responses/amazon/getBillingAgreementDetails.json D tests/phpunit/includes/Responses/amazon/getCaptureDetails.json D tests/phpunit/includes/Responses/amazon/setBillingAgreementDetails.json D tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse D tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_OK.testresponse 15 files changed, 0 insertions(+), 1,718 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/32/368832/1 diff --git a/tests/phpunit/Adapter/Adyen/AdyenApiTest.php b/tests/phpunit/Adapter/Adyen/AdyenApiTest.php deleted file mode 100644 index 6c855d1..0000000 --- a/tests/phpunit/Adapter/Adyen/AdyenApiTest.php +++ /dev/null @@ -1,156 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -<?php -use Psr\Log\LogLevel; -use SmashPig\PaymentProviders\Adyen\Tests\AdyenTestConfiguration; -use SmashPig\Tests\TestingContext; - -/** - * @group Fundraising - * @group DonationInterface - * @group Adyen - * @group DonationInterfaceApi - * @group medium - */ -class AdyenApiTest extends DonationInterfaceApiTestCase { - - public function setUp() { - parent::setUp(); - $ctx = TestingContext::get(); - $ctx->providerConfigurationOverride = - AdyenTestConfiguration::createWithSuccessfulApi( - $ctx->getGlobalConfiguration() - ); - $this->setMwGlobals( array( - 'wgAdyenGatewayEnabled' => true, - 'wgAdyenGatewayTestingURL' => 'https://example.org', - ) ); - } - - public function testGoodSubmit() { - $init = $this->getDonorData(); - - $apiResult = $this->doApiRequest( $init ); - $result = $apiResult[0]['result']; - $this->assertTrue( empty( $result['errors'] ) ); - - $this->assertEquals( - 'https://example.org/hpp/pay.shtml', - $result['formaction'], - 'Adyen API not setting correct formaction' - ); - $expectedParams = array( - 'allowedMethods' => 'card', - 'card.cardHolderName' => 'Firstname Surname', - 'currencyCode' => 'USD', - 'merchantAccount' => 'wikitest', - 'merchantReference' => '1.1', - 'offset' => '20', - 'paymentAmount' => '155', - 'skinCode' => 'testskin', - 'shopperLocale' => 'en_US', - 'shopperEmail' => 'g...@innocent.com', - 'billingAddress.street' => '123 Fake Street', - 'billingAddress.city' => 'NA', - 'billingAddress.stateOrProvince' => 'NA', - 'billingAddress.postalCode' => '94105', - 'billingAddress.country' => 'US', - 'billingAddressType' => '2', - 'billingAddress.houseNumberOrName' => 'NA' - ); - $actualParams = $result['gateway_params']; - unset ( $actualParams['sessionValidity'] ); - unset ( $actualParams['shipBeforeDate'] ); - unset ( $actualParams['merchantSig'] ); - $this->assertEquals( - $expectedParams, - $actualParams, - 'Adyen API not setting correct gateway_params' - ); - $message = DonationQueue::instance()->pop( 'pending' ); - $this->assertNotNull( $message, 'Not sending a message to the pending queue' ); - DonationInterfaceTestCase::unsetVariableFields( $message ); - $expected = array( - 'gateway_txn_id' => false, - 'response' => false, - 'fee' => 0, - 'utm_source' => '..cc', - 'language' => 'en', - 'email' => 'g...@innocent.com', - 'first_name' => 'Firstname', - 'last_name' => 'Surname', - 'country' => 'US', - 'gateway' => 'adyen', - 'order_id' => '1.1', - 'recurring' => '', - 'payment_method' => 'cc', - 'payment_submethod' => 'visa', - 'currency' => 'USD', - 'gross' => '1.55', - 'user_ip' => '127.0.0.1', - 'street_address' => '123 Fake Street', - 'postal_code' => '94105', - 'risk_score' => 20 - ); - $this->assertArraySubset( $expected, $message ); - $message = DonationQueue::instance()->pop( 'pending' ); - $this->assertNull( $message, 'Sending extra pending messages' ); - $logged = DonationInterfaceTestCase::getLogMatches( - LogLevel::INFO, '/^Redirecting for transaction: /' - ); - $this->assertEquals( 1, count( $logged ), 'Should have logged details once' ); - preg_match( '/Redirecting for transaction: (.*)$/', $logged[0], $matches ); - $detailString = $matches[1]; - $actual = json_decode( $detailString, true ); - $this->assertArraySubset( $expected, $actual, 'Logged the wrong stuff!' ); - } - - public function testTooSmallDonation() { - $init = $this->getDonorData(); - $init['amount'] = 0.75; - - $apiResult = $this->doApiRequest( $init ); - $result = $apiResult[0]['result']; - $this->assertNotEmpty( $result['errors'], 'Should have returned an error' ); - $this->assertNotEmpty( $result['errors']['amount'], 'Error should be in amount' ); - $message = DonationQueue::instance()->pop( 'pending' ); - $this->assertNull( $message, 'Sending pending message for error' ); - $logged = DonationInterfaceTestCase::getLogMatches( - LogLevel::INFO, '/^Redirecting for transaction: /' - ); - $this->assertEmpty( $logged, 'Logs are a lie, we did not redirect' ); - } - - public function testMissingPostalCode() { - $init = $this->getDonorData(); - unset ( $init['postal_code'] ); - - $apiResult = $this->doApiRequest( $init ); - $result = $apiResult[0]['result']; - $this->assertNotEmpty( $result['errors'], 'Should have returned an error' ); - $this->assertNotEmpty( - $result['errors']['postal_code'], - 'Error should be in postal_code' - ); - $message = DonationQueue::instance()->pop( 'pending' ); - $this->assertNull( $message, 'Sending pending message for error' ); - $logged = DonationInterfaceTestCase::getLogMatches( - LogLevel::INFO, '/^Redirecting for transaction: /' - ); - $this->assertEmpty( $logged, 'Logs are a lie, we did not redirect' ); - } - - protected function getDonorData() { - $init = DonationInterfaceTestCase::getDonorTestData(); - $init['email'] = 'g...@innocent.com'; - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['gateway'] = 'adyen'; - $init['action'] = 'donate'; - // The US form doesn't have these two as we can look them up by zip - unset ( $init['city'] ); - unset ( $init['state_province'] ); - return $init; - } -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/Adapter/Adyen/AdyenTest.php b/tests/phpunit/Adapter/Adyen/AdyenTest.php deleted file mode 100644 index 27d3f5b..0000000 --- a/tests/phpunit/Adapter/Adyen/AdyenTest.php +++ /dev/null @@ -1,213 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -<?php -/** - * Wikimedia Foundation - * - * LICENSE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -use SmashPig\PaymentProviders\Adyen\Tests\AdyenTestConfiguration; -use SmashPig\Tests\TestingContext; -use Wikimedia\TestingAccessWrapper; - -/** - * - * @group Fundraising - * @group DonationInterface - * @group Adyen - */ -class DonationInterface_Adapter_Adyen_Test extends DonationInterfaceTestCase { - - /** - * @param $name string The name of the test case - * @param $data array Any parameters read from a dataProvider - * @param $dataName string|int The name or index of the data set - */ - public function __construct( $name = null, array $data = array(), $dataName = '' ) { - parent::__construct( $name, $data, $dataName ); - $this->testAdapterClass = 'TestingAdyenAdapter'; - } - - public function setUp() { - parent::setUp(); - TestingContext::get()->providerConfigurationOverride = - AdyenTestConfiguration::createWithSuccessfulApi( - $this->smashPigGlobalConfig - ); - - $this->setMwGlobals( array( - 'wgAdyenGatewayEnabled' => true, - ) ); - } - - /** - * Integration test to verify that the donate transaction works as expected when all necessary data is present. - */ - function testDoTransactionDonate() { - $init = $this->getDonorTestData(); - $init['payment_submethod'] = 'visa'; - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->do_transaction( 'donate' ); - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $ret = $exposed->buildRequestParams(); - - $expected = array ( - 'allowedMethods' => 'card', - 'billingAddress.street' => $init['street_address'], - 'billingAddress.city' => $init['city'], - 'billingAddress.postalCode' => $init['postal_code'], - 'billingAddress.stateOrProvince' => $init['state_province'], - 'billingAddress.country' => $init['country'], - 'billingAddress.houseNumberOrName' => 'NA', - 'billingAddressType' => 2, - 'card.cardHolderName' => $init['first_name'] . ' ' . $init['last_name'], - 'currencyCode' => $init['currency'], - 'merchantAccount' => 'wikitest', - 'merchantReference' => $exposed->getData_Staged( 'order_id' ), - 'merchantSig' => $exposed->getData_Staged( 'hpp_signature' ), - 'paymentAmount' => ($init['amount']) * 100, -// 'sessionValidity' => '2014-03-09T19:41:50+00:00', //commenting out, because this is a problem. -// 'shipBeforeDate' => $exposed->getData_Staged( 'expiration' ), //this too. - 'skinCode' => 'testskin', - 'shopperLocale' => 'en_US', - 'shopperEmail' => 'nob...@wikimedia.org', - 'offset' => '52', //once we construct the FraudFiltersTestCase, it should land here. - ); - - //deal with problem keys. - //@TODO: Refactor gateway so these are more testable - $problems = array ( - 'sessionValidity', - 'shipBeforeDate', - ); - - foreach ( $problems as $oneproblem ) { - if ( isset( $ret[$oneproblem] ) ) { - unset( $ret[$oneproblem] ); - } - } - - $this->assertEquals( $expected, $ret, 'Adyen "donate" transaction not constructing the expected redirect URL' ); - $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), "Adyen order_id is null, and we need one for 'merchantReference'" ); - } - - function testRiskScoreAddedToQueueMessage() { - $init = $this->getDonorTestData(); - $init['payment_submethod'] = 'visa'; - $gateway = $this->getFreshGatewayObject( $init ); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $exposed->risk_score = 57; - $message = $exposed->getQueueDonationMessage(); - $this->assertEquals( 57, $message['risk_score'], 'Risk score was not correctly added to queue message.' ); - } - - /** - * Make sure language is staged correctly when qs param is uppercase - */ - function testLanguageCaseSensitivity() { - $init = $this->getDonorTestData(); - $init['payment_submethod'] = 'visa'; - $init['language'] = 'FR'; - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->do_transaction( 'donate' ); - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $ret = $exposed->buildRequestParams(); - - $expected = array ( - 'allowedMethods' => 'card', - 'billingAddress.street' => $init['street_address'], - 'billingAddress.city' => $init['city'], - 'billingAddress.postalCode' => $init['postal_code'], - 'billingAddress.stateOrProvince' => $init['state_province'], - 'billingAddress.country' => $init['country'], - 'billingAddress.houseNumberOrName' => 'NA', - 'billingAddressType' => 2, - 'card.cardHolderName' => $init['first_name'] . ' ' . $init['last_name'], - 'currencyCode' => $init['currency'], - 'merchantAccount' => 'wikitest', - 'merchantReference' => $exposed->getData_Staged( 'order_id' ), - 'merchantSig' => $exposed->getData_Staged( 'hpp_signature' ), - 'paymentAmount' => ($init['amount']) * 100, - 'skinCode' => 'testskin', - 'shopperLocale' => 'fr_US', - 'shopperEmail' => 'nob...@wikimedia.org', - 'offset' => '52', - ); - - //deal with problem keys. - //@TODO: Refactor gateway so these are more testable - $problems = array ( - 'sessionValidity', - 'shipBeforeDate', - ); - - foreach ( $problems as $oneproblem ) { - if ( isset( $ret[$oneproblem] ) ) { - unset( $ret[$oneproblem] ); - } - } - - $this->assertEquals( $expected, $ret, 'Adyen "donate" transaction not constructing the expected redirect URL' ); - $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), "Adyen order_id is null, and we need one for 'merchantReference'" ); - } - - public function testDonorReturnSuccess() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['language'] = 'FR'; - $init['order_id'] = '55555'; - $session['Donor'] = $init; - $this->setUpRequest( $init, $session ); - $gateway = $this->getFreshGatewayObject( array() ); - $result = $gateway->processDonorReturn( array( - 'authResult' => 'AUTHORISED', - 'merchantReference' => '55555.1', - 'merchantSig' => 'NPG6j/g5LVORxSXb8WLegoG6e2Fd7D4986p736yozbI=', - 'paymentMethod' => 'visa', - 'pspReference' => '123987612346789', - 'shopperLocale' => 'fr_FR', - 'skinCode' => 'testskin', - 'title' => 'Special:AdyenGatewayResult' - ) ); - $this->assertFalse( $result->isFailed() ); - $this->assertEmpty( $result->getErrors() ); - // TODO inspect the queue message - } - - public function testDonorReturnFailure() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['language'] = 'FR'; - $init['order_id'] = '55555'; - $session['Donor'] = $init; - $this->setUpRequest( $init, $session ); - $gateway = $this->getFreshGatewayObject( array() ); - $result = $gateway->processDonorReturn( array( - 'authResult' => 'REFUSED', - 'merchantReference' => '55555.1', - 'merchantSig' => 's8t3037BPcWl8niWHsrnwOXh+EqdPHmKyaLHYLf1tz4=', - 'paymentMethod' => 'visa', - 'pspReference' => '123987612346789', - 'shopperLocale' => 'fr_FR', - 'skinCode' => 'testskin', - 'title' => 'Special:AdyenGatewayResult' - ) ); - $this->assertTrue( $result->isFailed() ); - } -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/Adapter/Amazon/AmazonApiTest.php b/tests/phpunit/Adapter/Amazon/AmazonApiTest.php deleted file mode 100644 index 8c2f4f8..0000000 --- a/tests/phpunit/Adapter/Amazon/AmazonApiTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -<?php -use SmashPig\Tests\TestingContext; -use SmashPig\Tests\TestingGlobalConfiguration; - -/** - * @group Amazon - * @group DonationInterface - * @group DonationInterfaceApi - * @group Fundraising - * @group medium - */ -class AmazonApiTest extends DonationInterfaceApiTestCase { - public function setUp() { - parent::setUp(); - TestingAmazonAdapter::$mockClient = new MockAmazonClient(); - } - - public function tearDown() { - TestingAmazonAdapter::$mockClient = null; - parent::tearDown(); - } - - public function testDoPaymentSuccess() { - $params = array( - 'amount' => '1.55', - 'currency' => 'USD', - 'recurring' => '0', - 'wmf_token' => 'e601502632e5e51dc2a17a0045162272+\\', - 'orderReferenceId' => mt_rand( 0, 10000000 ), - 'action' => 'di_amazon_bill', - ); - $session = array( - 'Donor' => array( - 'amount' => '1.55', - 'currency' => 'USD', - 'recurring' => '0', - 'contribution_tracking_id' => mt_rand( 0, 10000000 ), - 'country' => 'US', - ), - 'amazonEditToken' => 'kjaskdjahsdkjsad', - ); - $apiResult = $this->doApiRequest( $params, $session ); - $redirect = $apiResult[0]['redirect']; - $this->assertEquals( 'https://wikimediafoundation.org/wiki/Thank_You/en?country=US', $redirect ); - $mockClient = TestingAmazonAdapter::$mockClient; - $setOrderReferenceDetailsArgs = $mockClient->calls['setOrderReferenceDetails'][0]; - $oid = $session['Donor']['contribution_tracking_id'] . '-1'; - $this->assertEquals( $oid, $setOrderReferenceDetailsArgs['seller_order_id'], 'Did not set order id on order reference' ); - $this->assertEquals( $params['amount'], $setOrderReferenceDetailsArgs['amount'], 'Did not set amount on order reference' ); - - $this->assertEquals( $params['currency'], $setOrderReferenceDetailsArgs['currency_code'], 'Did not set currency code on order reference' ); - $message = DonationQueue::instance()->pop( 'donations' ); - $this->assertNotNull( $message, 'Not sending a message to the donations queue' ); - $this->assertEquals( 'S01-0391295-0674065-C095112', $message['gateway_txn_id'], 'Queue message has wrong txn ID' ); - } -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php deleted file mode 100644 index 08ae0e9..0000000 --- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php +++ /dev/null @@ -1,641 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -<?php -/** - * Wikimedia Foundation - * - * LICENSE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -use Psr\Log\LogLevel; -use Wikimedia\TestingAccessWrapper; - -/** - * - * @group Fundraising - * @group DonationInterface - * @group GlobalCollect - */ -class DonationInterface_Adapter_GlobalCollect_GlobalCollectTest extends DonationInterfaceTestCase { - public function setUp() { - parent::setUp(); - - $this->setMwGlobals( array( - 'wgGlobalCollectGatewayEnabled' => true, - 'wgDonationInterfaceAllowedHtmlForms' => array( - 'cc-vmad' => array( - 'gateway' => 'globalcollect', - 'payment_methods' => array('cc' => array( 'visa', 'mc', 'amex', 'discover' )), - 'countries' => array( - '+' => array( 'US', ), - ), - ), - ), - ) ); - } - - /** - * @param $name string The name of the test case - * @param $data array Any parameters read from a dataProvider - * @param $dataName string|int The name or index of the data set - */ - function __construct( $name = null, array $data = array(), $dataName = '' ) { - parent::__construct( $name, $data, $dataName ); - $this->testAdapterClass = 'TestingGlobalCollectAdapter'; - } - - /** - * testnormalizeOrderID - * Non-exhaustive integration tests to verify that order_id - * normalization works as expected with different settings and - * conditions in theGlobalCollect adapter - * @covers GatewayAdapter::normalizeOrderID - */ - public function testNormalizeOrderID() { - $request = $this->getDonorTestData(); - $externalData = $this->getDonorTestData(); - $session = array( 'Donor' => $this->getDonorTestData() ); - - //no order_id from anywhere, explicit no generate - $gateway = $this->getFreshGatewayObject( $externalData, array ( 'order_id_meta' => array ( 'generate' => FALSE ) ) ); - $this->assertFalse( $gateway->getOrderIDMeta( 'generate' ), 'The order_id meta generate setting override is not working properly. Deferred order_id generation may be broken.' ); - $this->assertNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Failed asserting that an absent order id is left as null, when not generating our own' ); - - //no order_id from anywhere, explicit generate - $gateway = $this->getFreshGatewayObject( $externalData, array ( 'order_id_meta' => array ( 'generate' => TRUE ) ) ); - $this->assertTrue( $gateway->getOrderIDMeta( 'generate' ), 'The order_id meta generate setting override is not working properly. Self order_id generation may be broken.' ); - $this->assertInternalType( 'numeric', $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Generated order_id is not numeric, which it should be for GlobalCollect' ); - - // conflicting order_id in request and session, default GC generation - $request['order_id'] = '55555'; - $session['Donor']['order_id'] = '44444'; - $this->setUpRequest( $request, $session ); - $gateway = new TestingGlobalCollectAdapter(); - $this->assertEquals( '55555', $gateway->getData_Unstaged_Escaped( 'order_id' ), 'GlobalCollect gateway is preferring session data over the request. Session should be secondary.' ); - - // conflicting order_id in request and session, garbage data in request, default GC generation - $request['order_id'] = 'nonsense!'; - $this->setUpRequest( $request, $session ); - $gateway = new TestingGlobalCollectAdapter(); - $this->assertEquals( '44444', $gateway->getData_Unstaged_Escaped( 'order_id' ), 'GlobalCollect gateway is not ignoring nonsensical order_id candidates' ); - - // order_id in session, default GC generation - unset( $request['order_id'] ); - $this->setUpRequest( $request, $session ); - $gateway = new TestingGlobalCollectAdapter(); - $this->assertEquals( '44444', $gateway->getData_Unstaged_Escaped( 'order_id' ), 'GlobalCollect gateway is not recognizing the session order_id' ); - - // conflicting order_id in external data, request and session, explicit GC generation, batch mode - $request['order_id'] = '33333'; - $externalData['order_id'] = '22222'; - $this->setUpRequest( $request, $session ); - $gateway = $this->getFreshGatewayObject( $externalData, array ( 'order_id_meta' => array ( 'generate' => true ), 'batch_mode' => true ) ); - $this->assertEquals( $externalData['order_id'], $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Failed asserting that an extrenally provided order id is being honored in batch mode' ); - - //make sure that decimal numbers are rejected by GC. Should be a toss and regen - $externalData['order_id'] = '2143.1'; - unset( $request['order_id'] ); - unset( $session['Donor']['order_id'] ); - $this->setUpRequest( $request, $session ); - //conflicting order_id in external data, request and session, explicit GC generation, batch mode - $gateway = $this->getFreshGatewayObject( $externalData, array ( 'order_id_meta' => array ( 'generate' => true, 'disallow_decimals' => true ), 'batch_mode' => true ) ); - $this->assertNotEquals( $externalData['order_id'], $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Failed assering that a decimal order_id was regenerated, when disallow_decimals is true' ); - } - - /** - * Non-exhaustive integration tests to verify that order_id, when in - * self-generation mode, won't regenerate until it is told to. - * @covers GatewayAdapter::normalizeOrderID - * @covers GatewayAdapter::regenerateOrderID - */ - function testStickyGeneratedOrderID() { - $init = self::$initial_vars; - unset( $init['order_id'] ); - - //no order_id from anywhere, explicit generate - $gateway = $this->getFreshGatewayObject( $init, array ( 'order_id_meta' => array ( 'generate' => TRUE ) ) ); - $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Generated order_id is null. The rest of this test is broken.' ); - $original_order_id = $gateway->getData_Unstaged_Escaped( 'order_id' ); - - $gateway->normalizeOrderID(); - $this->assertEquals( $original_order_id, $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Re-normalized order_id has changed without explicit regeneration.' ); - - //this might look a bit strange, but we need to be able to generate valid order_ids without making them stick to anything. - $gateway->generateOrderID(); - $this->assertEquals( $original_order_id, $gateway->getData_Unstaged_Escaped( 'order_id' ), 'function generateOrderID auto-changed the selected order ID. Not cool.' ); - - $gateway->regenerateOrderID(); - $this->assertNotEquals( $original_order_id, $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Re-normalized order_id has not changed, after explicit regeneration.' ); - } - - /** - * Integration test to verify that order_id can be retrieved from - * performing an INSERT_ORDERWITHPAYMENT. - */ - function testOrderIDRetrieval() { - $init = $this->getDonorTestData(); - unset( $init['order_id'] ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - - //no order_id from anywhere, explicit generate - $gateway = $this->getFreshGatewayObject( $init, array ( 'order_id_meta' => array ( 'generate' => FALSE ) ) ); - $this->assertNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Ungenerated order_id is not null. The rest of this test is broken.' ); - - $gateway->do_transaction( 'INSERT_ORDERWITHPAYMENT' ); - - $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), 'No order_id was retrieved from INSERT_ORDERWITHPAYMENT' ); - } - - /** - * Just run the GET_ORDERSTATUS transaction and make sure we load the data - */ - function testGetOrderStatus() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@safedomain.org'; - - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->do_transaction( 'GET_ORDERSTATUS' ); - - $data = $gateway->getTransactionData(); - - $this->assertEquals( 'N', $data['CVVRESULT'], 'CVV Result not loaded from XML response' ); - } - - /** - * Don't fraud-fail someone for bad CVV if GET_ORDERSTATUS - * comes back with STATUSID 25 and no CVVRESULT - * @group CvvResult - */ - function testConfirmCreditCardStatus25() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@safedomain.org'; - - $this->setUpRequest( array( 'CVVRESULT' => 'M' ) ); - - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '25' ); - - $gateway->do_transaction( 'Confirm_CreditCard' ); - $action = $gateway->getValidationAction(); - $this->assertEquals( 'process', $action, 'Gateway should not fraud fail on STATUSID 25' ); - } - - /** - * Make sure we're incorporating GET_ORDERSTATUS AVS and CVV responses into - * fraud scores. - */ - function testGetOrderstatusPostProcessFraud() { - $this->setMwGlobals( array( - 'wgDonationInterfaceEnableCustomFilters' => true, - 'wgGlobalCollectGatewayCustomFiltersFunctions' => array( - 'getCVVResult' => 10, - 'getAVSResult' => 30, - ), - ) ); - - $init = $this->getDonorTestData(); - $init['ffname'] = 'cc-vmad'; - $init['order_id'] = '55555'; - $init['email'] = 'innoc...@manichean.com'; - $init['contribution_tracking_id'] = mt_rand(); - $init['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->setDummyGatewayResponseCode( '600_badCvv' ); - - $gateway->do_transaction( 'Confirm_CreditCard' ); - $action = $gateway->getValidationAction(); - $this->assertEquals( 'review', $action, - 'Orphan gateway should fraud fail on bad CVV and AVS' ); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $this->assertEquals( 40, $exposed->risk_score, - 'Risk score was incremented correctly.' ); - } - - /** - * Ensure the Confirm_CreditCard transaction prefers CVVRESULT from the XML - * over any value from the querystring - */ - function testConfirmCreditCardPrefersXmlCvv() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@safedomain.org'; - - $this->setUpRequest( array( 'CVVRESULT' => 'M' ) ); - - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->do_transaction( 'Confirm_CreditCard' ); - - $this->assertEquals( 'N', $gateway->getData_Unstaged_Escaped('cvv_result'), 'CVV Result not taken from XML response' ); - } - - /** - * Make sure we record the actual amount charged, even if the donor has - * opened a new window and screwed up their session data. - */ - function testConfirmCreditCardUpdatesAmount() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@safedomain.org'; - // The values in session are not the values we originally used - // for INSERT_ORDERWITHPAYMENT - $init['amount'] = '12.50'; - $init['currency'] = 'USD'; - - $gateway = $this->getFreshGatewayObject( $init ); - - $amount = $gateway->getData_Unstaged_Escaped( 'amount' ); - $currency = $gateway->getData_Unstaged_Escaped( 'currency' ); - $this->assertEquals( '12.50', $amount ); - $this->assertEquals( 'USD', $currency ); - - $gateway->do_transaction( 'Confirm_CreditCard' ); - - $amount = $gateway->getData_Unstaged_Escaped( 'amount' ); - $currency = $gateway->getData_Unstaged_Escaped( 'currency' ); - $this->assertEquals( '23.45', $amount, 'Not recording correct amount' ); - $this->assertEquals( 'EUR', $currency, 'Not recording correct currency' ); - } - - /** - * testDefineVarMap - * - * This is tested with a bank transfer from Spain. - * - * @covers GlobalCollectAdapter::__construct - * @covers GlobalCollectAdapter::defineVarMap - */ - public function testDefineVarMap() { - - $gateway = $this->getFreshGatewayObject( self::$initial_vars ); - - $var_map = array( - 'ORDERID' => 'order_id', - 'AMOUNT' => 'amount', - 'CURRENCYCODE' => 'currency', - 'LANGUAGECODE' => 'language', - 'COUNTRYCODE' => 'country', - 'MERCHANTREFERENCE' => 'contribution_tracking_id', - 'RETURNURL' => 'returnto', - 'IPADDRESS' => 'server_ip', - 'ISSUERID' => 'issuer_id', - 'PAYMENTPRODUCTID' => 'payment_product', - 'CVV' => 'cvv', - 'EXPIRYDATE' => 'expiration', - 'CREDITCARDNUMBER' => 'card_num', - 'FIRSTNAME' => 'first_name', - 'SURNAME' => 'last_name', - 'STREET' => 'street_address', - 'CITY' => 'city', - 'STATE' => 'state_province', - 'ZIP' => 'postal_code', - 'EMAIL' => 'email', - 'ACCOUNTHOLDER' => 'account_holder', - 'ACCOUNTNAME' => 'account_name', - 'ACCOUNTNUMBER' => 'account_number', - 'ADDRESSLINE1E' => 'address_line_1e', - 'ADDRESSLINE2' => 'address_line_2', - 'ADDRESSLINE3' => 'address_line_3', - 'ADDRESSLINE4' => 'address_line_4', - 'ATTEMPTID' => 'attempt_id', - 'AUTHORISATIONID' => 'authorization_id', - 'BANKACCOUNTNUMBER' => 'bank_account_number', - 'BANKAGENZIA' => 'bank_agenzia', - 'BANKCHECKDIGIT' => 'bank_check_digit', - 'BANKCODE' => 'bank_code', - 'BANKFILIALE' => 'bank_filiale', - 'BANKNAME' => 'bank_name', - 'BRANCHCODE' => 'branch_code', - 'COUNTRYCODEBANK' => 'country_code_bank', - 'COUNTRYDESCRIPTION' => 'country_description', - 'CUSTOMERBANKCITY' => 'customer_bank_city', - 'CUSTOMERBANKSTREET' => 'customer_bank_street', - 'CUSTOMERBANKNUMBER' => 'customer_bank_number', - 'CUSTOMERBANKZIP' => 'customer_bank_zip', - 'DATECOLLECT' => 'date_collect', - 'DESCRIPTOR' => 'descriptor', - 'DIRECTDEBITTEXT' => 'direct_debit_text', - 'DOMICILIO' => 'domicilio', - 'EFFORTID' => 'effort_id', - 'IBAN' => 'iban', - 'IPADDRESSCUSTOMER' => 'user_ip', - 'PAYMENTREFERENCE' => 'payment_reference', - 'PROVINCIA' => 'provincia', - 'SPECIALID' => 'special_id', - 'SWIFTCODE' => 'swift_code', - 'TRANSACTIONTYPE' => 'transaction_type', - 'FISCALNUMBER' => 'fiscal_number', - 'AVSRESULT' => 'avs_result', - 'CVVRESULT' => 'cvv_result', - ); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $this->assertEquals( $var_map, $exposed->var_map ); - } - - public function testLanguageStaging() { - $options = $this->getDonorTestData( 'NO' ); - $options['payment_method'] = 'cc'; - $options['payment_submethod'] = 'visa'; - $gateway = $this->getFreshGatewayObject( $options ); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $exposed->stageData(); - - $this->assertEquals( $exposed->getData_Staged( 'language' ), 'no', "'NO' donor's language was inproperly set. Should be 'no'" ); - } - - public function testLanguageFallbackStaging() { - $options = $this->getDonorTestData( 'Catalonia' ); - $options['payment_method'] = 'cc'; - $options['payment_submethod'] = 'visa'; - $gateway = $this->getFreshGatewayObject( $options ); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $exposed->stageData(); - - // Requesting the fallback language from the gateway. - $this->assertEquals( 'en', $exposed->getData_Staged( 'language' ) ); - } - - /** - * Make sure unstaging functions don't overwrite core donor data. - */ - public function testAddResponseData_underzealous() { - $options = $this->getDonorTestData( 'Catalonia' ); - $options['payment_method'] = 'cc'; - $options['payment_submethod'] = 'visa'; - $gateway = $this->getFreshGatewayObject( $options ); - - // This will set staged_data['language'] = 'en'. - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $exposed->stageData(); - - $ctid = mt_rand(); - - $gateway->addResponseData( array( - 'contribution_tracking_id' => $ctid . '.1', - ) ); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - // Desired vars were written into normalized data. - $this->assertEquals( $ctid, $exposed->dataObj->getVal( 'contribution_tracking_id' ) ); - - // Language was not overwritten. - $this->assertEquals( 'ca', $exposed->dataObj->getVal( 'language' ) ); - } - - /** - * Tests to make sure that certain error codes returned from GC will or - * will not create payments error loglines. - */ - function testCCLogsOnGatewayError() { - $init = $this->getDonorTestData( 'US' ); - unset( $init['order_id'] ); - $init['ffname'] = 'cc-vmad'; - - //this should not throw any payments errors: Just an invalid card. - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '430285' ); - $gateway->do_transaction( 'GET_ORDERSTATUS' ); - $this->verifyNoLogErrors(); - - //Now test one we want to throw a payments error - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '21000050' ); - $gateway->do_transaction( 'GET_ORDERSTATUS' ); - $loglines = self::getLogMatches( LogLevel::ERROR, '/Investigation required!/' ); - $this->assertNotEmpty( $loglines, 'GC Error 21000050 is not generating the expected payments log error' ); - - //Reset logs - DonationLoggerFactory::$overrideLogger->messages = array(); - - //Most irritating version of 20001000 - They failed to enter an expiration date on GC's form. This should log some specific info, but not an error. - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '20001000-expiry' ); - $gateway->do_transaction( 'GET_ORDERSTATUS' ); - $this->verifyNoLogErrors(); - $loglines = self::getLogMatches( LogLevel::INFO, '/processResponse:.*EXPIRYDATE/' ); - $this->assertNotEmpty( $loglines, 'GC Error 20001000-expiry is not generating the expected payments log line' ); - } - - /** - * Tests to make sure that certain error codes returned from GC will - * trigger order cancellation, even if retryable errors also exist. - * @dataProvider mcNoRetryCodeProvider - */ - public function testNoMastercardFinesForRepeatOnBadCodes( $code ) { - $init = $this->getDonorTestData( 'US' ); - unset( $init['order_id'] ); - $init['ffname'] = 'cc-vmad'; - //Make it not look like an orphan - $this->setUpRequest( array( - 'CVVRESULT' => 'M', - 'AVSRESULT' => '0' - ) ); - - //Toxic card should not retry, even if there's an order id collision - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( $code ); - $gateway->do_transaction( 'Confirm_CreditCard' ); - $this->assertEquals( 1, count( $gateway->curled ), "Gateway kept trying even with response code $code! MasterCard could fine us a thousand bucks for that!" ); - } - - /** - * Tests that two API requests don't send the same order ID and merchant - * reference. This was the case when users doubleclicked and we were - * using the last 5 digits of time in seconds as a suffix. We want to see - * what happens when a 2nd request comes in while the 1st is still waiting - * for a CURL response, so here we fake that situation by having CURL throw - * an exception during the 1st response. - */ - public function testNoDupeOrderId( ) { - $this->setUpRequest( array( - 'action'=>'donate', - 'amount'=>'3.00', - 'card_type'=>'amex', - 'city'=>'Hollywood', - 'contribution_tracking_id'=>'22901382', - 'country'=>'US', - 'currency'=>'USD', - 'email'=>'faketyf...@gmail.com', - 'first_name'=>'Fakety', - 'format'=>'json', - 'gateway'=>'globalcollect', - 'language'=>'en', - 'last_name'=>'Fake', - 'payment_method'=>'cc', - 'referrer'=>'http://en.wikipedia.org/wiki/Main_Page', - 'state_province'=>'MA', - 'street_address'=>'99 Fake St', - 'utm_campaign'=>'C14_en5C_dec_dsk_FR', - 'utm_medium'=>'sitenotice', - 'utm_source'=>'B14_120921_5C_lg_fnt_sans.no-LP.cc', - 'postal_code'=>'90210' - ) ); - - $gateway = new TestingGlobalCollectAdapter(); - $gateway->setDummyGatewayResponseCode( 'Exception' ); - try { - $gateway->do_transaction( 'INSERT_ORDERWITHPAYMENT' ); - } - catch ( Exception $e ) { - // totally expected this - } - $first = $gateway->curled[0]; - //simulate another request coming in before we get anything back from GC - $anotherGateway = new TestingGlobalCollectAdapter(); - $anotherGateway->do_transaction( 'INSERT_ORDERWITHPAYMENT' ); - $second = $anotherGateway->curled[0]; - $this->assertFalse( $first == $second, 'Two calls to the api did the same thing'); - } - - /** - * Tests to see that we don't claim we're going to retry when we aren't - * going to. For GC, we really only want to retry on code 300620 - * @dataProvider benignNoRetryCodeProvider - */ - public function testNoClaimRetryOnBoringCodes( $code ) { - $init = $this->getDonorTestData( 'US' ); - unset( $init['order_id'] ); - $init['ffname'] = 'cc-vmad'; - //Make it not look like an orphan - $this->setUpRequest( array( - 'CVVRESULT' => 'M', - 'AVSRESULT' => '0' - ) ); - - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( $code ); - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $start_id = $exposed->getData_Staged( 'order_id' ); - $gateway->do_transaction( 'Confirm_CreditCard' ); - $finish_id = $exposed->getData_Staged( 'order_id' ); - $loglines = self::getLogMatches( LogLevel::INFO, '/Repeating transaction on request for vars:/' ); - $this->assertEmpty( $loglines, "Log says we are going to repeat the transaction for code $code, but that is not true" ); - $this->assertEquals( $start_id, $finish_id, "Needlessly regenerated order id for code $code "); - } - - /** - * doPayment should return an iframe result with normal data - */ - function testDoPaymentSuccess() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@clean.com'; - $init['ffname'] = 'cc-vmad'; - unset( $init['order_id'] ); - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->doPayment(); - $this->assertEmpty( $result->isFailed(), 'PaymentResult should not be failed' ); - $this->assertEmpty( $result->getErrors(), 'PaymentResult should have no errors' ); - $this->assertEquals( 'url_placeholder', $result->getIframe(), 'PaymentResult should have iframe set' ); - } - - /** - * doPayment should recover from an attempt to use a duplicate order ID. - */ - function testDuplicateOrderId() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@localhost.net'; - $init['ffname'] = 'cc-vmad'; - unset( $init['order_id'] ); - - $gateway = $this->getFreshGatewayObject( $init ); - $orig_id = $gateway->getData_Unstaged_Escaped( 'order_id' ); - $gateway->setDummyGatewayResponseCode( function ( $gateway ) use ( $orig_id ) { - if ( $gateway->getData_Unstaged_Escaped( 'order_id' ) === $orig_id ) { - return 'duplicate'; - } else { - return null; - } - } ); - $result = $gateway->doPayment(); - $this->assertEmpty( $result->isFailed(), 'PaymentResult should not be failed' ); - $this->assertEmpty( $result->getErrors(), 'PaymentResult should have no errors' ); - $this->assertNotEquals( $gateway->getData_Unstaged_Escaped( 'order_id' ), $orig_id, - 'Order ID regenerated in DonationData.' ); - $this->assertNotEquals( $gateway->session_getData( 'order_id' ), $orig_id, - 'Order ID regenerated in session.' ); - } - - /** - * doPayment should recover from Ingenico-side timeouts. - */ - function testTimeoutRecover() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@localhost.net'; - $init['ffname'] = 'cc-vmad'; - - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '11000400' ); - $gateway->do_transaction( 'SET_PAYMENT' ); - $loglines = self::getLogMatches( LogLevel::INFO, '/Repeating transaction for timeout/' ); - $this->assertNotEmpty( $loglines, "Log does not say we retried for timeout." ); - } - - public function testDonorReturnSuccess() { - $init = $this->getDonorTestData( 'FR' ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@localhost.net'; - $init['order_id'] = mt_rand(); - $session['Donor'] = $init; - $this->setUpRequest( $init, $session ); - $gateway = $this->getFreshGatewayObject( array() ); - $result = $gateway->processDonorReturn( array( - 'REF' => $init['order_id'], - 'CVVRESULT' => 'M', - 'AVSRESULT' => '0' - ) ); - $this->assertFalse( $result->isFailed() ); - $this->assertEmpty( $result->getErrors() ); - // TODO inspect the queue message - } - - public function testDonorReturnFailure() { - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['email'] = 'innoc...@localhost.net'; - $init['order_id'] = mt_rand(); - $session['Donor'] = $init; - $this->setUpRequest( $init, $session ); - $gateway = $this->getFreshGatewayObject( array() ); - $gateway->setDummyGatewayResponseCode( '430285' ); // invalid card - $result = $gateway->processDonorReturn( array( - 'REF' => $init['order_id'], - 'CVVRESULT' => 'M', - 'AVSRESULT' => '0' - ) ); - $this->assertTrue( $result->isFailed() ); - } -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php deleted file mode 100644 index 9632401..0000000 --- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php +++ /dev/null @@ -1,338 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -<?php -/** - * 'TIMESTAMP=2016%2d05%2d02T19%3a58%3a19Z&CORRELATIONID=b33e6ff7eba&ACK=Failure&VERSION=0%2e000000&BUILD=21669447&L_ERRORCODE0=10002&L_SHORTMESSAGE0=Authentication%2fAuthorization%20Failed&L_LONGMESSAGE0=You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call&L_SEVERITYCODE0=Error' - * - * TOKEN=EC%2d1YM52022PV490383V&PHONENUM=408%2d123%2d4567&BILLINGAGREEMENTACCEPTEDSTATUS=0&CHECKOUTSTATUS=PaymentActionNotInitiated&TIMESTAMP=2016%2d05%2d03T19%3a57%3a56Z&CORRELATIONID=c3811aeb1e7f5&ACK=Success&VERSION=124&BUILD=21669447&EMAIL=fr%2dtech%2bdonor%40wikimedia%2eorg&PAYERID=FLJLQ2GV38E4Y&PAYERSTATUS=verified&FIRSTNAME=f&LASTNAME=doner&COUNTRYCODE=US&ADDRESSSTATUS=Confirmed&CURRENCYCODE=JPY&AMT=500&ITEMAMT=500&SHIPPINGAMT=0&HANDLINGAMT=0&TAXAMT=0&CUSTOM=4116&DESC=Donation%20to%20the%20Wikimedia%20Foundation&INVNUM=4116%2e1&INSURANCEAMT=0&SHIPDISCAMT=0&INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_CURRENCYCODE=JPY&PAYMENTREQUEST_0_AMT=500&PAYMENTREQUEST_0_ITEMAMT=500&PAYMENTREQUEST_0_SHIPPINGAMT=0&PAYMENTREQUEST_0_HANDLINGAMT=0&PAYMENTREQUEST_0_TAXAMT=0&PAYMENTREQUEST_0_CUSTOM=4116&PAYMENTREQUEST_0_DESC=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUEST_0_INVNUM=4116%2e1&PAYMENTREQUEST_0_INSURANCEAMT=0&PAYMENTREQUEST_0_SHIPDISCAMT=0&PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID=fr%2dtech%2dfacilitator%40wikimedia%2eorg&PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed&PAYMENTREQUESTINFO_0_ERRORCODE=0 - * - * TIMESTAMP=2016%2d05%2d03T21%3a43%3a20Z&CORRELATIONID=f624ed5aa5db0&ACK=Failure&VERSION=124&BUILD=21669447&L_ERRORCODE0=10412&L_SHORTMESSAGE0=Duplicate%20invoice&L_LONGMESSAGE0=Payment%20has%20already%20been%20made%20for%20this%20InvoiceID%2e&L_SEVERITYCODE0=Error - */ -use SmashPig\PaymentProviders\PayPal\Tests\PayPalTestConfiguration; -use SmashPig\Tests\TestingContext; - -/** - * - * @group Fundraising - * @group DonationInterface - * @group PayPal - */ -class DonationInterface_Adapter_PayPal_Express_Test extends DonationInterfaceTestCase { - - protected $testAdapterClass = 'TestingPaypalExpressAdapter'; - - public function setUp() { - parent::setUp(); - TestingContext::get()->providerConfigurationOverride = PayPalTestConfiguration::get( - $this->smashPigGlobalConfig - ); - $this->setMwGlobals( array( - 'wgDonationInterfaceCancelPage' => 'https://example.com/tryAgain.php', - 'wgPaypalExpressGatewayEnabled' => true, - 'wgDonationInterfaceThankYouPage' => 'https://example.org/wiki/Thank_You', - ) ); - } - - function testPaymentSetup() { - $init = array( - 'amount' => 1.55, - 'currency' => 'USD', - 'payment_method' => 'paypal', - 'utm_source' => 'CD1234_FR', - 'utm_medium' => 'sitenotice', - 'country' => 'US', - 'contribution_tracking_id' => strval( mt_rand() ), - 'language' => 'fr', - ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'OK' ); - $result = $gateway->doPayment(); - $gateway->logPending(); // GatewayPage or the API calls this for redirects - $this->assertEquals( - 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-8US12345X1234567U', - $result->getRedirect(), - 'Wrong redirect for PayPal EC payment setup' - ); - $message = DonationQueue::instance()->pop( 'pending' ); - $this->assertNotEmpty( $message, 'Missing pending message' ); - self::unsetVariableFields( $message ); - $expected = array( - 'country' => 'US', - 'fee' => '0', - 'gateway' => 'paypal_ec', - 'gateway_txn_id' => null, - 'language' => 'fr', - 'contribution_tracking_id' => $init['contribution_tracking_id'], - 'order_id' => $init['contribution_tracking_id'] . '.1', - 'utm_source' => 'CD1234_FR..paypal', - 'currency' => 'USD', - 'email' => '', - 'gross' => '1.55', - 'recurring' => '', - 'response' => false, - 'utm_medium' => 'sitenotice', - 'payment_method' => 'paypal', - 'payment_submethod' => '', - 'gateway_session_id' => 'EC-8US12345X1234567U', - 'user_ip' => '127.0.0.1', - 'source_name' => 'DonationInterface', - 'source_type' => 'payments', - ); - $this->assertEquals( - $expected, - $message, - 'PayPal EC setup sending wrong pending message' - ); - } - - function testPaymentSetupRecurring() { - $init = array( - 'amount' => 1.55, - 'currency' => 'USD', - 'payment_method' => 'paypal', - 'utm_source' => 'CD1234_FR', - 'utm_medium' => 'sitenotice', - 'country' => 'US', - 'recurring' => '1', - 'contribution_tracking_id' => strval( mt_rand() ), - 'language' => 'fr', - ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'OK' ); - $result = $gateway->doPayment(); - $gateway->logPending(); // GatewayPage or the API calls this for redirects - $this->assertEquals( - 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-8US12345X1234567U', - $result->getRedirect(), - 'Wrong redirect for PayPal EC payment setup' - ); - $message = DonationQueue::instance()->pop( 'pending' ); - $this->assertNotEmpty( $message, 'Missing pending message' ); - $this->unsetVariableFields( $message ); - $expected = array( - 'country' => 'US', - 'fee' => '0', - 'gateway' => 'paypal_ec', - 'gateway_txn_id' => null, - 'language' => 'fr', - 'contribution_tracking_id' => $init['contribution_tracking_id'], - 'order_id' => $init['contribution_tracking_id'] . '.1', - 'utm_source' => 'CD1234_FR..rpaypal', - 'currency' => 'USD', - 'email' => '', - 'gross' => '1.55', - 'recurring' => '1', - 'response' => false, - 'utm_medium' => 'sitenotice', - 'payment_method' => 'paypal', - 'payment_submethod' => '', - 'gateway_session_id' => 'EC-8US12345X1234567U', - 'user_ip' => '127.0.0.1', - 'source_name' => 'DonationInterface', - 'source_type' => 'payments', - ); - $this->assertEquals( - $expected, - $message, - 'PayPal EC setup sending wrong pending message' - ); - } - - /** - * Check that the adapter makes the correct calls for successful donations - * and sends a good queue message. - */ - function testProcessDonorReturn() { - $init = $this->getDonorTestData( 'US' ); - $init['contribution_tracking_id'] = '45931210'; - $this->setUpRequest( $init, array( 'Donor' => $init ) ); - - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'OK' ); - $gateway->processDonorReturn( array( - 'token' => 'EC%2d4V987654XA123456V', - 'PayerID' => 'ASDASD', - ) ); - - $message = DonationQueue::instance()->pop( 'donations' ); - $this->assertNotNull( $message, 'Not sending a message to the donations queue' ); - self::unsetVariableFields( $message ); - $expected = array ( - 'contribution_tracking_id' => $init['contribution_tracking_id'], - 'country' => 'US', - 'fee' => '0', - 'gateway' => 'paypal_ec', - 'gateway_txn_id' => '5EJ123456T987654S', - 'gateway_session_id' => 'EC-4V987654XA123456V', - 'language' => 'en', - 'order_id' => $init['contribution_tracking_id'] . '.1', - 'payment_method' => 'paypal', - 'payment_submethod' => '', - 'response' => false, - 'user_ip' => '127.0.0.1', - 'utm_source' => '..paypal', - 'city' => 'San Francisco', - 'currency' => 'USD', - 'email' => 'do...@generous.net', - 'first_name' => 'Fezziwig', - 'gross' => '1.55', - 'last_name' => 'Fowl', - 'recurring' => '', - 'state_province' => 'CA', - 'street_address' => '123 Fake Street', - 'postal_code' => '94105', - 'source_name' => 'DonationInterface', - 'source_type' => 'payments', - ); - $this->assertEquals( $expected, $message ); - - $this->assertNull( - DonationQueue::instance()->pop( 'donations' ), - 'Sending extra messages to donations queue!' - ); - } - - public function testProcessDonorReturnRecurring() { - $init = $this->getDonorTestData( 'US' ); - $init['contribution_tracking_id'] = '45931210'; - $init['recurring'] = '1'; - $this->setUpRequest( $init, array( 'Donor' => $init ) ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'Recurring-OK' ); - $gateway->processDonorReturn( array( - 'token' => 'EC%2d4V987654XA123456V', - 'PayerID' => 'ASDASD' - ) ); - - $message = DonationQueue::instance()->pop( 'donations' ); - $this->assertNull( $message, 'Recurring should not send a message to the donations queue' ); - } - - /** - * Check that we send the donor back to paypal to try a different source - */ - function testProcessDonorReturnPaymentRetry() { - $init = $this->getDonorTestData( 'US' ); - $init['contribution_tracking_id'] = '45931210'; - $this->setUpRequest( $init, array( 'Donor' => $init ) ); - - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '10486' ); - $result = $gateway->processDonorReturn( array( - 'token' => 'EC%2d2D123456D9876543U', - 'PayerID' => 'ASDASD' - ) ); - - $message = DonationQueue::instance()->pop( 'donations' ); - $this->assertNull( $message, 'Should not queue a message' ); - $this->assertFalse( $result->isFailed() ); - $redirect = $result->getRedirect(); - $this->assertEquals( - 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-2D123456D9876543U', - $redirect - ); - } - - public function testProcessDonorReturnRecurringRetry() { - $init = $this->getDonorTestData( 'US' ); - $init['contribution_tracking_id'] = '45931210'; - $init['recurring'] = '1'; - $this->setUpRequest( $init, array( 'Donor' => $init ) ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '10486' ); - $result = $gateway->processDonorReturn( array( - 'token' => 'EC%2d2D123456D9876543U', - 'PayerID' => 'ASDASD' - ) ); - - $this->assertNull( - DonationQueue::instance()->pop( 'donations' ), - 'Sending a spurious message to the donations queue!' - ); - $this->assertFalse( $result->isFailed() ); - $redirect = $result->getRedirect(); - $this->assertEquals( - 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-2D123456D9876543U', - $redirect - ); - } - - /** - * The result switcher should redirect the donor to the thank you page and mark the token as - * processed. - */ - public function testResultSwitcher() { - $init = $this->getDonorTestData( 'US' ); - $init['contribution_tracking_id'] = '45931210'; - $init['gateway_session_id'] = mt_rand(); - $init['language'] = 'pt'; - $session = array( 'Donor' => $init ); - - $request = array( - 'token' => $init['gateway_session_id'], - 'PayerID' => 'ASdASDAS', - 'language' => $init['language'] // FIXME: mashing up request vars and other stuff in verifyFormOutput - ); - $assertNodes = array( - 'headers' => array( - 'Location' => function( $location ) use ( $init ) { - // Do this after the real processing to avoid side effects - $gateway = $this->getFreshGatewayObject( $init ); - $url = ResultPages::getThankYouPage( $gateway ); - $this->assertEquals( $url, $location ); - } - ) - ); - - $this->verifyFormOutput( 'PaypalExpressGatewayResult', $request, $assertNodes, false, $session ); - $key = 'processed_request-' . $request['token']; - $processed = wfGetMainCache()->get( $key ); - $this->assertTrue( $processed ); - - // Make sure we logged the expected cURL attempts - $messages = self::getLogMatches( 'info', '/Preparing to send GetExpressCheckoutDetails transaction to Paypal Express Checkout/' ); - $this->assertNotEmpty( $messages ); - $messages = self::getLogMatches( 'info', '/Preparing to send DoExpressCheckoutPayment transaction to Paypal Express Checkout/' ); - $this->assertNotEmpty( $messages ); - } - - /** - * The result switcher should redirect the donor to the thank you page without - * re-processing the donation. - */ - public function testResultSwitcherRepeat() { - $init = $this->getDonorTestData( 'US' ); - $init['contribution_tracking_id'] = '45931210'; - $init['gateway_session_id'] = mt_rand(); - $init['language'] = 'pt'; - $session = array( - 'Donor' => $init - ); - - $key = 'processed_request-' . $init['gateway_session_id']; - wfGetMainCache()->add( $key, true, 100 ); - - $request = array( - 'token' => $init['gateway_session_id'], - 'PayerID' => 'ASdASDAS', - 'language' => $init['language'] // FIXME: mashing up request vars and other stuff in verifyFormOutput - ); - $assertNodes = array( - 'headers' => array( - 'Location' => function( $location ) use ( $init ) { - // Do this after the real processing to avoid side effects - $gateway = $this->getFreshGatewayObject( $init ); - $url = ResultPages::getThankYouPage( $gateway ); - $this->assertEquals( $url, $location ); - } - ) - ); - - $this->verifyFormOutput( 'PaypalExpressGatewayResult', $request, $assertNodes, false, $session ); - - // We should not have logged any cURL attempts - $messages = self::getLogMatches( 'info', '/Preparing to send .*/' ); - $this->assertEmpty( $messages ); - } -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/authorize.json b/tests/phpunit/includes/Responses/amazon/authorize.json deleted file mode 100644 index e840b62..0000000 --- a/tests/phpunit/includes/Responses/amazon/authorize.json +++ /dev/null @@ -1,40 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "AuthorizeResult": { - "AuthorizationDetails": { - "AuthorizationAmount": { - "CurrencyCode": "USD", - "Amount": "10.00" - }, - "CapturedAmount": { - "CurrencyCode": "USD", - "Amount": "0" - }, - "SoftDescriptor": "AMZ*Wikimedia Founda", - "ExpirationTimestamp": "2015-09-23T21:50:58.221Z", - "IdList": { - "member": "S01-0391295-0674065-C095112" - }, - "AuthorizationStatus": { - "LastUpdateTimestamp": "2015-08-24T21:50:58.221Z", - "ReasonCode": "MaxCapturesProcessed", - "State": "Closed" - }, - "AuthorizationFee": { - "CurrencyCode": "USD", - "Amount": "0.00" - }, - "CaptureNow": "true", - "SellerAuthorizationNote": [], - "CreationTimestamp": "2015-08-24T21:50:58.221Z", - "AmazonAuthorizationId": "S01-0391295-0674065-A095112", - "AuthorizationReferenceId": "31243-1" - } - }, - "ResponseMetadata": { - "RequestId": "785d061e-e152-4180-80d1-3a492d16e24e" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/authorizeOnBillingAgreement.json b/tests/phpunit/includes/Responses/amazon/authorizeOnBillingAgreement.json deleted file mode 100644 index fe9f646..0000000 --- a/tests/phpunit/includes/Responses/amazon/authorizeOnBillingAgreement.json +++ /dev/null @@ -1,41 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "AuthorizeOnBillingAgreementResult": { - "AuthorizationDetails": { - "AuthorizationAmount": { - "CurrencyCode": "USD", - "Amount": "10.00" - }, - "CapturedAmount": { - "CurrencyCode": "USD", - "Amount": "0" - }, - "SoftDescriptor": "AMZ*Wikimedia Founda", - "ExpirationTimestamp": "2015-11-04T18:06:49.965Z", - "IdList": { - "member": "S01-5318994-6362993-C004044" - }, - "AuthorizationStatus": { - "LastUpdateTimestamp": "2015-10-05T18:06:49.965Z", - "State": "Closed", - "ReasonCode": "MaxCapturesProcessed" - }, - "AuthorizationFee": { - "CurrencyCode": "USD", - "Amount": "0.00" - }, - "CaptureNow": "true", - "CreationTimestamp": "2015-10-05T18:06:49.965Z", - "SellerAuthorizationNote": [], - "AmazonAuthorizationId": "S01-5318994-6362993-A004044", - "AuthorizationReferenceId": "36834-1" - }, - "AmazonOrderReferenceId": "S01-5318994-6362993" - }, - "ResponseMetadata": { - "RequestId": "8c8f4d79-06d5-4de5-ae34-d3fdc73aa343" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/authorize_AmazonRejected.json b/tests/phpunit/includes/Responses/amazon/authorize_AmazonRejected.json deleted file mode 100644 index bbfd09f..0000000 --- a/tests/phpunit/includes/Responses/amazon/authorize_AmazonRejected.json +++ /dev/null @@ -1,37 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "AuthorizeResult": { - "AuthorizationDetails": { - "AuthorizationAmount": { - "CurrencyCode": "USD", - "Amount": "10.00" - }, - "CapturedAmount": { - "CurrencyCode": "USD", - "Amount": "0" - }, - "SoftDescriptor": "AMZ*Wikimedia Founda", - "ExpirationTimestamp": "2015-10-01T22:31:02.551Z", - "AuthorizationStatus": { - "LastUpdateTimestamp": "2015-09-01T22:31:02.551Z", - "State": "Declined", - "ReasonCode": "AmazonRejected" - }, - "AuthorizationFee": { - "CurrencyCode": "USD", - "Amount": "0.00" - }, - "CaptureNow": "true", - "SellerAuthorizationNote": "{\"SandboxSimulation\": {\"State\":\"Declined\", \"ReasonCode\":\"AmazonRejected\"}}", - "CreationTimestamp": "2015-09-01T22:31:02.551Z", - "AmazonAuthorizationId": "S01-7821958-9177140-A084347", - "AuthorizationReferenceId": "36435-1" - } - }, - "ResponseMetadata": { - "RequestId": "4a509982-d8cb-4dec-ad56-81a9dc5f070c" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/authorize_InvalidPaymentMethod.json b/tests/phpunit/includes/Responses/amazon/authorize_InvalidPaymentMethod.json deleted file mode 100644 index bd0efbd..0000000 --- a/tests/phpunit/includes/Responses/amazon/authorize_InvalidPaymentMethod.json +++ /dev/null @@ -1,36 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "AuthorizeResult": { - "AuthorizationDetails": { - "AuthorizationAmount": { - "CurrencyCode": "USD", - "Amount": "10.00" - }, - "CapturedAmount": { - "CurrencyCode": "USD", - "Amount": "0" - }, - "SoftDescriptor": "AMZ*Wikimedia Founda", - "ExpirationTimestamp": "2015-09-24T18:24:37.748Z", - "AuthorizationStatus": { - "LastUpdateTimestamp": "2015-08-25T18:24:37.748Z", - "State": "Declined", - "ReasonCode": "InvalidPaymentMethod" - }, - "AuthorizationFee": { - "CurrencyCode": "USD", - "Amount": "0.00" - }, - "CaptureNow": "true", - "CreationTimestamp": "2015-08-25T18:24:37.748Z", - "AmazonAuthorizationId": "S01-2525143-9142520-A075353", - "AuthorizationReferenceId": "31243-1" - } - }, - "ResponseMetadata": { - "RequestId": "0122bebe-b8c3-4435-8169-8b3a92ba1800" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/authorize_TransactionTimedOut.json b/tests/phpunit/includes/Responses/amazon/authorize_TransactionTimedOut.json deleted file mode 100644 index 26c85ab..0000000 --- a/tests/phpunit/includes/Responses/amazon/authorize_TransactionTimedOut.json +++ /dev/null @@ -1,37 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "AuthorizeResult": { - "AuthorizationDetails": { - "AuthorizationAmount": { - "CurrencyCode": "USD", - "Amount": "10.00" - }, - "CapturedAmount": { - "CurrencyCode": "USD", - "Amount": "0" - }, - "SoftDescriptor": "AMZ*Wikimedia Founda", - "ExpirationTimestamp": "2015-10-02T17:14:02.214Z", - "AuthorizationStatus": { - "LastUpdateTimestamp": "2015-09-02T17:14:02.214Z", - "State": "Declined", - "ReasonCode": "TransactionTimedOut" - }, - "AuthorizationFee": { - "CurrencyCode": "USD", - "Amount": "0.00" - }, - "CaptureNow": "true", - "SellerAuthorizationNote": "{\"SandboxSimulation\": {\"State\":\"Declined\", \"ReasonCode\":\"TransactionTimedOut\"}}", - "CreationTimestamp": "2015-09-02T17:14:02.214Z", - "AmazonAuthorizationId": "S01-6689996-9664966-A069817", - "AuthorizationReferenceId": "36450-1" - } - }, - "ResponseMetadata": { - "RequestId": "06488d3c-bcee-4448-8f0a-bd6f816e6fec" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/getBillingAgreementDetails.json b/tests/phpunit/includes/Responses/amazon/getBillingAgreementDetails.json deleted file mode 100644 index 2b4b4c5..0000000 --- a/tests/phpunit/includes/Responses/amazon/getBillingAgreementDetails.json +++ /dev/null @@ -1,41 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "GetBillingAgreementDetailsResult": { - "BillingAgreementDetails": { - "BillingAgreementStatus": { - "LastUpdatedTimestamp": "2015-10-05T18:06:48.288Z", - "State": "Open" - }, - "AmazonBillingAgreementId": "C01-9650293-7351908", - "BillingAgreementConsent": "true", - "SellerBillingAgreementAttributes": { - "SellerBillingAgreementId": "36834-1" - }, - "Buyer": { - "Name": "Testy Test", - "Email": "nob...@wikimedia.org" - }, - "ReleaseEnvironment": "Sandbox", - "SellerNote": "Monthly donation to the Wikimedia Foundation", - "CreationTimestamp": "2015-10-05T18:06:38.940Z", - "BillingAgreementLimits": { - "TimePeriodStartDate": "2015-10-01T00:00:00Z", - "CurrentRemainingBalance": { - "CurrencyCode": "USD", - "Amount": "500.00" - }, - "AmountLimitPerTimePeriod": { - "CurrencyCode": "USD", - "Amount": "500" - }, - "TimePeriodEndDate": "2015-11-01T00:00:00Z" - } - } - }, - "ResponseMetadata": { - "RequestId": "547cb94e-690e-47e9-99cd-aef79622a451" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/getCaptureDetails.json b/tests/phpunit/includes/Responses/amazon/getCaptureDetails.json deleted file mode 100644 index 7aa5ec7c..0000000 --- a/tests/phpunit/includes/Responses/amazon/getCaptureDetails.json +++ /dev/null @@ -1,35 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "GetCaptureDetailsResult": { - "CaptureDetails": { - "CaptureReferenceId": "31243-1", - "CaptureFee": { - "CurrencyCode": "USD", - "Amount": "0.00" - }, - "AmazonCaptureId": "S01-0391295-0674065-C095112", - "CreationTimestamp": "2015-08-24T21:50:58.321Z", - "SoftDescriptor": "AMZ*Wikimedia Founda", - "IdList": [], - "CaptureStatus": { - "LastUpdateTimestamp": "2015-08-24T21:50:58.321Z", - "State": "Completed" - }, - "SellerCaptureNote": [], - "RefundedAmount": { - "CurrencyCode": "USD", - "Amount": "0" - }, - "CaptureAmount": { - "CurrencyCode": "USD", - "Amount": "10.00" - } - } - }, - "ResponseMetadata": { - "RequestId": "f863dd05-99f3-4e9c-b0b6-561d65281cd7" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/amazon/setBillingAgreementDetails.json b/tests/phpunit/includes/Responses/amazon/setBillingAgreementDetails.json deleted file mode 100644 index 8736c04..0000000 --- a/tests/phpunit/includes/Responses/amazon/setBillingAgreementDetails.json +++ /dev/null @@ -1,36 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -{ - "SetBillingAgreementDetailsResult": { - "BillingAgreementDetails": { - "AmazonBillingAgreementId": "C01-9650293-7351908", - "BillingAgreementStatus": { - "State": "Draft" - }, - "BillingAgreementConsent": "true", - "SellerBillingAgreementAttributes": { - "SellerBillingAgreementId": "36834-1" - }, - "ReleaseEnvironment": "Sandbox", - "SellerNote": "Monthly donation to the Wikimedia Foundation", - "CreationTimestamp": "2015-10-05T18:06:38.940Z", - "BillingAgreementLimits": { - "TimePeriodStartDate": "2015-10-01T00:00:00Z", - "CurrentRemainingBalance": { - "CurrencyCode": "USD", - "Amount": "500.00" - }, - "AmountLimitPerTimePeriod": { - "CurrencyCode": "USD", - "Amount": "500" - }, - "TimePeriodEndDate": "2015-11-01T00:00:00Z" - } - } - }, - "ResponseMetadata": { - "RequestId": "9a92b3f8-d8d2-46bf-b998-e3332c71df61" - }, - "ResponseStatus": "200" -} ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse b/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse deleted file mode 100644 index a91248c..0000000 --- a/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse +++ /dev/null @@ -1,4 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -TOKEN=EC%2d2D123456D9876543U&BILLINGAGREEMENTACCEPTEDSTATUS=0&CHECKOUTSTATUS=PaymentActionNotInitiated&TIMESTAMP=2017%2d02%2d01T20%3a07%3a14Z&CORRELATIONID=d70c9a334455e&ACK=Success&VERSION=204&BUILD=28806785&EMAIL=donor%40generous%2enet&PAYERID=8R297FE87CD8S&PAYERSTATUS=unverified&FIRSTNAME=Fezziwig&LASTNAME=Fowl&COUNTRYCODE=US&BILLINGNAME=Fezziwig%20Fowl&STREET=123%20Notta%20Way&CITY=Whoville&STATE=OR&ZIP=97211&COUNTRY=US&COUNTRYNAME=United%20States&ADDRESSID=PayPal&ADDRESSSTATUS=Confirmed&CURRENCYCODE=USD&AMT=1%2e55&ITEMAMT=1%2e55&SHIPPINGAMT=0&HANDLINGAMT=0&TAXAMT=0&CUSTOM=45931210&DESC=Donation%20to%20the%20Wikimedia%20Foundation&INVNUM=45931210%2e1&NOTIFYURL=http%3a%2f%2ffundraising%2ewikimedia%2eorg%2fIPNListener_Standalone%2ephp&INSURANCEAMT=0&SHIPDISCAMT=0&INSURANCEOPTIONOFFERED=false&L_QTY0=1&L_TAXAMT0=0&L_AMT0=1%2e55&L_DESC0=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUEST_0_CURRENCYCODE=USD&PAYMENTREQUEST_0_AMT=1%2e55&PAYMENTREQUEST_0_ITEMAMT=1%2e55&PAYMENTREQUEST_0_SHIPPINGAMT=0&PAYMENTREQUEST_0_HANDLINGAMT=0&PAYMENTREQUEST_0_TAXAMT=0&PAYMENTREQUEST_0_CUSTOM=45931210&PAYMENTREQUEST_0_DESC=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUEST_0_INVNUM=45931210%2e1&PAYMENTREQUEST_0_NOTIFYURL=http%3a%2f%2ffundraising%2ewikimedia%2eorg%2fIPNListener_Standalone%2ephp&PAYMENTREQUEST_0_INSURANCEAMT=0&PAYMENTREQUEST_0_SHIPDISCAMT=0&PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID=receiver%40wikimedia%2eorg&PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed&L_PAYMENTREQUEST_0_QTY0=1&L_PAYMENTREQUEST_0_TAXAMT0=0&L_PAYMENTREQUEST_0_AMT0=1%2e55&L_PAYMENTREQUEST_0_DESC0=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUESTINFO_0_ERRORCODE=0 ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) diff --git a/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_OK.testresponse b/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_OK.testresponse deleted file mode 100644 index ec8dd94..0000000 --- a/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_OK.testresponse +++ /dev/null @@ -1,4 +0,0 @@ -<<<<<<< HEAD (17637c Merge commit '9d7b9a522' into deployment) -======= -TOKEN=EC%2d4V987654XA123456V&BILLINGAGREEMENTACCEPTEDSTATUS=0&CHECKOUTSTATUS=PaymentActionNotInitiated&TIMESTAMP=2017%2d02%2d01T20%3a07%3a14Z&CORRELATIONID=d70c9a334455e&ACK=Success&VERSION=204&BUILD=28806785&EMAIL=donor%40generous%2enet&PAYERID=8R297FE87CD8S&PAYERSTATUS=unverified&FIRSTNAME=Fezziwig&LASTNAME=Fowl&COUNTRYCODE=US&BILLINGNAME=Fezziwig%20Fowl&STREET=123%20Notta%20Way&CITY=Whoville&STATE=OR&ZIP=97211&COUNTRY=US&COUNTRYNAME=United%20States&ADDRESSID=PayPal&ADDRESSSTATUS=Confirmed&CURRENCYCODE=USD&AMT=1%2e55&ITEMAMT=1%2e55&SHIPPINGAMT=0&HANDLINGAMT=0&TAXAMT=0&CUSTOM=45931210&DESC=Donation%20to%20the%20Wikimedia%20Foundation&INVNUM=45931210%2e1&NOTIFYURL=http%3a%2f%2ffundraising%2ewikimedia%2eorg%2fIPNListener_Standalone%2ephp&INSURANCEAMT=0&SHIPDISCAMT=0&INSURANCEOPTIONOFFERED=false&L_QTY0=1&L_TAXAMT0=0&L_AMT0=1%2e55&L_DESC0=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUEST_0_CURRENCYCODE=USD&PAYMENTREQUEST_0_AMT=1%2e55&PAYMENTREQUEST_0_ITEMAMT=1%2e55&PAYMENTREQUEST_0_SHIPPINGAMT=0&PAYMENTREQUEST_0_HANDLINGAMT=0&PAYMENTREQUEST_0_TAXAMT=0&PAYMENTREQUEST_0_CUSTOM=45931210&PAYMENTREQUEST_0_DESC=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUEST_0_INVNUM=45931210%2e1&PAYMENTREQUEST_0_NOTIFYURL=http%3a%2f%2ffundraising%2ewikimedia%2eorg%2fIPNListener_Standalone%2ephp&PAYMENTREQUEST_0_INSURANCEAMT=0&PAYMENTREQUEST_0_SHIPDISCAMT=0&PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID=receiver%40wikimedia%2eorg&PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed&L_PAYMENTREQUEST_0_QTY0=1&L_PAYMENTREQUEST_0_TAXAMT0=0&L_PAYMENTREQUEST_0_AMT0=1%2e55&L_PAYMENTREQUEST_0_DESC0=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUESTINFO_0_ERRORCODE=0 ->>>>>>> BRANCH (14ed96 Order sequence numbers start at 1, not 0) -- To view, visit https://gerrit.wikimedia.org/r/368832 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If6394218de80458cf0efa2ea7105f332bd23eca9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: deployment Gerrit-Owner: Ejegg <ej...@ejegg.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits