jenkins-bot has submitted this change and it was merged.

Change subject: Clear out old Amazon code to prepare for PwA
......................................................................


Clear out old Amazon code to prepare for PwA

Sun is setting on simple payments, so we can ditch most of what
we had.  Pay with Amazon will require a lot less code!

Remove most of adapter and gateway page code.
Delete old tests that depend on old Amazon functionality, skip
fallback currency test that we can use again later.

Bug: T108659
Change-Id: I621db21ded4cc91aed5426026830c7e94ac1bfb9
---
M DonationInterface.php
M amazon_gateway/amazon.adapter.php
M amazon_gateway/amazon_gateway.body.php
M tests/Adapter/Amazon/AmazonTest.php
4 files changed, 17 insertions(+), 572 deletions(-)

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



diff --git a/DonationInterface.php b/DonationInterface.php
index 5d54f14..8f59321 100644
--- a/DonationInterface.php
+++ b/DonationInterface.php
@@ -291,27 +291,18 @@
        '' => 100, //No code returned. All the points.
 );     
 
-
-//n.b. "-Testing-" urls are not wired to anything, they're just here for
-// your copy n paste pleasure.
-
-$wgAmazonGatewayURL = "https://authorize.payments.amazon.com/pba/paypipeline";;
-$wgAmazonGatewayTestingURL = 
"https://authorize.payments-sandbox.amazon.com/pba/paypipeline";;
-
-$wgAmazonGatewayFpsURL = "https://fps.amazonaws.com/";;
-$wgAmazonGatewayFpsTestingURL = "https://fps.sandbox.amazonaws.com/";;
-
 #      $wgAmazonGatewayAccountInfo['example'] = array(
-#              'AccessKey' => "",
-#              'SecretKey' => "",
-#
-#              // the long one, not the AWS account ID
-#              'PaymentsAccountID' => "",
+#              'SellerID' => '',
+#              'ClientID' => '',
+#              'ClientSecret' => '',
+#              'MWSAccessKey' => '',
+#              'MWSSecretKey' => '',
+#              'Region' => '',
 #      );
 
-// e.g. http://payments.wikimedia.org/index.php/Special:AmazonGateway  --
-// does NOT accept unroutable development names, use the number instead
-// even if it's 127.0.0.1
+// Sorry, devs, this one HAS to be https. So make with the self-signing 
already!
+// Also, it has to be whitelisted for your application at 
sellercentral.amazon.com
+// e.g. https://payments.wikimedia.org/index.php/Special:AmazonGateway
 $wgAmazonGatewayReturnURL = "";
 
 $wgAmazonGatewayHtmlFormDir = __DIR__ . '/amazon_gateway/forms/html';
