jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/351176 )
Change subject: Merge branch 'master' into deployment ...................................................................... Merge branch 'master' into deployment dfc39b5 Remove an unused default parameter 5893db2 processDonorReturn returns PaymentResult 33a7ead Paypal EC: send donor back to PP on code 10486 f6c1b02 Localisation updates from https://translatewiki.net. Change-Id: I9414a6fc020f2084b1634a9f46bf0c956aa659b7 --- D tests/phpunit/Adapter/Adyen/AdyenTest.php D tests/phpunit/Adapter/AstroPay/AstroPayTest.php D tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php D tests/phpunit/TestConfiguration.php D tests/phpunit/includes/Responses/paypal_ec/DoExpressCheckoutPayment_10486.testresponse D tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse 7 files changed, 0 insertions(+), 1,750 deletions(-) Approvals: jenkins-bot: Verified Ejegg: Looks good to me, approved diff --git a/tests/phpunit/Adapter/Adyen/AdyenTest.php b/tests/phpunit/Adapter/Adyen/AdyenTest.php deleted file mode 100644 index ba5305b..0000000 --- a/tests/phpunit/Adapter/Adyen/AdyenTest.php +++ /dev/null @@ -1,206 +0,0 @@ -<<<<<<< HEAD (ba9d09 Merge branch 'master' 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. - */ - -/** - * - * @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(); - - $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'], - 'billingAddress.city' => $init['city'], - 'billingAddress.postalCode' => $init['postal_code'], - 'billingAddress.stateOrProvince' => $init['state'], - 'billingAddress.country' => $init['country'], - 'billingAddress.houseNumberOrName' => 'NA', - 'billingAddressType' => 2, - 'card.cardHolderName' => $init['fname'] . ' ' . $init['lname'], - 'currencyCode' => $init['currency_code'], - '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->getStompTransaction(); - $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'], - 'billingAddress.city' => $init['city'], - 'billingAddress.postalCode' => $init['postal_code'], - 'billingAddress.stateOrProvince' => $init['state'], - 'billingAddress.country' => $init['country'], - 'billingAddress.houseNumberOrName' => 'NA', - 'billingAddressType' => 2, - 'card.cardHolderName' => $init['fname'] . ' ' . $init['lname'], - 'currencyCode' => $init['currency_code'], - '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.0', - 'merchantSig' => 'o1QTd6X/PYrOgLPoSheamR3osAksh6oTaSytsCcJsFA=', - '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.0', - 'merchantSig' => 'EVqAiz4nZ8XQ9Wfbm9bOQYaKPV22qdY+/6va7zAo580=', - 'paymentMethod' => 'visa', - 'pspReference' => '123987612346789', - 'shopperLocale' => 'fr_FR', - 'skinCode' => 'testskin', - 'title' => 'Special:AdyenGatewayResult' - ) ); - $this->assertTrue( $result->isFailed() ); - } -} ->>>>>>> BRANCH (f6c1b0 Localisation updates from https://translatewiki.net.) diff --git a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php deleted file mode 100644 index d23a83b..0000000 --- a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php +++ /dev/null @@ -1,552 +0,0 @@ -<<<<<<< HEAD (ba9d09 Merge branch 'master' 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; - -/** - * - * @group Fundraising - * @group DonationInterface - * @group AstroPay - */ -class DonationInterface_Adapter_AstroPay_AstroPayTest 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 - */ - function __construct( $name = null, array $data = array(), $dataName = '' ) { - parent::__construct( $name, $data, $dataName ); - $this->testAdapterClass = 'TestingAstroPayAdapter'; - } - - function setUp() { - parent::setUp(); - $this->setMwGlobals( array( - 'wgAstroPayGatewayEnabled' => true, - ) ); - } - - /** - * Ensure we're setting the right url for each transaction - * @covers AstroPayAdapter::getCurlBaseOpts - */ - function testCurlUrl() { - $init = $this->getDonorTestData( 'BR' ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setCurrentTransaction( 'NewInvoice' ); - - $result = $gateway->getCurlBaseOpts(); - - $this->assertEquals( - 'https://sandbox.astropay.example.com/api_curl/streamline/NewInvoice', - $result[CURLOPT_URL], - 'Not setting URL to transaction-specific value.' - ); - } - - /** - * Test the NewInvoice transaction is making a sane request and signing - * it correctly - */ - function testNewInvoiceRequest() { - $init = $this->getDonorTestData( 'BR' ); - $session['Donor']['order_id'] = '123456789'; - $this->setUpRequest( $init, $session ); - $this->setLanguage( $init['language'] ); - $gateway = new TestingAstroPayAdapter(); - - $gateway->do_transaction( 'NewInvoice' ); - parse_str( $gateway->curled[0], $actual ); - - $expected = array( - 'x_login' => 'createlogin', - 'x_trans_key' => 'createpass', - 'x_invoice' => '123456789', - 'x_amount' => '100.00', - 'x_currency' => 'BRL', - 'x_bank' => 'TE', - 'x_country' => 'BR', - 'x_description' => wfMessage( 'donate_interface-donation-description' )->inLanguage( $init['language'] )->text(), - 'x_iduser' => 'nob...@example.org', - 'x_cpf' => '00003456789', - 'x_name' => 'Nome Apelido', - 'x_email' => 'nob...@example.org', - // 'x_address' => 'Rua Falso 123', - // 'x_zip' => '01110-111', - // 'x_city' => 'São Paulo', - // 'x_state' => 'SP', - 'control' => 'AC43664E0C4DF30607A26F271C8998BC4EE26511366E65AFB69B96E89BFD4359', - 'type' => 'json', - ); - $this->assertEquals( $expected, $actual, 'NewInvoice is not including the right parameters' ); - } - - /** - * When AstroPay sends back valid JSON with status "0", we should set txn - * status to true and errors should be empty. - */ - function testStatusNoErrors() { - $init = $this->getDonorTestData( 'BR' ); - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->do_transaction( 'NewInvoice' ); - - $this->assertEquals( true, $gateway->getTransactionStatus(), - 'Transaction status should be true for code "0"' ); - - $this->assertEmpty( $gateway->getTransactionErrors(), - 'Transaction errors should be empty for code "0"' ); - } - - /** - * If astropay sends back non-JSON, communication status should be false - */ - function testGibberishResponse() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'notJson' ); - - $gateway->do_transaction( 'NewInvoice' ); - - $this->assertEquals( false, $gateway->getTransactionStatus(), - 'Transaction status should be false for bad format' ); - } - - /** - * When AstroPay sends back valid JSON with status "1", we should set - * error array to generic error and log a warning. - */ - function testStatusErrors() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '1' ); - - $gateway->do_transaction( 'NewInvoice' ); - - $expected = array( - 'internal-0000' => wfMessage( 'donate_interface-processing-error')->inLanguage( $init['language'] )->text() - ); - $this->assertEquals( $expected, $gateway->getTransactionErrors(), - 'Wrong error for code "1"' ); - $logged = $this->getLogMatches( LogLevel::WARNING, '/This error message should appear in the log./' ); - $this->assertNotEmpty( $logged ); - } - - /** - * do_transaction should set redirect key when we get a valid response. - */ - function testRedirectOnSuccess() { - $init = $this->getDonorTestData( 'BR' ); - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->do_transaction( 'NewInvoice' ); - - // from the test response - $expected = 'https://sandbox.astropaycard.com/go_to_bank?id=A5jvKfK1iHIRUTPXXt8lDFGaRRLzPgBg'; - $response = $gateway->getTransactionResponse(); - $this->assertEquals( $expected, $response->getRedirect(), - 'do_transaction is not setting the right redirect' ); - } - - /** - * do_transaction should set redirect key when we get a valid response. - */ - function testDoPaymentSuccess() { - $init = $this->getDonorTestData( 'BR' ); - $init['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $init ); - - $result = $gateway->doPayment(); - - // from the test response - $expected = 'https://sandbox.astropaycard.com/go_to_bank?id=A5jvKfK1iHIRUTPXXt8lDFGaRRLzPgBg'; - $this->assertEquals( $expected, $result->getRedirect(), - 'doPayment is not setting the right redirect' ); - } - - /** - * When AstroPay sends back valid JSON with status "1", we should set - * error array to generic error and log a warning. - */ - function testDoPaymentErrors() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '1' ); - - $result = $gateway->doPayment(); - - $expectedMessage = wfMessage( 'donate_interface-processing-error')->inLanguage( $init['language'] )->text(); - $actual = $result->getErrors(); - $this->assertEquals( $expectedMessage, $actual['internal-0000']['message'], - 'Wrong error array in PaymentResult' ); - - $logged = $this->getLogMatches( LogLevel::WARNING, '/This error message should appear in the log./' ); - $this->assertNotEmpty( $logged ); - // TODO: Should this really be a refresh, or should we finalize to failed here? - $this->assertTrue( $result->getRefresh(), 'PaymentResult should be a refresh' ); - } - - /** - * Should set a validation error on amount - */ - function testDoPaymentLimitExceeded() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $init['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'limit_exceeded' ); - - $result = $gateway->doPayment(); - $this->assertTrue( $result->getRefresh(), 'PaymentResult should be a refresh' ); - - $errors = $gateway->getTransactionResponse()->getErrors(); - $expectedMessage = wfMessage( 'donate_interface-error-msg-limit')->inLanguage( $init['language'] )->text(); - $this->assertEquals( $expectedMessage, $errors['internal-0000']['message'] ); - $this->assertEquals( 'amount', $errors['internal-0000']['context'] ); - } - - /** - * Should set a validation error on fiscal_number - */ - function testDoPaymentBadFiscalNumber() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $init['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'fiscal_number' ); - - $result = $gateway->doPayment(); - $this->assertTrue( $result->getRefresh(), 'PaymentResult should be a refresh' ); - - $errors = $gateway->getTransactionResponse()->getErrors(); - $expectedMessage = DataValidator::getErrorMessage( 'fiscal_number', 'calculated', $init['language'], $init['country'] ); - $this->assertEquals( $expectedMessage, $errors['internal-0000']['message'] ); - $this->assertEquals( 'fiscal_number', $errors['internal-0000']['context'] ); - } - - /** - * Should finalize to failed - */ - function testDoPaymentUserUnauthorized() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $init['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'user_unauthorized' ); - - $result = $gateway->doPayment(); - $this->assertTrue( $result->isFailed() ); - } - - /** - * Should tell the user to try again - */ - function testDoPaymentCouldNotRegister() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $init['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'could_not_register' ); - - $result = $gateway->doPayment(); - $this->assertTrue( $result->getRefresh(), 'PaymentResult should be a refresh' ); - - $errors = $gateway->getTransactionResponse()->getErrors(); - $expectedMessage = wfMessage( 'donate_interface-try-again')->inLanguage( $init['language'] )->text(); - $this->assertEquals( $expectedMessage, $errors['internal-0000']['message'] ); - } - - /** - * Should tell the user to try again - */ - function testDoPaymentCouldNotMakeDeposit() { - $init = $this->getDonorTestData( 'BR' ); - $this->setLanguage( $init['language'] ); - $init['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'could_not_make_deposit' ); - - $result = $gateway->doPayment(); - $this->assertTrue( $result->getRefresh(), 'PaymentResult should be a refresh' ); - - $errors = $gateway->getTransactionResponse()->getErrors(); - $expectedMessage = wfMessage( 'donate_interface-try-again')->inLanguage( $init['language'] )->text(); - $this->assertEquals( $expectedMessage, $errors['internal-0000']['message'] ); - } - - /** - * PaymentStatus transaction should interpret the delimited response - */ - function testPaymentStatus() { - $init = $this->getDonorTestData( 'BR' ); - $session['Donor']['order_id'] = '123456789'; - $this->setUpRequest( $init, $session ); - $gateway = new TestingAstroPayAdapter(); - - $gateway->do_transaction( 'PaymentStatus' ); - - // from the test response - $expected = array( - 'result' => '9', - 'x_amount' => '100.00', - 'x_iduser' => '08feb2d12771bbcfeb86', - 'x_invoice' => '123456789', - 'PT' => '1', - 'x_control' => '0656B92DF44B814D48D84FED2F444CCA1E991A24A365FBEECCCA15B73CC08C2A', - 'x_document' => '987654321', - 'x_bank' => 'TE', - 'x_payment_type' => '03', - 'x_bank_name' => 'GNB', - 'x_currency' => 'BRL', - ); - $results = $gateway->getTransactionData(); - $this->assertEquals( $expected, $results, - 'PaymentStatus response not interpreted correctly' ); - // Should not throw exception - $gateway->verifyStatusSignature( $results ); - } - - /** - * Invalid signature should be recognized as such. - */ - function testInvalidSignature() { - $init = $this->getDonorTestData( 'BR' ); - $session['Donor']['order_id'] = '123456789'; - $this->setUpRequest( $init, $session ); - $gateway = new TestingAstroPayAdapter(); - - $gateway->setDummyGatewayResponseCode( 'badsig' ); - $gateway->do_transaction( 'PaymentStatus' ); - - $results = $gateway->getTransactionData(); - $this->setExpectedException( 'ResponseProcessingException' ); - $gateway->verifyStatusSignature( $results ); - } - - /** - * If status is paid and signature is correct, processDonorReturn should not - * throw exception and final status should be 'completed' - */ - function testSuccessfulReturn() { - $init = $this->getDonorTestData( 'BR' ); - $session['Donor']['order_id'] = '123456789'; - $this->setUpRequest( $init, $session ); - $gateway = new TestingAstroPayAdapter(); - - $requestValues = array( - 'result' => '9', - 'x_amount' => '100.00', - 'x_amount_usd' => '42.05', - 'x_control' => 'DDF89085AC70C0B0628150C51D64419D8592769F2439E3936570E26D24881730', - 'x_description' => 'Donation to the Wikimedia Foundation', - 'x_document' => '32869', - 'x_iduser' => '08feb2d12771bbcfeb86', - 'x_invoice' => '123456789', - ); - - $result = $gateway->processDonorReturn( $requestValues ); - $this->assertFalse( $result->isFailed() ); - $status = $gateway->getFinalStatus(); - $this->assertEquals( FinalStatus::COMPLETE, $status ); - } - - /** - * Make sure we record the actual amount charged, even if the donor has - * opened a new window and screwed up their session data. - */ - function testReturnUpdatesAmount() { - $init = $this->getDonorTestData( 'BR' ); - $init['amount'] = '22.55'; // junk session data from another banner click - $session['Donor']['order_id'] = '123456789'; - $this->setUpRequest( $init, $session ); - $gateway = new TestingAstroPayAdapter(); - - $amount = $gateway->getData_Unstaged_Escaped( 'amount' ); - $this->assertEquals( '22.55', $amount ); - - $requestValues = array( - 'result' => '9', - 'x_amount' => '100.00', - 'x_amount_usd' => '42.05', - 'x_control' => 'DDF89085AC70C0B0628150C51D64419D8592769F2439E3936570E26D24881730', - 'x_description' => 'Donation to the Wikimedia Foundation', - 'x_document' => '32869', - 'x_iduser' => '08feb2d12771bbcfeb86', - 'x_invoice' => '123456789', - ); - - $result = $gateway->processDonorReturn( $requestValues ); - $this->assertFalse( $result->isFailed() ); - $amount = $gateway->getData_Unstaged_Escaped( 'amount' ); - $this->assertEquals( '100.00', $amount, 'Not recording correct amount' ); - } - - /** - * If payment is rejected, final status should be 'failed' - */ - function testRejectedReturn() { - $init = $this->getDonorTestData( 'BR' ); - $session['Donor']['order_id'] = '123456789'; - $this->setUpRequest( $init, $session ); - $gateway = new TestingAstroPayAdapter(); - - $requestValues = array( - 'result' => '8', // rejected by bank - 'x_amount' => '100.00', - 'x_amount_usd' => '42.05', - 'x_control' => '706F57BC3E74906B14B1DEB946F027104513797CC62AC0F5107BC98F42D5DC95', - 'x_description' => 'Donation to the Wikimedia Foundation', - 'x_document' => '32869', - 'x_iduser' => '08feb2d12771bbcfeb86', - 'x_invoice' => '123456789', - ); - - $result = $gateway->processDonorReturn( $requestValues ); - $this->assertTrue( $result->isFailed() ); - $status = $gateway->getFinalStatus(); - $this->assertEquals( FinalStatus::FAILED, $status ); - } - - function testStageBankCode() { - $init = $this->getDonorTestData( 'BR' ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'elo'; - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->doPayment(); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $bank_code = $exposed->getData_Staged( 'bank_code' ); - $this->assertEquals( 'EL', $bank_code, 'Not setting bank_code in doPayment' ); - } - - /** - * Test that we run the AntiFraud filters before redirecting - */ - function testAntiFraudFilters() { - DonationInterface_FraudFiltersTest::setupFraudMaps( $this ); - $init = $this->getDonorTestData( 'BR' ); - $init['payment_method'] = 'cc'; - $init['bank_code'] = 'VD'; - // following data should trip fraud alarms - $init['utm_medium'] = 'somethingmedia'; - $init['utm_source'] = 'somethingmedia'; - $init['email'] = 'someb...@wikipedia.org'; - - $gateway = $this->getFreshGatewayObject( $init ); - - $result = $gateway->doPayment(); - - $this->assertTrue( $result->isFailed(), 'Result should be failure if fraud filters say challenge' ); - $this->assertEquals( 'challenge', $gateway->getValidationAction(), 'Validation action is not as expected' ); - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $this->assertEquals( 60, $exposed->risk_score, 'RiskScore is not as expected' ); - } - - function testStageFiscalNumber() { - $init = $this->getDonorTestData( 'BR' ); - $init['fiscal_number'] = '000.034.567-89'; - $gateway = $this->getFreshGatewayObject( $init ); - - $gateway->doPayment(); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $staged = $exposed->getData_Staged( 'fiscal_number' ); - $this->assertEquals( '00003456789', $staged, 'Not stripping fiscal_number punctuation in doPayment' ); - } - - /** - * We should increment the order ID with each NewInvoice call - */ - function testNewInvoiceOrderId() { - $init = $this->getDonorTestData( 'BR' ); - $firstRequest = $this->setUpRequest( $init ); - $firstAttempt = new TestingAstroPayAdapter(); - $firstAttempt->setDummyGatewayResponseCode( '1' ); - - $firstAttempt->doPayment(); - - $this->setUpRequest( $init, $firstRequest->getSessionArray() ); - $secondAttempt = new TestingAstroPayAdapter(); - $secondAttempt->doPayment(); - - parse_str( $firstAttempt->curled[0], $firstParams ); - parse_str( $secondAttempt->curled[0], $secondParams ); - - $this->assertNotEquals( $firstParams['x_invoice'], $secondParams['x_invoice'], - 'Not generating new order id for NewInvoice call' - ); - } - - /** - * We should increment the order ID with each NewInvoice call, even when - * retrying inside a single doPayment call - */ - function testNewInvoiceOrderIdRetry() { - $init = $this->getDonorTestData( 'BR' ); - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'collision' ); - - $gateway->doPayment(); - - parse_str( $gateway->curled[0], $firstParams ); - parse_str( $gateway->curled[1], $secondParams ); - - $this->assertNotEquals( $firstParams['x_invoice'], $secondParams['x_invoice'], - 'Not generating new order id for retried NewInvoice call' - ); - } - - /** - * We should show an error for incompatible country / currency combinations - */ - function testBadCurrencyForCountry() { - $init = $this->getDonorTestData( 'BR' ); - $init['currency_code'] = 'CLP'; - $gateway = $this->getFreshGatewayObject( $init ); - - $errors = $gateway->getErrors(); - - $this->assertNotEmpty( $errors ); - $this->assertTrue( - isset( $errors['currency_code'] ), - 'Should show a currency code error for trying to use CLP in BR' - ); - } - - function testDummyFiscalNumber() { - $init = $this->getDonorTestData( 'MX' ); - $init['payment_submethod'] = 'visa'; - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->doPayment(); - - parse_str( $gateway->curled[0], $firstParams ); - $fiscalNumber = $firstParams['x_cpf']; - $this->assertEquals( - 13, strlen( $fiscalNumber ), - 'Fake fiscal number should be 13 digits' - ); - } -} ->>>>>>> BRANCH (f6c1b0 Localisation updates from https://translatewiki.net.) diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php deleted file mode 100644 index 243ccbc..0000000 --- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php +++ /dev/null @@ -1,639 +0,0 @@ -<<<<<<< HEAD (ba9d09 Merge branch 'master' 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; - -/** - * - * @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.0'; - 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_code'] = 'USD'; - - $gateway = $this->getFreshGatewayObject( $init ); - - $amount = $gateway->getData_Unstaged_Escaped( 'amount' ); - $currency = $gateway->getData_Unstaged_Escaped( 'currency_code' ); - $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_code' ); - $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_code', - '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' => 'fname', - 'SURNAME' => 'lname', - 'STREET' => 'street', - 'CITY' => 'city', - 'STATE' => 'state', - '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 = $this->getLogMatches( LogLevel::ERROR, '/Investigation required!/' ); - $this->assertNotEmpty( $loglines, 'GC Error 21000050 is not generating the expected payments log error' ); - - //Reset logs - $this->testLogger->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 = $this->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_code'=>'USD', - 'email'=>'faketyf...@gmail.com', - 'fname'=>'Fakety', - 'format'=>'json', - 'gateway'=>'globalcollect', - 'language'=>'en', - 'lname'=>'Fake', - 'payment_method'=>'cc', - 'referrer'=>'http://en.wikipedia.org/wiki/Main_Page', - 'state'=>'MA', - 'street'=>'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 = $this->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 = $this->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 (f6c1b0 Localisation updates from https://translatewiki.net.) diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php deleted file mode 100644 index b085ea4..0000000 --- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php +++ /dev/null @@ -1,167 +0,0 @@ -<<<<<<< HEAD (ba9d09 Merge branch 'master' 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&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&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 - */ - -/** - * - * @group Fundraising - * @group DonationInterface - * @group PayPal - */ -class DonationInterface_Adapter_PayPal_Express_Test extends DonationInterfaceTestCase { - - protected $testAdapterClass = 'TestingPaypalExpressAdapter'; - - public function setUp() { - parent::setUp(); - - $this->setMwGlobals( array( - 'wgDonationInterfaceCancelPage' => 'https://example.com/tryAgain.php', - 'wgPaypalExpressGatewayEnabled' => true, - 'wgDonationInterfaceThankYouPage' => 'https://example.org/wiki/Thank_You', - ) ); - } - - protected function unsetVariableFields( &$message ) { - $fields = array( - 'date', 'source_host', 'source_run_id', 'source_version', 'gateway_account' - ); - foreach ( $fields as $field ) { - unset( $message[$field] ); - } - } - - /** - * 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'; - - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( 'OK' ); - $gateway->processDonorReturn( array( - 'token' => 'EC%2d4V987654XA123456V', - 'PayerID' => 'ASDASD' - ) ); - - $message = DonationQueue::instance()->pop( 'complete' ); - $this->assertNotNull( $message, 'Not sending a message to the complete queue' ); - $this->unsetVariableFields( $message ); - $expected = array ( - 'contribution_tracking_id' => $init['contribution_tracking_id'], - 'country' => 'US', - 'fee' => '0', - 'gateway' => 'paypal_ec', - 'gateway_txn_id' => '5EJ123456T987654S', - 'language' => 'en', - 'order_id' => $init['contribution_tracking_id'] . '.0', - '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( 'complete' ), - 'Sending extra messages to complete 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( 'complete' ); - $this->assertNotNull( $message, 'Not sending a message to the complete queue' ); - $this->unsetVariableFields( $message ); - $expected = array ( - 'contribution_tracking_id' => $init['contribution_tracking_id'], - 'country' => 'US', - 'fee' => '0', - 'gateway' => 'paypal_ec', - 'gateway_txn_id' => '5EJ123456T987654S', - 'language' => 'en', - 'order_id' => $init['contribution_tracking_id'] . '.0', - 'payment_method' => 'paypal', - 'payment_submethod' => '', - 'response' => false, - 'user_ip' => '127.0.0.1', - 'utm_source' => '..rpaypal', - 'city' => 'San Francisco', - 'currency' => 'USD', - 'email' => 'do...@generous.net', - 'first_name' => 'Fezziwig', - 'gross' => '1.55', - 'last_name' => 'Fowl', - 'recurring' => '1', - 'state_province' => 'CA', - 'street_address' => '123 Fake Street', - 'postal_code' => '94105', - 'source_name' => 'DonationInterface', - 'source_type' => 'payments', - 'subscr_id' => 'I-88J1M3DLSF0' - ); - $this->assertEquals( $expected, $message ); - $this->assertNull( - DonationQueue::instance()->pop( 'complete' ), - 'Sending extra messages to complete 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'; - - $gateway = $this->getFreshGatewayObject( $init ); - $gateway->setDummyGatewayResponseCode( '10486' ); - $result = $gateway->processDonorReturn( array( - 'token' => 'EC%2d2D123456D9876543U', - 'PayerID' => 'ASDASD' - ) ); - - $message = DonationQueue::instance()->pop( 'complete' ); - $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 - ); - } - -} ->>>>>>> BRANCH (f6c1b0 Localisation updates from https://translatewiki.net.) diff --git a/tests/phpunit/TestConfiguration.php b/tests/phpunit/TestConfiguration.php deleted file mode 100644 index 99dfac8..0000000 --- a/tests/phpunit/TestConfiguration.php +++ /dev/null @@ -1,184 +0,0 @@ -<<<<<<< HEAD (ba9d09 Merge branch 'master' 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. - * - * This file contains custom options and constants for test configuration. - */ - -/** - * TESTS_MESSAGE_NOT_IMPLEMENTED - * - * Message for code that has not been implemented. - */ -define( 'TESTS_MESSAGE_NOT_IMPLEMENTED', 'Not implemented yet!' ); - -/** - * TESTS_HOSTNAME - * - * The hostname for the system - */ -define( 'TESTS_HOSTNAME', 'localhost' ); - -/** - * TESTS_EMAIL - * - * An email address to use in case test send mail - */ -define( 'TESTS_EMAIL', 'nob...@wikimedia.org' ); - -/** - * TESTS_GATEWAY_DEFAULT - * - * This is the default gateway that will be used to implement unit tests. - */ -define( 'TESTS_GATEWAY_DEFAULT', 'GlobalCollectGateway' ); - -/** - * TESTS_ADAPTER_DEFAULT - * - * This is the default adapter that will be used to implement unit tests. - */ -define( 'TESTS_ADAPTER_DEFAULT', 'TestingGlobalCollectAdapter' ); - -global $wgDonationInterfaceTestMode, - $wgDonationInterfaceMerchantID, - $wgDonationInterfaceGatewayAdapters, - $wgDonationInterfaceAllowedHtmlForms, - $wgDonationInterfaceThankYouPage, - $wgGlobalCollectGatewayAccountInfo, - $wgPaypalGatewayAccountInfo, - $wgPaypalGatewayReturnURL, - $wgPaypalExpressGatewayURL, - $wgPaypalExpressGatewayTestingURL, - $wgPaypalExpressGatewaySignatureURL, - $wgPaypalExpressGatewayAccountInfo, - $wgAmazonGatewayReturnURL, - $wgAmazonGatewayAccountInfo, - $wgAdyenGatewayURL, - $wgAdyenGatewayAccountInfo, - $wgAstroPayGatewayURL, - $wgAstroPayGatewayTestingURL, - $wgAstroPayGatewayAccountInfo, - $wgAstroPayGatewayFallbackCurrency, - $wgMinFraudLicenseKey, - $wgMinFraudTimeout, - $wgDonationInterfaceMinFraudServers, - $wgDonationInterfaceEnableMinfraud, - $wgDonationInterfaceEnableFunctionsFilter, - $wgDonationInterfaceEnableReferrerFilter, - $wgDonationInterfaceEnableSourceFilter; - -$wgDonationInterfaceGatewayAdapters = array( - 'globalcollect'=> 'TestingGlobalCollectAdapter', - 'amazon'=> 'TestingAmazonAdapter', - 'adyen'=> 'TestingAdyenAdapter', - 'astropay'=> 'TestingAstroPayAdapter', - 'paypal_ec'=> 'TestingPaypalExpressAdapter', - 'paypal'=> 'TestingPaypalLegacyAdapter' -); -/** - * Make sure the test setup is used, else we'll have the wrong classes. - */ -/** DonationInterface General Settings **/ -$wgDonationInterfaceTestMode = true; -$wgDonationInterfaceMerchantID = 'test'; - -$wgDonationInterfaceThankYouPage = 'https://wikimediafoundation.org/wiki/Thank_You'; - - -/** GlobalCollect **/ -$wgGlobalCollectGatewayAccountInfo = array(); -$wgGlobalCollectGatewayAccountInfo['test'] = array( - 'MerchantID' => 'test', -); - - -/** Paypal **/ -$wgPaypalGatewayAccountInfo = array(); -$wgPaypalGatewayAccountInfo['testing'] = array( - 'AccountEmail' => 'phpunittest...@wikimedia.org', -); -$wgPaypalGatewayReturnURL = 'http://donate.wikimedia.org'; // whatever, doesn't matter. - - -/** Paypal Express Checkout **/ -$wgPaypalExpressGatewayURL = 'https://api-3t.sandbox.paypal.com/nvp'; -$wgPaypalExpressGatewayTestingURL = 'https://api-3t.sandbox.paypal.com/nvp'; -$wgPaypalExpressGatewaySignatureURL = $wgPaypalExpressGatewayURL; -$wgPaypalExpressGatewayAccountInfo['test'] = array( - 'User' => 'phpunittest...@wikimedia.org', - 'Password' => '9876543210', - 'Signature' => 'ABCDEFGHIJKLMNOPQRSTUV-ZXCVBNMLKJHGFDSAPOIUYTREWQ', - 'RedirectURL' => 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=', -); - - -/** Amazon **/ -$wgAmazonGatewayReturnURL = 'https://payments.wikimedia.org/index.php/Special:AmazonGateway'; -$wgAmazonGatewayAccountInfo = array(); -$wgAmazonGatewayAccountInfo['test'] = array( - 'SellerID' => 'ABCDEFGHIJKL', - 'ClientID' => 'amzn1.application-oa2-client.1a2b3c4d5e', - 'ClientSecret' => '12432g134e3421a41234b1341c324123d', - 'MWSAccessKey' => 'N0NSENSEXYZ', - 'MWSSecretKey' => 'iuasd/2jhaslk2j49lkaALksdJLsJLas+', - 'Region' => 'us', - 'WidgetScriptURL' => - 'https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js', - 'ReturnURL' => "https://example.org/index.php/Special:AmazonGateway?debug=true", -); - -/** Adyen **/ -$wgAdyenGatewayURL = 'https://testorwhatever.adyen.com'; -$wgAdyenGatewayAccountInfo = array(); -$wgAdyenGatewayAccountInfo['test'] = array( - 'AccountName' => 'wikitest', - 'SharedSecret' => 'C7F1D9E29479CF18131063A742CD2703FB9D48BAB0160693045E3FB7B8508E59', - 'SkinCode' => 'testskin', -); - -/** AstroPay **/ -$wgAstroPayGatewayURL = 'https://astropay.example.com/'; -$wgAstroPayGatewayTestingURL = 'https://sandbox.astropay.example.com/'; -$wgAstroPayGatewayAccountInfo = array(); -$wgAstroPayGatewayAccountInfo['test'] = array( - 'Create' => array( - 'Login' => 'createlogin', - 'Password' => 'createpass', - ), - 'Status' => array( - 'Login' => 'statuslogin', - 'Password' => 'statuspass', - ), - 'SecretKey' => 'NanananananananananananananananaBatman', -); -$wgAstroPayGatewayFallbackCurrency = false; - -$wgMinFraudLicenseKey = 'testkey'; -$wgMinFraudTimeout = 1; -$wgDonationInterfaceMinFraudServers = array( "minfraud.wikimedia.org" ); - -// still can't quite handle minfraud by itself yet, so default like this. -// I will turn it on for individual tests in which I want to verify that it at -// least fails closed when enabled. -$wgDonationInterfaceEnableMinfraud = false; - -// ...but we want these. -$wgDonationInterfaceEnableFunctionsFilter = true; -$wgDonationInterfaceEnableReferrerFilter = true; -$wgDonationInterfaceEnableSourceFilter = true; ->>>>>>> BRANCH (f6c1b0 Localisation updates from https://translatewiki.net.) diff --git a/tests/phpunit/includes/Responses/paypal_ec/DoExpressCheckoutPayment_10486.testresponse b/tests/phpunit/includes/Responses/paypal_ec/DoExpressCheckoutPayment_10486.testresponse deleted file mode 100644 index 7eab458..0000000 --- a/tests/phpunit/includes/Responses/paypal_ec/DoExpressCheckoutPayment_10486.testresponse +++ /dev/null @@ -1 +0,0 @@ -TOKEN=EC%2d2D123456D9876543U&SUCCESSPAGEREDIRECTREQUESTED=false&TIMESTAMP=2017%2d04%2d20T16%3a59%3a06Z&CORRELATIONID=537ffff0fefa&ACK=Failure&VERSION=204&BUILD=32574509&L_ERRORCODE0=10486&L_SHORTMESSAGE0=This%20transaction%20couldn%27t%20be%20completed%2e&L_LONGMESSAGE0=This%20transaction%20couldn%27t%20be%20completed%2e%20Please%20redirect%20your%20customer%20to%20PayPal%2e&L_SEVERITYCODE0=Error 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 f945850..0000000 --- a/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse +++ /dev/null @@ -1 +0,0 @@ -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%2e0&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%2e0&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 -- To view, visit https://gerrit.wikimedia.org/r/351176 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9414a6fc020f2084b1634a9f46bf0c956aa659b7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: deployment Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits