jenkins-bot has submitted this change and it was merged. Change subject: Move Amazon Widget script and return URL into account ......................................................................
Move Amazon Widget script and return URL into account Different regions should load the script from different servers, and you may want to send donors to different URLs. Also document format of other account settings Alternatively, we could hard-code a list of widget script URLs and determine which to use based on region and test mode settings. Bug: T108112 Change-Id: I9aaedc2d5cd109cb605f69d60b43acc8e44d9abe --- M DonationInterface.php M amazon_gateway/amazon.adapter.php M tests/Adapter/Amazon/AmazonTest.php 3 files changed, 20 insertions(+), 22 deletions(-) Approvals: Awight: Looks good to me, approved jenkins-bot: Verified diff --git a/DonationInterface.php b/DonationInterface.php index e28676e..3dd06ca 100644 --- a/DonationInterface.php +++ b/DonationInterface.php @@ -295,24 +295,23 @@ ); # $wgAmazonGatewayAccountInfo['example'] = array( -# 'SellerID' => '', -# 'ClientID' => '', -# 'ClientSecret' => '', -# 'MWSAccessKey' => '', -# 'MWSSecretKey' => '', -# 'Region' => '', +# 'SellerID' => '', // 13 or so uppercase letters +# 'ClientID' => '', // app or site-specific, starts with amznX.application +# 'ClientSecret' => '', // 64 hex characters +# 'MWSAccessKey' => '', // 20 alphanumeric characters +# 'MWSSecretKey' => '', // 40 base-64 encoded chars +# 'Region' => '', // 'de', 'jp', 'uk', or 'us' +# 'WidgetScriptURL' => 'https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js', +# // static-eu serves widgets for uk and de, but jp uses this awful URL: +# // https://origin-na.ssl-images-amazon.com/images/G/09/EP/offAmazonPayments/sandbox/prod/lpa/js/Widgets.js +# // remove 'sandbox/' from above URLs for production use +# 'ReturnURL' => ''; +# // Sorry, devs, ReturnURL HAS to be https. +# // Also, it has to be whitelisted for your application at sellercentral.amazon.com +# // e.g. https://payments.wikimedia.org/index.php/Special:AmazonGateway # ); -// 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 = ''; - -// Adapt these for your region -$wgAmazonGatewayWidgetScript = 'https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js'; -$wgAmazonGatewayTestingWidgetScript = 'https://static-na.payments-amazon.com/OffAmazonPayments/us/js/Widgets.js'; - -// This one appears to be global and usable for both sandbox and non-sandbox +// This URL appears to be global and usable for both sandbox and non-sandbox $wgAmazonGatewayLoginScript = 'https://api-cdn.amazon.com/sdk/login1.js'; $wgPaypalGatewayURL = 'https://www.paypal.com/cgi-bin/webscr'; diff --git a/amazon_gateway/amazon.adapter.php b/amazon_gateway/amazon.adapter.php index 5ded7fa..2d5b7bc 100644 --- a/amazon_gateway/amazon.adapter.php +++ b/amazon_gateway/amazon.adapter.php @@ -291,14 +291,11 @@ * @param array $vars */ public function setClientVariables( &$vars ) { - $test = $this->getGlobal( 'TestMode' ) ? true : false; $vars['wgAmazonGatewayClientID'] = $this->account_config['ClientID']; $vars['wgAmazonGatewaySellerID'] = $this->account_config['SellerID']; - $vars['wgAmazonGatewaySandbox'] = $test; - $vars['wgAmazonGatewayReturnURL'] = $this->getGlobal( 'ReturnURL' ); - $vars['wgAmazonGatewayWidgetScript'] = $test - ? $this->getGlobal( 'WidgetScript' ) - : $this->getGlobal( 'TestingWidgetScript' ); + $vars['wgAmazonGatewaySandbox'] = $this->getGlobal( 'TestMode' ) ? true : false; + $vars['wgAmazonGatewayReturnURL'] = $this->account_config['ReturnURL']; + $vars['wgAmazonGatewayWidgetScript'] = $this->account_config['WidgetScriptURL']; $vars['wgAmazonGatewayLoginScript'] = $this->getGlobal( 'LoginScript' ); } } diff --git a/tests/Adapter/Amazon/AmazonTest.php b/tests/Adapter/Amazon/AmazonTest.php index 6292dfb..c43356e 100644 --- a/tests/Adapter/Amazon/AmazonTest.php +++ b/tests/Adapter/Amazon/AmazonTest.php @@ -58,6 +58,8 @@ '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", ) ), ) ); } -- To view, visit https://gerrit.wikimedia.org/r/231792 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9aaedc2d5cd109cb605f69d60b43acc8e44d9abe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: amazon 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