diff --git a/amazon_gateway/amazon.adapter.php 
b/amazon_gateway/amazon.adapter.php
index 4fb7a5a77..222872c 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -85,98 +85,6 @@
 
        function defineTransactions() {
                $this->transactions = array();
-               $this->transactions[ 'Donate' ] = array(
-                       'request' => array(
-                               'accessKey',
-                               'amount',
-                               'collectShippingAddress',
-                               'description',
-                               'immediateReturn',
-                               'ipnUrl',
-                               'returnUrl',
-                               'isDonationWidget',
-                               'processImmediate',
-                               'referenceId',
-                               //'signature',
-                               'signatureMethod',
-                               'signatureVersion',
-                       ),
-                       'values' => array(
-                               'accessKey' => $this->account_config[ 
'AccessKey' ],
-                               'collectShippingAddress' => '0',
-                               'description' => WmfFramework::formatMessage( 
'donate_interface-donation-description' ),
-                               'immediateReturn' => '1',
-                               'ipnUrl' => 
$this->account_config['IpnOverride'],
-                               'isDonationWidget' => '1',
-                               'processImmediate' => '1',
-                               'signatureMethod' => 'HmacSHA256',
-                               'signatureVersion' => '2',
-                       ),
-                       'redirect' => TRUE,
-               );
-
-               $this->transactions[ 'DonateMonthly' ] = array(
-                       'request' => array(
-                               'accessKey',
-                               'amount',
-                               'collectShippingAddress',
-                               'description',
-                               'immediateReturn',
-                               'ipnUrl',
-                               'processImmediate',
-                               'recurringFrequency',
-                               'referenceId',
-                               'returnUrl',
-                               //'signature',
-                               'signatureMethod',
-                               'signatureVersion',
-                               //'subscriptionPeriod',
-                       ),
-                       'values' => array(
-                               // FIXME: There is magick available if the 
names match.
-                               'accessKey' => $this->account_config[ 
'AccessKey' ],
-                               'collectShippingAddress' => '0',
-                               'description' => WmfFramework::formatMessage( 
'donate_interface-monthly-donation-description' ),
-                               'immediateReturn' => '1',
-                               'ipnUrl' => 
$this->account_config['IpnOverride'],
-                               'processImmediate' => '1',
-                               'recurringFrequency' => "1 month",
-                               'signatureMethod' => "HmacSHA256",
-                               'signatureVersion' => "2",
-                               // FIXME: this is the documented default, but 
passing it explicitly is buggy
-                               //'subscriptionPeriod' => "forever",
-                       ),
-                       'redirect' => TRUE,
-               );
-
-               $this->transactions[ 'VerifySignature' ] = array(
-                       'request' => array(
-                               'Action',
-                               'HttpParameters',
-                               'UrlEndPoint',
-                               'Version',
-                               //'Signature',
-                               'SignatureMethod',
-                               'SignatureVersion',
-                               'AWSAccessKeyId',
-                               'Timestamp',
-                       ),
-                       'values' => array(
-                               'Action' => "VerifySignature",
-                               'AWSAccessKeyId' => $this->account_config[ 
'AccessKey' ],
-                               'UrlEndPoint' => $this->getGlobal( "ReturnURL" 
),
-                               'Version' => "2010-08-28",
-                               'SignatureMethod' => "HmacSHA256",
-                               'SignatureVersion' => "2",
-                               'Timestamp' => date( 'c' ),
-                       ),
-                       'url' => $this->getGlobal( "FpsURL" ),
-               );
-
-               $this->transactions[ 'ProcessAmazonReturn' ] = array(
-                       'request' => array(),
-                       'values' => array(),
-               );
        }
 
        public function definePaymentMethods() {
@@ -210,92 +118,6 @@
                );
        }
 
