jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/380658 )

Change subject: Merge branch 'master' into deployment
......................................................................


Merge branch 'master' into deployment

3cc0a4eec PayPal country code mapping
51de6b768 Remove old transitional code
802cacd5e Add 'ingenico' to error form definitions
ccbc88af2 Ingenico can't accept VEF anymore
ed1174d3b Try out approvePayment
2ec4ccec4 Localisation updates from https://translatewiki.net.
c57317a65 Localisation updates from https://translatewiki.net.
148578a46 Localisation updates from https://translatewiki.net.
a01834425 Fix amount warnings

Change-Id: I34b08bd281a72070525b2dd585999feaa91f0dab
---
D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
D tests/phpunit/AmountTest.php
D 
tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_C2.testresponse
3 files changed, 0 insertions(+), 781 deletions(-)

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
deleted file mode 100644
index 54e7ebd..0000000
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ /dev/null
@@ -1,515 +0,0 @@
-<<<<<<< HEAD   (4ce7f5 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%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 Psr\Log\LogLevel;
-use SmashPig\Core\DataStores\QueueWrapper;
-use SmashPig\Tests\TestingContext;
-use SmashPig\Tests\TestingProviderConfiguration;
-
-/**
- *
- * @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 = 
TestingProviderConfiguration::createForProvider(
-                       'paypal', $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'
-               );
-               $this->assertEquals( 1, count( $gateway->curled ), 'Should have 
made 1 API call' );
-               $apiCall = $gateway->curled[0];
-               $parsed = [];
-               parse_str( $apiCall, $parsed );
-               $actualReturn = $parsed['RETURNURL'];
-               $parsedReturn = [];
-               parse_str( parse_url( $actualReturn, PHP_URL_QUERY ), 
$parsedReturn );
-               $this->assertEquals(
-                       [
-                               'title' => 'Special:PaypalExpressGatewayResult',
-                               'order_id' => $init['contribution_tracking_id'] 
. '.1',
-                               'wmf_token' => 
$gateway->token_getSaltedSessionToken()
-                       ],
-                       $parsedReturn
-               );
-               unset( $parsed['RETURNURL'] );
-               $expected = [
-                       'USER' => 'phpunittest...@wikimedia.org',
-                       'PWD' => '9876543210',
-                       'VERSION' => '204',
-                       'METHOD' => 'SetExpressCheckout',
-                       'CANCELURL' => 'https://example.com/tryAgain.php/fr',
-                       'REQCONFIRMSHIPPING' => '0',
-                       'NOSHIPPING' => '1',
-                       'LOCALECODE' => 'fr_US',
-                       'L_PAYMENTREQUEST_0_AMT0' => '1.55',
-                       'L_PAYMENTREQUEST_0_DESC0' => 'Donation to the 
Wikimedia Foundation',
-                       'PAYMENTREQUEST_0_AMT' => '1.55',
-                       'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
-                       'PAYMENTREQUEST_0_CUSTOM' => 
$init['contribution_tracking_id'],
-                       'PAYMENTREQUEST_0_DESC' => 'Donation to the Wikimedia 
Foundation',
-                       'PAYMENTREQUEST_0_INVNUM' => 
$init['contribution_tracking_id'] . '.1',
-                       'PAYMENTREQUEST_0_ITEMAMT' => '1.55',
-                       'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
-                       'PAYMENTREQUEST_0_PAYMENTREASON' => 'None',
-                       'SIGNATURE' => 
'ABCDEFGHIJKLMNOPQRSTUV-ZXCVBNMLKJHGFDSAPOIUYTREWQ',
-               ];
-               $this->assertEquals(
-                       $expected, $parsed
-               );
-               $message = QueueWrapper::getQueue( 'pending' )->pop();
-               $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 );
-               TestingPaypalExpressAdapter::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'
-               );
-               $this->assertEquals( 1, count( $gateway->curled ), 'Should have 
made 1 API call' );
-               $apiCall = $gateway->curled[0];
-               $parsed = [];
-               parse_str( $apiCall, $parsed );
-               $actualReturn = $parsed['RETURNURL'];
-               $parsedReturn = [];
-               parse_str( parse_url( $actualReturn, PHP_URL_QUERY ), 
$parsedReturn );
-               $this->assertEquals(
-                       [
-                               'title' => 'Special:PaypalExpressGatewayResult',
-                               'order_id' => $init['contribution_tracking_id'] 
. '.1',
-                               'recurring' => '1',
-                               'wmf_token' => 
$gateway->token_getSaltedSessionToken()
-                       ],
-                       $parsedReturn
-               );
-               unset( $parsed['RETURNURL'] );
-               $expected = [
-                       'USER' => 'phpunittest...@wikimedia.org',
-                       'PWD' => '9876543210',
-                       'VERSION' => '204',
-                       'METHOD' => 'SetExpressCheckout',
-                       'CANCELURL' => 'https://example.com/tryAgain.php/fr',
-                       'REQCONFIRMSHIPPING' => '0',
-                       'NOSHIPPING' => '1',
-                       'LOCALECODE' => 'fr_US',
-                       'L_PAYMENTREQUEST_0_AMT0' => '1.55',
-                       'PAYMENTREQUEST_0_AMT' => '1.55',
-                       'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
-                       'L_BILLINGTYPE0' => 'RecurringPayments',
-                       'L_BILLINGAGREEMENTDESCRIPTION0' => 'Monthly donation 
to the Wikimedia Foundation',
-                       'L_BILLINGAGREEMENTCUSTOM0' => 
$init['contribution_tracking_id'] . '.1',
-                       'L_PAYMENTREQUEST_0_NAME0' => 'Monthly donation to the 
Wikimedia Foundation',
-                       'L_PAYMENTREQUEST_0_QTY0' => '1',
-                       'MAXAMT' => '1.55',
-                       'PAYMENTREQUEST_0_ITEMAMT' => '1.55',
-                       'SIGNATURE' => 
'ABCDEFGHIJKLMNOPQRSTUV-ZXCVBNMLKJHGFDSAPOIUYTREWQ',
-               ];
-               $this->assertEquals(
-                       $expected, $parsed
-               );
-               $message = QueueWrapper::getQueue( 'pending' )->pop();
-               $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..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 );
-               TestingPaypalExpressAdapter::setDummyGatewayResponseCode( 'OK' 
);
-               $gateway->processDonorReturn( array(
-                       'token' => 'EC%2d4V987654XA123456V',
-                       'PayerID' => 'ASDASD',
-               ) );
-
-               $message = QueueWrapper::getQueue( 'donations' )->pop();
-               $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(
-                       QueueWrapper::getQueue( 'donations' )->pop(),
-                       '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 = QueueWrapper::getQueue( 'donations' )->pop();
-               $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 = QueueWrapper::getQueue( 'donations' )->pop();
-               $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
-               );
-       }
-
-       /**
-        * Check that we don't send donors to the fail page for warnings
-        */
-       function testProcessDonorReturnWarning() {
-               $init = $this->getDonorTestData( 'US' );
-               $init['contribution_tracking_id'] = '45931210';
-               $this->setUpRequest( $init, array( 'Donor' => $init ) );
-
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway::setDummyGatewayResponseCode( array(
-                       'OK', // For GetExpressCheckoutDetails
-                       '11607' // For DoExpressCheckoutPayment
-               ) );
-               $result = $gateway->processDonorReturn( array(
-                       'token' => 'EC%2d2D123456D9876543U',
-                       'PayerID' => 'ASDASD'
-               ) );
-
-               $this->assertFalse( $result->isFailed() );
-               $message = QueueWrapper::getQueue( 'donations' )->pop();
-               $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' => '33N12345BB123456D',
-                       '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(
-                       QueueWrapper::getQueue( 'donations' )->pop(),
-                       'Sending extra messages to donations queue!'
-               );
-               $matches = self::getLogMatches(
-                       LogLevel::WARNING, '/Transaction succeeded with 
warning.*/'
-               );
-               $this->assertNotEmpty( $matches );
-       }
-
-       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(
-                       QueueWrapper::getQueue( 'donations' )->pop(),
-                       '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' );
-               TestingPaypalExpressAdapter::setDummyGatewayResponseCode( 'OK' 
);
-               $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 );
-       }
-
-       public function testShouldRectifyOrphan() {
-               $message = $this->createOrphan( array( 'gateway' => 'paypal', 
'payment_method' => 'paypal' ) );
-               $this->gatewayAdapter = $this->getFreshGatewayObject( $message 
);
-               $result = $this->gatewayAdapter->shouldRectifyOrphan();
-               $this->assertEquals( $result, true, 'shouldRectifyOrphan 
returning false.' );
-       }
-
-       /**
-        * We should take the country from the donor info response, and 
transform
-        * it into a real code if it's a PayPal bogon.
-        */
-       public function testUnstageCountry() {
-               $init = $this->getDonorTestData( 'US' );
-               TestingPaypalExpressAdapter::setDummyGatewayResponseCode( [ 
'C2', 'OK' ] );
-               $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
-               );
-               $this->setUpRequest( $request, $session );
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->processDonorReturn( $request );
-               $savedCountry = $gateway->getData_Unstaged_Escaped( 'country' );
-               $this->assertEquals( 'CN', $savedCountry );
-       }
-}
->>>>>>> BRANCH (b77f90 Merge "PayPal country code mapping")
diff --git a/tests/phpunit/AmountTest.php b/tests/phpunit/AmountTest.php
deleted file mode 100644
index 886bc47..0000000
--- a/tests/phpunit/AmountTest.php
+++ /dev/null
@@ -1,265 +0,0 @@
-<<<<<<< HEAD   (4ce7f5 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      Validation
- */
-class AmountTest  extends DonationInterfaceTestCase {
-
-       /**
-        * @var GatewayType
-        */
-       protected $adapter;
-       /**
-        * @var Amount
-        */
-       protected $validator;
-       /**
-        * @var ErrorState
-        */
-       protected $errors;
-       /**
-        * @var array
-        */
-       protected $normalized;
-
-       public function setUp() {
-               parent::setUp();
-               $this->setMwGlobals( array(
-                       'wgDonationInterfacePriceFloor' => 1.50,
-                       'wgDonationInterfacePriceCeiling' => 100,
-                       'wgLanguageCode' => 'en',
-               ) );
-
-               $this->setUpRequest( array(
-                       'country' => 'US',
-                       'uselang' => 'en',
-               ) );
-
-               $this->normalized = array(
-                       'language' => 'en',
-                       'country' => 'US',
-                       'currency' => 'USD',
-               );
-
-               $this->errors = new ErrorState();
-               $this->adapter = new TestingGenericAdapter();
-               $this->validator = new Amount();
-       }
-
-       protected function validate() {
-               $this->validator->validate(
-                       $this->adapter, $this->normalized, $this->errors
-               );
-       }
-
-       protected function getFirstError() {
-               $list = $this->errors->getErrors();
-               return $list[0];
-       }
-
-       public function testValidUsd() {
-               $this->normalized['amount'] = '10.00';
-               $this->validate();
-               $this->assertFalse(
-                       $this->errors->hasValidationError(),
-                       'Error shown for valid amount'
-               );
-       }
-
-       public function testZeroAmount() {
-               $this->normalized['amount'] = '0.00';
-               $this->validate();
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for zero amount'
-               );
-               $expected = DataValidator::getError( 'amount', 'not_empty' );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error for zero amount'
-               );
-       }
-
-       public function testWhitespaceAmount() {
-               $this->normalized['amount'] = '    ';
-               $this->validate();
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for whitespace amount'
-               );
-               $expected = DataValidator::getError( 'amount', 'not_empty' );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error for zero amount'
-               );
-       }
-
-       public function testNonNumericAmount() {
-               $this->normalized['amount'] = 'XYZ123';
-               $this->validate();
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for non-numeric amount'
-               );
-
-               $expected = new ValidationError(
-                       'amount',
-                       'donate_interface-error-msg-invalid-amount'
-               );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error message for non-numeric amount'
-               );
-       }
-
-       public function testNegativeAmount() {
-               $this->normalized['amount'] = '-100.00';
-               $this->validate();
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for negative amount'
-               );
-
-               $expected = new ValidationError(
-                       'amount',
-                       'donate_interface-error-msg-invalid-amount'
-               );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error message for non-numeric amount'
-               );
-       }
-
-       public function testTooMuchUsd() {
-               $this->normalized['amount'] = '101.00';
-               $this->validate();
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for excessive amount (USD)'
-               );
-               $expected = new ValidationError(
-                       'amount',
-                       'donate_interface-bigamount-error',
-                       array(
-                               100,
-                               'USD',
-                               $this->adapter->getGlobal( 'MajorGiftsEmail' ),
-                       )
-               );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error message for excessive amount (USD)'
-               );
-       }
-
-       public function testTooLittleUsd() {
-               $this->normalized['amount'] = '1.49';
-               $this->validate();
-
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for diminutive amount (USD)'
-               );
-
-               $formattedMin = Amount::format( 1.50, 'USD', 'en_US' );
-               $expected = new ValidationError(
-                       'amount',
-                       'donate_interface-smallamount-error',
-                       array( $formattedMin )
-               );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error message for diminutive amount (USD)'
-               );
-       }
-
-       // Conversion tests depend on Barbadian monetary policy
-       // BBD is convenient as it's pegged to $0.50
-       public function testTooMuchBbd() {
-               $this->normalized['currency'] = 'BBD';
-               $this->normalized['amount'] = '201.00';
-               $this->validate();
-
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for excessive amount (BBD)'
-               );
-               $expected = new ValidationError(
-                       'amount',
-                       'donate_interface-bigamount-error',
-                       array(
-                               200,
-                               'BBD',
-                               $this->adapter->getGlobal( 'MajorGiftsEmail' )
-                       )
-               );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error message for excessive amount (BBD)'
-               );
-       }
-
-       public function testTooLittleBbd() {
-               $this->normalized['currency'] = 'BBD';
-               $this->normalized['amount'] = '2.95';
-               $this->validate();
-
-               $this->assertTrue(
-                       $this->errors->hasValidationError( 'amount' ),
-                       'No error for diminutive amount (BBD)'
-               );
-               $formattedMin = Amount::format( 3.00, 'BBD', 'en_US' );
-               $expected = new ValidationError(
-                       'amount',
-                       'donate_interface-smallamount-error',
-                       array( $formattedMin )
-               );
-               $this->assertEquals(
-                       $expected,
-                       $this->getFirstError(),
-                       'Wrong error message for diminutive amount (BBD)'
-               );
-       }
-
-       public function testRoundNoDigit() {
-               $rounded = Amount::round( '100.01', 'JPY' );
-               $this->assertEquals( 100, $rounded );
-       }
-
-       public function testRoundTwoDigit() {
-               $rounded = Amount::round( '2.762', 'CAD' );
-               $this->assertEquals( 2.76, $rounded );
-       }
-
-       public function testRoundThreeDigit() {
-               $rounded = Amount::round( '19.5437', 'KWD' );
-               $this->assertEquals( 19.544, $rounded );
-       }
-}
->>>>>>> BRANCH (b77f90 Merge "PayPal country code mapping")
diff --git 
a/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_C2.testresponse
 
b/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_C2.testresponse
deleted file mode 100644
index 040a97d..0000000
--- 
a/tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_C2.testresponse
+++ /dev/null
@@ -1 +0,0 @@
-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=C2&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

-- 
To view, visit https://gerrit.wikimedia.org/r/380658
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I34b08bd281a72070525b2dd585999feaa91f0dab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg <ej...@ejegg.com>
Gerrit-Reviewer: Ejegg <ej...@ejegg.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to