Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/165006
Change subject: Add ffname=amazon in code
......................................................................
Add ffname=amazon in code
Since it's necessary to avoid logspam, don't leave it up to the
configuration file.
Change-Id: I926fb1979354c6712a2a0e4a6f5c2bd57887cb28
---
M amazon_gateway/amazon.adapter.php
M tests/Adapter/Amazon/AmazonTestCase.php
2 files changed, 11 insertions(+), 6 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/06/165006/1
diff --git a/amazon_gateway/amazon.adapter.php
b/amazon_gateway/amazon.adapter.php
index 395d0ea..dfee698 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -221,7 +221,8 @@
//check if ReturnURL already has a query string
$return_query = parse_url( $return_url, PHP_URL_QUERY );
$return_url .= ( $return_query ? '&' : '?' );
- $this->transactions[ $transaction ][ 'values' ][
'returnUrl' ] = "{$return_url}order_id={$this->getData_Unstaged_Escaped(
'order_id' )}";
+ $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();
diff --git a/tests/Adapter/Amazon/AmazonTestCase.php
b/tests/Adapter/Amazon/AmazonTestCase.php
index 0c4ebbb..bdb5fd2 100644
--- a/tests/Adapter/Amazon/AmazonTestCase.php
+++ b/tests/Adapter/Amazon/AmazonTestCase.php
@@ -60,7 +60,7 @@
'isDonationWidget' => '1',
'processImmediate' => '1',
'referenceId' => $gateway->getData_Unstaged_Escaped(
'contribution_tracking_id' ),
- 'returnUrl' =>
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?order_id=' .
$gateway->getData_Unstaged_Escaped( 'order_id' ),
+ 'returnUrl' =>
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?ffname=amazon&order_id='
. $gateway->getData_Unstaged_Escaped( 'order_id' ),
'signatureMethod' => 'HmacSHA256',
'signatureVersion' => '2',
);
@@ -69,16 +69,20 @@
$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?ffname=amazon'
+ 'ReturnURL' =>
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?platypus=awesome'
);
$gateway->do_transaction( 'Donate' );
$ret = $gateway->_buildRequestParams();
- $expected =
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?ffname=amazon&order_id='
. $gateway->getData_Unstaged_Escaped( 'order_id' );
+ $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' );
}
@@ -111,7 +115,7 @@
'isDonationWidget' => '1',
'processImmediate' => '1',
'referenceId' => $gateway->getData_Unstaged_Escaped(
'contribution_tracking_id' ),
- 'returnUrl' =>
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?order_id=' .
$gateway->getData_Unstaged_Escaped( 'order_id' ),
+ 'returnUrl' =>
'https://payments.wikimedia.org/index.php/Special:AmazonGateway?ffname=amazon&order_id='
. $gateway->getData_Unstaged_Escaped( 'order_id' ),
'signatureMethod' => 'HmacSHA256',
'signatureVersion' => '2',
);
@@ -183,7 +187,7 @@
'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?order_id=' .
$gateway->getData_Unstaged_Escaped( 'order_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',
--
To view, visit https://gerrit.wikimedia.org/r/165006
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I926fb1979354c6712a2a0e4a6f5c2bd57887cb28
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits