Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231585

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
2 files changed, 18 insertions(+), 22 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/85/231585/1

diff --git a/DonationInterface.php b/DonationInterface.php
index c192d0d..d939794 100644
--- a/DonationInterface.php
+++ b/DonationInterface.php
@@ -294,24 +294,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' );
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9aaedc2d5cd109cb605f69d60b43acc8e44d9abe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: payWithAmazon
Gerrit-Owner: Ejegg <[email protected]>

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

Reply via email to