-       function do_transaction( $transaction ) {
-               global $wgRequest, $wgOut;
-               $this->session_addDonorData();
-
-               $this->setCurrentTransaction( $transaction );
-               $this->transaction_response = new PaymentTransactionResponse();
-
-               $override_url = $this->transaction_option( 'url' );
-               if ( !empty( $override_url ) ) {
-                       $this->url = $override_url;
-               }
-               else {
-                       $this->url = $this->getGlobal( "URL" );
-               }
-
-               switch ( $transaction ) {
-               case 'Donate':
-               case 'DonateMonthly':
-                       $return_url = $this->getGlobal( 'ReturnURL' );
-                       //check if ReturnURL already has a query string         
        
-                       $return_query = parse_url( $return_url, PHP_URL_QUERY );
-                       $return_url .= ( $return_query ? '&' : '?' );
-                       $return_url .= 
"ffname=amazon&order_id={$this->getData_Unstaged_Escaped( 'order_id' )}";
-                       $this->transactions[ $transaction ][ 'values' ][ 
'returnUrl' ] = $return_url;
-                       break;
-               case 'VerifySignature':
-                       $request_params = $wgRequest->getValues();
-                       unset( $request_params[ 'title' ] );
-                       $incoming = http_build_query( $request_params, '', '&' 
);
-                       $this->transactions[ $transaction ][ 'values' ][ 
'HttpParameters' ] = $incoming;
-                       $this->logger->debug( "received callback from amazon 
with: $incoming" );
-                       break;
-               }
-
-               // TODO this will move to a staging function once FR#507 is 
deployed
-               $query = $this->buildRequestParams();
-               $parsed_uri = parse_url( $this->url );
-               $signature = $this->signRequest( $parsed_uri[ 'host' ], 
$parsed_uri[ 'path' ], $query );
-
-               switch ( $transaction ) {
-                       case 'Donate':
-                       case 'DonateMonthly':
-                               $query_str = $this->encodeQuery( $query );
-                               $this->logger->debug( "At $transaction, 
redirecting with query string: $query_str" );
-                               
-                               //always have to do this before a redirect. 
-                               $this->dataObj->saveContributionTrackingData();
-
-                               //@TODO: This shouldn't be happening here. Oh 
Amazon... Why can't you be more like PayPalAdapter?
-                               $wgOut->redirect("{$this->getGlobal( "URL" 
)}?{$query_str}&signature={$signature}");
-                               break;
-
-                       case 'VerifySignature':
-                               // We don't currently use this. In fact we just 
ignore the return URL signature.
-                               // However, it's perfectly good code and we may 
go back to using it at some point
-                               // so I didn't want to remove it.
-                               $query_str = $this->encodeQuery( $query );
-                               $this->url .= 
"?{$query_str}&Signature={$signature}";
-
-                               $this->logger->debug( "At $transaction, query 
string: $query_str" );
-
-                               parent::do_transaction( $transaction );
-
-                               if ( $this->getFinalStatus() === 
FinalStatus::COMPLETE ) {
-                                       $this->unstaged_data = 
$this->dataObj->getDataEscaped(); // XXX not cool.
-                                       $this->runPostProcessHooks();
-                                       $this->doLimboStompTransaction( true );
-                                       $this->deleteLimboMessage();
-                               }
-                               break;
-
-                       case 'ProcessAmazonReturn':
-                               // What we need to do here is make sure THE WHAT
-                               // FIXME: This is resultswitcher logic.
-                               $this->addDataFromURI();
-                               $this->analyzeReturnStatus();
-                               break;
-
-                       default:
-                               $this->logger->critical( "At $transaction; THIS 
IS NOT DEFINED!" );
-                               $this->finalizeInternalStatus( 
FinalStatus::FAILED );
-               }
-
-               return $this->transaction_response;
-       }
-
        static function getCurrencies() {
                // See 
https://payments.amazon.com/sdui/sdui/about?nodeId=73479#feat_countries
                return array(
@@ -304,153 +126,17 @@
        }
 
        /**
-        * Looks at the 'status' variable in the amazon return URL get string 
and places the data
-        * in the appropriate Final Status and sends to STOMP.
+        * Override default behavior
         */
-       protected function analyzeReturnStatus() {
-               // We only want to analyze this if we don't already have a 
Final Status... Therefore we
-               // won't overwrite things.
-               if ( $this->getFinalStatus() === false ) {
-
-                       $txnid = $this->dataObj->getVal_Escaped( 
'gateway_txn_id' );
-                       $this->transaction_response->setGatewayTransactionId( 
$txnid );
-
-                       // Second make sure that the inbound request had a 
matching outbound session. If it
-                       // doesn't we drop it.
-                       if ( !self::session_hasDonorData( 'order_id', 
$this->getData_Unstaged_Escaped( 'order_id' ) ) ) {
-
-                               // We will however log it if we have a 
seemingly valid transaction id
-                               if ( $txnid != null ) {
-                                       $ctid = 
$this->getData_Unstaged_Escaped( 'contribution_tracking_id' );
-                                       $this->logger->alert( "$ctid failed 
orderid verification but has txnid '$txnid'. Investigation required." );
-                                       if ( $this->getGlobal( 
'UseOrderIdValidation' ) ) {
-                                               $this->finalizeInternalStatus( 
FinalStatus::FAILED );
-                                               return;
-                                       }
-                               } else {
-                                       $this->finalizeInternalStatus( 
FinalStatus::FAILED );
-                                       return;
-                               }
-                       }
-
-                       // Third: we did have an outbound request; so let's 
look at what amazon is telling us
-                       // about the transaction.
-                       // todo: lots of other statuses we can interpret
-                       // see: 
http://docs.amazonwebservices.com/AmazonSimplePay/latest/ASPAdvancedUserGuide/ReturnValueStatusCodes.html
-                       $this->logger->info( "Transaction $txnid returned with 
status " . $this->dataObj->getVal_Escaped( 'gateway_status' ) );
-                       switch ( $this->dataObj->getVal_Escaped( 
'gateway_status' ) ) {
-                               case 'PS':  // Payment success
-                                       $this->finalizeInternalStatus( 
FinalStatus::COMPLETE );
-                                       $this->doStompTransaction();
-                                       break;
-
-                               case 'PI':  // Payment initiated, it will 
complete later
-                                       $this->finalizeInternalStatus( 
FinalStatus::PENDING );
-                                       $this->doStompTransaction();
-                                       break;
-
-                               case 'SS':  // Subscription success -- 
processing handled by the IPN listener
-                                       $this->finalizeInternalStatus( 
FinalStatus::COMPLETE );
-                                       break;
-
-                               case 'SI':  // Subscription initiated -- 
processing handled by the IPN listener
-                                       $this->finalizeInternalStatus( 
FinalStatus::PENDING );
-                                       break;
-
-                               case 'PF':  // Payment failed
-                               case 'SF':  // Subscription failed
-                               case 'SE':  // This one is interesting; service 
failure... can we do something here?
-                               default:        // All other errorz
-                                       $status = 
$this->dataObj->getVal_Escaped( 'gateway_status' );
-                                       $errString = 
$this->dataObj->getVal_Escaped( 'error_message' );
-                                       $this->logger->info( "Transaction 
$txnid failed with ($status) $errString" );
-                                       $this->finalizeInternalStatus( 
FinalStatus::FAILED );
-                                       break;
-                       }
-               } else {
-                       $this->logger->error( 'Apparently we attempted to 
process a transaction that already had a final status... Odd' );
-               }
+       function getAvailableSubmethods() {
+               return array();
        }
 
        /**
-        * Adds translated data from the URI string into donation data
-        * FIXME: This should be done by unstaging functions.
-        */
-       function addDataFromURI() {
-               global $wgRequest;
-
-               // Obtain data parameters for STOMP message injection
-               //n.b. these request vars were from the _previous_ api call
-               $add_data = array();
-               foreach ( $this->var_map as $gateway_key => $normal_key ) {
-                       $value = $wgRequest->getVal( $gateway_key, null );
-                       if ( !empty( $value ) ) {
-                               // Deal with some fun special cases
-                               switch ( $gateway_key ) {
-                                       case 'transactionAmount':
-                                               list ($currency, $amount) = 
explode( ' ', $value );
-                                               $add_data['currency'] = 
$currency;
-                                               $add_data['amount'] = $amount;
-                                               break;
-
-                                       case 'buyerName':
-                                               list ($fname, $lname) = 
explode( ' ', $value, 2 );
-                                               $add_data['fname'] = $fname;
-                                               $add_data['lname'] = $lname;
-                                               break;
-                                       case 'paymentMethod':
-                                               $submethods = array (
-                                                       'Credit Card' => 
'amazon_cc',
-                                                       'Amazon Payments 
Balance' => 'amazon_wallet',
-                                               );
-                                               if ( array_key_exists( $value, 
$submethods ) ) {
-                                                       
$add_data['payment_submethod'] = $submethods[$value];
-                                               } else {
-                                                       //We don't rely on this 
anywhere serious, but I want to know about it anyway.
-                                                       $this->logger->error( 
"Amazon just coughed up a surprise payment submethod of '$value'." );
-                                                       
$add_data['payment_submethod'] = 'unknown';
-                                               }
-                                               break;
-                                       default:
-                                               $add_data[ $normal_key ] = 
$value;
-                                               break;
-                               }
-                       }
-               }
-               //TODO: consider prioritizing the session vars
-               $this->addResponseData( $add_data ); //using the gateway's 
addData function restages everything
-
-               $txnid = $this->dataObj->getVal_Escaped( 'gateway_txn_id' );
-               $email = $this->dataObj->getVal_Escaped( 'email' );
-
-               $this->logger->info( "Added data to session for txnid $txnid. 
Now serving email $email." );
-       }
-
-       /**
-        * We would call this function for the VerifySignature transaction, if 
we
-        * ever used that.
-        * @param DomDocument $response
-        * @throws ResponseProcessingException
+        * Don't need this if we use the SDK!
         */
        public function processResponse( $response ) {
-               $this->transaction_response->setErrors( 
$this->parseResponseErrors( $response ) );
-               if ( $this->getCurrentTransaction() !== 'VerifySignature' ) {
-                       return;
-               }
-               $statuses = $response->getElementsByTagName( 
'VerificationStatus' );
-               $verified = false;
-               $commStatus = false;
-               foreach ( $statuses as $node ) {
-                       $commStatus = true;
-                       if ( strtolower( $node->nodeValue ) == 'success' ) {
-                               $verified = true;
-                       }
-               }
-               $this->transaction_response->setCommunicationStatus( 
$commStatus );
-               if ( !$verified ) {
-                       $this->logger->info( "Transaction failed in response 
data verification." );
-                       $this->finalizeInternalStatus( FinalStatus::FAILED );
-               }
+
        }
 
        function encodeQuery( $params ) {
@@ -495,40 +181,6 @@
         $opts[CURLOPT_CAPATH] = __DIR__ . "/ca-bundle.crt";
 
                return $opts;
-       }
-
-       function parseResponseCommunicationStatus( $response ) {
-               $aok = false;
-
-               if ( $this->getCurrentTransaction() == 'VerifySignature' ) {
-
-                       foreach ( $response->getElementsByTagName( 
'VerifySignatureResult' ) as $node ) {
-                               // All we care about is that the node exists
-                               $aok = true;
-                       }
-               }
-
-               return $aok;
-       }
-
-       // @todo FIXME: This doesn't go anywhere.
-       function parseResponseErrors( $response ) {
-               $errors = array( );
-               foreach ( $response->getElementsByTagName( 'Error' ) as $node ) 
{
-                       $code = '';
-                       $message = '';
-                       foreach ( $node->childNodes as $childnode ) {
-                               if ( $childnode->nodeName === "Code" ) {
-                                       $code = $childnode->nodeValue;
-                               }
-                               if ( $childnode->nodeName === "Message" ) {
-                                       $message = $childnode->nodeValue;
-                               }
-                               // TODO: Convert to internal codes and 
translate.
-                               // $errors[$code] = $message;
-                       }
-               }
-               return $errors;
        }
 
        /**
diff --git a/amazon_gateway/amazon_gateway.body.php 
b/amazon_gateway/amazon_gateway.body.php
index b518e52..f88ea2e 100644
--- a/amazon_gateway/amazon_gateway.body.php
+++ b/amazon_gateway/amazon_gateway.body.php
@@ -27,54 +27,13 @@
 
        /**
         * Show the special page
-        *
-        * @todo
-        * - Finish error handling
         */
        protected function handleRequest() {
                $this->getOutput()->allowClickjacking();
 
                $this->setHeaders();
 
-               if ( $this->validateForm() ) {
-                       $this->displayForm();
-               } else {
-                       if ( $this->getRequest()->getText( 'redirect', 0 ) ) {
-                               if ( $this->getRequest()->getText( 'ffname', 
'default' ) === 'amazon-recurring'
-                                       ||  $this->getRequest()->getText( 
'recurring', 0 )
-                               ) {
-                                       // FIXME: do this in the form param 
harvesting step
-                                       $this->adapter->addRequestData( array(
-                                               'recurring' => 1,
-                                       ) );
-                               }
-                               $this->adapter->doPayment();
-                               // TODO: move redirect here.
-                               return;
-                       }
-
-                       // TODO: move resultswitching out
-                       $this->logger->info( 'At gateway return with params: ' 
. json_encode( $this->getRequest()->getValues() ) );
-                       if ( $this->adapter->checkTokens() && 
$this->getRequest()->getText( 'status' ) ) {
-                               $this->adapter->do_transaction( 
'ProcessAmazonReturn' );
-
-                               $status = $this->adapter->getFinalStatus();
-
-                               // FIXME: Isn't this why we have 
$goToThankYouOn?
-                               if ( $status === FinalStatus::COMPLETE || 
$status === FinalStatus::PENDING ) {
-                                       $this->getOutput()->redirect( 
$this->adapter->getThankYouPage() );
-                               }
-                               else {
-                                       $this->getOutput()->redirect( 
$this->adapter->getFailPage() );
-                               }
-                       } else {
-                               $specialform = $this->getRequest()->getText( 
'ffname', null );
-                               if ( !is_null( $specialform ) && 
$this->adapter->isValidSpecialForm( $specialform ) ){
-                                       $this->displayForm();
-                               } else {
-                                       $this->logger->error( 'Failed to 
process gateway return. Tokens bad or no status.' );
-                               }
-                       }
-               }
+               $this->validateForm();
+               $this->displayForm();
        }
 }
diff --git a/tests/Adapter/Amazon/AmazonTest.php 
b/tests/Adapter/Amazon/AmazonTest.php
index 75b3e35..561cc8e 100644
--- a/tests/Adapter/Amazon/AmazonTest.php
+++ b/tests/Adapter/Amazon/AmazonTest.php
@@ -64,101 +64,13 @@
        }
 
        /**
-        * Integration test to verify that the Donate transaction works as 
expected when all necessary data is present.
-        */
-       function testDoTransactionDonate() {
-               $init = $this->getDonorTestData();
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               //@TODO: Refactor the hell out of the Amazon adapter so it 
looks like... anything else we have, and it remotely testable.
-               //In the meantime, though...
-               $gateway->do_transaction( 'Donate' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $ret = $exposed->buildRequestParams();
-
-               $expected = array (
-                       'accessKey' => 'testkey',
-                       'amount' => $init['amount'],
-                       'collectShippingAddress' => '0',
-                       'description' => 'Donation to the Wikimedia Foundation',
-                       'immediateReturn' => '1',
-                       'ipnUrl' => 'https://test.wikimedia.org/amazon',
-                       'isDonationWidget' => '1',
-                       'processImmediate' => '1',
-                       'referenceId' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
-                       'returnUrl' => 
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?ffname=amazon&order_id='
 . $gateway->getData_Unstaged_Escaped( 'order_id' ),
-                       'signatureMethod' => 'HmacSHA256',
-                       'signatureVersion' => '2',
-               );
-
-               $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 
'order_id' ), "Amazon order_id is null, and we actually need one for the return 
URL follow-through" );
-               $this->assertEquals( $expected, $ret, 'Amazon "Donate" 
transaction not building the expected request params' );
-       }
-
-       /**
-        * Make sure the order ID is appended correctly if the ReturnURL 
already has
-        * querystring parameters
-        */
-       function testReturnURLAppendQuerystring() {
-               $init = $this->getDonorTestData();
-               $gateway = $this->getFreshGatewayObject( $init );
-               TestingAmazonAdapter::$fakeGlobals = array(
-                       'ReturnURL' => 
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?platypus=awesome'
-               );
-
-               $gateway->do_transaction( 'Donate' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $ret = $exposed->buildRequestParams();
-               $expected = 
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?platypus=awesome&ffname=amazon&order_id='
 . $gateway->getData_Unstaged_Escaped( 'order_id' );
-                
-               $this->assertEquals( $expected, $ret['returnUrl'], 'Amazon 
"Donate" transaction not building the expected returnUrl' );
-       }
-
-       /**
-        * Integration test to verify that the Donate transaction works as 
expected
-        * in Canada (English and French) when all necessary data is present.
-        *
-        * @dataProvider canadaLanguageProvider
-        */
-       function testDoTransactionDonate_CA( $language ) {
-               $init = $this->getDonorTestData( 'CA' );
-               $init['language'] = $language;
-               $init['currency_code'] = 'USD';
-               $this->setLanguage( $language );
-               $donateText = wfMessage( 
'donate_interface-donation-description' )->inLanguage( $language )->text();
-
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->do_transaction( 'Donate' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $ret = $exposed->buildRequestParams();
-
-               $expected = array (
-                       'accessKey' => 'testkey',
-                       'amount' => $init['amount'],
-                       'collectShippingAddress' => '0',
-                       'description' => $donateText,
-                       'immediateReturn' => '1',
-                       'ipnUrl' => 'https://test.wikimedia.org/amazon',
-                       'isDonationWidget' => '1',
-                       'processImmediate' => '1',
-                       'referenceId' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
-                       'returnUrl' => 
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?ffname=amazon&order_id='
 . $gateway->getData_Unstaged_Escaped( 'order_id' ),
-                       'signatureMethod' => 'HmacSHA256',
-                       'signatureVersion' => '2',
-               );
-
-               $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 
'order_id' ), "Amazon order_id is null, and we actually need one for the return 
URL follow-through" );
-               $this->assertEquals( $expected, $ret, 'Amazon "Donate" 
transaction not building the expected request params' );
-       }
-
-       /**
         * Integration test to verify that the Amazon gateway converts Canadian
         * dollars before redirecting
         *
         * @dataProvider canadaLanguageProvider
         */
        function testCanadianDollarConversion( $language ) {
+               $this->markTestSkipped( 'Logic temporarily missing' );
                $init = $this->getDonorTestData( 'CA' );
                unset( $init['order_id'] );
                $init['payment_method'] = 'amazon';
@@ -192,75 +104,6 @@
                        )
                );
                $this->verifyFormOutput( 'TestingAmazonGateway', $init, 
$assertNodes, false );
-       }
-
-       /**
-        * Integration test to verify that the DonateMonthly transaction works 
as expected when all necessary data is present.
-        */
-       function testDoTransactionDonateMonthly() {
-               $init = $this->getDonorTestData();
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               //@TODO: Refactor the hell out of the Amazon adapter so it 
looks like... anything else we have, and it remotely testable.
-               //In the meantime, though...
-               $gateway->do_transaction( 'DonateMonthly' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $ret = $exposed->buildRequestParams();
-
-               $expected = array (
-                       'accessKey' => 'testkey',
-                       'amount' => $init['amount'],
-                       'collectShippingAddress' => '0',
-                       'description' => 'Monthly donation to the Wikimedia 
Foundation',
-                       'immediateReturn' => '1',
-                       'ipnUrl' => 'https://test.wikimedia.org/amazon',
-                       'processImmediate' => '1',
-                       'referenceId' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
-                       'returnUrl' => 
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?ffname=amazon&order_id='
 . $gateway->getData_Unstaged_Escaped( 'order_id' ),
-                       'signatureMethod' => 'HmacSHA256',
-                       'signatureVersion' => '2',
-                       'recurringFrequency' => '1 month',
-               );
-
-               $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 
'order_id' ), "Amazon order_id is null, and we actually need one for the return 
URL follow-through" );
-               $this->assertEquals( $expected, $ret, 'Amazon "DonateMonthly" 
transaction not building the expected request params' );
-       }
-
-       /**
-        * Verify that the Amazon adapter populates return data from URI.
-        */
-       function testAmazonGatewayReturn() {
-               $url_vars = array (
-                       'transactionAmount' => 'USD 123',
-                       'buyerEmail' => '[email protected]',
-                       'transactionDate' => '2014-07-13',
-                       'buyerName' => 'Suzy Greenberg',
-                       'paymentMethod' => 'Credit Card',
-                       'referenceId' => '12345',
-               );
-               $fake_request = new TestingRequest( $url_vars, false );
-               $this->setMwGlobals( array ( 'wgRequest' => $fake_request ) );
-
-               $init = $this->getDonorTestData();
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->do_transaction( 'ProcessAmazonReturn' );
-               $ret = $gateway->getData_Unstaged_Escaped();
-
-               $expected = array (
-                       'currency_code' => 'USD',
-                       'amount' => '123.00',
-                       'email' => '[email protected]',
-                       'fname' => 'Suzy',
-                       'lname' => 'Greenberg',
-                       'payment_submethod' => 'amazon_cc',
-                       'contribution_tracking_id' => '12345',
-                       'date_collect' => '2014-07-13',
-               );
-
-               foreach ($expected as $key => $value) {
-                       $this->assertEquals( $value, $ret[$key], 'Amazon 
"ProcessAmazonReturn" transaction not populating data from the URI as expected' 
);     
-               }
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I621db21ded4cc91aed5426026830c7e94ac1bfb9
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: payWithAmazon
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to