[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: WIP Ingenico WX audit parsing

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368948 )

Change subject: WIP Ingenico WX audit parsing
..

WIP Ingenico WX audit parsing

Code copied over from I1eed97f975617706e9

Bug: T86090
Change-Id: Ie85c11fca0f4155359361119420fca6325f5bb9b
---
A PaymentProviders/Ingenico/Audit/IngenicoAudit.php
A PaymentProviders/Ingenico/Tests/Data/chargeback.xml.gz
A PaymentProviders/Ingenico/Tests/Data/donation.xml.gz
A PaymentProviders/Ingenico/Tests/Data/refund.xml.gz
4 files changed, 186 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/48/368948/1

diff --git a/PaymentProviders/Ingenico/Audit/IngenicoAudit.php 
b/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
new file mode 100644
index 000..fd58434
--- /dev/null
+++ b/PaymentProviders/Ingenico/Audit/IngenicoAudit.php
@@ -0,0 +1,186 @@
+ 'gc_category',
+   'Recordtype' => 'gc_type',
+   'Amount' => 'gross',
+   'IPAddressCustomer' => 'user_ip',
+   'BillingFirstname' => 'first_name',
+   'BillingSurname' => 'last_name',
+   'BillingStreet' => 'street_address',
+   'BillingCity' => 'city',
+   'ZipCode' => 'postal_code',
+   'BillingCountryCode' => 'country',
+   'BillingEmail' => 'email',
+   'AdditionalReference' => 'contribution_tracking_id', // will 
need to trim everything after the dot, but it's there! Woo.
+   'PaymentMethodId' => 'gc_method_id', // wut
+   'PaymentProductId' => 'gc_product_id', // ...wut?
+   'PaymentGroupId' => 'gc_group_id', // But seriously. WUT.
+   'OrderID' => 'order_id',
+   'PaymentCurrency' => 'currency',
+   'AmountLocal' => 'gross',
+   'TransactionDateTime' => 'datetime', // damn it.
+   );
+
+   protected $identifiers_we_can_cope_with = array(
+   // Credit card item that has been processed, but not settled.
+   // We take these seriously.
+   // TODO: Why aren't we waiting for +ON?
+   'XON' => 'new',
+   // Settled "Invoice Payment". Could be invoice, bt, rtbt, check,
+   // prepaid card, ew, cash
+   '+IP' => 'new',
+   '-CB' => 'chargeback', // Credit card chargeback
+   '-CR' => 'refund', // Credit card refund
+   '+AP' => 'new', // Direct Debit collected
+   );
+
+   public function parseFile( $path ) {
+   $unzippedFullPath = $this->getUnzippedFile( $path );
+
+   // load the XML into a domdocument.
+   // Total Memory Hog Alert. Handle with care.
+   $domDoc = new DomDocument( '1.0' );
+   Logger::info( "Loading XML from $unzippedFullPath" );
+   $domDoc->load( $unzippedFullPath );
+   Logger::info( "Processing" );
+
+   foreach ( $domDoc->getElementsByTagName( 'DataRecord' ) as 
$recordnode ) {
+   $this->parseRecord( $recordnode );
+   }
+
+   return $this->fileData;
+   }
+
+   protected function parseRecord( DOMElement $recordNode ) {
+   // So, first things first. There is a TOTAL LOAD of data in 
this file
+   // that we genuinely don't care about at all. We're going to 
have to
+   // figure out how to distill this list in a reasonable way.
+   $temp = array();
+
+   foreach ( $this->nodemap as $theirs => $ours ) {
+   foreach ( $recordNode->getElementsByTagName( $theirs ) 
as $recorditem ) {
+   $temp[$ours] = $recorditem->nodeValue;  // 
there 'ya go: Normal already.
+   }
+   }
+
+   $record_type_identifier = $temp['gc_category'] . 
$temp['gc_type'];
+
+   if ( !array_key_exists( $record_type_identifier, 
$this->identifiers_we_can_cope_with ) ) {
+   return;
+   }
+   $temp['type'] = 
$this->identifiers_we_can_cope_with[$record_type_identifier];
+
+   $temp = $this->addPaymentMethod( $temp );
+
+   $this->fileData[] = $temp;
+   }
+
+   /**
+* Gets our normalized payment_method and payment_submethod params from 
the
+* codes that GC uses
+* @param array $record The record from the wx file, in array format
+* @return array The $record param with our normal keys appended
+*/
+   function addPaymentMethod( $record ) {
+   // FIXME: move payment_submethods.yaml to ingenico config dir, 
use that
+   // everywhere
+
+   $payment_products = array(
+   '1' => array( 'payment_method' => 'cc', 
'payment_submethod' 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update DonationInterface lib

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368848 )

Change subject: Update DonationInterface lib
..

Update DonationInterface lib

Gets the unified queue message handling from SmashPig. Now we don't
have to pass those settings through in the $wg variables!

Bug: T95647
Change-Id: I379e7e9a37487696e8f1a44cf085f9a7e81b154e
---
M composer.lock
M sites/all/modules/wmf_audit/ingenico/orphan_rectify.drush.inc
2 files changed, 4 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/48/368848/1

diff --git a/composer.lock b/composer.lock
index b6be6ff..b41588e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -733,7 +733,7 @@
 "keywords": [
 "Silverpop"
 ],
-"time": "2017-07-06T03:06:53+00:00"
+"time": "2017-07-24T07:31:30+00:00"
 },
 {
 "name": "neitanod/forceutf8",
@@ -1793,7 +1793,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/mediawiki/extensions/DonationInterface.git;,
-"reference": "b6eb7d3c689fd2a612f522d43cfd7d6b68218d02"
+"reference": "10e64942ae79b572a750307844bbe25930b6eb19"
 },
 "require": {
 "addshore/psr-6-mediawiki-bagostuff-adapter": "0.1",
@@ -1834,7 +1834,7 @@
 "GPL-2.0"
 ],
 "description": "Wikimedia Foundation payment processing library",
-"time": "2017-07-12T20:59:10+00:00"
+"time": "2017-07-31T14:43:02+00:00"
 },
 {
 "name": "wikimedia/omnimail-silverpop",
@@ -1881,7 +1881,7 @@
 "omnimail",
 "silverpop"
 ],
-"time": "2017-07-09T22:55:21+00:00"
+"time": "2017-07-17T20:03:43+00:00"
 },
 {
 "name": "wikimedia/smash-pig",
diff --git a/sites/all/modules/wmf_audit/ingenico/orphan_rectify.drush.inc 
b/sites/all/modules/wmf_audit/ingenico/orphan_rectify.drush.inc
index f357a63..8b25d07 100644
--- a/sites/all/modules/wmf_audit/ingenico/orphan_rectify.drush.inc
+++ b/sites/all/modules/wmf_audit/ingenico/orphan_rectify.drush.inc
@@ -36,10 +36,6 @@
  * Note: You'll need to include a bunch of exciting MediaWiki globals in your
  * Drupal settings.local.php, including default values that would normally be
  * read from extension.json.
- * $wgDonationInterfaceDefaultQueueServer
- * $wgDonationInterfaceQueues
- * $wgDonationInterfaceEnableQueue
- * $wgDonationInterfaceQueueMirrors
  * $wgDonationInterfaceOrphanCron
  * $wgDonationInterfaceGatewayAdapters
  * $wgDonationInterfaceForbiddenCountries

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I379e7e9a37487696e8f1a44cf085f9a7e81b154e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368839 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: I4c4ba731a0a98dfd4586db3f12f414e337a4899a
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/39/368839/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index 4bba50a..2151924 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit 4bba50a2d861d4cd96c5c30565a83614eff5f3ff
+Subproject commit 2151924612f920f96f0a5dd325dc822ee5ea464d

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c4ba731a0a98dfd4586db3f12f414e337a4899a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368833 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: Ib12de0bbec4785975823f75734671896f8673c4a
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/33/368833/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index 17637c7..4bba50a 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit 17637c7231773bc7e05fabb51d7be0a3561181b3
+Subproject commit 4bba50a2d861d4cd96c5c30565a83614eff5f3ff

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib12de0bbec4785975823f75734671896f8673c4a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Merge commit '14ed96cff' into deployment

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368832 )

Change subject: Merge commit '14ed96cff' into deployment
..

Merge commit '14ed96cff' into deployment

14ed96cff Order sequence numbers start at 1, not 0

Change-Id: If6394218de80458cf0efa2ea7105f332bd23eca9
---
D tests/phpunit/Adapter/Adyen/AdyenApiTest.php
D tests/phpunit/Adapter/Adyen/AdyenTest.php
D tests/phpunit/Adapter/Amazon/AmazonApiTest.php
D tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
D tests/phpunit/includes/Responses/amazon/authorize.json
D tests/phpunit/includes/Responses/amazon/authorizeOnBillingAgreement.json
D tests/phpunit/includes/Responses/amazon/authorize_AmazonRejected.json
D tests/phpunit/includes/Responses/amazon/authorize_InvalidPaymentMethod.json
D tests/phpunit/includes/Responses/amazon/authorize_TransactionTimedOut.json
D tests/phpunit/includes/Responses/amazon/getBillingAgreementDetails.json
D tests/phpunit/includes/Responses/amazon/getCaptureDetails.json
D tests/phpunit/includes/Responses/amazon/setBillingAgreementDetails.json
D 
tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse
D 
tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_OK.testresponse
15 files changed, 0 insertions(+), 1,718 deletions(-)


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

diff --git a/tests/phpunit/Adapter/Adyen/AdyenApiTest.php 
b/tests/phpunit/Adapter/Adyen/AdyenApiTest.php
deleted file mode 100644
index 6c855d1..000
--- a/tests/phpunit/Adapter/Adyen/AdyenApiTest.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<<< HEAD   (17637c Merge commit '9d7b9a522' into deployment)
-===
-providerConfigurationOverride =
-   AdyenTestConfiguration::createWithSuccessfulApi(
-   $ctx->getGlobalConfiguration()
-   );
-   $this->setMwGlobals( array(
-   'wgAdyenGatewayEnabled' => true,
-   'wgAdyenGatewayTestingURL' => 'https://example.org',
-   ) );
-   }
-
-   public function testGoodSubmit() {
-   $init = $this->getDonorData();
-
-   $apiResult = $this->doApiRequest( $init );
-   $result = $apiResult[0]['result'];
-   $this->assertTrue( empty( $result['errors'] ) );
-
-   $this->assertEquals(
-   'https://example.org/hpp/pay.shtml',
-   $result['formaction'],
-   'Adyen API not setting correct formaction'
-   );
-   $expectedParams = array(
-   'allowedMethods' => 'card',
-   'card.cardHolderName' => 'Firstname Surname',
-   'currencyCode' => 'USD',
-   'merchantAccount' => 'wikitest',
-   'merchantReference' => '1.1',
-   'offset' => '20',
-   'paymentAmount' => '155',
-   'skinCode' => 'testskin',
-   'shopperLocale' => 'en_US',
-   'shopperEmail' => 'g...@innocent.com',
-   'billingAddress.street' => '123 Fake Street',
-   'billingAddress.city' => 'NA',
-   'billingAddress.stateOrProvince' => 'NA',
-   'billingAddress.postalCode' => '94105',
-   'billingAddress.country' => 'US',
-   'billingAddressType' => '2',
-   'billingAddress.houseNumberOrName' => 'NA'
-   );
-   $actualParams = $result['gateway_params'];
-   unset ( $actualParams['sessionValidity'] );
-   unset ( $actualParams['shipBeforeDate'] );
-   unset ( $actualParams['merchantSig'] );
-   $this->assertEquals(
-   $expectedParams,
-   $actualParams,
-   'Adyen API not setting correct gateway_params'
-   );
-   $message = DonationQueue::instance()->pop( 'pending' );
-   $this->assertNotNull( $message, 'Not sending a message to the 
pending queue' );
-   DonationInterfaceTestCase::unsetVariableFields( $message );
-   $expected = array(
-   'gateway_txn_id' => false,
-   'response' => false,
-   'fee' => 0,
-   'utm_source' => '..cc',
-   'language' => 'en',
-   'email' => 'g...@innocent.com',
-   'first_name' => 'Firstname',
-   'last_name' => 'Surname',
-   'country' => 'US',
-   'gateway' => 'adyen',
-   

[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368818 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: I63bc68968f9c09e62fbffdc50cb22f0b91c272fc
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/18/368818/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index f3b3f26..17637c7 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit f3b3f26fe813ab4f0fd944272d4d4245b0342f89
+Subproject commit 17637c7231773bc7e05fabb51d7be0a3561181b3

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63bc68968f9c09e62fbffdc50cb22f0b91c272fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Merge commit '9d7b9a522' into deployment

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368815 )

Change subject: Merge commit '9d7b9a522' into deployment
..

Merge commit '9d7b9a522' into deployment

Lots of stuff was merged Friday, deploying piecemeal to make it
easier to diagnose any potential breakage.

c6916e96c Allow getRequiredFields before unstagedData is set
840d7f7e2 Better message when geoIP lookup fails
514499b8d Localisation updates from https://translatewiki.net.
b794c0103 Localisation updates from https://translatewiki.net.
536d978c1 Localisation updates from https://translatewiki.net.
7c909a658 Localisation updates from https://translatewiki.net.
cb33248b5 Fix blank i18n message added by TranslateWiki
bf3018d26 Set license-name in extension.json
9d7b9a522 Store processed payment id list in main cache, not session

Change-Id: I8833d486318adfd70a77a3b185a2cf147f93d6d7
---
D tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php
D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
D tests/phpunit/DonationInterfaceApiTestCase.php
D tests/phpunit/DonationInterfaceTestCase.php
D tests/phpunit/GatewayValidationTest.php
D tests/phpunit/TestConfiguration.php
6 files changed, 0 insertions(+), 1,738 deletions(-)


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

diff --git 
a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php
deleted file mode 100644
index c6337ea..000
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php
+++ /dev/null
@@ -1,217 +0,0 @@
-<<< HEAD   (da5736 Define npm peer dependency explicitly)
-===
-setMwGlobals( array(
-   'wgDonationInterfaceOrphanCron' => array(
-   'enable' => true,
-   'target_execute_time' => 
self::TARGET_EXECUTE_TIME,
-   'time_buffer' => self::TIME_BUFFER,
-   ),
-   'wgGlobalCollectGatewayEnabled' => true,
-   'wgDonationInterfaceGatewayAdapters' => array(
-   // We include the regular adapter in order to 
pass gateway validation D:
-   'globalcollect' => 
'TestingGlobalCollectOrphanAdapter',
-   'globalcollect_orphan' => 
'TestingGlobalCollectOrphanAdapter',
-   ),
-   ) );
-
-   $this->pendingDb = PendingDatabase::get();
-
-   // Create the schema.
-   $this->pendingDb->createTable();
-   }
-
-   /**
-* When leaving a message unprocessed and pending, don't try to process 
it
-* again.
-*/
-   public function testProcessOrphansStatusPending() {
-   $orphan_pending = $this->createOrphan();
-
-   $rectifier = new GlobalCollectOrphanRectifier();
-   $this->gateway = $rectifier->getAdapter();
-   $this->gateway->setDummyGatewayResponseCode( 
self::STATUS_PENDING );
-   $rectifier->processOrphans();
-
-   $fetched = $this->pendingDb->fetchMessageByGatewayOrderId(
-   'globalcollect', $orphan_pending['order_id'] );
-   $this->assertNull( $fetched,
-   'Message was popped.' );
-
-   $this->assertGatewayCallsExactly( array(
-   'GET_ORDERSTATUS'
-   ) );
-   }
-
-   /**
-* If a message is waiting for the API kiss of death, perform it.
-*/
-   public function testProcessOrphansStatusPendingPoke() {
-   $orphan_pending_poke = $this->createOrphan();
-
-   $rectifier = new GlobalCollectOrphanRectifier();
-   $this->gateway = $rectifier->getAdapter();
-   $this->gateway->setDummyGatewayResponseCode( 
self::STATUS_PENDING_POKE );
-   $rectifier->processOrphans();
-
-   $fetched = $this->pendingDb->fetchMessageByGatewayOrderId(
-   'globalcollect', $orphan_pending_poke['order_id'] );
-   $this->assertNull( $fetched,
-   'Message was popped' );
-
-   $this->assertGatewayCallsExactly( array(
-   'GET_ORDERSTATUS',
-   'SET_PAYMENT',
-   ) );
-
-   // TODO: test that we sent a completion message
-   }
-
-   /**
-* Report a completed transaction.
-*/
-   public function testProcessOrphansStatusComplete() {
-
-   $orphan_complete = $this->createOrphan();
-
-   $rectifier = new GlobalCollectOrphanRectifier();
-   $this->gateway = $rectifier->getAdapter();
-   

[MediaWiki-commits] [Gerrit] wikimedia...tools[deploy]: Merge branch 'master' into deploy

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368813 )

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

Merge branch 'master' into deploy

5ea9dcf Fix exported values for contacts with no donations

Change-Id: I75992d2a2f51d7801abb963abac4175bf2273542
---
D silverpop_export/tests/test_update.py
1 file changed, 0 insertions(+), 234 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/13/368813/1

diff --git a/silverpop_export/tests/test_update.py 
b/silverpop_export/tests/test_update.py
deleted file mode 100644
index e99276f..000
--- a/silverpop_export/tests/test_update.py
+++ /dev/null
@@ -1,234 +0,0 @@
-<<< HEAD   (457bdd Merge branch 'master' into deploy)
-===
-import datetime
-from decimal import Decimal
-import mock
-import MySQLdb
-import os
-import warnings
-
-import database.db
-import silverpop_export.update
-
-conn = None
-db_name = None
-
-
-def setup():
-global conn
-global db_name
-# FIXME: parameterize test configuration better
-db_host = "127.0.0.1"
-db_pass = None
-if 'EXECUTOR_NUMBER' in os.environ:
-# We're running under Jenkins.  Assume things.
-db_name = "test"
-db_user = "root"
-else:
-db_name = "test"
-db_user = "test"
-
-db_params = {"user": db_user, "host": db_host}
-if db_pass:
-db_params['passwd'] = db_pass
-
-conn = database.db.Connection(**db_params)
-conn.execute("set default_storage_engine=memory")
-conn.execute("drop database if exists " + db_name)
-conn.execute("create database " + db_name)
-conn.db_conn.select_db(db_name)
-
-
-def test_test_setup():
-'''
-Set up the civcrm and export databases and run the update with no data.
-'''
-run_update_with_fixtures(fixture_queries=[])
-
-
-def test_duplicate():
-'''
-Test that we export one record for a duplicate contact.
-'''
-
-run_update_with_fixtures(fixture_queries=["""
-insert into civicrm_email (contact_id, email, is_primary, on_hold) values
-(1, 'person1@localhost', 1, 0),
-(2, 'person1@localhost', 1, 0);
-""", """
-insert into civicrm_contact (id) values
-(1),
-(2);
-"""])
-
-cursor = conn.db_conn.cursor()
-cursor.execute("select count(*) from silverpop_export")
-assert cursor.fetchone() == (1,)
-
-
-def test_no_donations():
-'''
-Test that we set the donation-related fields correctly when a contact has
-no donations.
-'''
-
-run_update_with_fixtures(fixture_queries=["""
-insert into civicrm_email (contact_id, email, is_primary, on_hold) values
-(1, 'person1@localhost', 1, 0);
-""", """
-insert into civicrm_contact (id) values
-(1);
-"""])
-
-cursor = conn.db_conn.cursor()
-cursor.execute("select has_recurred_donation, highest_usd_amount, " +
-   "highest_native_amount, highest_native_currency, " +
-   "highest_donation_date, lifetime_usd_total, " +
-   "donation_count, latest_currency, latest_native_amount, " +
-   "latest_usd_amount, latest_donation from silverpop_export")
-actual = cursor.fetchone()
-print(actual)
-expected = (0, Decimal('0.00'),
-Decimal('0.00'), None,
-None, Decimal('0.00'),
-0, None, Decimal('0.00'),
-Decimal('0.00'), None)
-assert actual == expected
-
-
-def test_refund_history():
-'''
-Test that we don't include refunded donations in a donor's history
-'''
-
-run_update_with_fixtures(fixture_queries=["""
-insert into civicrm_email (contact_id, email, is_primary, on_hold) values
-(1, 'person1@localhost', 1, 0);
-""", """
-insert into civicrm_contact (id) values
-(1);
-""", """
-insert into civicrm_contribution (id, contact_id, receive_date, 
total_amount, trxn_id, contribution_status_id) values
-(1, 1, '2015-01-03', 15.25, 'xyz123', 1),
-(2, 1, '2016-05-05', 25.25, 'abc456', 9);
-""", """
-insert into wmf_contribution_extra (entity_id, original_amount, 
original_currency) values
-(1, 20.15, 'CAD'),
-(2, 35.15, 'CAD');
-"""])
-
-cursor = conn.db_conn.cursor()
-cursor.execute("select highest_usd_amount, lifetime_usd_total, 
donation_count, latest_currency, latest_native_amount, latest_usd_amount, 
latest_donation  from silverpop_export")
-expected = (Decimal('15.25'), Decimal('15.25'), 1, 'CAD', 
Decimal('20.15'), Decimal('15.25'), datetime.datetime(2015, 1, 3))
-assert cursor.fetchone() == expected
-
-
-def test_timezone():
-'''
-Test that we export timezone records where they exist
-'''
-
-run_update_with_fixtures(fixture_queries=["""
-insert into civicrm_email (contact_id, email, is_primary, on_hold) values
-   

[MediaWiki-commits] [Gerrit] wikimedia...tools[master]: Add filename to paypal audit failmail

2017-07-31 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368809 )

Change subject: Add filename to paypal audit failmail
..

Add filename to paypal audit failmail

Handy for reporting errors to PayPal

Change-Id: I0ed4d36f34355525eaca83f919a5d5a834f80049
---
M audit/paypal/ppreport.py
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/09/368809/1

diff --git a/audit/paypal/ppreport.py b/audit/paypal/ppreport.py
index 16062a1..334c7e3 100644
--- a/audit/paypal/ppreport.py
+++ b/audit/paypal/ppreport.py
@@ -2,6 +2,7 @@
 import dateutil.parser
 import dateutil.tz
 import io
+import os.path
 
 from failmail.mailer import FailMailer
 from process.logging import Logger as log
@@ -45,7 +46,10 @@
 try:
 callback(record)
 except:
-logme = {'row': rownum}
+logme = {
+'file': os.path.basename(path),
+'row': rownum
+}
 for identifier in ['Transaction ID', 'Invoice ID', 'PayPal 
Reference ID', 'Subscription ID']:
 if identifier in record:
 logme[identifier] = record[identifier]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ed4d36f34355525eaca83f919a5d5a834f80049
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: WIP teach PEAR about deadlock errors

2017-07-28 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368517 )

Change subject: WIP teach PEAR about deadlock errors
..

WIP teach PEAR about deadlock errors

Sorta-hopeless effort to pass more db error info up the chain

Bug: T118487
Change-Id: Iddf380d6db9e9e42e6d5703e26da71f7fe3e498a
---
M packages/DB.php
M packages/DB/mysqli.php
2 files changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/17/368517/1

diff --git a/packages/DB.php b/packages/DB.php
index 2a06764..a49c868 100644
--- a/packages/DB.php
+++ b/packages/DB.php
@@ -183,6 +183,9 @@
  */
 define('DB_ERROR_CONSTRAINT_NOT_NULL',-29);
 
+define('DB_ERROR_LOCK_TIMEOUT', -30);
+
+define('DB_ERROR_DEADLOCK', -31);
 /**
  * Invalid view or no permissions
  */
diff --git a/packages/DB/mysqli.php b/packages/DB/mysqli.php
index 371cfb0..a12ee17 100644
--- a/packages/DB/mysqli.php
+++ b/packages/DB/mysqli.php
@@ -112,6 +112,8 @@
 1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
 1142 => DB_ERROR_ACCESS_VIOLATION,
 1146 => DB_ERROR_NOSUCHTABLE,
+1205 => DB_ERROR_LOCK_TIMEOUT,
+1213 => DB_ERROR_DEADLOCK,
 1216 => DB_ERROR_CONSTRAINT,
 1217 => DB_ERROR_CONSTRAINT,
 1356 => DB_ERROR_INVALID_VIEW,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iddf380d6db9e9e42e6d5703e26da71f7fe3e498a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Remove obsolete selenium tests and WP responses.

2017-07-28 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368474 )

Change subject: Remove obsolete selenium tests and WP responses.
..

Remove obsolete selenium tests and WP responses.

These are for the old RapidHTML forms, and are not being run in CI
WorldPay is no longer an option

Change-Id: I27fdebf894411a2c8c5bd83f0f9fcb29838e5144
---
D 
tests/macros/form.twostepamount.banktransfer.netherlands.fail.not.a.valid.combination.htm
D tests/macros/form.twostepamount.banktransfer.netherlands.htm
D tests/macros/form.twostepamount.banktransfer.spain.htm
D tests/macros/form.twostepamount.creditcard.visa.us.htm
D tests/macros/form.twostepamount.directdebit.austria.htm
D tests/macros/form.twostepamount.directdebit.belgium.htm
D tests/macros/form.twostepamount.directdebit.belgium.invalid.length.htm
D tests/macros/form.twostepamount.directdebit.italy.htm
D 
tests/macros/form.twostepamount.directdebit.netherlands.fail.invalid.accountnumber.length.htm
D tests/macros/form.twostepamount.directdebit.netherlands.htm
D tests/macros/form.twostepamount.directdebit.spain.htm
D tests/macros/form.twostepamount.ewallets.webmoney.htm
D tests/macros/form.twostepamount.onlinebanktransfer.australia.htm
D tests/macros/form.twostepamount.realtimebanktransfer.enets.htm
D tests/macros/form.twostepamount.realtimebanktransfer.eps.824.htm
D tests/macros/form.twostepamount.realtimebanktransfer.ideal.771.htm
D tests/macros/form.twostepamount.realtimebanktransfer.nordea_sweden.htm
D tests/macros/suite-all-payment-gateways.htm
D 
tests/phpunit/includes/Responses/worldpay/AuthorizeAndDepositPayment.testresponse
D 
tests/phpunit/includes/Responses/worldpay/AuthorizePaymentForFraud.testresponse
D 
tests/phpunit/includes/Responses/worldpay/AuthorizePaymentForFraud_2208.testresponse
D 
tests/phpunit/includes/Responses/worldpay/AuthorizePaymentForFraud_9000.testresponse
D 
tests/phpunit/includes/Responses/worldpay/AuthorizePaymentForFraud_snowflake.testresponse
D tests/phpunit/includes/Responses/worldpay/GenerateToken.testresponse
D tests/phpunit/includes/Responses/worldpay/QueryTokenData.testresponse
25 files changed, 0 insertions(+), 1,960 deletions(-)


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

diff --git 
a/tests/macros/form.twostepamount.banktransfer.netherlands.fail.not.a.valid.combination.htm
 
b/tests/macros/form.twostepamount.banktransfer.netherlands.fail.not.a.valid.combination.htm
deleted file mode 100644
index 795c26a..000
--- 
a/tests/macros/form.twostepamount.banktransfer.netherlands.fail.not.a.valid.combination.htm
+++ /dev/null
@@ -1,91 +0,0 @@
-
-http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>
-http://www.w3.org/1999/xhtml; xml:lang="en" lang="en">
-http://selenium-ide.openqa.org/profiles/test-case;>
-
-http://wikimedia-fundraising-1.17.localhost.wikimedia.org/; />
-form.twostepamount.banktransfer
-
-
-
-
-form.twostepamount.banktransfer
-
-
-   open
-   
/index.php/Special:GlobalCollectGateway?form_name=TwoStepAmountpayment_method=btpayment_submethod=bt
-   
-
-
-   type
-   id=fname
-   Testy
-
-
-   type
-   id=lname
-   Testerton
-
-
-   select
-   id=country
-   label=Netherlands
-
-
-   type
-   id=street
-   123 Happy Street
-
-
-   type
-   id=city
-   Madrid
-
-
-   type
-   id=emailAdd
-   nob...@wikimedia.org
-
-
-   click
-   id=input_amount_other
-   
-
-
-   type
-   id=other-amount
-   1
-
-
-   selectWindow
-   null
-   
-
-
-   select
-   id=state
-   label=Outside the U.S.
-
-
-   type
-   id=zip
-   123
-
-
-   select
-   id=input_currency_code
-   label=U.S. dollar
-
-
-   clickAndWait
-   css=input.button-plain
-   
-
-
-   verifyText
-   css=p.payment_error_message.payment_error_message_general
-   There was an error processing your transaction. Please try again 
later.
-
-
-
-
diff --git a/tests/macros/form.twostepamount.banktransfer.netherlands.htm 
b/tests/macros/form.twostepamount.banktransfer.netherlands.htm
deleted file mode 100644
index 19199c4..000
--- a/tests/macros/form.twostepamount.banktransfer.netherlands.htm
+++ /dev/null
@@ -1,111 +0,0 @@
-
-http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>
-http://www.w3.org/1999/xhtml; xml:lang="en" lang="en">
-http://selenium-ide.openqa.org/profiles/test-case;>
-
-http://wikimedia-fundraising-1.17.localhost.wikimedia.org/; />
-form.twostepamount.banktransfer
-
-
-
-
-form.twostepamount.banktransfer
-
-
-   open
-   
/index.php/Special:GlobalCollectGateway?form_name=TwoStepAmountpayment_method=btpayment_submethod=bt
-   
-
-
-   type
-   id=fname
-   Testy
-
-
-   type
-   id=lname
-   Testerton
-
-
-   select
-   id=country
-   label=Netherlands
-
-
-   type
-   

[MediaWiki-commits] [Gerrit] wikimedia...tools[master]: WIP fix export for contacts with no donations

2017-07-28 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368467 )

Change subject: WIP fix export for contacts with no donations
..

WIP fix export for contacts with no donations

Test only so far, with debugging code to print actual row

Bug: T171920
Change-Id: I03f362549707b21b1258af8733d6a84c4e343c44
---
M silverpop_export/tests/test_update.py
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/67/368467/1

diff --git a/silverpop_export/tests/test_update.py 
b/silverpop_export/tests/test_update.py
index ef17da0..0c404b8 100644
--- a/silverpop_export/tests/test_update.py
+++ b/silverpop_export/tests/test_update.py
@@ -64,6 +64,28 @@
 assert cursor.fetchone() == (1,)
 
 
+def test_no_donations():
+'''
+Test that we set the donation-related fields correctly when a contact has
+no donations.
+'''
+
+run_update_with_fixtures(fixture_queries=["""
+insert into civicrm_email (contact_id, email, is_primary, on_hold) values
+(1, 'person1@localhost', 1, 0);
+""", """
+insert into civicrm_contact (id) values
+(1);
+"""])
+
+cursor = conn.db_conn.cursor()
+cursor.execute("select highest_usd_amount, lifetime_usd_total, 
donation_count, latest_currency, latest_native_amount, latest_usd_amount, 
latest_donation from silverpop_export")
+actual = cursor.fetchone()
+print(actual)
+expected = (None, None, None, None, None, None, None)
+assert actual == expected
+
+
 def test_refund_history():
 '''
 Test that we don't include refunded donations in a donor's history

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03f362549707b21b1258af8733d6a84c4e343c44
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' into deployment

2017-07-27 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368311 )

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

Merge branch 'master' into deployment

7907ec4e9 Add throttling to Omnrecipients.load function
1af6a49f7 Simplify duplicate check call

Change-Id: Iacd4daad1de242ab5e414356a54286d70fbaddd1
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/11/368311/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iacd4daad1de242ab5e414356a54286d70fbaddd1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Store processed payments in main cache, not session

2017-07-27 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368307 )

Change subject: Store processed payments in main cache, not session
..

Store processed payments in main cache, not session

Seeing users still being redirected to failpage on reload. These
users also seem to have gotten new sessions between the first
ResultSwitcher hit and the second.

Bug: T167990
Change-Id: I79f593fd126a2cb6d24662f770d8a7846bd4eb93
---
M gateway_common/GatewayPage.php
M gateway_common/gateway.adapter.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/DonationInterfaceApiTestCase.php
M tests/phpunit/DonationInterfaceTestCase.php
M tests/phpunit/TestConfiguration.php
6 files changed, 21 insertions(+), 19 deletions(-)


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

diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index f2061ea..634d558 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -589,11 +589,9 @@
$requestProcessId = $this->adapter->getRequestProcessId(
$request->getValues()
);
-   $processedRequests = $request->getSessionData( 
'processed_requests' );
-   if ( !$requestProcessId || empty( $processedRequests ) ) {
-   return false;
-   }
-   return array_key_exists( $requestProcessId, $processedRequests 
);
+   $key = 'processed_request-' . $requestProcessId;
+   $cachedResult = wfGetMainCache()->get( $key );
+   return boolval( $cachedResult );
}
 
protected function markReturnProcessed() {
@@ -604,13 +602,10 @@
if ( !$requestProcessId ) {
return;
}
-   $processedRequests = $request->getSessionData( 
'processed_requests' );
-   if ( !$processedRequests ) {
-   $processedRequests = array();
-   }
+   $key = 'processed_request-' . $requestProcessId;
+
// TODO: we could store the results of the last process here, 
but for now
// we just indicate we did SOMETHING with it
-   $processedRequests[$requestProcessId] = true;
-   $request->setSessionData( 'processed_requests', 
$processedRequests );
+   wfGetMainCache()->add( $key, true, 7200 );
}
 }
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 5da2a72..8c0859d 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -2967,7 +2967,6 @@
'PaymentForms',
'numAttempt',
'order_status', //for post-payment activities
-   'processed_requests', //for post-payment 
activities
'sequence',
);
$preservedData = array();
diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
index b13db0c..6ba90a9 100644
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
@@ -283,8 +283,9 @@
);
 
$this->verifyFormOutput( 'PaypalExpressGatewayResult', 
$request, $assertNodes, false, $session );
-   $processed = 
RequestContext::getMain()->getRequest()->getSessionData( 'processed_requests' );
-   $this->assertArrayHasKey( $request['token'], $processed );
+   $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/' );
@@ -303,12 +304,12 @@
$init['gateway_session_id'] = mt_rand();
$init['language'] = 'pt';
$session = array(
-   'Donor' => $init,
-   'processed_requests' => array(
-   $init['gateway_session_id'] => true
-   )
+   'Donor' => $init
);
 
+   $key = 'processed_request-' . $init['gateway_session_id'];
+   wfGetMainCache()->add( $key, true, 100 );
+
$request = array(
'token' => $init['gateway_session_id'],
'PayerID' => 'ASdASDAS',
diff --git a/tests/phpunit/DonationInterfaceApiTestCase.php 
b/tests/phpunit/DonationInterfaceApiTestCase.php
index f033056..39b0c85 100644

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: WIP order sequence numbers start at 1, not 0

2017-07-27 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368266 )

Change subject: WIP order sequence numbers start at 1, not 0
..

WIP order sequence numbers start at 1, not 0

Bug: T171891
Change-Id: I2ae477f3d1e4bb9d155333534b9fcb5c6a14074d
---
M adyen_gateway/adyen.adapter.php
M amazon_gateway/amazon.adapter.php
M astropay_gateway/astropay.adapter.php
M gateway_common/gateway.adapter.php
M tests/phpunit/Adapter/Adyen/AdyenApiTest.php
M tests/phpunit/Adapter/Adyen/AdyenTest.php
M tests/phpunit/Adapter/Amazon/AmazonApiTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/includes/Responses/amazon/authorize.json
M tests/phpunit/includes/Responses/amazon/authorizeOnBillingAgreement.json
M tests/phpunit/includes/Responses/amazon/authorize_AmazonRejected.json
M tests/phpunit/includes/Responses/amazon/authorize_InvalidPaymentMethod.json
M tests/phpunit/includes/Responses/amazon/authorize_TransactionTimedOut.json
M tests/phpunit/includes/Responses/amazon/getBillingAgreementDetails.json
M tests/phpunit/includes/Responses/amazon/getCaptureDetails.json
M tests/phpunit/includes/Responses/amazon/setBillingAgreementDetails.json
M 
tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_10486.testresponse
M 
tests/phpunit/includes/Responses/paypal_ec/GetExpressCheckoutDetails_OK.testresponse
19 files changed, 45 insertions(+), 43 deletions(-)


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

diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php
index 4542a24..992270f 100644
--- a/adyen_gateway/adyen.adapter.php
+++ b/adyen_gateway/adyen.adapter.php
@@ -153,11 +153,7 @@
 * is never used at all.
 */
function do_transaction( $transaction ) {
-   // If this is not our first call, get a fresh order ID
-   // FIXME: This is repeated in three places. Maybe always 
regenerate in incrementSequenceNumber?
-   if ( $this->session_getData( 'sequence' ) ) {
-   $this->regenerateOrderID();
-   }
+   $this->ensureUniqueOrderID();
$this->session_addDonorData();
$this->setCurrentTransaction( $transaction );
 
diff --git a/amazon_gateway/amazon.adapter.php 
b/amazon_gateway/amazon.adapter.php
index c150ae2..213db1f 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -118,9 +118,7 @@
$this->client = $this->getPwaClient();
 
$this->transaction_response = new PaymentTransactionResponse();
-   if ( $this->session_getData( 'sequence' ) ) {
-   $this->regenerateOrderID();
-   }
+   $this->ensureUniqueOrderID();
 
try {
if ( $this->getData_Unstaged_Escaped( 'recurring' ) === 
'1' ) {
@@ -133,8 +131,6 @@
} catch ( ResponseProcessingException $ex ) {
$this->handleErrors( $ex, $this->transaction_response );
}
-
-   $this->incrementSequenceNumber();
 
return PaymentResult::fromResults(
$this->transaction_response,
diff --git a/astropay_gateway/astropay.adapter.php 
b/astropay_gateway/astropay.adapter.php
index 9b98b44..47e3a41 100644
--- a/astropay_gateway/astropay.adapter.php
+++ b/astropay_gateway/astropay.adapter.php
@@ -199,10 +199,7 @@
}
 
function doPayment() {
-   // If this is not our first NewInvoice call, get a fresh order 
ID
-   if ( $this->session_getData( 'sequence' ) ) {
-   $this->regenerateOrderID();
-   }
+   $this->ensureUniqueOrderID();
 
$transaction_result = $this->do_transaction( 'NewInvoice' );
$this->runAntifraudFilters();
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 5da2a72..590bef5 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -3479,7 +3479,11 @@
}
 
$this->session_ensure();
-   $sequence = $this->session_getData( 'sequence' ) ?: 0;
+   $sequence = $this->session_getData( 'sequence' );
+   if ( !$sequence ) {
+   $sequence = 1;
+   WmfFramework::setSessionValue( 'sequence', 
$sequence );
+   }
 
return "{$ctid}.{$sequence}";
}
@@ -3511,6 +3515,15 @@
return $id;
}
 
+   protected function ensureUniqueOrderID() {
+   // If this is not our first call, get a fresh order ID
+  

[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: WIP slow-start jobs

2017-07-27 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368217 )

Change subject: WIP slow-start jobs
..

WIP slow-start jobs

Add a config key 'slow-start' to define an alternate list of commands
to be run when --slow-start option is given on command line

TODO: doc, tests

Bug: T171873
Change-Id: Ie0e41d1984b943adeaefed989e1f215a08c1
---
M bin/run-job
M processcontrol/job_spec.py
M processcontrol/runner.py
3 files changed, 23 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/process-control 
refs/changes/17/368217/1

diff --git a/bin/run-job b/bin/run-job
index 1d4d86a..ab6bb27 100755
--- a/bin/run-job
+++ b/bin/run-job
@@ -50,7 +50,14 @@
job_group.add_argument("job", nargs="?", help="Run a given job.", 
type=str)
job_group.add_argument("-j", "--job", dest="job_name", help="Run a 
given job.", type=str)
parser.add_argument("-l", "--list-jobs", help="Print a list of 
available jobs.", action='store_true')
-   parser.add_argument("-s", "--status", help="Print status of all jobs", 
action='store_true')
+   parser.add_argument("-s", "--status", help="Print status of all jobs.", 
action='store_true')
+   parser.add_argument(
+   "-w",
+   "--slow-start",
+   dest="slow_start",
+   help="Slow start a job, if a slow-start configuration has been 
supplied.",
+   action="store_true"
+   )
# TODO: --kill-job, --disable-group, --enable-group
args = parser.parse_args()
 
@@ -61,8 +68,10 @@
job_name = args.job
if job_name is not None:
job = job_spec.load(job_name)
+   if args.slow_start:
+   assert "slow_start_commands" in job, "Cannot slow 
start: job config missing slow-start key"
runner = runner.JobRunner(job)
-   runner.run()
+   runner.run(args)
 
if args.list_jobs:
list_jobs(False)
diff --git a/processcontrol/job_spec.py b/processcontrol/job_spec.py
index 93f095c..2c96a40 100644
--- a/processcontrol/job_spec.py
+++ b/processcontrol/job_spec.py
@@ -60,6 +60,9 @@
 
 self.commands = self.config.get_as_list("command")
 
+if self.config.has("slow_start"):
+self.slow_start_commands = self.config.get_as_list("slow_start")
+
 if self.config.has("tag"):
 self.tags = self.config.get_as_list("tag")
 else:
diff --git a/processcontrol/runner.py b/processcontrol/runner.py
index c9e1cef..15b138d 100644
--- a/processcontrol/runner.py
+++ b/processcontrol/runner.py
@@ -22,7 +22,7 @@
 self.killer_was_me = False
 self.failure_reason = None
 
-def run(self):
+def run(self, run_job_options):
 # Check that we are the service user.
 service_user = str(self.global_config.get("user"))
 if service_user.isdigit():
@@ -46,8 +46,14 @@
 try:
 lock.begin(slug=self.job.slug)
 
-config.log.info("Running job {name} 
({slug})".format(name=self.job.name, slug=self.job.slug))
-for command_line in self.job.commands:
+if run_job_options.slow_start:
+commands = self.job.slow_start_commands
+verb = "Slow starting"
+else:
+commands = self.job.commands
+verb = "Running"
+config.log.info("{verb} job {name} ({slug})".format(verb=verb, 
name=self.job.name, slug=self.job.slug))
+for command_line in commands:
 return_code = self.run_command(command_line)
 if return_code != 0:
 self.fail_exitcode(return_code)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0e41d1984b943adeaefed989e1f215a08c1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' into deployment

2017-07-27 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368195 )

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

Merge branch 'master' into deployment

7d0c7b55e Fix duplicate check logic
03cd8c507 Initialize SmashPig context for recurring Ingenico charges

Change-Id: I483a020b6bf91e4921c6c0b34ef8561c7cee1b2b
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/95/368195/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I483a020b6bf91e4921c6c0b34ef8561c7cee1b2b
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Initialize SmashPig context for recurring Ingenico charges

2017-07-27 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368193 )

Change subject: Initialize SmashPig context for recurring Ingenico charges
..

Initialize SmashPig context for recurring Ingenico charges

Bug: T171858
Change-Id: I4190d06dba3c007adc08f510de6f34612848b604
---
M sites/all/modules/recurring_globalcollect/recurring_globalcollect.drush.inc
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/93/368193/1

diff --git 
a/sites/all/modules/recurring_globalcollect/recurring_globalcollect.drush.inc 
b/sites/all/modules/recurring_globalcollect/recurring_globalcollect.drush.inc
index 91a939f..7a5ef4f 100644
--- 
a/sites/all/modules/recurring_globalcollect/recurring_globalcollect.drush.inc
+++ 
b/sites/all/modules/recurring_globalcollect/recurring_globalcollect.drush.inc
@@ -52,6 +52,7 @@
  *
  */
 function drush_recurring_globalcollect() {
+  wmf_common_create_smashpig_context( 'ingenico_recurring', 'ingenico' );
 
   $date = drush_get_option('date');
   $url = drush_get_option('url');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4190d06dba3c007adc08f510de6f34612848b604
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Fix blank i18n message added by TranslateWiki

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368108 )

Change subject: Fix blank i18n message added by TranslateWiki
..

Fix blank i18n message added by TranslateWiki

This is breaking unrelated things, and probably shouldn't have been
allowed in the first place!

Change-Id: I71168377c940df2abb07e47f07a2c30cc61196fc
---
M amazon_gateway/i18n/de.json
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/amazon_gateway/i18n/de.json b/amazon_gateway/i18n/de.json
index 9dbdf1b..511e14a 100644
--- a/amazon_gateway/i18n/de.json
+++ b/amazon_gateway/i18n/de.json
@@ -6,5 +6,4 @@
]
},
"amazon_gateway-desc": "Ermöglicht die Verarbeitung von Zahlungen über 
Amazon",
-   "apihelp-di_amazon_bill-param-currency": ""
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71168377c940df2abb07e47f07a2c30cc61196fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' into deployment

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368105 )

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

Merge branch 'master' into deployment

6cf08f690 Fixes for SmashPig update
d502f4ee3 Make CI scripts more stricts
0c855ebb2 Fix misc bash oddities in the CI scripts

Change-Id: I9b6ab8b32d1f4b04cb7634378ddbe0241556d37c
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/05/368105/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b6ab8b32d1f4b04cb7634378ddbe0241556d37c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: clean up insert_contribution_tracking signature

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368103 )

Change subject: clean up insert_contribution_tracking signature
..

clean up insert_contribution_tracking signature

Change-Id: I9a4e58b72795e26babbb59c42d7bdcaa57b78862
---
M sites/all/modules/queue2civicrm/recurring/recurring.module
M sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
M sites/all/modules/wmf_civicrm/tracking.inc
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
4 files changed, 30 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/03/368103/1

diff --git a/sites/all/modules/queue2civicrm/recurring/recurring.module 
b/sites/all/modules/queue2civicrm/recurring/recurring.module
index 5a37e07..58f0156 100644
--- a/sites/all/modules/queue2civicrm/recurring/recurring.module
+++ b/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -171,12 +171,18 @@
   sort( $contrib_ids, SORT_NUMERIC );
   $contrib_id = array_shift( $contrib_ids ); // this should return null if 
$contrib_ids is empty
   $date = wmf_common_date_unix_to_sql( strtotime( $msg[ 'payment_date' ] 
));
-  $contribution_tracking_id = wmf_civicrm_insert_contribution_tracking( 
'..rpp', 'civicrm', null, $date, $contrib_id );
+  $tracking = array(
+'utm_source' => '..rpp',
+'utm_medium' => 'civicrm',
+'ts' => $date,
+'contribution_id' => $contrib_id
+  );
+  $contribution_tracking_id = wmf_civicrm_insert_contribution_tracking( 
$tracking );
   watchdog( 'recurring', 'recurring_get_contribution_tracking_id: Inserted 
contrib tracking id, %cti', array( '%cti' => $contribution_tracking_id ), 
WATCHDOG_DEBUG );
   return $contribution_tracking_id;
 }
   } else {
-   watchdog( 'recurring', 'recurring_get_contribution_tracking_id: No 
contribution_tracking_id returned.', array(), WATCHDOG_DEBUG );
+watchdog( 'recurring', 'recurring_get_contribution_tracking_id: No 
contribution_tracking_id returned.', array(), WATCHDOG_DEBUG );
 return null;
   }
 }
diff --git 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
index c60ce38..fc2fc0c 100644
--- 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
+++ 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
@@ -60,7 +60,13 @@
'trxn_id' => 'RECURRING GLOBALCOLLECT 
STUB_ORIG_CONTRIB-' . mt_rand(),
) );
$this->contributions[] = $result['id'];
-   wmf_civicrm_insert_contribution_tracking( '..rcc', 'civicrm', 
null, wmf_common_date_unix_to_sql( strtotime( 'now' ) ), $result['id'] );
+   $tracking = array(
+   'utm_source' => '..rcc',
+   'utm_medium' => 'civicrm',
+   'ts' => wmf_common_date_unix_to_sql( strtotime( 'now' ) 
),
+   'contribution_id' => $result['id'],
+   );
+   wmf_civicrm_insert_contribution_tracking( $tracking );
}
 
function testChargeRecorded() {
diff --git a/sites/all/modules/wmf_civicrm/tracking.inc 
b/sites/all/modules/wmf_civicrm/tracking.inc
index 6d7739c..216b6c8 100644
--- a/sites/all/modules/wmf_civicrm/tracking.inc
+++ b/sites/all/modules/wmf_civicrm/tracking.inc
@@ -2,29 +2,19 @@
 
 /**
  * Insert a record into contribution_tracking table
- * 
+ *
  * Primarily used when a record does not already exist in the table for a
  * particular transaction.  Rare, but inserting some data for a trxn when
  * absent helps facilitate better analytics.
- * 
+ *
+ * @param array $values associative array of columns => values to insert
+ *  into the contribution tracking table
  * @return int the contribution_tracking id
  */
-function wmf_civicrm_insert_contribution_tracking( $utm_source, $utm_medium, 
$utm_campaign, $ts, $contrib_id=null, $optout=null, $anonymous=null ) {
+function wmf_civicrm_insert_contribution_tracking( $values ) {
 // make sure we're using the default (drupal) db
 $dbs = wmf_civicrm_get_dbs();
 $dbs->push( 'donations' );
-
-$values = array(
-'utm_source' => $utm_source,
-'utm_medium' => $utm_medium,
-'utm_campaign' => $utm_campaign,
-'optout' => $optout,
-'anonymous' => $anonymous,
-'ts' => $ts,
-);
-if ($contrib_id !== null){
-$values['contribution_id'] = $contrib_id;
-}
 
 $contribution_tracking_id = db_insert( 'contribution_tracking' )->fields( 
$values )->execute();
 watchdog( 'wmf_civicrm', "Created new contribution_tracking entry %id", 
array( '%id' => $contribution_tracking_id ), WATCHDOG_INFO );
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fixes for SmashPig update

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367953 )

Change subject: Fixes for SmashPig update
..

Fixes for SmashPig update

Missed a couple of obsolete config usages for audit, replaced with
QueueWrapper. Also remove some no-longer-used use statements

Change-Id: I48238b777e78c310b1f1a1959af643a86e7ffb98
TODO: audit tests should look at queue messages
---
M sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc
M sites/all/modules/globalcollect_audit/globalcollect_audit.module
M sites/all/modules/queue2civicrm/banner_history/banner_history.module
M sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
M sites/all/modules/queue2civicrm/queue2civicrm.module
M sites/all/modules/queue2civicrm/recurring/recurring.module
M sites/all/modules/queue2civicrm/refund/wmf_refund_qc.module
M sites/all/modules/queue2civicrm/unsubscribe/wmf_unsubscribe_qc.module
M sites/all/modules/wmf_audit/ingenico/orphan_rectify.drush.inc
M sites/all/modules/wmf_audit/wmf_audit.module
10 files changed, 9 insertions(+), 41 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/53/367953/1

diff --git 
a/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc 
b/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc
index 3deb547..6f4a654 100644
--- a/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc
+++ b/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc
@@ -7,9 +7,6 @@
  * @TODO print some useful info to STDOUT
  */
 
-use SmashPig\Core\Context;
-use SmashPig\Core\Configuration;
-
 /**
  * Implementation of hook_drush_command()
  */
diff --git a/sites/all/modules/globalcollect_audit/globalcollect_audit.module 
b/sites/all/modules/globalcollect_audit/globalcollect_audit.module
index d0bdcde..4563706 100644
--- a/sites/all/modules/globalcollect_audit/globalcollect_audit.module
+++ b/sites/all/modules/globalcollect_audit/globalcollect_audit.module
@@ -1,5 +1,5 @@
 object( $configKey, 
false );
-   $newQueue->push( $body );
+QueueWrapper::push( $queueId, $body );
 }
 
 /**
diff --git 
a/sites/all/modules/queue2civicrm/banner_history/banner_history.module 
b/sites/all/modules/queue2civicrm/banner_history/banner_history.module
index 9f0255c..468ca0b 100644
--- a/sites/all/modules/queue2civicrm/banner_history/banner_history.module
+++ b/sites/all/modules/queue2civicrm/banner_history/banner_history.module
@@ -1,8 +1,6 @@
  'data-store/donations',
-'negative' => 'data-store/refund',
-'recurring' => 'data-store/recurring',
+  $queueNames = array(
+'main' => 'donations',
+'negative' => 'refund',
+'recurring' => 'recurring',
   );
 
-  if (!array_key_exists($type, $configKeys)) {
+  if (!array_key_exists($type, $queueNames)) {
 throw new Exception(__FUNCTION__ . ": Unhandled message type '$type'");
   }
 
   wmf_common_set_message_source($body, 'audit', 
wmf_audit_runtime_options('submod_prefix') . ' Recon Auditor');
-  $newQueue = Configuration::getDefaultConfig()->object(
-$configKeys[$type]
-  );
-  $newQueue->push( $body );
+  QueueWrapper::push( $queueNames[$type], $body );
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48238b777e78c310b1f1a1959af643a86e7ffb98
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Update vendor (get rid of php54 polyfill includes)

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367950 )

Change subject: Update vendor (get rid of php54 polyfill includes)
..

Update vendor (get rid of php54 polyfill includes)

Change-Id: I8891e4a1ec237798c1b0db89e7d906a56080de18
---
M vendor
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/50/367950/1

diff --git a/vendor b/vendor
index 5449ec1..0e1e603 16
--- a/vendor
+++ b/vendor
@@ -1 +1 @@
-Subproject commit 5449ec1076ea3a6fd42e376fe7bc8b13b885ad2b
+Subproject commit 0e1e6032f2385632ba86658ba9cc916de470d50e

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8891e4a1ec237798c1b0db89e7d906a56080de18
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...vendor[master]: hack out php54 polyfill stuff

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367948 )

Change subject: hack out php54 polyfill stuff
..

hack out php54 polyfill stuff

Change-Id: I07eb7af41752ffdab1321965ef975451a4b82fc4
---
M composer/autoload_classmap.php
M composer/autoload_files.php
M composer/autoload_psr4.php
M composer/autoload_static.php
4 files changed, 0 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/vendor 
refs/changes/48/367948/1

diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php
index 1d0f519..50a225a 100644
--- a/composer/autoload_classmap.php
+++ b/composer/autoload_classmap.php
@@ -26,7 +26,6 @@
 'AstroPayStatusQuery' => $vendorDir . 
'/wikimedia/donation-interface/astropay_gateway/scripts/status.php',
 'BannerHistoryLogIdProcessor' => $vendorDir . 
'/wikimedia/donation-interface/extras/banner_history/BannerHistoryLogIdProcessor.php',
 'BlankAddressFields' => $vendorDir . 
'/wikimedia/donation-interface/adyen_gateway/BlankAddressFields.php',
-'CallbackFilterIterator' => $vendorDir . 
'/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php',
 'CleanupRecurringLength' => $vendorDir . 
'/wikimedia/donation-interface/paypal_gateway/CleanupRecurringLength.php',
 'ClientSideValidationHelper' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/ClientSideValidationHelper.php',
 'ContributionTrackingPlusUnique' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/ContributionTrackingPlusUnique.php',
@@ -103,13 +102,11 @@
 'PaypalLegacyAdapter' => $vendorDir . 
'/wikimedia/donation-interface/paypal_gateway/legacy/paypal_legacy.adapter.php',
 'PaypalLegacyGateway' => $vendorDir . 
'/wikimedia/donation-interface/paypal_gateway/legacy/paypal_legacy_gateway.body.php',
 'PaypalLegacyLocale' => $vendorDir . 
'/wikimedia/donation-interface/paypal_gateway/legacy/PaypalLegacyLocale.php',
-'RecursiveCallbackFilterIterator' => $vendorDir . 
'/symfony/polyfill-php54/Resources/stubs/RecursiveCallbackFilterIterator.php',
 'ResponseCodes' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/ResponseCodes.php',
 'ResponseProcessingException' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/ResponseProcessingException.php',
 'ResultPages' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/ResultPages.php',
 'RiskScore' => $vendorDir . 
'/wikimedia/donation-interface/adyen_gateway/RiskScore.php',
 'SMTP' => $vendorDir . '/phpmailer/phpmailer/class.smtp.php',
-'SessionHandlerInterface' => $vendorDir . 
'/symfony/polyfill-php54/Resources/stubs/SessionHandlerInterface.php',
 'StagingHelper' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/StagingHelper.php',
 'StreetAddress' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/StreetAddress.php',
 'Subdivisions' => $vendorDir . 
'/wikimedia/donation-interface/gateway_forms/includes/Subdivisions.php',
diff --git a/composer/autoload_files.php b/composer/autoload_files.php
index 439db46..96d963b 100644
--- a/composer/autoload_files.php
+++ b/composer/autoload_files.php
@@ -13,7 +13,6 @@
 '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . 
'/symfony/polyfill-mbstring/bootstrap.php',
 '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . 
'/guzzlehttp/guzzle/src/functions_include.php',
 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . 
'/phpseclib/phpseclib/phpseclib/bootstrap.php',
-'3e2471375464aac821502deb0ac64275' => $vendorDir . 
'/symfony/polyfill-php54/bootstrap.php',
 '5255c38a0faeba867671b61dfda6d864' => $vendorDir . 
'/paragonie/random_compat/lib/random.php',
 'bf34263f834e2781b79cae4d55a1d350' => $vendorDir . 
'/wikimedia/donation-interface/gateway_common/WmfFramework.php',
 );
diff --git a/composer/autoload_psr4.php b/composer/autoload_psr4.php
index 5b7a33f..58eb314 100644
--- a/composer/autoload_psr4.php
+++ b/composer/autoload_psr4.php
@@ -9,7 +9,6 @@
 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
 'Wikimedia\\Composer\\' => array($vendorDir . 
'/wikimedia/composer-merge-plugin/src'),
 'Symfony\\Polyfill\\Php55\\' => array($vendorDir . 
'/symfony/polyfill-php55'),
-'Symfony\\Polyfill\\Php54\\' => array($vendorDir . 
'/symfony/polyfill-php54'),
 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . 
'/symfony/polyfill-mbstring'),
 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . 
'/symfony/http-foundation'),
diff --git a/composer/autoload_static.php b/composer/autoload_static.php
index e061c4e..13d56c9 100644
--- a/composer/autoload_static.php
+++ b/composer/autoload_static.php
@@ -14,7 +14,6 @@
 '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . 

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' into deployment

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367944 )

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

Merge branch 'master' into deployment

And update vendor submodule

8c89e7bf9 Add tests & finalise unsubscribe process
edefb82ab Update SmashPig and DonationInterface
a2bf76aa4 Fix typo causing enotice & suppressed not to populate

Change-Id: I3190ba4a900e178865a2c443a6f64a7ef2c852ec
---
D sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/BannerHistoryTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/RecurringQueueTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/RefundQueueTest.php
D sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
D sites/all/modules/wmf_audit/tests/AmazonAuditTest.php
D sites/all/modules/wmf_civicrm/tests/phpunit/DonationInterfaceFactoryTest.php
D sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
M vendor
11 files changed, 1 insertion(+), 1,590 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/44/367944/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
deleted file mode 100644
index d376c2f..000
--- a/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<<< HEAD   (461900 Merge "Merge branch 'master' of 
https://gerrit.wikimedia.org)
-===
-consumer = new AntifraudQueueConsumer(
-   'payments-antifraud'
-   );
-   }
-
-   public function testValidMessage() {
-   $message = json_decode(
-   file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-   true
-   );
-   $ctId = mt_rand();
-   $oId = $ctId . '.0';
-   $message['contribution_tracking_id'] = $ctId;
-   $message['order_id'] = $oId;
-   $this->consumer->processMessage( $message );
-
-   $this->compareMessageWithDb( $message, 
$message['score_breakdown'] );
-   }
-
-   /**
-* The first message for a ct_id / order_id pair needs to be complete
-*
-* @expectedException FredgeDataValidationException
-*/
-   public function testIncompleteMessage() {
-   $message = json_decode(
-   file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-   true
-   );
-   unset( $message['user_ip'] );
-   $this->consumer->processMessage( $message );
-   }
-
-   public function testCombinedMessage() {
-   $message1 = json_decode(
-   file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-   true
-   );
-   $message2 = json_decode(
-   file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-   true
-   );
-   $ctId = mt_rand();
-   $oId = $ctId . '.0';
-   $message1['contribution_tracking_id'] = $ctId;
-   $message2['contribution_tracking_id'] = $ctId;
-   $message1['order_id'] = $oId;
-   $message2['order_id'] = $oId;
-   $message1['score_breakdown'] = array_slice(
-   $message1['score_breakdown'], 0, 4
-   );
-   $message2['score_breakdown'] = array_slice(
-   $message2['score_breakdown'], 4, 4
-   );
-   $this->consumer->processMessage( $message1 );
-
-   $dbEntries = $this->getDbEntries( $ctId, $oId );
-   $this->assertEquals( 4, count( $dbEntries ) );
-
-   $this->consumer->processMessage( $message2 );
-
-   $breakdown = array_merge(
-   $message1['score_breakdown'], 
$message2['score_breakdown']
-   );
-
-   $this->compareMessageWithDb( $message1, $breakdown );
-   }
-
-   protected function compareMessageWithDb( $common, $breakdown ) {
-   $dbEntries = $this->getDbEntries(
-   $common['contribution_tracking_id'], $common['order_id']
-   );
-   $this->assertEquals( 8, count( $dbEntries ) );
-   $fields = array(
-   'gateway',  'validation_action', 'payment_method',
-   'risk_score', 'server'
-   );
-   foreach ( $fields as $field ) {
-   

[MediaWiki-commits] [Gerrit] wikimedia...vendor[master]: Update SmashPig, DonationInterface, and dependencies

2017-07-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367943 )

Change subject: Update SmashPig, DonationInterface, and dependencies
..

Update SmashPig, DonationInterface, and dependencies

Change-Id: I1c13901a2f33ba67db26bf5053b7abab9aee9323
---
M composer/autoload_classmap.php
M composer/autoload_files.php
M composer/autoload_psr4.php
M composer/autoload_static.php
M composer/installed.json
A corneltek/getoptionkit/.gitignore
A corneltek/getoptionkit/.travis.yml
A corneltek/getoptionkit/CHANGELOG.md
A corneltek/getoptionkit/CONTRIBUTORS.txt
A corneltek/getoptionkit/LICENSE
A corneltek/getoptionkit/README.md
A corneltek/getoptionkit/build.xml
A corneltek/getoptionkit/composer.json
A corneltek/getoptionkit/composer.lock
A corneltek/getoptionkit/examples/demo.php
A corneltek/getoptionkit/package.ini
A corneltek/getoptionkit/phpdox.xml
A corneltek/getoptionkit/phprelease.ini
A corneltek/getoptionkit/phpunit-ci.xml
A corneltek/getoptionkit/phpunit.xml.dist
A corneltek/getoptionkit/src/Argument.php
A corneltek/getoptionkit/src/ContinuousOptionParser.php
A corneltek/getoptionkit/src/Exception/InvalidOptionException.php
A corneltek/getoptionkit/src/Exception/InvalidOptionValueException.php
A corneltek/getoptionkit/src/Exception/NonNumericException.php
A corneltek/getoptionkit/src/Exception/OptionConflictException.php
A corneltek/getoptionkit/src/Exception/RequireValueException.php
A corneltek/getoptionkit/src/Option.php
A corneltek/getoptionkit/src/OptionCollection.php
A corneltek/getoptionkit/src/OptionParser.php
A corneltek/getoptionkit/src/OptionPrinter/ConsoleOptionPrinter.php
A corneltek/getoptionkit/src/OptionPrinter/OptionPrinter.php
A corneltek/getoptionkit/src/OptionResult.php
A corneltek/getoptionkit/src/ValueType/BaseType.php
A corneltek/getoptionkit/src/ValueType/BoolType.php
A corneltek/getoptionkit/src/ValueType/BooleanType.php
A corneltek/getoptionkit/src/ValueType/DateTimeType.php
A corneltek/getoptionkit/src/ValueType/DateType.php
A corneltek/getoptionkit/src/ValueType/DirType.php
A corneltek/getoptionkit/src/ValueType/EmailType.php
A corneltek/getoptionkit/src/ValueType/FileType.php
A corneltek/getoptionkit/src/ValueType/IpType.php
A corneltek/getoptionkit/src/ValueType/Ipv4Type.php
A corneltek/getoptionkit/src/ValueType/Ipv6Type.php
A corneltek/getoptionkit/src/ValueType/NumberType.php
A corneltek/getoptionkit/src/ValueType/PathType.php
A corneltek/getoptionkit/src/ValueType/RegexType.php
A corneltek/getoptionkit/src/ValueType/StringType.php
A corneltek/getoptionkit/src/ValueType/UrlType.php
A corneltek/getoptionkit/tests/ArgumentTest.php
A corneltek/getoptionkit/tests/ContinuousOptionParserTest.php
A corneltek/getoptionkit/tests/OptionCollectionTest.php
A corneltek/getoptionkit/tests/OptionParserTest.php
A corneltek/getoptionkit/tests/OptionPrinter/ConsoleOptionPrinterTest.php
A corneltek/getoptionkit/tests/OptionResultTest.php
A corneltek/getoptionkit/tests/OptionTest.php
A corneltek/getoptionkit/tests/RegexValueTypeTest.php
A corneltek/getoptionkit/tests/ValueTypeTest.php
A wikimedia/donation-interface/.stylelintrc
M wikimedia/donation-interface/DonationInterface.alias.php
M wikimedia/donation-interface/DonationInterface.class.php
M wikimedia/donation-interface/DonationInterfaceFormSettings.php
M wikimedia/donation-interface/Gruntfile.js
M wikimedia/donation-interface/README.txt
M wikimedia/donation-interface/adyen_gateway/AmountInMinorUnits.php
M wikimedia/donation-interface/adyen_gateway/BlankAddressFields.php
M wikimedia/donation-interface/adyen_gateway/adyen.adapter.php
M wikimedia/donation-interface/adyen_gateway/config/country_fields.yaml
M wikimedia/donation-interface/adyen_gateway/config/var_map.yaml
M wikimedia/donation-interface/amazon_gateway/amazon.adapter.php
M wikimedia/donation-interface/amazon_gateway/amazon.api.php
M wikimedia/donation-interface/amazon_gateway/amazon.js
M wikimedia/donation-interface/amazon_gateway/amazon_gateway.body.php
M wikimedia/donation-interface/amazon_gateway/i18n/en.json
M wikimedia/donation-interface/amazon_gateway/i18n/fr.json
M wikimedia/donation-interface/amazon_gateway/i18n/qqq.json
M wikimedia/donation-interface/amazon_gateway/i18n/ru.json
M wikimedia/donation-interface/amazon_gateway/i18n/uk.json
M wikimedia/donation-interface/astropay_gateway/AstroPaySignature.php
M wikimedia/donation-interface/astropay_gateway/astropay.adapter.php
M wikimedia/donation-interface/astropay_gateway/config/var_map.yaml
M wikimedia/donation-interface/astropay_gateway/scripts/status.php
M wikimedia/donation-interface/composer.json
M wikimedia/donation-interface/composer.lock
M wikimedia/donation-interface/extension.json
M wikimedia/donation-interface/extras/FraudFilter.php
M 
wikimedia/donation-interface/extras/banner_history/BannerHistoryLogIdProcessor.php
M 
wikimedia/donation-interface/extras/custom_filters/filters/minfraud/minfraud.body.php
M 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix failing refund test

2017-07-25 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367813 )

Change subject: Fix failing refund test
..

Fix failing refund test

Consistently set exchange rates, clean up better

Change-Id: I8179e8f16bdb8fce03001480b533952086b4bae2
---
M sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php
M sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
2 files changed, 29 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/13/367813/1

diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php
index cc9fbdc..a423cb5 100644
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php
+++ b/sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php
@@ -5,6 +5,7 @@
 /**
  * @group Pipeline
  * @group WmfCivicrm
+ * @group Refund
  */
 class RefundTest extends BaseWmfDrupalPhpUnitTestCase {
 
@@ -14,6 +15,11 @@
  * @var int
  */
 protected $original_contribution_id;
+protected $gateway_txn_id;
+protected $contact_id;
+protected $original_currency;
+protected $original_amount;
+protected $trxn_id;
 
 public function setUp() {
 parent::setUp();
@@ -45,24 +51,10 @@
 'trxn_id' => $this->trxn_id,
 ) );
 $this->original_contribution_id = $results['id'];
-
-$this->refund_contribution_id = null;
 }
 
 public function tearDown() {
-civicrm_api3('contribution', 'delete', array(
-'id' => $this->original_contribution_id,
-));
-
-if ($this->refund_contribution_id && $this->refund_contribution_id != 
$this->original_contribution_id) {
-  civicrm_api3('contribution', 'delete', array(
-'id' => $this->refund_contribution_id,
-  ));
-}
-
-civicrm_api3( 'contact', 'delete', array(
-'id' => $this->contact_id,
-) );
+$this->cleanUpContact( $this->contact_id );
 
 parent::tearDown();
 }
@@ -151,7 +143,7 @@
  * Make a refund with type set to "chargeback"
  */
 public function testMarkRefundWithType() {
-$this->refund_contribution_id = wmf_civicrm_mark_refund( 
$this->original_contribution_id, 'chargeback' );
+wmf_civicrm_mark_refund( $this->original_contribution_id, 'chargeback' 
);
 
 $contribution = civicrm_api3('contribution', 'getsingle', array(
   'id' => $this->original_contribution_id,
@@ -174,7 +166,7 @@
 );
 
 
-$this->refund_contribution_id  = CRM_Core_DAO::singleValueQuery("
+$refund_contribution_id = CRM_Core_DAO::singleValueQuery("
   SELECT entity_id FROM wmf_contribution_extra
   WHERE
   parent_contribution_id = %1",
@@ -182,7 +174,7 @@
 );
 
 $refund_contribution = civicrm_api3('Contribution', 'getsingle', array(
-  'id' => $this->refund_contribution_id,
+  'id' => $refund_contribution_id,
 ));
 
 $this->assertEquals(
@@ -224,14 +216,15 @@
  * Make a lesser refund in the wrong currency
  */
 public function testLesserWrongCurrencyRefund() {
-  $dbtime = '2000-04-03';
-  $epochtime = wmf_common_date_parse_string( $dbtime );
-  $this->setExchangeRates( $epochtime, array('COP' => .01 ) );
+  $epochtime = time();
+  $dbtime = wmf_common_date_unix_to_civicrm( $epochtime );
+  $this->setExchangeRates( $epochtime, array('USD' => 1, 'COP' => .01 ) );
 
   $result = $this->callAPISuccess('contribution', 'create', array(
 'contact_id' => $this->contact_id,
 'financial_type_id' => 'Cash',
 'total_amount' => 200,
+'currency' => 'USD',
 'contribution_source' => 'COP 2',
 'trxn_id' => "TEST_GATEWAY {$this->gateway_txn_id} " . (time() + 20),
   ));
@@ -253,7 +246,6 @@
   $this->assertEquals(3, $contributions['count'], print_r($contributions, 
TRUE));
   $this->assertEquals(200, $contributions['values'][1]['total_amount']);
   $this->assertEquals('USD', $contributions['values'][2]['currency']);
-  // Exchange rates might move a bit but hopefully it stays less than the 
original amount.
   $this->assertEquals($contributions['values'][2]['total_amount'], 150);
   $this->assertEquals('COP 15000', 
$contributions['values'][2]['contribution_source']);
 }
diff --git 
a/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php 
b/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
index 7f8ccaa..fb9c147 100644
--- 
a/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
+++ 
b/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
@@ -168,4 +168,19 @@
 return $contactID;
   }
 
+  public function cleanUpContact( $contactId ) {

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add country to c_t rows created during imports

2017-07-25 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367806 )

Change subject: Add country to c_t rows created during imports
..

Add country to c_t rows created during imports

And clean up a bit of ugly code.

Bug: T171658
Change-Id: If685b1e82a5f5a3f01367e908bb2834a73f27133
---
M sites/all/modules/queue2civicrm/recurring/recurring.module
M sites/all/modules/wmf_civicrm/tracking.inc
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
3 files changed, 29 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/06/367806/1

diff --git a/sites/all/modules/queue2civicrm/recurring/recurring.module 
b/sites/all/modules/queue2civicrm/recurring/recurring.module
index 19f062c..47e597d 100644
--- a/sites/all/modules/queue2civicrm/recurring/recurring.module
+++ b/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -172,12 +172,18 @@
   sort( $contrib_ids, SORT_NUMERIC );
   $contrib_id = array_shift( $contrib_ids ); // this should return null if 
$contrib_ids is empty
   $date = wmf_common_date_unix_to_sql( strtotime( $msg[ 'payment_date' ] 
));
-  $contribution_tracking_id = wmf_civicrm_insert_contribution_tracking( 
'..rpp', 'civicrm', null, $date, $contrib_id );
+  $tracking = array(
+'utm_source' => '..rpp',
+'utm_medium' => 'civicrm',
+'ts' => $date,
+'contribution_id' => $contrib_id
+  );
+  $contribution_tracking_id = wmf_civicrm_insert_contribution_tracking( 
$tracking );
   watchdog( 'recurring', 'recurring_get_contribution_tracking_id: Inserted 
contrib tracking id, %cti', array( '%cti' => $contribution_tracking_id ), 
WATCHDOG_DEBUG );
   return $contribution_tracking_id;
 }
   } else {
-   watchdog( 'recurring', 'recurring_get_contribution_tracking_id: No 
contribution_tracking_id returned.', array(), WATCHDOG_DEBUG );
+watchdog( 'recurring', 'recurring_get_contribution_tracking_id: No 
contribution_tracking_id returned.', array(), WATCHDOG_DEBUG );
 return null;
   }
 }
diff --git a/sites/all/modules/wmf_civicrm/tracking.inc 
b/sites/all/modules/wmf_civicrm/tracking.inc
index 6d7739c..216b6c8 100644
--- a/sites/all/modules/wmf_civicrm/tracking.inc
+++ b/sites/all/modules/wmf_civicrm/tracking.inc
@@ -2,29 +2,19 @@
 
 /**
  * Insert a record into contribution_tracking table
- * 
+ *
  * Primarily used when a record does not already exist in the table for a
  * particular transaction.  Rare, but inserting some data for a trxn when
  * absent helps facilitate better analytics.
- * 
+ *
+ * @param array $values associative array of columns => values to insert
+ *  into the contribution tracking table
  * @return int the contribution_tracking id
  */
-function wmf_civicrm_insert_contribution_tracking( $utm_source, $utm_medium, 
$utm_campaign, $ts, $contrib_id=null, $optout=null, $anonymous=null ) {
+function wmf_civicrm_insert_contribution_tracking( $values ) {
 // make sure we're using the default (drupal) db
 $dbs = wmf_civicrm_get_dbs();
 $dbs->push( 'donations' );
-
-$values = array(
-'utm_source' => $utm_source,
-'utm_medium' => $utm_medium,
-'utm_campaign' => $utm_campaign,
-'optout' => $optout,
-'anonymous' => $anonymous,
-'ts' => $ts,
-);
-if ($contrib_id !== null){
-$values['contribution_id'] = $contrib_id;
-}
 
 $contribution_tracking_id = db_insert( 'contribution_tracking' )->fields( 
$values )->execute();
 watchdog( 'wmf_civicrm', "Created new contribution_tracking entry %id", 
array( '%id' => $contribution_tracking_id ), WATCHDOG_INFO );
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index a692882..6861169 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -1788,11 +1788,11 @@
 // code change respects previous recognition of 'payment_method' as being 
a little bit magic,
 // but also assumes that if you are setting utm_medium or utm_source in 
your import you intend them to be recorded.
 if ( !isset( $msg[ 'contribution_tracking_id' ] ) ) {
-if (
-  (!empty($msg['utm_medium']) || !empty($msg['utm_source']))
-  || (array_key_exists('payment_method', $msg) && 
strtoupper($msg['payment_method']) != "CHECK")
-) {
+$hasUtmData = !empty( $msg['utm_medium'] ) || !empty( 
$msg['utm_source'] );
+$isCheck = array_key_exists( 'payment_method', $msg )
+   && strtoupper( $msg['payment_method'] ) == "CHECK";
 
+if ( $hasUtmData || !$isCheck ) {
 watchdog( 'wmf_civicrm', 'Contribution missing 
contribution_tracking_id', array(), WATCHDOG_DEBUG );
 //@fixme: For the regular transactions, this has been moved to the 
staging function. 

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[deployment]: Merge branch 'master' into deployment

2017-07-25 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367797 )

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

Merge branch 'master' into deployment

3a61cbf Curl Wrapper fix and use provider config
28035b9 Implement HostedCheckout
8da42bf Get HostedCheckout and Payment Status
55b029d Fix PayPal EC recurring profile created messages

Change-Id: I27a4514b3e92655f08893bca7f86ca252ba91b62
---
D PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response
D PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response
D PaymentProviders/Ingenico/Tests/Data/paymentStatus.response
D PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
D PaymentProviders/Ingenico/Tests/phpunit/HostedCheckoutProviderTest.php
D PaymentProviders/Ingenico/Tests/phpunit/IdealStatusProviderTest.php
D PaymentProviders/Ingenico/Tests/phpunit/IngenicoPaymentProviderTest.php
D 
PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
D Tests/BaseSmashPigUnitTestCase.php
9 files changed, 0 insertions(+), 510 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/97/367797/1

diff --git a/PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response 
b/PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response
deleted file mode 100644
index 9d35135..000
--- a/PaymentProviders/Ingenico/Tests/Data/hostedPaymentStatus.response
+++ /dev/null
@@ -1,51 +0,0 @@
-HTTP/1.1 200 OK
-Date: Mon, 30 Jan 2017 17:58:02 GMT
-Server: Apache/2.4.16 (Unix) OpenSSL/1.0.1t
-X-Powered-By: Servlet/3.0 JSP/2.2
-Transfer-Encoding: chunked
-Content-Type: application/json
-
-{
-  "createdPaymentOutput": {
-"payment": {
-  "id": "008915660725016821",
-  "paymentOutput": {
-"amountOfMoney": {
-  "amount": 2345,
-  "currencyCode": "USD"
-},
-"references": {
-  "paymentReference": "0"
-},
-"paymentMethod": "card",
-"cardPaymentMethodSpecificOutput": {
-  "paymentProductId": 1,
-  "authorisationCode": "123456",
-  "card": {
-"cardNumber": "7977",
-"expiryDate": "1220"
-  },
-  "fraudResults": {
-"avsResult": "0",
-"cvvResult": "M",
-"fraudServiceResult": "no-advice"
-  }
-}
-  },
-  "status": "PENDING_APPROVAL",
-  "statusOutput": {
-"isCancellable": true,
-"statusCode": 600,
-"statusCodeChangeDateTime": "20140717145840",
-"isAuthorized": true
-  }
-},
-"paymentCreationReferences": {
-  "additionalReference": "0089156607250168",
-  "externalReference": "008915660725016821"
-},
-"tokens": ""
-  },
-  "status": "PAYMENT_CREATED"
-}
-
diff --git a/PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response 
b/PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response
deleted file mode 100644
index 15723b9..000
--- a/PaymentProviders/Ingenico/Tests/Data/newHostedCheckout.response
+++ /dev/null
@@ -1,12 +0,0 @@
-HTTP/1.1 200 OK
-Date: Mon, 30 Jan 2017 17:58:02 GMT
-Server: Apache/2.4.16 (Unix) OpenSSL/1.0.1t
-X-Powered-By: Servlet/3.0 JSP/2.2
-Transfer-Encoding: chunked
-Content-Type: application/json
-
-{
-  "partialRedirectUrl": 
"poweredbyglobalcollect.com/pay8915-53ebca407e6b4a1dbd086aad4f10354d:8915-28e5b79c889641c8ba770f1ba576c1fe:9798f4c44ac6406e8288494332d1daa0",
-  "hostedCheckoutId": "8915-28e5b79c889641c8ba770f1ba576c1fe",
-  "RETURNMAC": "f5b66cf9-c64c-4c8d-8171-b47205c89a56"
-}
diff --git a/PaymentProviders/Ingenico/Tests/Data/paymentStatus.response 
b/PaymentProviders/Ingenico/Tests/Data/paymentStatus.response
deleted file mode 100644
index 216a1cb..000
--- a/PaymentProviders/Ingenico/Tests/Data/paymentStatus.response
+++ /dev/null
@@ -1,43 +0,0 @@
-HTTP/1.1 200 OK
-Date: Mon, 30 Jan 2017 17:58:02 GMT
-Server: Apache/2.4.16 (Unix) OpenSSL/1.0.1t
-X-Powered-By: Servlet/3.0 JSP/2.2
-Transfer-Encoding: chunked
-Content-Type: application/json
-
-{
-  "id": "00850011881821",
-  "paymentOutput":
-  {
-"amountOfMoney":
-{
-  "amount": 100,
-  "currencyCode": "EUR"
-},
-"references": {
-  "merchantReference": "AcmeOrder0001",
-  "paymentReference": "0"
-},
-"paymentMethod": "card",
-"cardPaymentMethodSpecificOutput": {
-  "paymentProductId": 1,
-  "authorisationCode": "726747",
-  "card": {
-"cardNumber": "7977",
-"expiryDate": "1220"
-  },
-  "fraudResults": {
-"avsResult": "0",
-"cvvResult": "0",
-"fraudServiceResult": "no-advice"
-  }
-}
-  },
-  "status": "PENDING_APPROVAL",
-  "statusOutput": {
-"isCancellable": true,
-"statusCode": 600,
-"statusCodeChangeDateTime": 

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Get rid of return-a-reference option

2017-07-25 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367748 )

Change subject: Get rid of return-a-reference option
..

Get rid of return-a-reference option

We aren't using it any more, and we shouldn't start.

Bug: T171560
Change-Id: I28e310da3f86f8540a61b81ae466ff4c848bdca7
---
M Core/Configuration.php
M Core/DataStores/QueueWrapper.php
M Core/Listeners/ListenerBase.php
3 files changed, 15 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/48/367748/1

diff --git a/Core/Configuration.php b/Core/Configuration.php
index 3923c7a..bf59f2a 100644
--- a/Core/Configuration.php
+++ b/Core/Configuration.php
@@ -104,15 +104,12 @@
 * Obtain a value from the configuration. If the key does not exist 
this will throw an
 * exception.
 *
-* @param string $nodeParameter node to obtain. If this 
contains '/' it is assumed that the
+* @param string $path Parameter node to obtain. If this contains '/' 
it is assumed that the
 *value is contained under additional keys.
-* @param bool $returnRef If true will return a reference to the 
configuration node. This will
-*mean that any modifications to the node 
will be stored in RAM for the
-*duration of the session.
 * @return mixed
 * @throws ConfigurationKeyException
 */
-   public function ( $node, $returnRef = false ) {
+   public function val( $path ) {
/*
 * Magic "/" returns the entire configuration tree.
 *
@@ -122,34 +119,22 @@
 * Note: Never log this tree insecurely, it will contain 
processor
 * credentials and other sensitive information.
 */
-   if ( $node === '/' ) {
-   if ( $returnRef ) {
-   // TODO: Don't offer a return-by-reference.
-   $options = &$this->options;
-   } else {
-   $options = $this->options;
-   }
-   return $options;
+   if ( $path === '/' ) {
+   return $this->options;
}
 
-   $keys = explode( '/', $node );
+   $segments = explode( '/', $path );
 
-   $croot = & $this->options;
-   foreach ( $keys as $key ) {
-   if ( array_key_exists( $key, $croot ) ) {
-   $croot = & $croot[ $key ];
+   $currentNode = $this->options;
+   foreach ( $segments as $segment ) {
+   if ( array_key_exists( $segment, $currentNode ) ) {
+   $currentNode = $currentNode[$segment];
} else {
-   throw new ConfigurationKeyException( 
"Configuration key '{$node}' does not exist.", $node );
+   throw new ConfigurationKeyException( 
"Configuration key '{$path}' does not exist.", $path );
}
}
 
-   if ( $returnRef ) {
-   return $croot;
-   } else {
-   // Dereference the variable
-   $obj = $croot;
-   return $obj;
-   }
+   return $currentNode;
}
 
/**
@@ -208,7 +193,7 @@
 */
public function nodeExists( $node ) {
try {
-   $this->val( $node, true );
+   $this->val( $node );
return true;
} catch ( ConfigurationKeyException $ex ) {
return false;
diff --git a/Core/DataStores/QueueWrapper.php b/Core/DataStores/QueueWrapper.php
index ac504f6..537038d 100644
--- a/Core/DataStores/QueueWrapper.php
+++ b/Core/DataStores/QueueWrapper.php
@@ -30,7 +30,7 @@
 $key = "data-store/$queueName";
 
 // Examine the config node for a queue name
-$node = $config->val( $key, true );
+$node = $config->val( $key );
 if (
 empty( $node['constructor-parameters'] ) ||
 empty( $node['constructor-parameters'][0]['queue'] )
@@ -52,4 +52,4 @@
 return $config->object( $key );
 }
 
-}
\ No newline at end of file
+}
diff --git a/Core/Listeners/ListenerBase.php b/Core/Listeners/ListenerBase.php
index 2c32225..9d35737 100644
--- a/Core/Listeners/ListenerBase.php
+++ b/Core/Listeners/ListenerBase.php
@@ -49,7 +49,7 @@
 */
protected function validateRemoteIp() {
// Obtain whitelist
-   $whitelist = $this->c->val( 'security/ip-whitelist', true );
+   

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[deployment]: Get rid of return-a-reference option

2017-07-25 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367747 )

Change subject: Get rid of return-a-reference option
..

Get rid of return-a-reference option

We aren't using it any more, and we shouldn't start.

Bug: T171560
Change-Id: I28e310da3f86f8540a61b81ae466ff4c848bdca7
---
M Core/Configuration.php
M Core/DataStores/QueueWrapper.php
M Core/Listeners/ListenerBase.php
3 files changed, 15 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/47/367747/1

diff --git a/Core/Configuration.php b/Core/Configuration.php
index 3923c7a..bf59f2a 100644
--- a/Core/Configuration.php
+++ b/Core/Configuration.php
@@ -104,15 +104,12 @@
 * Obtain a value from the configuration. If the key does not exist 
this will throw an
 * exception.
 *
-* @param string $nodeParameter node to obtain. If this 
contains '/' it is assumed that the
+* @param string $path Parameter node to obtain. If this contains '/' 
it is assumed that the
 *value is contained under additional keys.
-* @param bool $returnRef If true will return a reference to the 
configuration node. This will
-*mean that any modifications to the node 
will be stored in RAM for the
-*duration of the session.
 * @return mixed
 * @throws ConfigurationKeyException
 */
-   public function ( $node, $returnRef = false ) {
+   public function val( $path ) {
/*
 * Magic "/" returns the entire configuration tree.
 *
@@ -122,34 +119,22 @@
 * Note: Never log this tree insecurely, it will contain 
processor
 * credentials and other sensitive information.
 */
-   if ( $node === '/' ) {
-   if ( $returnRef ) {
-   // TODO: Don't offer a return-by-reference.
-   $options = &$this->options;
-   } else {
-   $options = $this->options;
-   }
-   return $options;
+   if ( $path === '/' ) {
+   return $this->options;
}
 
-   $keys = explode( '/', $node );
+   $segments = explode( '/', $path );
 
-   $croot = & $this->options;
-   foreach ( $keys as $key ) {
-   if ( array_key_exists( $key, $croot ) ) {
-   $croot = & $croot[ $key ];
+   $currentNode = $this->options;
+   foreach ( $segments as $segment ) {
+   if ( array_key_exists( $segment, $currentNode ) ) {
+   $currentNode = $currentNode[$segment];
} else {
-   throw new ConfigurationKeyException( 
"Configuration key '{$node}' does not exist.", $node );
+   throw new ConfigurationKeyException( 
"Configuration key '{$path}' does not exist.", $path );
}
}
 
-   if ( $returnRef ) {
-   return $croot;
-   } else {
-   // Dereference the variable
-   $obj = $croot;
-   return $obj;
-   }
+   return $currentNode;
}
 
/**
@@ -208,7 +193,7 @@
 */
public function nodeExists( $node ) {
try {
-   $this->val( $node, true );
+   $this->val( $node );
return true;
} catch ( ConfigurationKeyException $ex ) {
return false;
diff --git a/Core/DataStores/QueueWrapper.php b/Core/DataStores/QueueWrapper.php
index ac504f6..537038d 100644
--- a/Core/DataStores/QueueWrapper.php
+++ b/Core/DataStores/QueueWrapper.php
@@ -30,7 +30,7 @@
 $key = "data-store/$queueName";
 
 // Examine the config node for a queue name
-$node = $config->val( $key, true );
+$node = $config->val( $key );
 if (
 empty( $node['constructor-parameters'] ) ||
 empty( $node['constructor-parameters'][0]['queue'] )
@@ -52,4 +52,4 @@
 return $config->object( $key );
 }
 
-}
\ No newline at end of file
+}
diff --git a/Core/Listeners/ListenerBase.php b/Core/Listeners/ListenerBase.php
index 2c32225..9d35737 100644
--- a/Core/Listeners/ListenerBase.php
+++ b/Core/Listeners/ListenerBase.php
@@ -49,7 +49,7 @@
 */
protected function validateRemoteIp() {
// Obtain whitelist
-   $whitelist = $this->c->val( 'security/ip-whitelist', true );
+   

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Fix PayPal EC recurring profile created messages

2017-07-24 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367624 )

Change subject: Fix PayPal EC recurring profile created messages
..

Fix PayPal EC recurring profile created messages

We should send currency and amount to Civi

Bug: T171546
Change-Id: I36dd1f05cbd66eac292b351b0809419c46e9dc09
---
M 
PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
M config/paypal/main.yaml
2 files changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/24/367624/1

diff --git 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
index ce73c80..0c7ad8e 100644
--- 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
+++ 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
@@ -15,5 +15,7 @@
   "start_date": 1492533928,
   "date": 1492533928,
   "gateway": "paypal_ec",
-  "recurring": "1"
+  "recurring": "1",
+  "gross": "140",
+  "currency": "JPY"
 }
diff --git a/config/paypal/main.yaml b/config/paypal/main.yaml
index cbd7aaf..005c889 100644
--- a/config/paypal/main.yaml
+++ b/config/paypal/main.yaml
@@ -28,6 +28,7 @@
 # FIXME This is only true for refund messages.  Where to represent?
 #txn_id: gateway_refund_id
 mc_currency: currency
+currency_code: currency
 # FIXME rename refund_type
 reason_code: type
 #test_ipn:  # signals test mode
@@ -46,6 +47,8 @@
 # FIXME this too
 address_name: supplemental_address_1
 gateway: gateway
+# NOTE: order matters, later ones override earlier ones
+amount_per_cycle: gross
 mc_gross: gross
 mc_amount3: gross
 amount3: gross

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36dd1f05cbd66eac292b351b0809419c46e9dc09
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-24 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367615 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: I4e8623f5f8e1894eb13290ea66966ed2191ef797
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/367615/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index f1b6131..f3b3f26 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit f1b6131da1f5fdd70a99bba26b75f439f3a7708d
+Subproject commit f3b3f26fe813ab4f0fd944272d4d4245b0342f89

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e8623f5f8e1894eb13290ea66966ed2191ef797
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Guard against undefined username/pw

2017-07-24 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367427 )

Change subject: Guard against undefined username/pw
..

Guard against undefined username/pw

Change-Id: I4a3e008f3a4f4798e568b05b043d09a187f449a0
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/27/367427/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
index 781382c..0c827ee 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
@@ -15,12 +15,10 @@
  */
 function civicrm_api3_omnimailing_load($params) {
   $values = array();
-  $mailings = civicrm_api3('Omnimailing', 'get', array(
-'mail_provider' => 'Silverpop',
+  $getParams = array(
+'mail_provider' => $params['mail_provider'],
 'start_date' => $params['start_date'],
 'end_date' => $params['end_date'],
-'username' => $params['username'],
-'password' => $params['password'],
 'return' => array(
   'external_identifier',
   'subject',
@@ -38,7 +36,12 @@
   'number_bounced',
   'number_sent',
 ),
-  ));
+  );
+  if (isset($params['username']) && isset($params['password'])) {
+$getParams['username'] = $params['username'];
+$getParams['password'] = $params['password'];
+  }
+  $mailings = civicrm_api3('Omnimailing', 'get', $getParams);
 
   foreach ($mailings['values']  as $mailing) {
 $campaign = civicrm_api3('Campaign', 'replace', array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a3e008f3a4f4798e568b05b043d09a187f449a0
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: WIP Tag refunds with correct paypal gateway

2017-07-21 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366976 )

Change subject: WIP Tag refunds with correct paypal gateway
..

WIP Tag refunds with correct paypal gateway

Wow, these are crappy ways to tell the difference! Really should have
put the gateway code in one of those tracking fields.

Bug: T171351
Change-Id: I49da156eb72933d44bb299d92072c551c02798ad
---
M PaymentProviders/PayPal/RefundMessage.php
M PaymentProviders/PayPal/Tests/Data/chargeback_settlement.json
A PaymentProviders/PayPal/Tests/Data/chargeback_settlement_ec.json
A PaymentProviders/PayPal/Tests/Data/chargeback_settlement_ec_transformed.json
A PaymentProviders/PayPal/Tests/Data/chargeback_settlement_transformed.json
M PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
6 files changed, 73 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/76/366976/1

diff --git a/PaymentProviders/PayPal/RefundMessage.php 
b/PaymentProviders/PayPal/RefundMessage.php
index 98227a6..6ce11e2 100644
--- a/PaymentProviders/PayPal/RefundMessage.php
+++ b/PaymentProviders/PayPal/RefundMessage.php
@@ -14,12 +14,21 @@
$message['type'] = 'refund';
}
 
-   // Express checkout puts a description in transaction_subject, 
Legacy puts a contribution
-   // tracking ID there. Chargebacks don't set the field at all.
-   if ( isset( $ipnMessage['transaction_subject'] ) && 
!is_numeric( $ipnMessage['transaction_subject'] ) ) {
-   $message['gateway'] = 'paypal_ec';
+   if ( $message['type'] === 'refund' ) {
+   // For refunds, express checkout puts a description in 
transaction_subject,
+   // but legacy puts a contribution tracking ID there.
+   if ( isset( $ipnMessage['transaction_subject'] ) && 
!is_numeric( $ipnMessage['transaction_subject'] ) ) {
+   $message['gateway'] = 'paypal_ec';
+   } else {
+   $message['gateway'] = 'paypal';
+   }
} else {
-   $message['gateway'] = 'paypal';
+   // For chargebacks, express checkout sets the 'invoice' 
field
+   if ( isset( $ipnMessage['invoice'] ) ) {
+   $message['gateway'] = 'paypal_ec';
+   } else {
+   $message['gateway'] = 'paypal';
+   }
}
 
}
diff --git a/PaymentProviders/PayPal/Tests/Data/chargeback_settlement.json 
b/PaymentProviders/PayPal/Tests/Data/chargeback_settlement.json
index d96bde3..bfdbb40 100644
--- a/PaymentProviders/PayPal/Tests/Data/chargeback_settlement.json
+++ b/PaymentProviders/PayPal/Tests/Data/chargeback_settlement.json
@@ -1,22 +1,18 @@
 {
-   "payment_date": "11:55:22 Sep 28, 2016 PDT",
+   "payment_date": "05:32:08 Jun 30, 2017 PDT",
+   "txn_id": "91N12345TB8654321",
"payment_status": "Completed",
-   "txn_type": "adjustment",
-   "parent_txn_id": "X",
-   "txn_id": "Y",
"mc_currency": "USD",
-   "reason_code": "chargeback_settlement",
-   "email": "a...@wikimedia.org",
-   "mc_gross": "-10.00",
-   "gateway": "paypal",
-   "notify_version": "3.8",
-   "payment_gross": "-10.00",
+   "parent_txn_id": "2JP12345X654321V",
+   "notify_version": 3.8,
+   "custom": 47470083,
+   "txn_type": "adjustment",
+   "charset": "UTF-8",
+   "mc_gross": -1.00,
+   "payment_gross": -1.00,
+   "payer_email": "recipi...@wikimedia.org",
+   "verify_sign": 
"AZfnGop49sf6bIkvk-UIIwAT3vE6AqUlokuReG4Znr85ICxgRDn1rO8s",
+   "payer_id": "AA987ASDFGHUW8",
"payer_status": "verified",
-   "payment_fee": "-20.00",
-   "source_name": "SmashPig",
-   "source_type": "listener",
-   "source_host": "secrethost",
-   "source_run_id": "12423",
-   "source_version": "",
-   "source_enqueued_time": "1476796977"
+   "ipn_track_id": "28eec9b3c7857"
 }
diff --git a/PaymentProviders/PayPal/Tests/Data/chargeback_settlement_ec.json 
b/PaymentProviders/PayPal/Tests/Data/chargeback_settlement_ec.json
new file mode 100644
index 000..daef6ad
--- /dev/null
+++ b/PaymentProviders/PayPal/Tests/Data/chargeback_settlement_ec.json
@@ -0,0 +1,19 @@
+{
+   "txn_type" : "adjustment",
+   "payment_date" : "06:25:22 Jul 10, 2017 PDT",
+   "payment_gross" : -5.00,
+   "mc_currency" : "USD",
+   "verify_sign" : 
"A21kmBLyRcQpDSjYvmswlm3ckjahAZ-SbzbHuzDA0wERKwHSrBlTr9cY",
+   "payer_status" : "verified",
+   "payer_email" : "recipi...@wikimedia.org",
+   "txn_id" : 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Log more and catch errors on duplicate invoice ID

2017-07-21 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366964 )

Change subject: Log more and catch errors on duplicate invoice ID
..

Log more and catch errors on duplicate invoice ID

TODO: tests

Bug: T171349
Change-Id: I0e71426e21fc3f642aab34aa3adfd304f01ec5ff
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 23 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/64/366964/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 025335e..a692882 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -443,21 +443,34 @@
   watchdog('wmf_civicrm', 'Contribution result from 
civicrm_contribution_add(): ' . print_r($contribution_result, TRUE), NULL, 
WATCHDOG_DEBUG);
 }
 catch (CiviCRM_API3_Exception $e) {
+watchdog( 'wmf_civicrm', 'Error inserting contribution: ' . 
$e->getMessage(), NULL, WATCHDOG_INFO );
 $duplicate = null;
-if (array_key_exists('invoice_id', $contribution)) {
-$invoice_id = $contribution['invoice_id'];
-$duplicate = civicrm_api3("Contribution", "getSingle", 
array("invoice_id" => $invoice_id));
+
+try {
+if ( array_key_exists( 'invoice_id', $contribution ) ) {
+watchdog( 'wmf_civicrm', 'Checking for duplicate on invoice ID 
' . $contribution['invoice_id'], NULL, WATCHDOG_INFO );
+$invoice_id = $contribution['invoice_id'];
+$duplicate = civicrm_api3( "Contribution", "getSingle", array( 
"invoice_id" => $invoice_id ) );
+}
+if ( $duplicate ) {
+$contribution['invoice_id'] = $contribution['invoice_id'] . 
'|dup-' . UtcDate::getUtcTimeStamp();
+watchdog( 'wmf_civicrm', 'Found duplicate invoice ID, changing 
this one to ' . $contribution['invoice_id'], NULL, WATCHDOG_INFO );
+$contribution_result = civicrm_api3( "Contribution", "Create", 
$contribution );
+watchdog( 'wmf_civicrm', 'Contribution result from 
civicrm_contribution_add(): ' . print_r( $contribution_result, TRUE ), NULL, 
WATCHDOG_DEBUG );
+$msg['contribution_tags'][] = 'DuplicateInvoiceId';
+} else {
+throw new WmfException(
+'INVALID_MESSAGE',
+'Cannot create contribution, civi error!',
+$e->getExtraParams()
+);
+}
 }
-if ($duplicate){
-$contribution['invoice_id'] = $contribution['invoice_id'] . 
'|dup-' . UtcDate::getUtcTimeStamp();
-$contribution_result = civicrm_api3("Contribution", "Create", 
$contribution);
-$msg['contribution_tags'][] = 'DuplicateInvoiceId';
-}
-else {
+catch ( CiviCRM_API3_Exception $eInner ) {
 throw new WmfException(
 'INVALID_MESSAGE',
 'Cannot create contribution, civi error!',
-$e->getExtraParams()
+$eInner->getExtraParams()
 );
 }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e71426e21fc3f642aab34aa3adfd304f01ec5ff
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Merge branch 'master' into deployment

2017-07-21 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366886 )

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

Merge branch 'master' into deployment

e32ca6e9a Localisation updates from https://translatewiki.net.
9491e7a7c Localisation updates from https://translatewiki.net.
c49eee5bc PayPal EC recurring: initial donation is async

Change-Id: I1d04f6df7b1e67773e017a72fed757282764e5be
---
D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
D 
tests/phpunit/includes/Responses/paypal_ec/CreateRecurringPaymentsProfile_Recurring-OK.testresponse
2 files changed, 0 insertions(+), 341 deletions(-)


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

diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
deleted file mode 100644
index 8f4e3dd..000
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ /dev/null
@@ -1,337 +0,0 @@
-<<< HEAD   (f1b613 Merge branch 'master' into deployment)
-===
-providerConfigurationOverride = 
PayPalTestConfiguration::get(
-   $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=EC-8US12345X1234567U',
-   $result->getRedirect(),
-   'Wrong redirect for PayPal EC payment setup'
-   );
-   $message = DonationQueue::instance()->pop( 'pending' );
-   $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'] . '.0',
-   '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 );
-   $gateway->setDummyGatewayResponseCode( 'OK' );
-   $result = $gateway->doPayment();
-   $gateway->logPending(); // GatewayPage or the API calls this 
for redirects
-   

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: PayPal EC recurring: initial donation is async

2017-07-21 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366870 )

Change subject: PayPal EC recurring: initial donation is async
..

PayPal EC recurring: initial donation is async

After we set up a subscription, the initial donation isn't immediately
charged. So we don't have a donation to send to the queue here, just
a subscr_id. We're stashing this in the pending queue now, for potential
use later.

Note that this is actually how all donations work with the legacy PayPal
integration - the payments cluster just sets things up and lets the IPN
listener handle the payment notifications and getting stuff into Civi.

Bug: T170478
Change-Id: I5f80586485d6a0cef53c5d19ce8913e61c258121
---
M paypal_gateway/express_checkout/paypal_express.adapter.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M 
tests/phpunit/includes/Responses/paypal_ec/CreateRecurringPaymentsProfile_Recurring-OK.testresponse
3 files changed, 11 insertions(+), 50 deletions(-)


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

diff --git a/paypal_gateway/express_checkout/paypal_express.adapter.php 
b/paypal_gateway/express_checkout/paypal_express.adapter.php
index 6eabf1b..5c6f0fd 100644
--- a/paypal_gateway/express_checkout/paypal_express.adapter.php
+++ b/paypal_gateway/express_checkout/paypal_express.adapter.php
@@ -343,8 +343,7 @@
'response' => array(
# FIXME: Make sure this gets passed as 
subscription_id in the message
'PROFILEID',
-   'PROFILESTATUS',
-   'TRANSACTIONID',
+   'PROFILESTATUS'
),
);
 
@@ -408,20 +407,16 @@
case 'CreateRecurringPaymentsProfile':
$this->checkResponseAck( $response );
 
-   // Grab the subscription ID and transaction ID 
for the
-   // initial charge.
+   // Grab the subscription ID
$this->addResponseData( $this->unstageKeys( 
$response ) );
-   // FIXME: Silly to store this thing in two 
places.
-   // The queue message functions look for it in 
transaction_response.
-   // We should make all the gateways store it in 
the standard
-   // data fields and get rid of the 
transaction_response field.
-   
$this->transaction_response->setGatewayTransactionId(
-   $this->getData_Unstaged_Escaped( 
'gateway_txn_id' )
-   );
 
-   // FIXME: Not a satisfying ending.  Parse the 
PROFILESTATUS
-   // response and sort it into complete or 
pending.
-   $this->finalizeInternalStatus( 
FinalStatus::COMPLETE );
+   // We've created a subscription, but we haven't 
got an initial
+   // payment yet, so we leave the details in the 
pending queue.
+   // The IPN listener will push the donation 
through to Civi when
+   // it gets notifications from PayPal.
+   // TODO: it would be nice to send the 
subscr_start message to
+   // the recurring queue here.
+   $this->finalizeInternalStatus( 
FinalStatus::PENDING );
$this->postProcessDonation();
break;
case 'SetExpressCheckout':
diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
index a2a3e63..b13db0c 100644
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
@@ -203,41 +203,7 @@
) );
 
$message = DonationQueue::instance()->pop( 'donations' );
-   $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'] . '.0',
-   

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: WIP use INITAMT for first payment

2017-07-19 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366472 )

Change subject: WIP use INITAMT for first payment
..

WIP use INITAMT for first payment

Trying to get the first payment created synchronously AND linked to
the subscription, but this still doesn't seem to do it. Not getting
any TRANSACTIONID in the profile creation return

Bug: T170478
Change-Id: I679ac81be488c297142149e9caf742e288e09b4d
---
M paypal_gateway/express_checkout/config/var_map.yaml
M paypal_gateway/express_checkout/paypal_express.adapter.php
2 files changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/paypal_gateway/express_checkout/config/var_map.yaml 
b/paypal_gateway/express_checkout/config/var_map.yaml
index 1b7032f..70cf536 100644
--- a/paypal_gateway/express_checkout/config/var_map.yaml
+++ b/paypal_gateway/express_checkout/config/var_map.yaml
@@ -1,4 +1,5 @@
 AMT: amount
+INITAMT: amount
 COUNTRYCODE: country
 CURRENCYCODE: currency
 EMAIL: email
diff --git a/paypal_gateway/express_checkout/paypal_express.adapter.php 
b/paypal_gateway/express_checkout/paypal_express.adapter.php
index 6eabf1b..1c69362 100644
--- a/paypal_gateway/express_checkout/paypal_express.adapter.php
+++ b/paypal_gateway/express_checkout/paypal_express.adapter.php
@@ -1,6 +1,7 @@
 getData_Unstaged_Escaped( 'recurring' ) ) {
// Set up recurring billing agreement.
$this->addRequestData( array(
-   'date' => time()
+   'date' => UtcDate::getUtcTimestamp( '+1 month' )
) );
$resultData = $this->do_transaction( 
'CreateRecurringPaymentsProfile' );
if ( !$resultData->getCommunicationStatus() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I679ac81be488c297142149e9caf742e288e09b4d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-19 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366306 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: I42a1e872ac9bf3627c831f6bd7b4057d47d13a64
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/06/366306/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index e523058..f1b6131 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit e5230588cd34ee368cb034492017992690d2379c
+Subproject commit f1b6131da1f5fdd70a99bba26b75f439f3a7708d

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42a1e872ac9bf3627c831f6bd7b4057d47d13a64
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: WIP getHostedCheckoutStatus

2017-07-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366167 )

Change subject: WIP getHostedCheckoutStatus
..

WIP getHostedCheckoutStatus

Bug: T163948
Change-Id: I3d11fba2d4c900752c6e35d2182f412d95735696
---
M ingenico_gateway/config/var_map.yaml
M ingenico_gateway/ingenico.adapter.php
2 files changed, 29 insertions(+), 2 deletions(-)


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

diff --git a/ingenico_gateway/config/var_map.yaml 
b/ingenico_gateway/config/var_map.yaml
index 79c88d8..fb21f7e 100644
--- a/ingenico_gateway/config/var_map.yaml
+++ b/ingenico_gateway/config/var_map.yaml
@@ -14,3 +14,5 @@
 surname: last_name
 merchantReference: order_id
 hostedCheckoutId: gateway_session_id
+id: gateway_txn_id
+statusCode: gateway_status
diff --git a/ingenico_gateway/ingenico.adapter.php 
b/ingenico_gateway/ingenico.adapter.php
index 127e5be..ec8031d 100644
--- a/ingenico_gateway/ingenico.adapter.php
+++ b/ingenico_gateway/ingenico.adapter.php
@@ -90,6 +90,18 @@
'hostedCheckoutId'
)
);
+
+   $this->transactions['getHostedCheckoutStatus'] = array(
+   'request' => array( 'hostedCheckoutId' ),
+   'response' => array(
+   'id',
+   'amount',
+   'currencyCode',
+   'avsResult',
+   'cvvResult',
+   'statusCode',
+   )
+   );
}
 
/**
@@ -107,6 +119,12 @@
);
}
 
+   /**
+* Make an API call to Ingenico Connect.
+*
+* @param array $data parameters for the transaction
+* @return bool whether the API call succeeded
+*/
public function curl_transaction( $data ) {
$email = $this->getData_Unstaged_Escaped( 'email' );
$this->logger->info( "Making API call for donor $email" );
@@ -120,11 +138,18 @@
switch( $this->getCurrentTransaction() ) {
case 'createHostedCheckout':
$result = $provider->createHostedPayment( $data 
);
-   $this->transaction_response->setRawResponse( 
json_encode( $result ) );
-   return true;
+   break;
+   case 'getHostedCheckoutStatus':
+   $result = $provider->getHostedPaymentStatus(
+   $data['hostedCheckoutId']
+   );
+   break;
default:
return false;
}
+
+   $this->transaction_response->setRawResponse( json_encode( 
$result ) );
+   return true;
}
 
public function getBasedir() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d11fba2d4c900752c6e35d2182f412d95735696
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Make getLogMatches static

2017-07-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366161 )

Change subject: Make getLogMatches static
..

Make getLogMatches static

This will let us re-use it in API tests

Change-Id: Idfaff167388e9f338270d17307baf9d6a4643b69
---
M tests/phpunit/Adapter/AstroPay/AstroPayTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
M tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/DonationDataTest.php
M tests/phpunit/DonationInterfaceTestCase.php
M tests/phpunit/GatewayPageTest.php
M tests/phpunit/IntegrationTest.php
M tests/phpunit/LoggingTest.php
10 files changed, 25 insertions(+), 29 deletions(-)


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

diff --git a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php 
b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
index 59e1185..24c5c54 100644
--- a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
+++ b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
@@ -158,7 +158,7 @@
$errors[0]->getErrorCode(),
'Wrong error for code "1"'
);
-   $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
+   $logged = self::getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
$this->assertNotEmpty( $logged );
}
 
@@ -212,7 +212,7 @@
'Should be an error in PaymentResult'
);
 
-   $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
+   $logged = self::getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
$this->assertNotEmpty( $logged );
// TODO: Should this really be a refresh, or should we finalize 
to failed here?
$this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
diff --git 
a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
index 8053400..86d457b 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
@@ -151,7 +151,7 @@
return $error->getErrorCode() == '101';
};
$this->assertNotEmpty( array_filter( $errors, $finder ), 
'Orphan adapter needs error 101 to consider it rectified' );
-   $loglines = $this->getLogMatches( LogLevel::INFO, "/Got error 
code $code, not retrying to avoid MasterCard fines./" );
+   $loglines = self::getLogMatches( LogLevel::INFO, "/Got error 
code $code, not retrying to avoid MasterCard fines./" );
$this->assertNotEmpty( $loglines, "GC Error $code is not 
generating the expected payments log error" );
}
 
diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
index 972d8b0..ee8e3d3 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
@@ -423,18 +423,18 @@
$gateway = $this->getFreshGatewayObject( $init );
$gateway->setDummyGatewayResponseCode( '2150' );
$gateway->do_transaction( 'GET_ORDERSTATUS' );
-   $loglines = $this->getLogMatches( LogLevel::ERROR, 
'/Investigation required!/' );
+   $loglines = self::getLogMatches( LogLevel::ERROR, 
'/Investigation required!/' );
$this->assertNotEmpty( $loglines, 'GC Error 2150 is not 
generating the expected payments log error' );
 
//Reset logs
-   $this->testLogger->messages = array();
+   DonationLoggerFactory::$overrideLogger->messages = array();
 
//Most irritating version of 20001000 - They failed to enter an 
expiration date on GC's form. This should log some specific info, but not an 
error.
$gateway = $this->getFreshGatewayObject( $init );
$gateway->setDummyGatewayResponseCode( '20001000-expiry' );
$gateway->do_transaction( 'GET_ORDERSTATUS' );
$this->verifyNoLogErrors();
-   $loglines = $this->getLogMatches( LogLevel::INFO, 
'/processResponse:.*EXPIRYDATE/' );
+   $loglines = self::getLogMatches( LogLevel::INFO, 
'/processResponse:.*EXPIRYDATE/' );
$this->assertNotEmpty( $loglines, 'GC Error 20001000-expiry is 
not generating the expected payments log line' );
 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Standardize pending queue message and logging in API

2017-07-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366159 )

Change subject: Standardize pending queue message and logging in API
..

Standardize pending queue message and logging in API

Needed for the new PayPal EC redirect flow, as the last change
removed pending messages and logging.

This patch makes the donate API call the same logPending method that
the GatewayPage class calls when the payment result is a redirect.

This patch also adds Adyen API tests

TODO: test invalid submissions, look at logged messages.

Bug: T167923
Change-Id: I4ac8eb79fa8ab697eed272ef14a5fd6bf412dc55
---
M adyen_gateway/adyen.adapter.php
M gateway_common/donation.api.php
M globalcollect_gateway/globalcollect.adapter.php
A tests/phpunit/Adapter/Adyen/AdyenApiTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
M tests/phpunit/Adapter/PayPal/PayPalApiTest.php
M tests/phpunit/DonationInterfaceApiTestCase.php
7 files changed, 155 insertions(+), 24 deletions(-)


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

diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php
index 47896f2..4542a24 100644
--- a/adyen_gateway/adyen.adapter.php
+++ b/adyen_gateway/adyen.adapter.php
@@ -165,7 +165,7 @@
if ( !$this->validatedOK() ){
//If the data didn't validate okay, prevent all data 
transmissions.
$response = $this->getFailedValidationResponse();
-   $this->logger->info( "Failed Validation. Aborting 
$transaction " . print_r( $this->errors, true ) );
+   $this->logger->info( "Failed Validation. Aborting 
$transaction " . print_r( $this->errorState, true ) );
return $response;
}
$this->transaction_response = new PaymentTransactionResponse();
@@ -196,10 +196,9 @@
'FORMACTION' => $formaction,
'gateway_params' => 
$requestParams,
) );
-   $this->logger->info( "launching 
external iframe request: " . print_r( $requestParams, true )
+   $this->logger->info(
+   "launching external iframe 
request: " . print_r( $requestParams, true )
);
-   $this->logPaymentDetails();
-   $this->sendPendingMessage();
break;
}
}
diff --git a/gateway_common/donation.api.php b/gateway_common/donation.api.php
index 7ad1075..107f62c 100644
--- a/gateway_common/donation.api.php
+++ b/gateway_common/donation.api.php
@@ -62,6 +62,7 @@
$outputResult['status'] = 
$result->getCommunicationStatus();
}
 
+   $errors = $result->getErrors();
$data = $result->getData();
if ( !empty( $data ) ) {
if ( array_key_exists( 'PAYMENT', $data )
@@ -71,6 +72,9 @@
}
if ( array_key_exists( 'FORMACTION', $data ) ) {
$outputResult['formaction'] = 
$data['FORMACTION'];
+   if ( empty( $errors ) ) {
+   $gatewayObj->logPending();
+   }
}
if ( array_key_exists( 'gateway_params', $data ) ) {
$outputResult['gateway_params'] = 
$data['gateway_params'];
@@ -82,7 +86,6 @@
$outputResult['orderid'] = $data['ORDERID'];
}
}
-   $errors = $result->getErrors();
if ( !empty( $errors ) ) {
$outputResult['errors'] = $this->serializeErrors( 
$errors, $gatewayObj );
$this->getResult()->setIndexedTagName( 
$outputResult['errors'], 'error' );
diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index c3b94d8..f509250 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -1691,24 +1691,6 @@
}
}
 
-   /**
-* post-process function for INSERT_ORDERWITHPAYMENT.
-* This gets called by executeIfFunctionExists, in do_transaction.
-*/
-   protected function post_process_insert_orderwithpayment(){
-   //yeah, we absolutely want to do this for every one of these.
-   if ( $this->getTransactionStatus() === true ) {
-   

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Move message cleaning function to base test

2017-07-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366158 )

Change subject: Move message cleaning function to base test
..

Move message cleaning function to base test

Change-Id: Ib7657a72081d35df22feddfffe7a24de3e290230
---
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/DonationInterfaceTestCase.php
3 files changed, 14 insertions(+), 16 deletions(-)


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

diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
index 285495d..0247286 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
@@ -29,11 +29,10 @@
$this->assertNotEmpty( $match, 'GC API not setting proper 
return url' );
$message = DonationQueue::instance()->pop( 'pending' );
$this->assertNotNull( $message, 'Not sending a message to the 
pending queue' );
-   SourceFields::removeFromMessage( $message );
+   DonationInterfaceTestCase::unsetVariableFields( $message );
$expected = array(
'gateway_txn_id' => '626113410',
'response' => 'Response Status: 20',
-   'gateway_account' => 'test',
'fee' => 0,
'utm_source' => '..cc',
'language' => 'en',
diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
index 35b9b6a..7ea9f12 100644
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
@@ -31,15 +31,6 @@
) );
}
 
-   protected function unsetVariableFields( &$message ) {
-   $fields = array(
-   'date', 'source_enqueued_time', 'source_host', 
'source_run_id', 'source_version', 'gateway_account'
-   );
-   foreach ( $fields as $field ) {
-   unset( $message[$field] );
-   }
-   }
-
function testPaymentSetup() {
$init = array(
'amount' => 1.55,
@@ -62,7 +53,7 @@
);
$message = DonationQueue::instance()->pop( 'pending' );
$this->assertNotEmpty( $message, 'Missing pending message' );
-   $this->unsetVariableFields( $message );
+   self::unsetVariableFields( $message );
$expected = array(
'country' => 'US',
'fee' => '0',
@@ -110,7 +101,7 @@
 
$message = DonationQueue::instance()->pop( 'donations' );
$this->assertNotNull( $message, 'Not sending a message to the 
donations queue' );
-   $this->unsetVariableFields( $message );
+   self::unsetVariableFields( $message );
$expected = array (
'contribution_tracking_id' => 
$init['contribution_tracking_id'],
'country' => 'US',
@@ -160,8 +151,8 @@
 
$message = DonationQueue::instance()->pop( 'donations' );
$this->assertNotNull( $message, 'Not sending a message to the 
donations queue' );
-   $this->unsetVariableFields( $message );
-   $expected = array (
+   self::unsetVariableFields( $message );
+   $expected = array(
'contribution_tracking_id' => 
$init['contribution_tracking_id'],
'country' => 'US',
'fee' => '0',
diff --git a/tests/phpunit/DonationInterfaceTestCase.php 
b/tests/phpunit/DonationInterfaceTestCase.php
index c3548ae..a418960 100644
--- a/tests/phpunit/DonationInterfaceTestCase.php
+++ b/tests/phpunit/DonationInterfaceTestCase.php
@@ -19,7 +19,6 @@
 use SmashPig\Core\Context;
 use SmashPig\Tests\TestingContext;
 use SmashPig\Tests\TestingGlobalConfiguration;
-use SmashPig\Tests\TestingProviderConfiguration;
 use Wikimedia\TestingAccessWrapper;
 
 /**
@@ -710,4 +709,13 @@
}
return $innerHTML;
}
+
+   public static function unsetVariableFields( &$message ) {
+   $fields = array(
+   'date', 'source_enqueued_time', 'source_host', 
'source_run_id', 'source_version', 'gateway_account'
+   );
+   foreach ( $fields as $field ) {
+   unset( $message[$field] );
+   }
+   }
 }

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

Gerrit-MessageType: newchange

[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366014 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: I81b796bc0c4f8de303a4d546391ffdb2c2695747
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/14/366014/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index 9bcbec8..e523058 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit 9bcbec8bbdc3845012542ab788d4b7a9313ef8e7
+Subproject commit e5230588cd34ee368cb034492017992690d2379c

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81b796bc0c4f8de303a4d546391ffdb2c2695747
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Merge branch 'master' into deployment

2017-07-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366013 )

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

Merge branch 'master' into deployment

9305f7662 Localisation updates from https://translatewiki.net.
b6eb7d3c6 Localisation updates from https://translatewiki.net.
153e676ff PayPal EC: use ajax to get redirect URL
a4534c043 Localisation updates from https://translatewiki.net.
c3d44f0d9 Common setup for donation API tests, add one for PayPal EC
0755c651e Localisation updates from https://translatewiki.net.
7f179918c Leave form disabled while redirecting to PayPal EC

Change-Id: Iaa6e901006f65ad1f5b0aa8d02a89e0552a7d0fc
---
D tests/phpunit/Adapter/Amazon/AmazonApiTest.php
D tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
D tests/phpunit/Adapter/PayPal/PayPalApiTest.php
D tests/phpunit/DonationInterfaceApiTestCase.php
D tests/phpunit/includes/test_gateway/TestingGlobalCollectAdapter.php
5 files changed, 0 insertions(+), 314 deletions(-)


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

diff --git a/tests/phpunit/Adapter/Amazon/AmazonApiTest.php 
b/tests/phpunit/Adapter/Amazon/AmazonApiTest.php
deleted file mode 100644
index 2717faa..000
--- a/tests/phpunit/Adapter/Amazon/AmazonApiTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<<< HEAD   (9bcbec Merge branch 'master' into deployment)
-===
- '1.55',
-   'currency' => 'USD',
-   'recurring' => '0',
-   'wmf_token' => 'e601502632e5e51dc2a17a0045162272+\\',
-   'orderReferenceId' => mt_rand( 0, 1000 ),
-   'action' => 'di_amazon_bill',
-   );
-   $session = array(
-   'Donor' => array(
-   'amount' => '1.55',
-   'currency' => 'USD',
-   'recurring' => '0',
-   'contribution_tracking_id' => mt_rand( 0, 
1000 ),
-   'country' => 'US',
-   ),
-   'amazonEditToken' => 'kjaskdjahsdkjsad',
-   );
-   $apiResult = $this->doApiRequest( $params, $session );
-   $redirect = $apiResult[0]['redirect'];
-   $this->assertEquals( 
'https://wikimediafoundation.org/wiki/Thank_You/en?country=US', $redirect );
-   $mockClient = TestingAmazonAdapter::$mockClient;
-   $setOrderReferenceDetailsArgs = 
$mockClient->calls['setOrderReferenceDetails'][0];
-   $oid = $session['Donor']['contribution_tracking_id'] . '-0';
-   $this->assertEquals( $oid, 
$setOrderReferenceDetailsArgs['seller_order_id'], 'Did not set order id on 
order reference' );
-   $this->assertEquals( $params['amount'], 
$setOrderReferenceDetailsArgs['amount'], 'Did not set amount on order 
reference' );
-
-   $this->assertEquals( $params['currency'], 
$setOrderReferenceDetailsArgs['currency_code'], 'Did not set currency code on 
order reference' );
-   $message = DonationQueue::instance()->pop( 'donations' );
-   $this->assertNotNull( $message, 'Not sending a message to the 
donations queue' );
-   $this->assertEquals( 'S01-0391295-0674065-C095112', 
$message['gateway_txn_id'], 'Queue message has wrong txn ID' );
-   }
-}
->>> BRANCH (7f1799 Leave form disabled while redirecting to PayPal EC)
diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
deleted file mode 100644
index 84a18a1..000
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<<< HEAD   (9bcbec Merge branch 'master' into deployment)
-===
-doApiRequest( $init );
-   $result = $apiResult[0]['result'];
-   $orderId = $result['orderid'];
-
-   $this->assertEquals( 'url_placeholder', $result['formaction'], 
'GC API not setting formaction' );
-   $this->assertTrue( is_numeric( $orderId ), 'GC API not setting 
numeric order ID' );
-   $this->assertTrue( $result['status'], 'GC API result status 
should be true' );
-   preg_match( 
"/Special:GlobalCollectGatewayResult\?order_id={$orderId}\$/", 
$result['returnurl'], $match );
-   $this->assertNotEmpty( $match, 'GC API not setting proper 
return url' );
-   $message = DonationQueue::instance()->pop( 'pending' );
-   $this->assertNotNull( $message, 'Not sending a message to the 
pending queue' );
-   SourceFields::removeFromMessage( $message );
-   $expected = array(
-   'gateway_txn_id' => '626113410',
-   'response' => 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Disable form while redirecting to PayPal

2017-07-17 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365648 )

Change subject: Disable form while redirecting to PayPal
..

Disable form while redirecting to PayPal

Bug: T167923
Change-Id: I92bf95118eb2f97be5045596c7d3ea9bcba39250
---
M modules/js/ext.donationInterface.forms.js
M paypal_gateway/express_checkout/forms/js/paypal.js
2 files changed, 7 insertions(+), 1 deletion(-)


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

diff --git a/modules/js/ext.donationInterface.forms.js 
b/modules/js/ext.donationInterface.forms.js
index dd0a103..5b72dd3 100644
--- a/modules/js/ext.donationInterface.forms.js
+++ b/modules/js/ext.donationInterface.forms.js
@@ -31,7 +31,7 @@
/**
 * Call the generic donation API and handle errors or execute a callback
 *
-* @param {function()} successCallback will be called with response's 
'result' property
+* @param {function(result)} successCallback will be called with 
response's 'result' property
 */
function callDonateApi( successCallback ) {
di.forms.disable();
diff --git a/paypal_gateway/express_checkout/forms/js/paypal.js 
b/paypal_gateway/express_checkout/forms/js/paypal.js
index 9f41454..fe61fbe 100644
--- a/paypal_gateway/express_checkout/forms/js/paypal.js
+++ b/paypal_gateway/express_checkout/forms/js/paypal.js
@@ -3,6 +3,12 @@
 
function redirect( result ) {
top.location.href = result.formaction;
+   window.setTimeout( function() {
+   // Needs to be in this setTimeout because callDonateApi 
has an
+   // 'enable()' call in the AJAX 'complete' callback. We 
want donors
+   // to see our loading spinner while redirecting to 
PayPal.
+   di.forms.disable();
+   }, 50 );
}
 
di.forms.submit = function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92bf95118eb2f97be5045596c7d3ea9bcba39250
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Common setup for donation API tests, add one for PayPal EC

2017-07-17 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365630 )

Change subject: Common setup for donation API tests, add one for PayPal EC
..

Common setup for donation API tests, add one for PayPal EC

Bug: T167923
Change-Id: I2664e4c3747be462b396b715b795c0506f3d3d47
---
M DonationInterface.class.php
M tests/phpunit/Adapter/Amazon/AmazonApiTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
A tests/phpunit/Adapter/PayPal/PayPalApiTest.php
A tests/phpunit/DonationInterfaceApiTestCase.php
M tests/phpunit/includes/test_gateway/TestingGlobalCollectAdapter.php
6 files changed, 109 insertions(+), 27 deletions(-)


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

diff --git a/DonationInterface.class.php b/DonationInterface.class.php
index 2f2f7db..2a0f3e4 100644
--- a/DonationInterface.class.php
+++ b/DonationInterface.class.php
@@ -68,6 +68,7 @@
$files[] = $testDir . 'AllTests.php';
 
$wgAutoloadClasses['DonationInterfaceTestCase'] = $testDir . 
'DonationInterfaceTestCase.php';
+   $wgAutoloadClasses['DonationInterfaceApiTestCase'] = $testDir . 
'DonationInterfaceApiTestCase.php';
$wgAutoloadClasses['MockAmazonClient'] = $testDir . 
'includes/MockAmazonClient.php';
$wgAutoloadClasses['MockAmazonResponse'] = $testDir . 
'includes/MockAmazonResponse.php';
$wgAutoloadClasses['TestingQueue'] = $testDir . 
'includes/TestingQueue.php';
diff --git a/tests/phpunit/Adapter/Amazon/AmazonApiTest.php 
b/tests/phpunit/Adapter/Amazon/AmazonApiTest.php
index 8ee1c83..4f5c0ab 100644
--- a/tests/phpunit/Adapter/Amazon/AmazonApiTest.php
+++ b/tests/phpunit/Adapter/Amazon/AmazonApiTest.php
@@ -4,20 +4,15 @@
 
 /**
  * @group Amazon
+ * @group DonationInterface
+ * @group DonationInterfaceApi
+ * @group Fundraising
  * @group medium
  */
-class AmazonApiTest extends ApiTestCase {
+class AmazonApiTest extends DonationInterfaceApiTestCase {
public function setUp() {
parent::setUp();
-   $config = TestingGlobalConfiguration::create();
-   TestingContext::init( $config );
TestingAmazonAdapter::$mockClient = new MockAmazonClient();
-   $this->setMwGlobals( array(
-   'wgDonationInterfaceEnableQueue' => true,
-   'wgDonationInterfaceDefaultQueueServer' => array(
-   'type' => 'TestingQueue',
-   ),
-   ) );
}
 
public function tearDown() {
diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
index f3738eb..285495d 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
@@ -1,23 +1,15 @@
 assertTrue( $result['status'], 'GC API result status 
should be true' );
preg_match( 
"/Special:GlobalCollectGatewayResult\?order_id={$orderId}\$/", 
$result['returnurl'], $match );
$this->assertNotEmpty( $match, 'GC API not setting proper 
return url' );
+   $message = DonationQueue::instance()->pop( 'pending' );
+   $this->assertNotNull( $message, 'Not sending a message to the 
pending queue' );
+   SourceFields::removeFromMessage( $message );
+   $expected = array(
+   'gateway_txn_id' => '626113410',
+   'response' => 'Response Status: 20',
+   'gateway_account' => 'test',
+   'fee' => 0,
+   'utm_source' => '..cc',
+   'language' => 'en',
+   'email' => 'g...@innocent.com',
+   'first_name' => 'Firstname',
+   'last_name' => 'Surname',
+   'country' => 'US',
+   'gateway' => 'globalcollect',
+   'order_id' => '626113410',
+   'recurring' => '',
+   'payment_method' => 'cc',
+   'payment_submethod' => '',
+   'currency' => 'USD',
+   'gross' => '1.55',
+   'user_ip' => '127.0.0.1',
+   'street_address' => '123 Fake Street',
+   'city' => 'San Francisco',
+   'state_province' => 'CA',
+   'postal_code' => '94105'
+   );
+   $this->assertArraySubset( $expected, $message );
}
 }
diff --git a/tests/phpunit/Adapter/PayPal/PayPalApiTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalApiTest.php
new file mode 100644
index 000..86d76ed
--- /dev/null
+++ 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Use new SmashPig split configuration

2017-07-14 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365069 )

Change subject: Use new SmashPig split configuration
..

Use new SmashPig split configuration

Change-Id: I26d89875f7fbd1adf9d2c51de973f99761200032
---
M composer.lock
M sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc
M sites/all/modules/queue2civicrm/banner_history/banner_history.module
M sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
M sites/all/modules/queue2civicrm/queue2civicrm.module
M sites/all/modules/queue2civicrm/recurring/recurring.module
M sites/all/modules/queue2civicrm/refund/wmf_refund_qc.module
M sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
M sites/all/modules/queue2civicrm/tests/phpunit/BannerHistoryTest.php
M sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
M sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
M sites/all/modules/queue2civicrm/tests/phpunit/RecurringQueueTest.php
M sites/all/modules/queue2civicrm/tests/phpunit/RefundQueueTest.php
M sites/all/modules/queue2civicrm/unsubscribe/wmf_unsubscribe_qc.module
M sites/all/modules/wmf_audit/ingenico/orphan_rectify.drush.inc
M sites/all/modules/wmf_audit/tests/AmazonAuditTest.php
M sites/all/modules/wmf_audit/wmf_audit.module
M sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
M sites/all/modules/wmf_common/wmf_common.module
19 files changed, 90 insertions(+), 75 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/69/365069/1

diff --git a/composer.lock b/composer.lock
index 556e316..ff69240 100644
--- a/composer.lock
+++ b/composer.lock
@@ -88,7 +88,7 @@
 "payment",
 "payments"
 ],
-"time": "2016-02-17 00:53:20"
+"time": "2016-02-17T00:44:20+00:00"
 },
 {
 "name": "clio/clio",
@@ -198,7 +198,7 @@
 "queue",
 "transaction"
 ],
-"time": "2017-04-17 14:11:55"
+"time": "2017-04-17T14:11:55+00:00"
 },
 {
 "name": "cogpowered/finediff",
@@ -250,6 +250,48 @@
 "text"
 ],
 "time": "2014-05-19T10:25:02+00:00"
+},
+{
+"name": "corneltek/getoptionkit",
+"version": "2.6.0",
+"source": {
+"type": "git",
+"url": "https://github.com/c9s/GetOptionKit.git;,
+"reference": "995607ddf4fc90ebdb4a7d58fe972d581ad8495f"
+},
+"dist": {
+"type": "zip",
+"url": 
"https://api.github.com/repos/c9s/GetOptionKit/zipball/995607ddf4fc90ebdb4a7d58fe972d581ad8495f;,
+"reference": "995607ddf4fc90ebdb4a7d58fe972d581ad8495f",
+"shasum": ""
+},
+"require": {
+"php": ">=5.3.0"
+},
+"type": "library",
+"extra": {
+"branch-alias": {
+"dev-master": "2.6.x-dev"
+}
+},
+"autoload": {
+"psr-4": {
+"GetOptionKit\\": "src/"
+}
+},
+"notification-url": "https://packagist.org/downloads/;,
+"license": [
+"MIT"
+],
+"authors": [
+{
+"name": "Yo-An Lin",
+"email": "yoanli...@gmail.com"
+}
+],
+"description": "Powerful command-line option toolkit",
+"homepage": "http://github.com/c9s/GetOptionKit;,
+"time": "2017-06-30T14:54:48+00:00"
 },
 {
 "name": "guzzlehttp/guzzle",
@@ -1791,7 +1833,7 @@
 "GPL-2.0"
 ],
 "description": "Wikimedia Foundation payment processing library",
-"time": "2017-04-13 00:15:19"
+"time": "2017-04-13T00:15:19+00:00"
 },
 {
 "name": "wikimedia/omnimail-silverpop",
@@ -1846,11 +1888,12 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "3b81aba0abe619bed038c8d31c7f36cae5b041cb"
+"reference": "756898ef42efd9e6ff316823e4b03b6a90c78589"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
 "coderkungfu/php-queue": "dev-master",
+"corneltek/getoptionkit": "^2.5",
 "php": ">=5.3.3",
 "phpmailer/phpmailer": "^5.2",
 "predis/predis": "^1.1",
@@ -1897,7 +1940,7 @@
 "donations",
 "payments"
 ],
- 

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' into deployment

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364913 )

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

Merge branch 'master' into deployment

And update CiviCRM pointer to get primary address import

542da931c Fix thank you mailer watchdog message
b0f16c817 Speed up thank you query

Change-Id: Icf9d4a7ce26659fbf5a8f3401371d242f8b899ea
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/13/364913/1

diff --git a/civicrm b/civicrm
index 7ff5e80..1620e86 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 7ff5e80169a112bd5b68004ff255b1cf326ebdc2
+Subproject commit 1620e8653ff8244930c8cc5a36eba8f51033bc5a

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf9d4a7ce26659fbf5a8f3401371d242f8b899ea
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: PayPal EC recurring: initial charge is part of subscription

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364903 )

Change subject: PayPal EC recurring: initial charge is part of subscription
..

PayPal EC recurring: initial charge is part of subscription

We were originally doing a kludgey workaround that had an initial
standalone payment, then a subscription starting in a month. That
made it really hard for Donor Services to find subscriptions.

Bug: T170478
Change-Id: Ifebc76e0e501303381ff8c73000d02e36cdb796c
---
M paypal_gateway/express_checkout/config/var_map.yaml
M paypal_gateway/express_checkout/paypal_express.adapter.php
A 
tests/phpunit/includes/Responses/paypal_ec/CreateRecurringPaymentsProfile_10486.testresponse
M 
tests/phpunit/includes/Responses/paypal_ec/CreateRecurringPaymentsProfile_Recurring-OK.testresponse
4 files changed, 23 insertions(+), 29 deletions(-)


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

diff --git a/paypal_gateway/express_checkout/config/var_map.yaml 
b/paypal_gateway/express_checkout/config/var_map.yaml
index 40e9b9f..1b7032f 100644
--- a/paypal_gateway/express_checkout/config/var_map.yaml
+++ b/paypal_gateway/express_checkout/config/var_map.yaml
@@ -24,6 +24,7 @@
 PROFILEID: subscr_id
 PROFILEREFERENCE: contribution_tracking_id
 PROFILESTARTDATE: date
+TRANSACTIONID: gateway_txn_id
 # TODO: discuss whether to capture
 #PHONENUM: phone
 RETURNURL: returnto
diff --git a/paypal_gateway/express_checkout/paypal_express.adapter.php 
b/paypal_gateway/express_checkout/paypal_express.adapter.php
index c614407..527c093 100644
--- a/paypal_gateway/express_checkout/paypal_express.adapter.php
+++ b/paypal_gateway/express_checkout/paypal_express.adapter.php
@@ -200,7 +200,7 @@
'NOSHIPPING' => 1,
'L_BILLINGTYPE0' => 'RecurringPayments',
// FIXME: Sad!  The thank-you message would be 
perfect here,
-   // but it seems the exlamation mark is not 
supported, even when
+   // but it seems the exclamation mark is not 
supported, even when
// urlencoded properly.
//'L_BILLINGAGREEMENTDESCRIPTION0' => 
WmfFramework::formatMessage( 
'donate_interface-donate-error-thank-you-for-your-support' ),
'L_BILLINGAGREEMENTDESCRIPTION0' => 
WmfFramework::formatMessage( 'donate_interface-monthly-donation-description' ),
@@ -408,8 +408,12 @@
case 'CreateRecurringPaymentsProfile':
$this->checkResponseAck( $response );
 
-   // Grab the subscription ID.
+   // Grab the subscription ID and transaction ID 
for the
+   // initial charge.
$this->addResponseData( $this->unstageKeys( 
$response ) );
+   // FIXME: Silly.
+   
$this->transaction_response->setGatewayTransactionId(
+   $this->getData_Unstaged_Escaped( 
'gateway_txn_id' ) );
 
// FIXME: Not a satisfying ending.  Parse the 
PROFILESTATUS
// response and sort it into complete or 
pending.
@@ -446,15 +450,9 @@
$this->getData_Unstaged_Escaped( 
'gateway_txn_id' ) );
$status = $this->findCodeAction( 
'DoExpressCheckoutPayment',
'PAYMENTINFO_0_ERRORCODE', 
$response['PAYMENTINFO_0_ERRORCODE'] );
-   // For recurring payments, we don't want to 
finalize or send the queue
-   // message just yet
-   if (
-   $status === FinalStatus::FAILED ||
-   !$this->getData_Unstaged_Escaped( 
'recurring' )
-   ) {
-   $this->finalizeInternalStatus( $status 
);
-   $this->postProcessDonation();
-   }
+
+   $this->finalizeInternalStatus( $status );
+   $this->postProcessDonation();
break;
}
 
@@ -484,7 +482,8 @@
case '10486':
// Donor's first funding method 
failed, but they might have another

$this->transaction_response->setRedirect(
-   
$this->account_config['RedirectURL'] . $response['TOKEN']
+

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: PayPal EC: use ajax to get redirect URL

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364825 )

Change subject: PayPal EC: use ajax to get redirect URL
..

PayPal EC: use ajax to get redirect URL

Act like Adyen or Ingenico, showing the form and using and AJAX call to do
the server-to-server setup in the background and return a formaction URL.

Slightly different from Adyen and Ingenico, this will submit instantly and
redirect instead of showing an iframe.

This might solve our dead session errors.

Bug: T167923
Change-Id: Ifad296dbd09dc6935ecd8799278e411ef3b14548
---
M extension.json
M gateway_common/donation.api.php
A paypal_gateway/express_checkout/forms/js/paypal.js
M paypal_gateway/express_checkout/paypal_express.adapter.php
M paypal_gateway/express_checkout/paypal_express_gateway.body.php
5 files changed, 25 insertions(+), 11 deletions(-)


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

diff --git a/extension.json b/extension.json
index d6367ad..ca62edd 100644
--- a/extension.json
+++ b/extension.json
@@ -203,6 +203,10 @@
"scripts": "globalcollect_gateway/forms/js/ingenico.js",
"dependencies": "ext.donationInterface.forms"
},
+   "ext.donationinterface.paypal.scripts": {
+   "scripts": 
"paypal_gateway/express_checkout/forms/js/paypal.js",
+   "dependencies": "ext.donationInterface.forms"
+   },
"ext.donationinterface.amazon.styles": {
"styles": "amazon_gateway/amazon.css"
},
diff --git a/gateway_common/donation.api.php b/gateway_common/donation.api.php
index 5d38d3c..7ad1075 100644
--- a/gateway_common/donation.api.php
+++ b/gateway_common/donation.api.php
@@ -48,6 +48,9 @@
}
} elseif ( $this->gateway == 'adyen' ) {
$result = $gatewayObj->do_transaction( 'donate' );
+   } elseif ( $this->gateway === 'paypal_ec' ) {
+   $gatewayObj->doPayment();
+   $result = $gatewayObj->getTransactionResponse();
}
 
// $normalizedData = $gatewayObj->getData_Unstaged_Escaped();
diff --git a/paypal_gateway/express_checkout/forms/js/paypal.js 
b/paypal_gateway/express_checkout/forms/js/paypal.js
new file mode 100644
index 000..9f41454
--- /dev/null
+++ b/paypal_gateway/express_checkout/forms/js/paypal.js
@@ -0,0 +1,12 @@
+( function ( $, mw ) {
+   var di = mw.donationInterface;
+
+   function redirect( result ) {
+   top.location.href = result.formaction;
+   }
+
+   di.forms.submit = function () {
+   di.forms.callDonateApi( redirect );
+   };
+   di.forms.submit();
+} )( jQuery, mediaWiki );
diff --git a/paypal_gateway/express_checkout/paypal_express.adapter.php 
b/paypal_gateway/express_checkout/paypal_express.adapter.php
index c614407..f40e39b 100644
--- a/paypal_gateway/express_checkout/paypal_express.adapter.php
+++ b/paypal_gateway/express_checkout/paypal_express.adapter.php
@@ -420,8 +420,11 @@
case 'SetExpressCheckout_recurring':
$this->checkResponseAck( $response );
$this->addResponseData( $this->unstageKeys( 
$response ) );
-   $this->transaction_response->setRedirect(
-   $this->account_config['RedirectURL'] . 
$response['TOKEN'] );
+   $redirectUrl = 
$this->account_config['RedirectURL'] . $response['TOKEN'];
+   $this->transaction_response->setRedirect( 
$redirectUrl );
+   $this->transaction_response->setData( array(
+   'FORMACTION' => $redirectUrl
+   ) );
break;
case 'GetExpressCheckoutDetails':
$this->checkResponseAck( $response );
diff --git a/paypal_gateway/express_checkout/paypal_express_gateway.body.php 
b/paypal_gateway/express_checkout/paypal_express_gateway.body.php
index 2d7e4ce..8f624ba 100644
--- a/paypal_gateway/express_checkout/paypal_express_gateway.body.php
+++ b/paypal_gateway/express_checkout/paypal_express_gateway.body.php
@@ -8,17 +8,9 @@
 */
protected function handleRequest() {
$this->getOutput()->allowClickjacking();
-   $this->getOutput()->addModules( 'ext.donationInterface.forms' );
+   $this->getOutput()->addModules( 
'ext.donationinterface.paypal.scripts' );
 
$this->handleDonationRequest();
}
 
-   /**
-* Always attempt to pass through transparently.
-*
-* @see 

[MediaWiki-commits] [Gerrit] integration/config[master]: Get rid of npm test for CiviCRM

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364804 )

Change subject: Get rid of npm test for CiviCRM
..

Get rid of npm test for CiviCRM

We're only using it for json linting, and it's making us wait in the
zuul queue for a long time during peak hours. Commit Ia6b74ed7c3e3
will do that linting in composer test.

Change-Id: I1bd0e125ffafb27aef14a9fee7a84c637d513a1b
---
M jjb/wm-fundraising.yaml
M zuul/layout.yaml
2 files changed, 0 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/04/364804/1

diff --git a/jjb/wm-fundraising.yaml b/jjb/wm-fundraising.yaml
index b682639..4998ab6 100644
--- a/jjb/wm-fundraising.yaml
+++ b/jjb/wm-fundraising.yaml
@@ -1,7 +1,6 @@
 - project:
 name: wikimedia-fundraising-crm
 jobs:
-  - '{name}-npm-node-6-jessie'
   - '{name}-composer-{phpflavor}-{image}':
   phpflavor:
   - php56:
diff --git a/zuul/layout.yaml b/zuul/layout.yaml
index e2fb31b..708bd17 100644
--- a/zuul/layout.yaml
+++ b/zuul/layout.yaml
@@ -2391,11 +2391,9 @@
   - name: wikimedia/fundraising/crm
 test:
   - wikimedia-fundraising-crm-composer-php56-jessie
-  - wikimedia-fundraising-crm-npm-node-6-jessie
   - wikimedia-fundraising-civicrm
 gate-and-submit:
   - wikimedia-fundraising-crm-composer-php56-jessie
-  - wikimedia-fundraising-crm-npm-node-6-jessie
   - wikimedia-fundraising-civicrm
 
   - name: wikimedia/fundraising/crm/civicrm

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bd0e125ffafb27aef14a9fee7a84c637d513a1b
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: WIP recover from dead sessions via EC token

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364794 )

Change subject: WIP recover from dead sessions via EC token
..

WIP recover from dead sessions via EC token

We're nowhere near hitting the RAM limit of our memcache instance.

Store an extra copy of the initial session data for PayPal express checkout
donors in memcache, keyed with the EC token. When a donor comes back with
no session information for whatever reason, try to restore the data from
memcache

Bug: T167923
Change-Id: I9fac867d8d101ca2b0365fe15ec52ba151226967
---
M paypal_gateway/express_checkout/paypal_express.adapter.php
M paypal_gateway/express_checkout/paypal_express_resultswitcher.body.php
2 files changed, 47 insertions(+), 0 deletions(-)


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

diff --git a/paypal_gateway/express_checkout/paypal_express.adapter.php 
b/paypal_gateway/express_checkout/paypal_express.adapter.php
index c614407..76613bb 100644
--- a/paypal_gateway/express_checkout/paypal_express.adapter.php
+++ b/paypal_gateway/express_checkout/paypal_express.adapter.php
@@ -1,6 +1,7 @@
 addResponseData( $this->unstageKeys( 
$response ) );
$this->transaction_response->setRedirect(
$this->account_config['RedirectURL'] . 
$response['TOKEN'] );
+   $this->backupDonorDataInMemcache( 
$response['TOKEN'] );
break;
case 'GetExpressCheckoutDetails':
$this->checkResponseAck( $response );
@@ -592,4 +594,41 @@
public function getTransactionGatewayTxnID() {
return $this->getData_Unstaged_Escaped( 'gateway_txn_id' );
}
+
+   public function backupDonorDataInMemcache( $token ) {
+   $cache = $this->getCache();
+   $cacheKey = $this->makeCacheKey( $token );
+   $cacheItem = $cache->getItem( $cacheKey );
+   if ( !$cacheItem->isHit() ) {
+   $cacheItem->set(
+   $this->getData_Unstaged_Escaped()
+   );
+   }
+   // EC tokens are valid for 3 hrs
+   $cacheItem->expiresAfter( 60 * 60 * 3 );
+   $cache->save( $cacheItem );
+   }
+
+   public function restoreSessionFromMemcache( $token ) {
+   $cache = $this->getCache();
+   $cacheKey = $this->makeCacheKey( $token );
+   $cacheItem = $cache->getItem( $cacheKey );
+   if ( !$cacheItem->isHit() ) {
+   $this->logger->warning( "Could not find donor data for 
token $token" );
+   return false;
+   }
+   $this->logger->info( "Restoring lost session data from cache 
for token $token" );
+   $this->addRequestData( $cacheItem->get() );
+   $this->session_addDonorData();
+   return true;
+   }
+
+   protected function getCache() {
+   $spConfig = Context::get()->getGlobalConfiguration();
+   return $spConfig->object( 'cache' );
+   }
+
+   protected function makeCacheKey( $token ) {
+   return 'DonationInterface-PayPalExpress-' . $token;
+   }
 }
diff --git 
a/paypal_gateway/express_checkout/paypal_express_resultswitcher.body.php 
b/paypal_gateway/express_checkout/paypal_express_resultswitcher.body.php
index 80b0c17..4a322fe 100644
--- a/paypal_gateway/express_checkout/paypal_express_resultswitcher.body.php
+++ b/paypal_gateway/express_checkout/paypal_express_resultswitcher.body.php
@@ -5,6 +5,14 @@
protected $gatewayIdentifier = PaypalExpressAdapter::IDENTIFIER;
 
protected function handleRequest() {
+   // Some donors are coming back from paypal with no session
+   // cookies. We can still identify them by the token, though.
+   if ( !$this->$this->adapter->session_hasDonorData() ) {
+   $token = $this->getRequest()->getVal( 'token' );
+   if ( $token ) {
+   $this->adapter->restoreSessionFromMemcache( 
$token );
+   }
+   }
$this->adapter->setCurrentTransaction( 'ProcessReturn' );
$this->handleResultRequest();
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fac867d8d101ca2b0365fe15ec52ba151226967
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Cache result of language fallback lookups

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364790 )

Change subject: Cache result of language fallback lookups
..

Cache result of language fallback lookups

Change-Id: I386cf58509c9b76c28d0ba8fe13a935394fcea77
---
M sites/all/modules/thank_you/thank_you.module
M sites/all/modules/wmf_communication/Templating.php
2 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/90/364790/1

diff --git a/sites/all/modules/thank_you/thank_you.module 
b/sites/all/modules/thank_you/thank_you.module
index 918401e..9ee8255 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -833,7 +833,7 @@
 /**
  *
  *
- * @param $params template parameters
+ * @param $params array template parameters
  */
 function thank_you_render( $params ) {
 
diff --git a/sites/all/modules/wmf_communication/Templating.php 
b/sites/all/modules/wmf_communication/Templating.php
index f19bbb2..f2342e2 100644
--- a/sites/all/modules/wmf_communication/Templating.php
+++ b/sites/all/modules/wmf_communication/Templating.php
@@ -22,6 +22,8 @@
 protected $format;
 protected $template_params;
 
+protected static $template_cache = array();
+
 /**
  * Prepare a template for substitution.
  *
@@ -112,10 +114,14 @@
  * @return \Twig_Template
  */
 protected function loadTemplate() {
+if ( array_key_exists( $this->language, self::$template_cache ) ) {
+return self::$template_cache[$this->language];
+}
 $language = $this->language;
 do {
 $template = $this->loadTemplateFile( $language );
 if ( $template ) {
+self::$template_cache[$this->language] = $template;
 return $template;
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I386cf58509c9b76c28d0ba8fe13a935394fcea77
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Speed up thank you query

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364783 )

Change subject: Speed up thank you query
..

Speed up thank you query

Ordering by ID ascending is taking up to 9 seconds on production.
Changing the sort to use receive_date make the query take less than 1
second, and keeps us thanking people in the right order.

Change-Id: Icbfa48febb98c2752f41046897350c85db9f2193
---
M sites/all/modules/thank_you/thank_you.module
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/83/364783/1

diff --git a/sites/all/modules/thank_you/thank_you.module 
b/sites/all/modules/thank_you/thank_you.module
index 58e672c..918401e 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -754,7 +754,7 @@
receive_date > DATE_SUB( NOW(), INTERVAL :interval DAY 
) AND
thankyou_date IS NULL AND
no_thank_you IS NULL
-   ORDER BY id ASC LIMIT {$batch};
+   ORDER BY receive_date ASC LIMIT {$batch};
 EOT;
 
$result = db_query( $ty_query, array( ':interval' => $days ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbfa48febb98c2752f41046897350c85db9f2193
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix thank you mailer watchdog message

2017-07-12 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364765 )

Change subject: Fix thank you mailer watchdog message
..

Fix thank you mailer watchdog message

Change-Id: Ia7888e0c7bbbf63a0f6bf4db56449c852e19a92e
---
M sites/all/modules/thank_you/thank_you.module
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/65/364765/1

diff --git a/sites/all/modules/thank_you/thank_you.module 
b/sites/all/modules/thank_you/thank_you.module
index 75174f5..58e672c 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -766,7 +766,7 @@
$endTime = $startTime + $timeLimit;
foreach( $result as $contribution ) {
if (time() >= $endTime){
-   watchdog("Batch time limit elapsed", WATCHDOG_NOTICE);
+   watchdog("thank_you", "Batch time limit ($timeLimit s) 
elapsed", array(), WATCHDOG_INFO);
break;
}
watchdog(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7888e0c7bbbf63a0f6bf4db56449c852e19a92e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Restore unsubscribe tag replacement

2017-07-11 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364616 )

Change subject: Restore unsubscribe tag replacement
..

Restore unsubscribe tag replacement

Bug: T170302
Change-Id: If4eab0a9ab95980445b606a5f7b47a7980ea0596
---
M sites/all/modules/thank_you/generators/ThankYou.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/16/364616/1

diff --git a/sites/all/modules/thank_you/generators/ThankYou.php 
b/sites/all/modules/thank_you/generators/ThankYou.php
index fa6fc89..9eb26cd 100644
--- a/sites/all/modules/thank_you/generators/ThankYou.php
+++ b/sites/all/modules/thank_you/generators/ThankYou.php
@@ -28,6 +28,7 @@
'/\[endifRecurringProblem\]<\/p>/' => "\n{% endif 
%}",
'/()?\[ifRecurring\]\s*/' => "{% if recurring 
%}\n\\1",
'/\s*\[endifRecurring\]\s*(<\/p>)?/' => "\\1\n{% endif 
%}",
+   '/\[#?unsubscribe ((?:(?!\]).)*)\]/' => '$1',
// All of the thank you letter's if...endif blocks 
should be outside p tags, not inside
'/\s*({%\s*if [^}]+})\s*/i' => "\\1\n",
'/\s*{%\s*endif\s*%}\s*<\/p>/i' => "\n{% endif %}",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4eab0a9ab95980445b606a5f7b47a7980ea0596
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Some notes on pushing gateway classes down to SmashPig

2017-07-11 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364531 )

Change subject: Some notes on pushing gateway classes down to SmashPig
..

Some notes on pushing gateway classes down to SmashPig

Change-Id: I7d8f263b96741c3d6e85bf129276a75ee18762e3
---
M gateway_common/GatewayType.php
M gateway_common/gateway.adapter.php
M gateway_forms/Mustache.php
M globalcollect_gateway/globalcollect.adapter.php
4 files changed, 19 insertions(+), 6 deletions(-)


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

diff --git a/gateway_common/GatewayType.php b/gateway_common/GatewayType.php
index b5226f9..b6bb970 100644
--- a/gateway_common/GatewayType.php
+++ b/gateway_common/GatewayType.php
@@ -23,7 +23,7 @@
 * Get a tag to use to identify this adapter in logs, e.g. 
amazon_gateway
 * @return string
 */
-   public static function getLogIdentifier();
+   public static function getLogIdentifier(); // Redundant, lose this on 
the way to smashpig
 
/**
 * This function is important.
@@ -45,6 +45,7 @@
 * @return mixed The configured value for that gateway if it exists. If 
not,
 * the configured value for Donation Interface if it exists or not.
 */
+   // Kiss this goodbye too, config nodes take care of it
public static function getGlobal( $varname );
 
/**
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 5da2a72..eae8c78 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -403,6 +403,7 @@
}
 
/**
+* // All UI stuff, should happen in GatewayPage (and should use real 
MW functions at this point)
 * Checks the edit tokens in the user's session against the one gathered
 * from populated form data.
 * Adds a string to the debugarray, to make it a little easier to tell 
what
@@ -473,6 +474,11 @@
$this->stageData();
}
 
+   // How to do this statelessly?
+   // UI layer should pass in raw values from the request (and session), 
and the
+   // gateway should stage those on the way in. Anything coming back from a
+   // processor API call should be fed to processResponse, which should 
return
+   // the data 'unstaged' (what's a better word for that?)
/**
 * Add data from the processor to staged_data and run any unstaging 
functions.
 *
diff --git a/gateway_forms/Mustache.php b/gateway_forms/Mustache.php
index 0c99d62..389da9f 100644
--- a/gateway_forms/Mustache.php
+++ b/gateway_forms/Mustache.php
@@ -27,6 +27,7 @@
 
/**
 * Return the rendered HTML form, using template parameters from the 
gateway object
+* FIXME: can this get all the parameters as arguments to this function?
 *
 * @return string
 * @throw RuntimeException
diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index c3b94d8..1d706f9 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -25,19 +25,19 @@
 class GlobalCollectAdapter extends GatewayAdapter {
const GATEWAY_NAME = 'Global Collect';
const IDENTIFIER = 'globalcollect';
-   const GLOBAL_PREFIX = 'wgGlobalCollectGateway';
+   const GLOBAL_PREFIX = 'wgGlobalCollectGateway'; // obsoleted by sp 
configuration
 
public function getCommunicationType() {
-   return 'xml';
+   return 'xml'; // When not using SDKs, we need a set of helper 
classes to build requests in different formats
}
 
+   // This is too complicated - could have each transaction be a data 
structure with reuse of common keys
/**
 * Add a key to the transaction INSERT_ORDERWITHPAYMENT.
 *
 * 
$this->transactions['INSERT_ORDERWITHPAYMENT']['request']['REQUEST']['PARAMS'][$section][]
 = $value
 */
protected function addKeyToTransaction( $value, $section = 'PAYMENT' ) {
-
if ( !in_array( $value, 
$this->transactions['INSERT_ORDERWITHPAYMENT']['request']['REQUEST']['PARAMS'][$section]
 ) ) {

$this->transactions['INSERT_ORDERWITHPAYMENT']['request']['REQUEST']['PARAMS'][$section][]
 = $value;
}
@@ -71,7 +71,7 @@
}
 
$defaults = array (
-   'returnto' => $returnTo,
+   'returnto' => $returnTo, // UI layer responsibility.
'attempt_id' => '1',
'effort_id' => '1',
);
@@ -112,6 +112,7 @@
$this->defineGoToThankYouOn();
}
 
+   // Order ID generation should be a helper class
/**
 * Sets up the $order_id_meta 

[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-11 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364498 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: Iff121faaa79f9ee91431fb6d8a24caa2a0c040d7
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/98/364498/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index 238b314..9bcbec8 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit 238b31460bf2a87225c7c5ff3ff1f24ad9b4f78b
+Subproject commit 9bcbec8bbdc3845012542ab788d4b7a9313ef8e7

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff121faaa79f9ee91431fb6d8a24caa2a0c040d7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: base ingenico test case

2017-07-10 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364345 )

Change subject: base ingenico test case
..

base ingenico test case

Sets up mocks n stuff

Change-Id: I73727d4fd08d2d75bf1c28b50b2f203e8e446d91
---
A tests/phpunit/BaseIngenicoTestCase.php
1 file changed, 25 insertions(+), 0 deletions(-)


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

diff --git a/tests/phpunit/BaseIngenicoTestCase.php 
b/tests/phpunit/BaseIngenicoTestCase.php
new file mode 100644
index 000..6fcef64
--- /dev/null
+++ b/tests/phpunit/BaseIngenicoTestCase.php
@@ -0,0 +1,25 @@
+hostedCheckoutProvider = $this->getMockBuilder(
+   
'SmashPig\PaymentProviders\Ingenico\HostedCheckoutProvider'
+   )->disableOriginalConstructor()->getMock();
+
+   $config = Context::get()->getProviderConfiguration();
+
+   $config->overrideObjectInstance(
+   'payment-provider/cc',
+   $this->hostedCheckoutProvider
+   );
+   }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73727d4fd08d2d75bf1c28b50b2f203e8e446d91
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: buildRequestArray handles recursion, used for name/value

2017-07-10 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364339 )

Change subject: buildRequestArray handles recursion, used for name/value
..

buildRequestArray handles recursion, used for name/value

Add a new function for building array structures for API requests,
similar to the XML builders.

Change-Id: I9f0775720408a0eff685cd311295c33e327c4b01
---
M gateway_common/ArrayHelper.php
M gateway_common/gateway.adapter.php
A tests/phpunit/ArrayHelperTest.php
3 files changed, 233 insertions(+), 39 deletions(-)


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

diff --git a/gateway_common/ArrayHelper.php b/gateway_common/ArrayHelper.php
index 7256e91..c0cece8 100644
--- a/gateway_common/ArrayHelper.php
+++ b/gateway_common/ArrayHelper.php
@@ -19,5 +19,59 @@
 
return array_combine( $keys, $values );
}
+
+   /**
+* Create an array mirroring the given structure, but with values 
obtained
+* from a callback. Like array_map, but with a few differences
+*  - recurses when elements are themselves arrays
+*  - if the callback returns '' or false, the element is skipped in 
the output
+*  - if the element is a key with value null, the output element has 
no key
+*
+* @param callable $callback
+* @param array $structure
+* @return array
+*/
+   public static function buildRequestArray( $callback, $structure ) {
+   $data = array();
+   foreach ( $structure as $key => $value ) {
+   self::addArrayElement( $data, $structure, $key, $value, 
$callback );
+   }
+   return $data;
+   }
+
+   protected static function addArrayElement( &$targetElement, 
$structureElement, $key, $value, $callback ) {
+   if ( is_numeric( $key ) ) {
+   // it's just a value, not an associative array key
+   $fieldName = $value;
+   $fieldValue = $callback( $fieldName );
+   if ( self::includeElement( $fieldValue ) ) {
+   $targetElement[$fieldName] = $fieldValue;
+   }
+   return;
+   }
+   if ( is_array( $structureElement[$key] ) ) {
+   $targetElement[$key] = array();
+   foreach ( $structureElement[$key] as $subKey => 
$subValue ) {
+   self::addArrayElement(
+   $targetElement[$key],
+   $structureElement[$key],
+   $subKey,
+   $subValue,
+   $callback
+   );
+   }
+   // TODO: If all children are skipped, remove 
$targetElement[$key] ?
+   } else if ( $structureElement[$key] === null ) {
+   // HACK: needed a way to specify non-associative arrays 
in the output
+   $fieldValue = $callback( $key );
+   if ( self::includeElement( $fieldValue ) ) {
+   $targetElement[] = $fieldValue;
+   }
+   }
+   }
+
+   protected static function includeElement( $value ) {
+   return ( $value !== '' && $value !== false );
+   }
 }
 
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index e34988d..5c73969 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -742,22 +742,19 @@
 * curl'd off to the remote server.
 */
protected function buildRequestNameValueString() {
+   $data = $this->buildRequestArray();
+   $ret = http_build_query( $data );
+   return $ret;
+   }
+
+   protected function buildRequestArray() {
// Look up the request structure for our current transaction 
type in the transactions array
$structure = $this->getTransactionRequestStructure();
if ( !is_array( $structure ) ) {
-   return '';
+   return array();
}
-
-   $data = array();
-   foreach ( $structure as $fieldname ) {
-   $fieldvalue = $this->getTransactionSpecificValue( 
$fieldname );
-   if ( $fieldvalue !== '' && $fieldvalue !== false ) {
-   $data[$fieldname] = $fieldvalue;
-   }
-   }
-
-   $ret = http_build_query( $data );
-   return $ret;
+   $callback = array( $this, 'getTransactionSpecificValue' );
+

[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-07-10 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364238 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: I08632e9e6523d5906178ac64c55578d816f44489
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/364238/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index 5890ce7..238b314 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit 5890ce71247a561feb9da2c5d01687c2ca6719f0
+Subproject commit 238b31460bf2a87225c7c5ff3ff1f24ad9b4f78b

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I08632e9e6523d5906178ac64c55578d816f44489
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: WIP Ingenico gateway mimics GlobalCollect

2017-07-09 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364143 )

Change subject: WIP Ingenico gateway mimics GlobalCollect
..

WIP Ingenico gateway mimics GlobalCollect

Just swaps out the API calls and response parsing.
TODO: actually parse stuff

Change-Id: I4c02abd190b1ea27c1921f37196481d87cd0162a
---
M gateway_common/donation.api.php
A ingenico_gateway/ingenico.adapter.php
A tests/phpunit/Adapter/Ingenico/IngenicoApiTest.php
A tests/phpunit/Adapter/Ingenico/IngenicoFormLoadTest.php
A tests/phpunit/Adapter/Ingenico/IngenicoOrphanAdapterTest.php
A tests/phpunit/Adapter/Ingenico/IngenicoOrphanRectifierTest.php
A tests/phpunit/Adapter/Ingenico/IngenicoTest.php
A tests/phpunit/Adapter/Ingenico/RealTimeBankTransferIdealTest.php
A tests/phpunit/Adapter/Ingenico/RecurringTest.php
A tests/phpunit/Adapter/Ingenico/ResultSwitcherTest.php
10 files changed, 2,019 insertions(+), 11 deletions(-)


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

diff --git a/gateway_common/donation.api.php b/gateway_common/donation.api.php
index c90896b..2a4f908 100644
--- a/gateway_common/donation.api.php
+++ b/gateway_common/donation.api.php
@@ -37,17 +37,23 @@
return;
}
 
-   if ( $this->gateway == 'globalcollect' ) {
-   switch ( $method ) {
-   // TODO: add other iframe payment methods
-   case 'cc':
-   $result = $gatewayObj->do_transaction( 
'INSERT_ORDERWITHPAYMENT' );
-   break;
-   default:
-   $result = $gatewayObj->do_transaction( 
'TEST_CONNECTION' );
-   }
-   } elseif ( $this->gateway == 'adyen' ) {
-   $result = $gatewayObj->do_transaction( 'donate' );
+   switch( $this->gateway ) {
+   case 'globalcollect':
+   switch ( $method ) {
+   // TODO: add other iframe payment 
methods
+   case 'cc':
+   $result = 
$gatewayObj->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
+   break;
+   default:
+   $result = 
$gatewayObj->do_transaction( 'TEST_CONNECTION' );
+   }
+   break;
+   case 'ingenico':
+   $result = $gatewayObj->do_transaction( 
'createHostedCheckout' );
+   break;
+   case 'adyen':
+   $result = $gatewayObj->do_transaction( 'donate' 
);
+   break;
}
 
// $normalizedData = $gatewayObj->getData_Unstaged_Escaped();
diff --git a/ingenico_gateway/ingenico.adapter.php 
b/ingenico_gateway/ingenico.adapter.php
new file mode 100644
index 000..1718bd9
--- /dev/null
+++ b/ingenico_gateway/ingenico.adapter.php
@@ -0,0 +1,68 @@
+getData_Unstaged_Escaped( 'email' );
+   $this->logger->info( "Making API call for donor $email" );
+
+   $filterResult = $this->runSessionVelocityFilter();
+   if ( $filterResult == false ) {
+   return false;
+   }
+
+   $provider = $this->getPaymentProvider();
+   switch( $this->getCurrentTransaction() ) {
+   case 'createHostedCheckout':
+   $payment = new Payment(
+   $this->getData_Staged( 'amount' ),
+   $this->getData_Staged( 'currency' ),
+   $this->getData_Staged( 'order_id' ),
+   $this->getData_Staged( 'locale' ),
+   $this->getData_Staged( 'country' ),
+   array(
+   'payment_product' => 
$this->getData_Staged( 'payment_product' ),
+   )
+   );
+
+   $result = $provider->createHostedPayment( 
$payment );
+   $this->transaction_response->setRawResponse( 
json_encode( $result ) );
+   return true;
+   default:
+   return false;
+   }
+   }
+
+   protected function getPaymentProvider() {
+   $method = $this->getData_Unstaged_Escaped( 'payment_method' );
+   return 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Revert "Revert "Merge branch 'master' into deployment""

2017-07-07 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363971 )

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

Revert "Revert "Merge branch 'master' into deployment""

Basically re-applying all the stuff we reverted, since the
problems have fixes

This reverts commit f8314476c2d391e992725686cb106f4b4488c7d6.

Change-Id: Ie7e641537cf2495e1282e447934838865c2f4d02
---
M DonationInterface.alias.php
M adyen_gateway/adyen.adapter.php
M amazon_gateway/amazon.adapter.php
M amazon_gateway/amazon.api.php
M amazon_gateway/i18n/en.json
M amazon_gateway/i18n/fr.json
M amazon_gateway/i18n/qqq.json
M amazon_gateway/i18n/ru.json
M amazon_gateway/i18n/uk.json
M extras/FraudFilter.php
M extras/banner_history/BannerHistoryLogIdProcessor.php
M gateway_common/DonationData.php
M gateway_common/DonationQueue.php
M gateway_common/GatewayType.php
M gateway_common/NationalCurrencies.php
M gateway_common/WmfFramework.drupal.php
M gateway_common/WmfFramework.mediawiki.php
M gateway_common/gateway.adapter.php
M gateway_common/i18n/interface/ast.json
M gateway_common/i18n/interface/bg.json
M gateway_common/i18n/interface/bn.json
M gateway_common/i18n/interface/bs.json
M gateway_common/i18n/interface/en.json
M gateway_common/i18n/interface/es.json
M gateway_common/i18n/interface/fr.json
M gateway_common/i18n/interface/hr.json
M gateway_common/i18n/interface/ia.json
M gateway_common/i18n/interface/it.json
M gateway_common/i18n/interface/jv.json
M gateway_common/i18n/interface/lt.json
M gateway_common/i18n/interface/mk.json
M gateway_common/i18n/interface/nb.json
M gateway_common/i18n/interface/pt.json
M gateway_common/i18n/interface/qqq.json
M gateway_common/i18n/interface/ru.json
M gateway_common/i18n/interface/sv.json
M gateway_common/i18n/interface/uk.json
M gateway_common/i18n/interface/ur.json
M gateway_common/i18n/interface/yi.json
M gateway_common/i18n/interface/zh-hans.json
M gateway_common/i18n/interface/zh-hant.json
M gateway_forms/mustache/forms.css
M globalcollect_gateway/globalcollect_resultswitcher.body.php
M globalcollect_gateway/i18n/es.json
M globalcollect_gateway/orphan.adapter.php
M paypal_gateway/express_checkout/paypal_express.adapter.php
46 files changed, 306 insertions(+), 301 deletions(-)


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

diff --git a/DonationInterface.alias.php b/DonationInterface.alias.php
index 725754d..060dee0 100644
--- a/DonationInterface.alias.php
+++ b/DonationInterface.alias.php
@@ -1,11 +1,9 @@
  array( 'GatewayFormChooser' ),
-   'SystemStatus' => array( 'SystemStatus' ),
-);
+$specialPageAliases['en'] = [
+   'GatewayFormChooser' => [ 'GatewayFormChooser' ],
+   'SystemStatus' => [ 'SystemStatus' ],
+];
diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php
index c86adb5..8129c3e 100644
--- a/adyen_gateway/adyen.adapter.php
+++ b/adyen_gateway/adyen.adapter.php
@@ -215,8 +215,8 @@
 * whether to capture the payment or leave it for manual review.
 * @return array
 */
-   protected function getStompTransaction() {
-   $transaction = parent::getStompTransaction();
+   protected function getQueueDonationMessage() {
+   $transaction = parent::getQueueDonationMessage();
$transaction['risk_score'] = $this->risk_score;
return $transaction;
}
diff --git a/amazon_gateway/amazon.adapter.php 
b/amazon_gateway/amazon.adapter.php
index 8d4473a..08e499a 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -199,7 +199,7 @@
) );
// Stash their info in pending queue and logs to fill in data 
for
// audit and IPN messages
-   $details = $this->getStompTransaction();
+   $details = $this->getQueueDonationMessage();
$this->logger->info( 'Got info for Amazon donation: ' . 
json_encode( $details ) );
$this->sendPendingMessage();
}
diff --git a/amazon_gateway/amazon.api.php b/amazon_gateway/amazon.api.php
index 740b912..3b9cd54 100644
--- a/amazon_gateway/amazon.api.php
+++ b/amazon_gateway/amazon.api.php
@@ -24,7 +24,9 @@
),
);
 
-   $adapter = new AmazonAdapter( $adapterParams );
+   $adapterClass = DonationInterface::getAdapterClassForGateway( 
'amazon' );
+   // @var AmazonAdapter
+   $adapter = new $adapterClass( $adapterParams );
 
if ( $adapter->getErrorState()->hasErrors() ) {
$output->addValue(
diff --git a/amazon_gateway/i18n/en.json b/amazon_gateway/i18n/en.json
index d0ba913..4b1ef57 100644
--- a/amazon_gateway/i18n/en.json
+++ b/amazon_gateway/i18n/en.json
@@ -4,6 +4,7 @@
},
"amazon_gateway-desc": 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Merge branch 'master' into deployment

2017-07-07 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363972 )

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

Merge branch 'master' into deployment

de328fa8 Move fraud filter config to TestConfiguration
655a931c Fix antifraud messages, add tests
4c4fdbe6 Fix function visibility in default getRequestProcessId
a249c8be Allow CUIT for Argentina
e257265d Localisation updates from https://translatewiki.net.
4438f41b Add one more yahoo tld
c8a675e4 Test cleanup - closures can use $this, fix PP test assert
1d95a7ac One more bit of $that = $this cleanup

Change-Id: I95d4dbd09b532a2d4a9d62c209dce13de92f9bb6
---
M gateway_common/gateway.adapter.php
D tests/phpunit/Adapter/Amazon/AmazonTest.php
D tests/phpunit/Adapter/AstroPay/AstroPayTest.php
D tests/phpunit/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php
D tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
D tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php
D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
D tests/phpunit/Adapter/PayPal/PayPalLegacyTest.php
D tests/phpunit/DataValidatorTest.php
D tests/phpunit/FormChooserTest.php
D tests/phpunit/FraudFiltersTest.php
D tests/phpunit/TestConfiguration.php
D tests/phpunit/includes/test_gateway/TestingPaypalExpressAdapter.php
13 files changed, 0 insertions(+), 2,765 deletions(-)


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

diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 50ea23b..e34988d 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1460,11 +1460,7 @@
 * @param array $requestValues
 * @return int|string Order id
 */
-<<< HEAD   (a977e5 Revert "Revert "Merge branch 'master' into deployment"")
-   protected function getRequestProcessId( $requestValues ) {
-===
public function getRequestProcessId( $requestValues ) {
->>> BRANCH (3ce4f1 Merge "One more bit of $that = $this cleanup")
return null;
}
 
diff --git a/tests/phpunit/Adapter/Amazon/AmazonTest.php 
b/tests/phpunit/Adapter/Amazon/AmazonTest.php
deleted file mode 100644
index 1846e5f..000
--- a/tests/phpunit/Adapter/Amazon/AmazonTest.php
+++ /dev/null
@@ -1,294 +0,0 @@
-<<< HEAD   (a977e5 Revert "Revert "Merge branch 'master' into deployment"")
-===
-testAdapterClass = 'TestingAmazonAdapter';
-   }
-
-   public function setUp() {
-   parent::setUp();
-   DonationInterface::initializeSmashPig( 'amazon' );
-
-   TestingAmazonAdapter::$mockClient = new MockAmazonClient();
-
-   $this->setMwGlobals( array(
-   'wgAmazonGatewayEnabled' => true,
-   'wgDonationInterfaceAllowedHtmlForms' => array(
-   'amazon' => array(
-   'gateway' => 'amazon',
-   'payment_methods' => array('amazon' => 
'ALL'),
-   'redirect',
-   ),
-   'amazon-recurring' => array(
-   'gateway' => 'amazon',
-   'payment_methods' => array('amazon' => 
'ALL'),
-   'redirect',
-   'recurring',
-   ),
-   ),
-   ) );
-   }
-
-   public function tearDown() {
-   TestingAmazonAdapter::$fakeGlobals = array();
-   parent::tearDown();
-   }
-
-   /**
-* Integration test to verify that the Amazon gateway converts Canadian
-* dollars before redirecting
-*
-* FIXME: Merge with currency fallback tests?
-*
-* @dataProvider canadaLanguageProvider
-*/
-   function testCanadianDollarConversion( $language ) {
-   $init = $this->getDonorTestData( 'CA' );
-   unset( $init['order_id'] );
-   $init['payment_method'] = 'amazon';
-   $init['ffname'] = 'amazon';
-   $init['language'] = $language;
-   $rates = CurrencyRates::getCurrencyRates();
-   $cadRate = $rates['CAD'];
-
-   $expectedAmount = floor( $init['amount'] / $cadRate );
-
-   TestingAmazonAdapter::$fakeGlobals = array(
-   'FallbackCurrency' => 'USD',
-   'NotifyOnConvert' => true,
-   );
-
-   $expectedNotification = wfMessage(
-   'donate_interface-fallback-currency-notice',
-   'USD'
-   )->inLanguage( $language )->text();
-
-   $locale = $init['language'] . '_' . 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: PHPunit 5.7, not 5.6

2017-07-07 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363854 )

Change subject: PHPunit 5.7, not 5.6
..

PHPunit 5.7, not 5.6

Oops, I messed up Eileen's commit and then merged it. Fixing!

Change-Id: Iaf99d19f3011ab219ea1f2a5fa5f3f06165e8bd6
---
M composer.lock
1 file changed, 69 insertions(+), 63 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/54/363854/1

diff --git a/composer.lock b/composer.lock
index 53b9a37..e086b90 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1984,16 +1984,16 @@
 },
 {
 "name": "phpunit/phpunit",
-"version": "5.6.4",
+"version": "5.7.21",
 "source": {
 "type": "git",
 "url": "https://github.com/sebastianbergmann/phpunit.git;,
-"reference": "4ddb822f1de421b4cadb47570a525fd7d9359493"
+"reference": "3b91adfb64264ddec5a2dee9851f354aa66327db"
 },
 "dist": {
 "type": "zip",
-"url": 
"https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4ddb822f1de421b4cadb47570a525fd7d9359493;,
-"reference": "4ddb822f1de421b4cadb47570a525fd7d9359493",
+"url": 
"https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b91adfb64264ddec5a2dee9851f354aa66327db;,
+"reference": "3b91adfb64264ddec5a2dee9851f354aa66327db",
 "shasum": ""
 },
 "require": {
@@ -2004,26 +2004,24 @@
 "ext-xml": "*",
 "myclabs/deep-copy": "~1.3",
 "php": "^5.6 || ^7.0",
-"phpspec/prophecy": "^1.3.1",
-"phpunit/php-code-coverage": "^4.0.1",
+"phpspec/prophecy": "^1.6.2",
+"phpunit/php-code-coverage": "^4.0.4",
 "phpunit/php-file-iterator": "~1.4",
 "phpunit/php-text-template": "~1.2",
 "phpunit/php-timer": "^1.0.6",
 "phpunit/phpunit-mock-objects": "^3.2",
-"sebastian/comparator": "~1.1",
-"sebastian/diff": "~1.2",
-"sebastian/environment": "^1.3 || ^2.0",
-"sebastian/exporter": "~1.2",
-"sebastian/global-state": "~1.0",
-"sebastian/object-enumerator": "~1.0",
+"sebastian/comparator": "^1.2.4",
+"sebastian/diff": "^1.4.3",
+"sebastian/environment": "^1.3.4 || ^2.0",
+"sebastian/exporter": "~2.0",
+"sebastian/global-state": "^1.1",
+"sebastian/object-enumerator": "~2.0",
 "sebastian/resource-operations": "~1.0",
-"sebastian/version": "~1.0|~2.0",
+"sebastian/version": "~1.0.3|~2.0",
 "symfony/yaml": "~2.1|~3.0"
 },
 "conflict": {
-"phpdocumentor/reflection-docblock": "3.0.2",
-"sebastian/object-enumerator": "1.0.1",
-"sebastian/recursion-context": "1.0.3 || 1.0.4"
+"phpdocumentor/reflection-docblock": "3.0.2"
 },
 "require-dev": {
 "ext-pdo": "*"
@@ -2038,7 +2036,7 @@
 "type": "library",
 "extra": {
 "branch-alias": {
-"dev-master": "5.6.x-dev"
+"dev-master": "5.7.x-dev"
 }
 },
 "autoload": {
@@ -2064,7 +2062,7 @@
 "testing",
 "xunit"
 ],
-"time": "2016-11-18T09:50:51+00:00"
+"time": "2017-06-21T08:11:54+00:00"
 },
 {
 "name": "phpunit/phpunit-mock-objects",
@@ -2172,16 +2170,16 @@
 },
 {
 "name": "sebastian/comparator",
-"version": "1.2.2",
+"version": "1.2.4",
 "source": {
 "type": "git",
 "url": "https://github.com/sebastianbergmann/comparator.git;,
-"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f"
+"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
 },
 "dist": {
 "type": "zip",
-"url": 
"https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f;,
-"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
+"url": 
"https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be;,
+"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
 "shasum": ""
 },
 "require": {
@@ -2232,27 +2230,27 @@
 "compare",
 "equality"
 ],
-   

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Use SmashPig version of Currency classes

2017-07-06 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363744 )

Change subject: Use SmashPig version of Currency classes
..

Use SmashPig version of Currency classes

Bug:163868
Change-Id: If9bdaa9f7128d85c13dc0b5f15c0cb7452f1aa80
---
M extension.json
M gateway_common/Amount.php
D gateway_common/CurrencyRates.php
M gateway_common/DonationData.php
D gateway_common/NationalCurrencies.php
M gateway_common/gateway.adapter.php
M modules/CurrencyRatesModule.php
M tests/phpunit/Adapter/Amazon/AmazonTest.php
8 files changed, 9 insertions(+), 443 deletions(-)


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

diff --git a/extension.json b/extension.json
index d6367ad..0c35e95 100644
--- a/extension.json
+++ b/extension.json
@@ -67,7 +67,6 @@
"FiscalNumber": "gateway_common/FiscalNumber.php",
"ClientSideValidationHelper": 
"gateway_common/ClientSideValidationHelper.php",
"ContributionTrackingPlusUnique": 
"gateway_common/ContributionTrackingPlusUnique.php",
-   "CurrencyRates": "gateway_common/CurrencyRates.php",
"CurrencyRatesModule": "modules/CurrencyRatesModule.php",
"DonationData": "gateway_common/DonationData.php",
"DonationInterface": "DonationInterface.class.php",
@@ -91,7 +90,6 @@
"LocalClusterPsr6Cache": 
"gateway_common/LocalClusterPsr6Cache.php",
"LogPrefixProvider": "gateway_common/LogPrefixProvider.php",
"MessageUtils": "gateway_common/MessageUtils.php",
-   "NationalCurrencies": "gateway_common/NationalCurrencies.php",
"PaymentError": "gateway_common/PaymentError.php",
"PaymentMethod": "gateway_common/PaymentMethod.php",
"PaymentResult": "gateway_common/PaymentResult.php",
diff --git a/gateway_common/Amount.php b/gateway_common/Amount.php
index 434223c..924e2ff 100644
--- a/gateway_common/Amount.php
+++ b/gateway_common/Amount.php
@@ -1,5 +1,7 @@
  6.11,
-   'ADP' => 155,
-   'AED' => 3.67,
-   'AFA' => 67,
-   'AFN' => 67,
-   'ALL' => 126,
-   'AMD' => 486,
-   'ANG' => 1.78,
-   'AOA' => 165,
-   'AON' => 165,
-   'ARS' => 16,
-   'ATS' => 13,
-   'AUD' => 1.32,
-   'AWG' => 1.79,
-   'AZM' => 9583,
-   'AZN' => 1.92,
-   'BAM' => 1.82,
-   'BBD' => 2,
-   'BDT' => 78,
-   'BEF' => 38,
-   'BGL' => 1.81,
-   'BGN' => 1.81,
-   'BHD' => 0.37423,
-   'BIF' => 1663,
-   'BMD' => 0.999603,
-   'BND' => 1.41,
-   'BOB' => 6.73,
-   'BRL' => 3.13,
-   'BSD' => 0.995552,
-   'BTN' => 68,
-   'BWP' => 10,
-   'BYR' => 20020,
-   'BZD' => 1.96,
-   'CAD' => 1.31,
-   'CDF' => 1250,
-   'CHF' => 0.992983,
-   'CLP' => 647,
-   'CNY' => 6.88,
-   'COP' => 2922,
-   'CRC' => 537,
-   'CUC' => 1,
-   'CUP' => 23,
-   'CVE' => 103,
-   'CYP' => 0.5453490001,
-   'CZK' => 25,
-   'DEM' => 1.82,
-   'DJF' => 178,
-   'DKK' => 6.93,
-   'DOP' => 46,
-   'DZD' => 109,
-   'ECS' => 25589,
-   'EEK' => 15,
-   'EGP' => 19,
-   'ESP' => 155,
-   'ETB' => 22,
-   'EUR' => 0.931784,
-   'FIM' => 5.54,
-   'FJD' => 2.05,
-   'FKP' => 0.798973,
-   'FRF' => 6.11,
-   'GBP' => 0.7991879998,
-   'GEL' => 2.69,
-   'GHC' => 43112,
-   'GHS' => 4.31,
-   'GIP' => 0.798973,
-   'GMD' => 43,
-   'GNF' => 9274,
-   'GRD' => 318,
-   'GTQ' => 7.27,
-   'GYD' => 198,
-   'HKD' => 7.76,
-   'HNL' => 23,
-   

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Fix filename case for some api examples

2017-07-06 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363653 )

Change subject: Fix filename case for some api examples
..

Fix filename case for some api examples

Not sure how we got out of sync with core...

Change-Id: I5a3db8322f3c32a32f5ae2670c9867cde1f86391
---
R api/v3/examples/CustomValue/FormatFieldName.php
R api/v3/examples/Group/GetFields.php
R api/v3/examples/Membership/FilterIsCurrent.php
R api/v3/examples/Tag/GetReturnArray.php
4 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/53/363653/1

diff --git a/api/v3/examples/CustomValue/formatFieldName.php 
b/api/v3/examples/CustomValue/FormatFieldName.php
similarity index 100%
rename from api/v3/examples/CustomValue/formatFieldName.php
rename to api/v3/examples/CustomValue/FormatFieldName.php
diff --git a/api/v3/examples/Group/getfields.php 
b/api/v3/examples/Group/GetFields.php
similarity index 100%
rename from api/v3/examples/Group/getfields.php
rename to api/v3/examples/Group/GetFields.php
diff --git a/api/v3/examples/Membership/filterIsCurrent.php 
b/api/v3/examples/Membership/FilterIsCurrent.php
similarity index 100%
rename from api/v3/examples/Membership/filterIsCurrent.php
rename to api/v3/examples/Membership/FilterIsCurrent.php
diff --git a/api/v3/examples/Tag/getReturnArray.php 
b/api/v3/examples/Tag/GetReturnArray.php
similarity index 100%
rename from api/v3/examples/Tag/getReturnArray.php
rename to api/v3/examples/Tag/GetReturnArray.php

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a3db8322f3c32a32f5ae2670c9867cde1f86391
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Fix case of crmEditable.js

2017-07-06 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363646 )

Change subject: Fix case of crmEditable.js
..

Fix case of crmEditable.js

This has been deprecated and is no longer bundled, but there are
still a few places it's used. It's breaking recurring donation
cancelation

Bug: T169909
Change-Id: I479eb3e2271a7e2df30147f64940b47852330408
---
R js/jquery/jquery.crmEditable.js
1 file changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/46/363646/1

diff --git a/js/jquery/jquery.crmeditable.js b/js/jquery/jquery.crmEditable.js
similarity index 100%
rename from js/jquery/jquery.crmeditable.js
rename to js/jquery/jquery.crmEditable.js

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I479eb3e2271a7e2df30147f64940b47852330408
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[deployment]: Merge branch 'master' into deployment

2017-07-06 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363636 )

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

Merge branch 'master' into deployment

It's a biggie! Needs new config deployed too

f95d5b6 More logging around paypal listener
ad0df32 Maintenance script to batch capture Amazon payments
ecd86f5 Batch cancel Amazon payments
955cfde Smashpig has a config directory, not just one big file
3f0d19e Split provider configuration out of main
306939e Quick path name fix
0e18ef1 Actually split out config classes
8d28cdb Declare reportsClient property explicitly
16935fb Always (re-)initialize logger when setting provider configuration
268a642 Add TestingContext for overriding ProviderConfigurations
545bfb7 Convenience functions to initialize test datastores
604eb24 Add config and test config for payments-init queue
5586bc1 Allow specifying configuration dir with environment vars
b3ad07b Get rid of redundant payment-provider/adyen path
e7c9a45 Config fix: Check provider config for actions node
a1d631e Add gateway_session_id to pending table
780b671 Move CurrencyRates into SmashPig
89983e7 Move NationalCurrencies into SmashPig
286b050 Alert on Amazon message verification failure
8897930 Explicit include path for phpunit bootstrap
fdd1a2c Revert "Add gateway_session_id to pending table"
afdda8e Recover Amazon order IDs when txn captured at console
a0f9fe5 Revert "Allow specifying configuration dir with environment vars"
07840d3 Add missing national currencies, alphabetize
3ad3bd5 Fix Adyen test data generation
756898e Get provider config dir from global config

Change-Id: I0445b229c4723113d505644c26bf77c922542764
---
D PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php
D PaymentProviders/Adyen/Tests/BaseAdyenTestCase.php
D PaymentProviders/Adyen/Tests/faker/README
D PaymentProviders/Adyen/Tests/faker/faker.py
D PaymentProviders/Adyen/Tests/faker/templates/pending.json
D PaymentProviders/Adyen/Tests/phpunit/CaptureJobTest.php
D PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php
D PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php
D PaymentProviders/Adyen/Tests/phpunit/RecordCaptureJobTest.php
D PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
D PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php
D PaymentProviders/Amazon/Tests/AmazonTestCase.php
D PaymentProviders/Amazon/Tests/AmazonTestConfiguration.php
D PaymentProviders/Amazon/Tests/config_test.yaml
D PaymentProviders/Amazon/Tests/phpunit/AuditTest.php
D PaymentProviders/Ingenico/Tests/phpunit/ApiTest.php
D PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
D PaymentProviders/Ingenico/Tests/phpunit/IdealStatusProviderTest.php
D PaymentProviders/PayPal/Tests/PayPalTestConfiguration.php
D PaymentProviders/PayPal/Tests/config_test.yaml
D PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
D Tests/BaseSmashPigUnitTestCase.php
D Tests/ConfigurationTest.php
D Tests/DamagedDatabaseTest.php
D Tests/FileDumperTest.php
D Tests/PaymentsInitialDatabaseTest.php
D Tests/PendingDatabaseTest.php
D Tests/PendingQueueConsumerTest.php
D Tests/QueueConsumerTest.php
D Tests/SmashPigDatabaseTest.php
D Tests/TestingContext.php
D Tests/TestingDatabase.php
D Tests/TestingGlobalConfiguration.php
D Tests/TestingProviderConfiguration.php
D Tests/bootstrap-phpunit.php
D Tests/data/test_global.yaml
36 files changed, 0 insertions(+), 2,492 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/36/363636/1

diff --git a/PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php 
b/PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php
deleted file mode 100644
index e3191d6..000
--- a/PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<<< HEAD   (d4458f Merge branch 'master' into deployment)
-===
-override( $overrides );
-
-   return $config;
-   }
-
-   public static function createWithSuccessfulApi( GlobalConfiguration 
$globalConfig ) {
-   $override = array( 'api' =>
-   array(
-   'class' => 
'SmashPig\PaymentProviders\Adyen\Tests\MockAdyenPaymentsAPI',
-   'constructor-parameters' =>
-   array( 'Success!' )
-   )
-   );
-   return self::instance( $override, $globalConfig );
-   }
-
-   public static function createWithUnsuccessfulApi( GlobalConfiguration 
$globalConfig ) {
-   $override = array( 'api' =>
-   array(
-   'class' => 
'SmashPig\PaymentProviders\Adyen\Tests\MockAdyenPaymentsAPI',
-   'constructor-parameters' =>
-   // FIXME: Really?  or boolean `false` 
as it would be if
-  

[MediaWiki-commits] [Gerrit] integration/config[master]: Templatize phplint jobs

2017-07-05 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363493 )

Change subject: Templatize phplint jobs
..

Templatize phplint jobs

Change-Id: I0130c3638f1b0e417354dd37e4e2cb54e9ffa175
---
M jjb/job-templates.yaml
1 file changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/93/363493/1

diff --git a/jjb/job-templates.yaml b/jjb/job-templates.yaml
index 44c4926..a4ecb87 100644
--- a/jjb/job-templates.yaml
+++ b/jjb/job-templates.yaml
@@ -147,9 +147,9 @@
  - archive-log-allow-empty
  - castor-save
 
-- job:
-name: 'php55lint'
-node: contintLabsSlave && phpflavor-php55
+- job-template:
+name: '{phpflavor}lint'
+node: contintLabsSlave && phpflavor-{phpflavor}
 defaults: use-remote-zuul-shallow-clone
 concurrent: true
 triggers:
@@ -157,9 +157,9 @@
 builders:
  - phplint
 
-- job-template:
-name: '{name}-php55lint'
-node: contintLabsSlave && phpflavor-php55
+- job-template: _lint
+name: '{name}-{phpflavor}lint'
+node: contintLabsSlave && phpflavor-{phpflavor}
 defaults: use-remote-zuul-no-submodules
 concurrent: true
 properties:
@@ -170,6 +170,11 @@
 builders:
  - phplint
 
+- job-template:
+<<: *name_lint
+name: '{name}-php55lint'
+node: contintLabsSlave && phpflavor-php55
+
 # Verify whether there is any leading tabs in files matching 'fileselector'.
 #
 # 'fileselector': the parameter is passed to grep --include= option and is

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0130c3638f1b0e417354dd37e4e2cb54e9ffa175
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] integration/config[master]: Switch all fundraising tests to PHP5.6

2017-07-05 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363478 )

Change subject: Switch all fundraising tests to PHP5.6
..

Switch all fundraising tests to PHP5.6

To match production.

Bug: T169806
Change-Id: Iaaa0ea5958ff4eca61f569134d7e0fd786111ebf
---
M jjb/wm-fundraising.yaml
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/78/363478/1

diff --git a/jjb/wm-fundraising.yaml b/jjb/wm-fundraising.yaml
index 8023a3b..213fb57 100644
--- a/jjb/wm-fundraising.yaml
+++ b/jjb/wm-fundraising.yaml
@@ -4,8 +4,8 @@
   - '{name}-npm-node-6-jessie'
   - '{name}-composer-{phpflavor}-{image}':
   phpflavor:
-  - php55:
-  image: trusty
+  - php56:
+  image: jessie
 
 - builder:
 name: fundraising-crm-install
@@ -68,22 +68,22 @@
   - archive-log-dir
 
 - project:
-name: donationinterface-fundraising-branches-php55
+name: donationinterface-fundraising-branches-php56
 branch:
  - REL1_27
  - REL1_28
 jobs:
- - mwext-donationinterfacecore-{branch}-zend55-trusty:
+ - mwext-donationinterfacecore-{branch}-zend56-jessie:
 
 - job-template:
-name: 'mwext-donationinterfacecore-{branch}-zend55-trusty'
-node: ci-trusty-wikimedia
+name: 'mwext-donationinterfacecore-{branch}-zend56-jessie'
+node: ci-jessie-wikimedia
 concurrent: true
 triggers:
  - zuul
 builders:
  - assert-phpflavor:
- phpflavor: 'php55'
+ phpflavor: 'php56'
  - castor-load
  - prepare-mediawiki-branch:
  branch: '{branch}'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaaa0ea5958ff4eca61f569134d7e0fd786111ebf
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: It's just 'Test', not 'TestMode'

2017-07-05 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363391 )

Change subject: It's just 'Test', not 'TestMode'
..

It's just 'Test', not 'TestMode'

Change-Id: I44e8867a5adf916d1bdb89337e72ed6022ab59a5
---
M DonationInterface.class.php
M tests/phpunit/DonationInterfaceTestCase.php
M tests/phpunit/TestConfiguration.php
3 files changed, 7 insertions(+), 7 deletions(-)


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

diff --git a/DonationInterface.class.php b/DonationInterface.class.php
index fbb0713..58c338c 100644
--- a/DonationInterface.class.php
+++ b/DonationInterface.class.php
@@ -8,14 +8,14 @@
 * Executed after processing extension.json
 */
public static function registerExtension() {
-   global $wgDonationInterfaceTestMode,
+   global $wgDonationInterfaceTest,
$wgDonationInterfaceTemplate,
$wgDonationInterfaceErrorTemplate;
 
// Test mode (not for production!)
// Set it if not defined
-   if ( !isset( $wgDonationInterfaceTestMode) || 
$wgDonationInterfaceTestMode !== true ) {
-   $wgDonationInterfaceTestMode = false;
+   if ( !isset( $wgDonationInterfaceTest ) || 
$wgDonationInterfaceTest !== true ) {
+   $wgDonationInterfaceTest = false;
}
 
/**
diff --git a/tests/phpunit/DonationInterfaceTestCase.php 
b/tests/phpunit/DonationInterfaceTestCase.php
index 42700a7..d7c9c5f 100644
--- a/tests/phpunit/DonationInterfaceTestCase.php
+++ b/tests/phpunit/DonationInterfaceTestCase.php
@@ -62,8 +62,8 @@
public function __construct( $name = null, array $data = array(), 
$dataName = '' ) {
 
//Just in case you got here without running the configuration...
-   global $wgDonationInterfaceTestMode;
-   $wgDonationInterfaceTestMode = true;
+   global $wgDonationInterfaceTest;
+   $wgDonationInterfaceTest = true;
 
parent::__construct( $name, $data, $dataName );
}
diff --git a/tests/phpunit/TestConfiguration.php 
b/tests/phpunit/TestConfiguration.php
index 30d6cb4..a80ee19 100644
--- a/tests/phpunit/TestConfiguration.php
+++ b/tests/phpunit/TestConfiguration.php
@@ -52,7 +52,7 @@
  */
 define( 'TESTS_ADAPTER_DEFAULT', 'TestingGlobalCollectAdapter' );
 
-global $wgDonationInterfaceTestMode,
+global $wgDonationInterfaceTest,
$wgDonationInterfaceMerchantID,
$wgDonationInterfaceGatewayAdapters,
$wgDonationInterfaceAllowedHtmlForms,
@@ -102,7 +102,7 @@
  * Make sure the test setup is used, else we'll have the wrong classes.
  */
 /** DonationInterface General Settings **/
-$wgDonationInterfaceTestMode = true;
+$wgDonationInterfaceTest = true;
 $wgDonationInterfaceMerchantID = 'test';
 
 $wgDonationInterfaceThankYouPage = 
'https://wikimediafoundation.org/wiki/Thank_You';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I44e8867a5adf916d1bdb89337e72ed6022ab59a5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Add Spanish translations for missing fiscal numbers

2017-07-05 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363386 )

Change subject: Add Spanish translations for missing fiscal numbers
..

Add Spanish translations for missing fiscal numbers

D'oh - most of the way through the Latin American fundraiser, too

Change-Id: Ie9d80558e7afea079e87f6cc1b1752f0d9e73c3e
---
M gateway_common/i18n/interface/es.json
1 file changed, 8 insertions(+), 0 deletions(-)


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

diff --git a/gateway_common/i18n/interface/es.json 
b/gateway_common/i18n/interface/es.json
index 455e262..6eb70e1 100644
--- a/gateway_common/i18n/interface/es.json
+++ b/gateway_common/i18n/interface/es.json
@@ -229,6 +229,14 @@
"donate_interface-error-msg-cookies": "Habilita las cookies en tu 
navegador.",
"donate_interface-error-msg-country-calc": "Error. No es posible 
aceptar tu donación en este momento.",
"donate_interface-error-msg-fiscal_number": "Escribe tu número fiscal",
+   "donate_interface-error-msg-fiscal_number-ar": "Escribe tu DNI",
+   "donate_interface-error-msg-fiscal_number-bo": "Escribe tu NIT",
+   "donate_interface-error-msg-fiscal_number-br": "Escribe tu CPF/CNPJ",
+   "donate_interface-error-msg-fiscal_number-cl": "Escribe tu RUT",
+   "donate_interface-error-msg-fiscal_number-co": "Escribe tu Cédula de 
Ciudadanía",
+   "donate_interface-error-msg-fiscal_number-mx": "Escribe tu 
CURP/RFC/IFE",
+   "donate_interface-error-msg-fiscal_number-pe": "Escribe tu DNI",
+   "donate_interface-error-msg-fiscal_number-uy": "Escribe tu CI",
"donate_interface-error-msg-invalid-fiscal_number": "Corrige los 
errores en el campo número fiscal",
"donate_interface-error-msg-invalid-fiscal_number-ar": "Corrige los 
errores en tu DNI",
"donate_interface-error-msg-invalid-fiscal_number-bo": "Corrige los 
errores en tu NIT",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9d80558e7afea079e87f6cc1b1752f0d9e73c3e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Don't tie mock PayPal API to one specific test

2017-07-05 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363373 )

Change subject: Don't tie mock PayPal API to one specific test
..

Don't tie mock PayPal API to one specific test

This way, you can even use it in manual IPN testing in case you
don't actually want to hit the IPN verification URL

Change-Id: Ic2e67022bb8c41740ab5de46095817159d0ab83e
---
M PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
M PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
2 files changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/73/363373/1

diff --git a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php 
b/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
index e35a52c..88948da 100644
--- a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
+++ b/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
@@ -3,11 +3,15 @@
 use SmashPig\PaymentProviders\PayPal\PayPalPaymentsAPI;
 
 class MockPayPalPaymentsAPI extends PayPalPaymentsAPI {
+
+   static $fail_verification = false;
+   static $paypal_is_broken = false;
+
protected function curl ( $ch, $post_fields ) {
-   if ( CaptureIncomingMessageTest::$fail_verification ) {
+   if ( self::$fail_verification ) {
return 'INVALID';
}
-   if ( CaptureIncomingMessageTest::$paypal_is_broken ) {
+   if ( self::$paypal_is_broken ) {
return 'lkjasjdhfiuasdgjgbasdd';
}
return 'VERIFIED';
diff --git 
a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php 
b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
index 2b08ef4..2fb9eb5 100644
--- a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
+++ b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
@@ -21,9 +21,6 @@
 */
public $config;
 
-   static $fail_verification = false;
-   static $paypal_is_broken = false;
-
// filename and the queue it should get dropped in
static $message_data = array(
'web_accept.json' => 'donations',
@@ -49,8 +46,8 @@
}
 
public function tearDown() {
-   self::$fail_verification = false;
-   self::$paypal_is_broken = false;
+   MockPayPalPaymentsAPI::$fail_verification = false;
+   MockPayPalPaymentsAPI::$paypal_is_broken = false;
parent::tearDown();
}
 
@@ -146,7 +143,7 @@
}
 
public function testFailedVerification() {
-   self::$fail_verification = true;
+   MockPayPalPaymentsAPI::$fail_verification = true;
$jobMessage = array( 'txn_type' => 'fail' );
$this->assertFalse( $this->capture( $jobMessage ) );
}
@@ -154,7 +151,7 @@
// FIXME: not really testing anything. Would like to verify that it 
tried
// N times. Bubble that information up somehow.
public function testPayPalIsBroken() {
-   self::$paypal_is_broken = true;
+   MockPayPalPaymentsAPI::$paypal_is_broken = true;
$jobMessage = array( 'txn_type' => 'fail' );
$this->assertFalse( $this->capture( $jobMessage ) );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2e67022bb8c41740ab5de46095817159d0ab83e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Fix and note for Amazon manual IPN test harness

2017-07-05 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363361 )

Change subject: Fix and note for Amazon manual IPN test harness
..

Fix and note for Amazon manual IPN test harness

Change-Id: I9a05ded44989e4afd18117ba88b783fcc15d7943
---
M PaymentProviders/Amazon/Tests/manual/amznipnfake.js
M PaymentProviders/Amazon/Tests/manual/index.html
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/61/363361/1

diff --git a/PaymentProviders/Amazon/Tests/manual/amznipnfake.js 
b/PaymentProviders/Amazon/Tests/manual/amznipnfake.js
index 7907a88..026fa22 100644
--- a/PaymentProviders/Amazon/Tests/manual/amznipnfake.js
+++ b/PaymentProviders/Amazon/Tests/manual/amznipnfake.js
@@ -10,7 +10,7 @@
$.getJSON( 'RawPosts/' + notificationType + '.json',
function( postJson ) {
$.ajax({
-   type: 'POST',
+   method: 'POST',
url: listenerUrl,
contentType: 'application/json; charset=utf-8',
headers: postJson.headers,
diff --git a/PaymentProviders/Amazon/Tests/manual/index.html 
b/PaymentProviders/Amazon/Tests/manual/index.html
index b9b07a2..fd057ed 100644
--- a/PaymentProviders/Amazon/Tests/manual/index.html
+++ b/PaymentProviders/Amazon/Tests/manual/index.html
@@ -7,7 +7,7 @@
Amazon listener test posts
Send some convincing-looking posts (including valid signatures) to 
your listener
If you have an externally-accessible https URL and an Amazon 
merchant account, you can test more varieties at https://sellercentral.amazon.com/hz/me/hmi/ipn/main;>https://sellercentral.amazon.com/hz/me/hmi/ipn/main
-Listener URL: 
+Listener URL (must be on the same domain as this page): 
 Capture completed
 Refund completed
 Capture declined

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a05ded44989e4afd18117ba88b783fcc15d7943
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Fix Adyen test data generation

2017-07-05 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363353 )

Change subject: Fix Adyen test data generation
..

Fix Adyen test data generation

Need to consume pending messages to db, and there was a typo in the
capture notification generation.  Also, create pending messages in
the new, more-like-json format

Change-Id: If9961d56dd779ecfd42f53288dd161fb977eef16
---
M PaymentProviders/Adyen/Tests/faker/README
M PaymentProviders/Adyen/Tests/faker/faker.py
M PaymentProviders/Adyen/Tests/faker/templates/pending.json
3 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/53/363353/1

diff --git a/PaymentProviders/Adyen/Tests/faker/README 
b/PaymentProviders/Adyen/Tests/faker/README
index f62c9d6..d5371fa 100644
--- a/PaymentProviders/Adyen/Tests/faker/README
+++ b/PaymentProviders/Adyen/Tests/faker/README
@@ -15,6 +15,9 @@
 
 ~/src/SmashPig$ php Maintenance/PopulateQueueFromDump.php --queue pending 
adyen-12345-pending.json
 
+And move them from the pending queue to the pending table in your smashpig db.
+~/src/SmashPig$ php Maintenance/ConsumePendingQueue.php
+
 Then use the soap injector to simulate some IPN messages for the 
authorizations:
 ~/src/SmashPig/Tests/SoapInjector$ ./soapinject.py localhost 
'/ipn/smashpig_http_handler.php?p=adyen/listener' ../../adyen-12345-auths.xml
 
diff --git a/PaymentProviders/Adyen/Tests/faker/faker.py 
b/PaymentProviders/Adyen/Tests/faker/faker.py
index 207e128..46b6a19 100755
--- a/PaymentProviders/Adyen/Tests/faker/faker.py
+++ b/PaymentProviders/Adyen/Tests/faker/faker.py
@@ -38,7 +38,7 @@
 header = 'adyen-'  + oid
 pqueue += pending.replace('[[CTID]]', ctid).replace('[[ORDERID]]', oid)
 auths += auth.replace('[[ORDERID]]', oid).replace('[[AUTHID]]', authid)
-captures += captures.replace('[[ORDERID]]', oid).replace('[[AUTHID]]', 
authid).replace('[[CAPTUREID]]', captureid)
+captures += capture.replace('[[ORDERID]]', oid).replace('[[AUTHID]]', 
authid).replace('[[CAPTUREID]]', captureid)
 
 with open(fileprefix + '-auths.xml', 'w') as myfile:
 myfile.write( ipnContainer.replace('[[ITEMS]]', auths ))
diff --git a/PaymentProviders/Adyen/Tests/faker/templates/pending.json 
b/PaymentProviders/Adyen/Tests/faker/templates/pending.json
index fce8917..e3f3bb8 100644
--- a/PaymentProviders/Adyen/Tests/faker/templates/pending.json
+++ b/PaymentProviders/Adyen/Tests/faker/templates/pending.json
@@ -1 +1 @@
-raw={"headers":{"expires":"0","source_host":"lakitu","source_enqueued_time":"1458060070","destination":"\/queue\/pending","php-message-class":"SmashPig\\CrmLink\\Messages\\DonationInterfaceMessage","source_type":"payments","priority":"4","source_version":"unknown","source_run_id":"2027","message-id":"ID:lakitu-33375-[[AUTHID]]-2:5:-1:1:1","persistent":"true","source_name":"DonationInterface","gateway":"adyen","timestamp":"1458060070309"},"body":"{\"contribution_tracking_id\":\"[[CTID]]\",\"country\":\"US\",\"order_id\":\"[[ORDERID]]\",\"date\":1458060070,\"email\":\"test[[CTID]]@example.com\",\"fee\":\"0\",\"gateway_account\":\"WikimediaCOM\",\"gateway\":\"adyen\",\"gateway_txn_id\":false,\"language\":\"en\",\"payment_method\":\"cc\",\"payment_submethod\":\"visa\",\"response\":false,\"user_ip\":\"127.0.0.1\",\"utm_source\":\"..cc\",\"city\":\"Columbus\",\"currency\":\"USD\",\"first_name\":\"Testy[[CTID]]\",\"gross\":\"10.00\",\"last_name\":\"Testerson[[CTID]]\",\"recurring\":\"\",\"risk_score\":10,\"state_province\":\"OH\",\"street_address\":\"123
 Fake 
St\",\"utm_campaign\":\"\",\"utm_medium\":\"\",\"postal_code\":\"12345\"}"}
+{"source_host":"lakitu","source_enqueued_time":"1458060070","source_type":"payments","source_version":"unknown","source_run_id":"2027","source_name":"DonationInterface","contribution_tracking_id":"[[CTID]]","country":"US","order_id":"[[ORDERID]]","date":1458060070,"email":"test[[CTID]]@example.com","fee":"0","gateway_account":"WikimediaCOM","gateway":"adyen","gateway_txn_id":false,"language":"en","payment_method":"cc","payment_submethod":"visa","response":false,"user_ip":"127.0.0.1","utm_source":"..cc","city":"Columbus","currency":"USD","first_name":"Testy[[CTID]]","gross":"10.00","last_name":"Testerson[[CTID]]","recurring":"","risk_score":10,"state_province":"OH","street_address":"123
 Fake St","utm_campaign":"","utm_medium":"","postal_code":"12345"}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9961d56dd779ecfd42f53288dd161fb977eef16
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org

[MediaWiki-commits] [Gerrit] integration/config[master]: Add civicrm-buildkit/bin to path for CRM builds

2017-07-04 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363229 )

Change subject: Add civicrm-buildkit/bin to path for CRM builds
..

Add civicrm-buildkit/bin to path for CRM builds

Bug: T169593
Change-Id: I2aa7c5761ebc3a20893e694cd86a6cd1bf007e25
---
M jjb/wm-fundraising.yaml
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/29/363229/1

diff --git a/jjb/wm-fundraising.yaml b/jjb/wm-fundraising.yaml
index 5a60bbb..3af2616 100644
--- a/jjb/wm-fundraising.yaml
+++ b/jjb/wm-fundraising.yaml
@@ -21,6 +21,7 @@
   else
 git clone https://github.com/civicrm/civicrm-buildkit.git 
$WORKSPACE/src/wikimedia/fundraising/civicrm-buildkit
   fi
+  export 
PATH=$PATH:$WORKSPACE/src/wikimedia/fundraising/civicrm-buildkit/bin
   $WORKSPACE/src/wikimedia/fundraising/crm/bin/ci-create-dbs.sh
   $WORKSPACE/src/wikimedia/fundraising/crm/bin/ci-populate-dbs.sh
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2aa7c5761ebc3a20893e694cd86a6cd1bf007e25
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: WIP try to fix environment

2017-07-04 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363198 )

Change subject: WIP try to fix environment
..

WIP try to fix environment

Change-Id: Id888e71ecd4070d560f012fb050a01d7bbbc4d23
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/bootstrap.php
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/98/363198/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/bootstrap.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/bootstrap.php
index da3ae80..d3acdb9 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/bootstrap.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/bootstrap.php
@@ -20,7 +20,13 @@
   $descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 
=> STDERR);
   $oldOutput = getenv('CV_OUTPUT');
   putenv("CV_OUTPUT=json");
-  $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__);
+  $env = $_ENV + array(
+"PATH" => getenv("PATH"),
+"CIVICRM_SETTINGS" => getenv("CIVICRM_SETTINGS"),
+"CV_OUTPUT" => "json",
+"CV_CONFIG" => __DIR__ . '/cv.json',
+  );
+  $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__, $env);
   putenv("CV_OUTPUT=$oldOutput");
   fclose($pipes[0]);
   $result = stream_get_contents($pipes[1]);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id888e71ecd4070d560f012fb050a01d7bbbc4d23
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Allow CUIT for Argentina

2017-06-30 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362468 )

Change subject: Allow CUIT for Argentina
..

Allow CUIT for Argentina

We'd only been accepting the 7-10 digit DNI numbers, but d*Local also
accepts 11 digit CUIT numbers

Change-Id: Ia02722b057d8985bbc004e07928a9a71243ede72
---
M gateway_common/FiscalNumber.php
M tests/phpunit/DataValidatorTest.php
2 files changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/gateway_common/FiscalNumber.php b/gateway_common/FiscalNumber.php
index e817775..05e4d57 100644
--- a/gateway_common/FiscalNumber.php
+++ b/gateway_common/FiscalNumber.php
@@ -10,10 +10,11 @@
protected static $key = 'fiscal_number';
 
protected static $countryRules = array(
+   // Argentina's DNI numbers have 7-10 digits and CUIT numbers 
have 11
'AR' => array(
'numeric' => true,
'min' => 7,
-   'max' => 10,
+   'max' => 11,
),
'BR' => array(
'numeric' => true,
diff --git a/tests/phpunit/DataValidatorTest.php 
b/tests/phpunit/DataValidatorTest.php
index d44f5bb..c02dfec 100644
--- a/tests/phpunit/DataValidatorTest.php
+++ b/tests/phpunit/DataValidatorTest.php
@@ -127,6 +127,7 @@
array( 'CO', '1234-5678-901', false ),
array( 'AR', 'ABC12312', false ),
array( 'AR', '12341234', true ),
+   array( 'AR', '12-34123412-1', true ), // 11 digit CUIT 
should pass
array( 'AR', '1112223', true ),
array( 'AR', '111222', false ),
array( 'MX', '', true ), // Not required for MX

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia02722b057d8985bbc004e07928a9a71243ede72
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: One more bit of $that = $this cleanup

2017-06-30 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362432 )

Change subject: One more bit of $that = $this cleanup
..

One more bit of $that = $this cleanup

Change-Id: I0d36b4ac153538129f882b6b8900650f408d73af
---
M amazon_gateway/amazon.adapter.php
1 file changed, 3 insertions(+), 4 deletions(-)


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

diff --git a/amazon_gateway/amazon.adapter.php 
b/amazon_gateway/amazon.adapter.php
index 08e499a..c150ae2 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -88,13 +88,12 @@
public function defineErrorMap() {
parent::defineErrorMap();
 
-   $self = $this;
-   $differentCard = function() use ( $self ) {
-   $otherWays = $self->localizeGlobal( 'OtherWaysURL' );
+   $differentCard = function() {
+   $otherWays = $this->localizeGlobal( 'OtherWaysURL' );
return WmfFramework::formatMessage(

'donate_interface-donate-error-try-a-different-card-html',
$otherWays,
-   $self->getGlobal( 'ProblemsEmail' )
+   $this->getGlobal( 'ProblemsEmail' )
);
};
// Donor needs to select a different card.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d36b4ac153538129f882b6b8900650f408d73af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Test cleanup - closures can use $this, fix PP test assert

2017-06-30 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362431 )

Change subject: Test cleanup - closures can use $this, fix PP test assert
..

Test cleanup - closures can use $this, fix PP test assert

No longer using php 5.3, so no need for $that = $this silliness.
Also, the PayPal test wasn't actually asserting anything about the
location.

Change-Id: I68ab636e7e8d272f57f8751a39b30d153138871d
---
M tests/phpunit/Adapter/Amazon/AmazonTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/Adapter/PayPal/PayPalLegacyTest.php
M tests/phpunit/FormChooserTest.php
5 files changed, 8 insertions(+), 12 deletions(-)


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

diff --git a/tests/phpunit/Adapter/Amazon/AmazonTest.php 
b/tests/phpunit/Adapter/Amazon/AmazonTest.php
index 25c94b7..527ff70 100644
--- a/tests/phpunit/Adapter/Amazon/AmazonTest.php
+++ b/tests/phpunit/Adapter/Amazon/AmazonTest.php
@@ -94,9 +94,8 @@
$locale = $init['language'] . '_' . $init['country'];
$expectedDisplayAmount = Amount::format( $expectedAmount, 
'USD', $locale );
 
-   $that = $this; //needed for PHP pre-5.4
-   $convertTest = function( $amountString ) use ( 
$expectedDisplayAmount, $that ) {
-   $that->assertEquals( $expectedDisplayAmount, trim( 
$amountString ), 'Displaying wrong amount' );
+   $convertTest = function( $amountString ) use ( 
$expectedDisplayAmount ) {
+   $this->assertEquals( $expectedDisplayAmount, trim( 
$amountString ), 'Displaying wrong amount' );
};
 
$assertNodes = array(
diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php
index 17b0c63..e78907c 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php
@@ -229,7 +229,6 @@
$init['payment_submethod'] = 'visa';
$init['ffname'] = 'cc-vma';
$init['language'] = $language;
-   $locale = $language . '_CA';
 
$assertNodes = array (
'selected-amount' => array (
diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
index c949fa5..93dd2a5 100644
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
@@ -262,7 +262,7 @@
// Do this after the real processing to 
avoid side effects
$gateway = 
$this->getFreshGatewayObject( $init );
$url = ResultPages::getThankYouPage( 
$gateway );
-   return $location === $url;
+   $this->assertEquals( $url, $location );
}
)
);
@@ -304,7 +304,7 @@
// Do this after the real processing to 
avoid side effects
$gateway = 
$this->getFreshGatewayObject( $init );
$url = ResultPages::getThankYouPage( 
$gateway );
-   return $location === $url;
+   $this->assertEquals( $url, $location );
}
)
);
diff --git a/tests/phpunit/Adapter/PayPal/PayPalLegacyTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalLegacyTest.php
index 971da42..5ca7b75 100644
--- a/tests/phpunit/Adapter/PayPal/PayPalLegacyTest.php
+++ b/tests/phpunit/Adapter/PayPal/PayPalLegacyTest.php
@@ -167,10 +167,9 @@
$init = $this->getDonorTestData();
$session = array( 'Donor' => $init );
 
-   $that = $this;
-   $redirectTest = function( $location ) use ( $that, $init ) {
+   $redirectTest = function( $location ) use ( $init ) {
parse_str( parse_url( $location, PHP_URL_QUERY ), 
$actual );
-   $that->assertEquals( $init['amount'], $actual['amount'] 
);
+   $this->assertEquals( $init['amount'], $actual['amount'] 
);
};
$assertNodes = array(
'headers' => array(
diff --git a/tests/phpunit/FormChooserTest.php 
b/tests/phpunit/FormChooserTest.php
index a711803..ac24348 100644
--- a/tests/phpunit/FormChooserTest.php
+++ b/tests/phpunit/FormChooserTest.php
@@ -90,13 +90,12 @@
 * over paymentmethod, etc.
 */
 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Move fraud filter config to TestConfiguration

2017-06-29 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362313 )

Change subject: Move fraud filter config to TestConfiguration
..

Move fraud filter config to TestConfiguration

Once upon a time I thought it was OK to do stuff in test case
constructors. That was totally wrong, as all of the constructors
are called before any of the tests are run. These maps don't need to
be set dynamically - they can just live in the test config.

Change-Id: I33c1260a8d7394ca1722d70eff0bf2c8ddae7a9f
---
M tests/phpunit/Adapter/AstroPay/AstroPayTest.php
M tests/phpunit/FraudFiltersTest.php
M tests/phpunit/TestConfiguration.php
3 files changed, 64 insertions(+), 73 deletions(-)


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

diff --git a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php 
b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
index 5b6643a..95a7c34 100644
--- a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
+++ b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
@@ -446,7 +446,6 @@
 * Test that we run the AntiFraud filters before redirecting
 */
function testAntiFraudFilters() {
-   DonationInterface_FraudFiltersTest::setupFraudMaps( $this );
$init = $this->getDonorTestData( 'BR' );
$init['payment_method'] = 'cc';
$init['bank_code'] = 'VD';
diff --git a/tests/phpunit/FraudFiltersTest.php 
b/tests/phpunit/FraudFiltersTest.php
index b8726c7..96245bc 100644
--- a/tests/phpunit/FraudFiltersTest.php
+++ b/tests/phpunit/FraudFiltersTest.php
@@ -25,77 +25,6 @@
  */
 class DonationInterface_FraudFiltersTest extends DonationInterfaceTestCase {
 
-   /**
-* @param $name string The name of the test case
-* @param $data array Any parameters read from a dataProvider
-* @param $dataName string|int The name or index of the data set
-*/
-   public function __construct( $name = null, array $data = array(), 
$dataName = '' ) {
-   $adapterclass = TESTS_ADAPTER_DEFAULT;
-   $this->testAdapterClass = $adapterclass;
-
-   parent::__construct( $name, $data, $dataName );
-   self::setupFraudMaps( $this );
-   }
-
-   public static function setupFraudMaps( $testContext ) {
-   // Declare so setMwGlobals can override.
-   global $wgGlobalCollectGatewayCustomFiltersFunctions;
-   $wgGlobalCollectGatewayCustomFiltersFunctions = null;
-
-
-   // Declare here cos reused.
-   $customFilters = array(
-   'getScoreCountryMap' => 50,
-   'getScoreUtmCampaignMap' => 50,
-   'getScoreUtmSourceMap' => 15,
-   'getScoreUtmMediumMap' => 15,
-   'getScoreEmailDomainMap' => 75,
-   );
-
-   $testContext->setMwGlobals( array(
-   'wgDonationInterfaceCustomFiltersActionRanges' => array 
(
-   'process' => array ( 0, 25 ),
-   'review' => array ( 25, 50 ),
-   'challenge' => array ( 50, 75 ),
-   'reject' => array ( 75, 100 ),
-   ),
-
-   'wgDonationInterfaceCustomFiltersRefRules' => array (
-   '/donate-error/i' => 5,
-   ),
-
-   'wgDonationInterfaceCustomFiltersSrcRules' => array ( 
'/wikimedia\.org/i' => 80 ),
-
-   'wgDonationInterfaceCustomFiltersFunctions' => 
$customFilters,
-
-   'wgGlobalCollectGatewayCustomFiltersFunctions' => array(
-   'getCVVResult' => 20,
-   'getAVSResult' => 25,
-   ) + $customFilters,
-
-   'wgDonationInterfaceCountryMap' => array (
-   'US' => 40,
-   'CA' => 15,
-   'RU' => -4,
-   ),
-
-   'wgDonationInterfaceUtmCampaignMap' => array (
-   '/^(C14_)/' => 14,
-   '/^(spontaneous)/' => 5
-   ),
-   'wgDonationInterfaceUtmSourceMap' => array (
-   '/somethingmedia/' => 70
-   ),
-   'wgDonationInterfaceUtmMediumMap' => array (
-   '/somethingmedia/' => 80
-   ),
-   'wgDonationInterfaceEmailDomainMap' => array (
-   'wikimedia.org' => 42,
-   'wikipedia.org' => 50,
-   ),
-   ) );
-   }
 
function 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Fix function visibility in default getRequestProcessId

2017-06-29 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362307 )

Change subject: Fix function visibility in default getRequestProcessId
..

Fix function visibility in default getRequestProcessId

Ugh. Sloppy error. I'd written unit tests, but they only covered the
Paypal Express resultswitcher, whose gateway was overriding the
function with public visibility.

This commit adds a test for the GlobalCollect resultswitcher. TODO:
AstroPay and Adyen resultswitcher tests.

Change-Id: Ia1cd67b1823b5ad11a230758f8eb5f2ea7f24142
---
M gateway_common/gateway.adapter.php
A tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php
2 files changed, 48 insertions(+), 1 deletion(-)


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

diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index be079a7..dbba9c8 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1460,7 +1460,7 @@
 * @param array $requestValues
 * @return int|string Order id
 */
-   protected function getRequestProcessId( $requestValues ) {
+   public function getRequestProcessId( $requestValues ) {
return null;
}
 
diff --git a/tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php 
b/tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php
new file mode 100644
index 000..94c1485
--- /dev/null
+++ b/tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php
@@ -0,0 +1,47 @@
+getDonorTestData( 'FR' );
+   $donorTestData['payment_method'] = 'cc';
+   $donorTestData['payment_submethod'] = 'visa';
+   $donorTestData['email'] = 'innoc...@localhost.net';
+   $donorTestData['order_id'] = mt_rand();
+   $session['Donor'] = $donorTestData;
+   // Mark the order as already popped out of the iframe
+   $session['order_status'][$donorTestData['order_id']] = 
'liberated';
+   $request = array(
+   'REF' => $donorTestData['order_id'],
+   'CVVRESULT' => 'M',
+   'AVSRESULT' => '0',
+'language' => 'fr', // FIXME: verifyFormOutput conflates request 
with other stuff
+   );
+   $assertNodes = array(
+   'headers' => array(
+   'Location' => function( $location ) use ( 
$donorTestData ) {
+   // Do this after the real processing to 
avoid side effects
+   $gateway = 
$this->getFreshGatewayObject( $donorTestData );
+   $url = ResultPages::getThankYouPage( 
$gateway );
+   return $location === $url;
+   }
+   )
+   );
+
+   $this->verifyFormOutput( 'GlobalCollectGatewayResult', 
$request, $assertNodes, false, $session );
+   $log = $this->testLogger->messages;
+   // Make sure we logged the expected cURL attempts
+   $messages = $this->getLogMatches( 'info', '/Preparing to send 
GET_ORDERSTATUS transaction to Global Collect/' );
+   $this->assertNotEmpty( $messages );
+   $messages = $this->getLogMatches( 'info', '/Preparing to send 
SET_PAYMENT transaction to Global Collect/' );
+   $this->assertNotEmpty( $messages );
+}
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1cd67b1823b5ad11a230758f8eb5f2ea7f24142
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Send resultswitcher reloaders to TY page

2017-06-29 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362295 )

Change subject: Send resultswitcher reloaders to TY page
..

Send resultswitcher reloaders to TY page

This restores some logic we used to have that kept track of processed
orders in a key outside of the donor data.

TODO: shouldn't globalcollectadapter return true for
isReturnProcessingRequired() ?

Cherry picked and sanitized of test code for deployment.

Bug: T167990
Change-Id: I9d23953e180b85d0d7ae357442760dd5c4d4619c
---
M gateway_common/GatewayPage.php
M gateway_common/gateway.adapter.php
M paypal_gateway/express_checkout/paypal_express.adapter.php
3 files changed, 59 insertions(+), 0 deletions(-)


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

diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index 4b1f2ba..1d0d271 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -398,6 +398,17 @@
 
$this->setHeaders();
 
+   if ( $this->isRepeatReturnProcess() ) {
+   $this->logger->warning(
+   'Donor is trying to process an 
already-processed payment. ' .
+   "Adapter Order ID: $oid.\n" .
+   "Cookies: " . print_r( $_COOKIE, true ) ."\n" .
+   "User-Agent: " . $_SERVER['HTTP_USER_AGENT']
+   );
+   $this->displayThankYouPage( 'repeat return processing' 
);
+   return;
+   }
+
if ( $deadSession ){
if ( $this->adapter->isReturnProcessingRequired() ) {
wfHttpError( 403, 'Forbidden', wfMessage( 
'donate_interface-error-http-403' )->text() );
@@ -429,6 +440,7 @@
// feed processDonorReturn all the GET and POST vars
$requestValues = $this->getRequest()->getValues();
$result = $this->adapter->processDonorReturn( 
$requestValues );
+   $this->markReturnProcessed();
$this->renderResponse( $result );
return;
} else {
@@ -567,4 +579,34 @@
);
}
}
+
+   protected function isRepeatReturnProcess() {
+   $request = $this->getRequest();
+   $requestProcessId = $this->adapter->getRequestProcessId(
+   $request->getValues()
+   );
+   $processedRequests = $request->getSessionData( 
'processed_requests' );
+   if ( !$requestProcessId || empty( $processedRequests ) ) {
+   return false;
+   }
+   return array_key_exists( $requestProcessId, $processedRequests 
);
+   }
+
+   protected function markReturnProcessed() {
+   $request = $this->getRequest();
+   $requestProcessId = $this->adapter->getRequestProcessId(
+   $request->getValues()
+   );
+   if ( !$requestProcessId ) {
+   return;
+   }
+   $processedRequests = $request->getSessionData( 
'processed_requests' );
+   if ( !$processedRequests ) {
+   $processedRequests = array();
+   }
+   // TODO: we could store the results of the last process here, 
but for now
+   // we just indicate we did SOMETHING with it
+   $processedRequests[$requestProcessId] = true;
+   $request->setSessionData( 'processed_requests', 
$processedRequests );
+   }
 }
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index f26ffd0..9a25296 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1452,6 +1452,18 @@
}
 
/**
+* Gateways which return true from isReturnProcessingRequired must
+* override this with logic to get an ID from the request which will
+* identify repeated attempts to process the same payment.
+*
+* @param array $requestValues
+* @return int|string Order id
+*/
+   protected function getRequestProcessId( $requestValues ) {
+   return null;
+   }
+
+   /**
 * Process the API response obtained from the payment processor and set
 * properties of transaction_response.
 * Default implementation just says we got a response.
@@ -2945,6 +2957,7 @@
'PaymentForms',
'numAttempt',
'order_status', //for post-payment activities
+   'processed_requests', //for post-payment 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Revert "Merge branch 'master' into deployment"

2017-06-29 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362294 )

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

Revert "Merge branch 'master' into deployment"

This reverts commit 74b81105a97d2e207d921a1646a70fb61ae8b912, reversing
changes made to c615ad97d44a6c9576b57e3ed756cb92cef9af84.

Little problem with the queue cleanup. I think we can cherry-pick the
PayPal session fix to deployment without this stuff.

Change-Id: I04fbf0068afb435889ffb8e520db18136c6b848d
---
M DonationInterface.alias.php
M adyen_gateway/adyen.adapter.php
M amazon_gateway/amazon.adapter.php
M amazon_gateway/amazon.api.php
M amazon_gateway/i18n/en.json
M amazon_gateway/i18n/fr.json
M amazon_gateway/i18n/qqq.json
M amazon_gateway/i18n/ru.json
M amazon_gateway/i18n/uk.json
M extras/FraudFilter.php
M extras/banner_history/BannerHistoryLogIdProcessor.php
M gateway_common/DonationData.php
M gateway_common/DonationQueue.php
M gateway_common/GatewayType.php
M gateway_common/NationalCurrencies.php
M gateway_common/WmfFramework.drupal.php
M gateway_common/WmfFramework.mediawiki.php
M gateway_common/gateway.adapter.php
M gateway_common/i18n/interface/ast.json
M gateway_common/i18n/interface/bg.json
M gateway_common/i18n/interface/bn.json
M gateway_common/i18n/interface/bs.json
M gateway_common/i18n/interface/en.json
M gateway_common/i18n/interface/es.json
M gateway_common/i18n/interface/fr.json
M gateway_common/i18n/interface/hr.json
M gateway_common/i18n/interface/ia.json
M gateway_common/i18n/interface/it.json
M gateway_common/i18n/interface/jv.json
M gateway_common/i18n/interface/lt.json
M gateway_common/i18n/interface/mk.json
M gateway_common/i18n/interface/nb.json
M gateway_common/i18n/interface/pt.json
M gateway_common/i18n/interface/qqq.json
M gateway_common/i18n/interface/ru.json
M gateway_common/i18n/interface/sv.json
M gateway_common/i18n/interface/uk.json
M gateway_common/i18n/interface/ur.json
M gateway_common/i18n/interface/yi.json
M gateway_common/i18n/interface/zh-hans.json
M gateway_common/i18n/interface/zh-hant.json
M gateway_forms/mustache/forms.css
M globalcollect_gateway/globalcollect_resultswitcher.body.php
M globalcollect_gateway/i18n/es.json
M globalcollect_gateway/orphan.adapter.php
M paypal_gateway/express_checkout/paypal_express.adapter.php
46 files changed, 302 insertions(+), 307 deletions(-)


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

diff --git a/DonationInterface.alias.php b/DonationInterface.alias.php
index 060dee0..725754d 100644
--- a/DonationInterface.alias.php
+++ b/DonationInterface.alias.php
@@ -1,9 +1,11 @@
  [ 'GatewayFormChooser' ],
-   'SystemStatus' => [ 'SystemStatus' ],
-];
+$specialPageAliases['en'] = array(
+   'GatewayFormChooser' => array( 'GatewayFormChooser' ),
+   'SystemStatus' => array( 'SystemStatus' ),
+);
diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php
index 8129c3e..c86adb5 100644
--- a/adyen_gateway/adyen.adapter.php
+++ b/adyen_gateway/adyen.adapter.php
@@ -215,8 +215,8 @@
 * whether to capture the payment or leave it for manual review.
 * @return array
 */
-   protected function getQueueDonationMessage() {
-   $transaction = parent::getQueueDonationMessage();
+   protected function getStompTransaction() {
+   $transaction = parent::getStompTransaction();
$transaction['risk_score'] = $this->risk_score;
return $transaction;
}
diff --git a/amazon_gateway/amazon.adapter.php 
b/amazon_gateway/amazon.adapter.php
index 08e499a..8d4473a 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -199,7 +199,7 @@
) );
// Stash their info in pending queue and logs to fill in data 
for
// audit and IPN messages
-   $details = $this->getQueueDonationMessage();
+   $details = $this->getStompTransaction();
$this->logger->info( 'Got info for Amazon donation: ' . 
json_encode( $details ) );
$this->sendPendingMessage();
}
diff --git a/amazon_gateway/amazon.api.php b/amazon_gateway/amazon.api.php
index 3b9cd54..740b912 100644
--- a/amazon_gateway/amazon.api.php
+++ b/amazon_gateway/amazon.api.php
@@ -24,9 +24,7 @@
),
);
 
-   $adapterClass = DonationInterface::getAdapterClassForGateway( 
'amazon' );
-   // @var AmazonAdapter
-   $adapter = new $adapterClass( $adapterParams );
+   $adapter = new AmazonAdapter( $adapterParams );
 
if ( $adapter->getErrorState()->hasErrors() ) {
$output->addValue(
diff --git a/amazon_gateway/i18n/en.json b/amazon_gateway/i18n/en.json
index 4b1ef57..d0ba913 100644
--- 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Add tests around payments-antifraud messages

2017-06-29 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362284 )

Change subject: Add tests around payments-antifraud messages
..

Add tests around payments-antifraud messages

Change-Id: I3df20685d7940d6379b8cedd7f0a0d285bbc7cd9
---
M gateway_common/gateway.adapter.php
M tests/phpunit/Adapter/AstroPay/AstroPayTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
M tests/phpunit/FraudFiltersTest.php
4 files changed, 94 insertions(+), 4 deletions(-)


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

diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index be079a7..2752870 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1837,7 +1837,7 @@
}
 
public function addStandardMessageFields( $transaction ) {
-   //bascially, add all the stuff we have come to take for 
granted, because syslog.
+   // basically, add all the stuff we have come to take for 
granted, because syslog.
$transaction['gateway_txn_id'] = 
$this->getTransactionGatewayTxnId();
$transaction['date'] = UtcDate::getUtcTimestamp();
$transaction['server'] = gethostname();
@@ -1846,6 +1846,7 @@
'gateway',
'contribution_tracking_id',
'order_id',
+   'payment_method',
);
foreach ( $these_too as $field ) {
$transaction[$field] = $this->getData_Unstaged_Escaped( 
$field );
@@ -2089,7 +2090,6 @@
//for now, though, just taking the ones that make it to the 
logs.
$keys = array(
'payment_submethod',
-   'payment_method',
'country',
'amount',
'currency',
diff --git a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php 
b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
index 5b6643a..bf16954 100644
--- a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
+++ b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
@@ -17,6 +17,9 @@
  */
 
 use \Psr\Log\LogLevel;
+use SmashPig\Core\Configuration;
+use SmashPig\Core\Context;
+use SmashPig\CrmLink\Messages\SourceFields;
 use Wikimedia\TestingAccessWrapper;
 
 /**
@@ -42,6 +45,8 @@
$this->setMwGlobals( array(
'wgAstroPayGatewayEnabled' => true,
) );
+   $config = Configuration::createForView( 'astropay' );
+   Context::initWithLogger( $config );
}
 
/**
@@ -463,6 +468,29 @@
$this->assertEquals( 'challenge', 
$gateway->getValidationAction(), 'Validation action is not as expected' );
$exposed = TestingAccessWrapper::newFromObject( $gateway );
$this->assertEquals( 60, $exposed->risk_score, 'RiskScore is 
not as expected' );
+   $message = DonationQueue::instance()->pop( 'payments-antifraud' 
);
+   SourceFields::removeFromMessage( $message );
+   $expected = array(
+   'validation_action' => 'challenge',
+   'risk_score' => 60,
+   'score_breakdown' => array(
+   'initial' => 0,
+   'getScoreUtmCampaignMap' => 0,
+   'getScoreCountryMap' => 0,
+   'getScoreUtmSourceMap' => 10.5,
+   'getScoreUtmMediumMap' => 12,
+   'getScoreEmailDomainMap' => 37.5,
+   ),
+   'user_ip' => '127.0.0.1',
+   'gateway_txn_id' => false,
+   'date' => $message['date'],
+   'server' => gethostname(),
+   'gateway' => 'astropay',
+   'contribution_tracking_id' => 
$gateway->getData_Unstaged_Escaped( 'contribution_tracking_id' ),
+   'order_id' => $gateway->getData_Unstaged_Escaped( 
'order_id' ),
+   'payment_method' => 'cc',
+   );
+   $this->assertEquals( $expected, $message );
}
 
function testStageFiscalNumber() {
diff --git 
a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
index 9560034..3e2ed75 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
@@ -17,6 +17,9 @@
  */
 
 use Psr\Log\LogLevel;
+use SmashPig\Core\Configuration;
+use SmashPig\Core\Context;
+use SmashPig\CrmLink\Messages\SourceFields;
 

[MediaWiki-commits] [Gerrit] mediawiki/core[fundraising/REL1_27]: Update DonationInterface submodule

2017-06-29 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362262 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Change-Id: I8136a217fc8b020cad92e93b1aa3762e5913880e
---
M extensions/DonationInterface
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/62/362262/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index c615ad9..74b8110 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit c615ad97d44a6c9576b57e3ed756cb92cef9af84
+Subproject commit 74b81105a97d2e207d921a1646a70fb61ae8b912

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8136a217fc8b020cad92e93b1aa3762e5913880e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: fundraising/REL1_27
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[deployment]: Merge branch 'master' into deployment

2017-06-29 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362231 )

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

Merge branch 'master' into deployment

9f3e5234 Localisation updates from https://translatewiki.net.
e33da29e Localisation updates from https://translatewiki.net.
2fef3053 Localisation updates from https://translatewiki.net.
454c93bd Localisation updates from https://translatewiki.net.
afa082a3 Localisation updates from https://translatewiki.net.
e6583072 Localisation updates from https://translatewiki.net.
4ad43bec Localisation updates from https://translatewiki.net.
b40761d8 Localisation updates from https://translatewiki.net.
91e68fcb Add missing MXN to national currencies list
816267c9 Localisation updates from https://translatewiki.net.
4608b6cb API: Split description messages into summary + additional text
b59da31b Localisation updates from https://translatewiki.net.
11710766 Localisation updates from https://translatewiki.net.
19ba3a5a Localisation updates from https://translatewiki.net.
907f4a1d Localisation updates from https://translatewiki.net.
5881436c Delete some unused vars
36f66ae0 Get rid of the rest of the !important modifiers in forms.css
62532af4 Stop masking possible test failure
6d1081a7 Add API test for Amazon
bd91024c Consolidate queue message generation.
5bc6b4d2 Get rid of some more php-message-class,
WmfFramework::getHostname
6f61d4c8 Guard against missing params in PP-EC return URL
9c673a49 Localisation updates from https://translatewiki.net.
602c836b Revert "Localisation updates from https://translatewiki.net.;
ad7937f6 Localisation updates from https://translatewiki.net.
7043c54d Use short array syntax in alias file
0bb0c742 Localisation updates from https://translatewiki.net.
4ee900d4 Localisation updates from https://translatewiki.net.

Change-Id: Ib652463c4d6b37ebc9a738298950c2f0112091da
---
D tests/phpunit/Adapter/Adyen/AdyenTest.php
D tests/phpunit/Adapter/Amazon/AmazonApiTest.php
D tests/phpunit/Adapter/Amazon/AmazonTest.php
D tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
D tests/phpunit/DonationQueueTest.php
D tests/phpunit/GatewayPageTest.php
D tests/phpunit/LoggingTest.php
7 files changed, 0 insertions(+), 1,304 deletions(-)


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

diff --git a/tests/phpunit/Adapter/Adyen/AdyenTest.php 
b/tests/phpunit/Adapter/Adyen/AdyenTest.php
deleted file mode 100644
index 5697312..000
--- a/tests/phpunit/Adapter/Adyen/AdyenTest.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<<< HEAD   (c615ad Merge branch 'master' into deployment)
-===
-testAdapterClass = 'TestingAdyenAdapter';
-   }
-
-   public function setUp() {
-   parent::setUp();
-   DonationInterface::initializeSmashPig( 'adyen' );
-
-   $this->setMwGlobals( array(
-   'wgAdyenGatewayEnabled' => true,
-   ) );
-   }
-
-   /**
-* Integration test to verify that the donate transaction works as 
expected when all necessary data is present.
-*/
-   function testDoTransactionDonate() {
-   $init = $this->getDonorTestData();
-   $init['payment_submethod'] = 'visa';
-   $gateway = $this->getFreshGatewayObject( $init );
-
-   $gateway->do_transaction( 'donate' );
-   $exposed = TestingAccessWrapper::newFromObject( $gateway );
-   $ret = $exposed->buildRequestParams();
-
-   $expected = array (
-   'allowedMethods' => 'card',
-   'billingAddress.street' => $init['street_address'],
-   'billingAddress.city' => $init['city'],
-   'billingAddress.postalCode' => $init['postal_code'],
-   'billingAddress.stateOrProvince' => 
$init['state_province'],
-   'billingAddress.country' => $init['country'],
-   'billingAddress.houseNumberOrName' => 'NA',
-   'billingAddressType' => 2,
-   'card.cardHolderName' => $init['first_name'] . ' ' . 
$init['last_name'],
-   'currencyCode' => $init['currency'],
-   'merchantAccount' => 'wikitest',
-   'merchantReference' => $exposed->getData_Staged( 
'order_id' ),
-   'merchantSig' => $exposed->getData_Staged( 
'hpp_signature' ),
-   'paymentAmount' => ($init['amount']) * 100,
-// 'sessionValidity' => '2014-03-09T19:41:50+00:00',   
//commenting out, because this is a problem.
-// 'shipBeforeDate' => $exposed->getData_Staged( 
'expiration' ),   //this too.
-   'skinCode' => 'testskin',
-   'shopperLocale' => 'en_US',
-   

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Add missing national currencies, alphabetize

2017-06-20 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/360384 )

Change subject: Add missing national currencies, alphabetize
..

Add missing national currencies, alphabetize

Change-Id: Ic413fc32d7fd200e80824458e5962bdbca284b68
---
M PaymentData/ReferenceData/NationalCurrencies.php
1 file changed, 141 insertions(+), 111 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/84/360384/1

diff --git a/PaymentData/ReferenceData/NationalCurrencies.php 
b/PaymentData/ReferenceData/NationalCurrencies.php
index 787a5f6..27ecfb7 100644
--- a/PaymentData/ReferenceData/NationalCurrencies.php
+++ b/PaymentData/ReferenceData/NationalCurrencies.php
@@ -22,200 +22,230 @@
 
static function getNationalCurrencies() {
$nationalCurrencies = array(
-   'AF' => 'AFN',
-   'AX' => 'EUR',
-   'AL' => 'ALL',
-   'DZ' => 'DZD',
-   'AS' => 'USD',
'AD' => 'EUR',
-   'AO' => 'AOA',
-   'AI' => 'XCD',
+   'AE' => 'AED',
+   'AF' => 'AFN',
'AG' => 'XCD',
-   'AR' => 'ARS',
+   'AI' => 'XCD',
+   'AL' => 'ALL',
'AM' => 'AMD',
-   'AW' => 'AWG',
-   'AU' => 'AUD',
+   'AN' => 'ANG',
+   'AO' => 'AOA',
+   'AR' => 'ARS',
+   'AS' => 'USD',
'AT' => 'EUR',
+   'AU' => 'AUD',
+   'AW' => 'AWG',
+   'AX' => 'EUR',
'AZ' => 'AZN',
-   'BS' => 'BSD',
-   'BH' => 'BHD',
-   'BD' => 'BDT',
+   'BA' => 'BAM',
'BB' => 'BBD',
-   'BY' => 'BYR',
+   'BD' => 'BDT',
'BE' => 'EUR',
-   'BZ' => 'BZD',
+   'BF' => 'XOF',
+   'BG' => 'BGN',
+   'BH' => 'BHD',
+   'BI' => 'BIF',
'BJ' => 'XOF',
'BM' => 'BMD',
-   'BT' => 'BTN',
+   'BN' => 'BND',
'BO' => 'BOB',
'BQ' => 'USD',
-   'BA' => 'BAM',
-   'BW' => 'BWP',
'BR' => 'BRL',
-   'IO' => 'USD',
-   'BN' => 'BND',
-   'BG' => 'BGN',
-   'BF' => 'XOF',
-   'BI' => 'BIF',
-   'KH' => 'KHR',
-   'CM' => 'XAF',
+   'BS' => 'BSD',
+   'BT' => 'BTN',
+   'BW' => 'BWP',
+   'BY' => 'BYN',
+   'BZ' => 'BZD',
'CA' => 'CAD',
-   'CV' => 'CVE',
-   'KY' => 'KYD',
-   'CF' => 'XAF',
-   'TD' => 'XAF',
-   'CL' => 'CLP',
-   'CN' => 'CNY',
-   'CX' => 'AUD',
'CC' => 'AUD',
-   'CO' => 'COP',
-   'KM' => 'KMF',
-   'CG' => 'XAF',
'CD' => 'CDF',
-   'CK' => 'NZD',
-   'CR' => 'CRC',
+   'CF' => 'XAF',
+   'CG' => 'XAF',
+   'CH' => 'CHF',
'CI' => 'XOF',
-   'HR' => 'HRK',
+   'CK' => 'NZD',
+   'CL' => 'CLP',
+   'CM' => 'XAF',
+   'CN' => 'CNY',
+   'CO' => 'COP',
+   'CR' => 'CRC',
'CU' => 'CUC',
+   'CV' => 'CVE',
'CW' => 'ANG',
+   'CX' => 'AUD',
'CY' => 'EUR',
'CZ' => 'CZK',
-   'DK' => 'DKK',
+   'DE' => 'EUR',
'DJ' => 'DJF',
+   'DK' => 'DKK',
'DM' => 'XCD',
'DO' => 'DOP',
-   'TL' => 'USD',
+   'DZ' => 'DZD',
'EC' => 'USD',
-   'EG' => 'EGP',
-   'SV' => 'SVC',
-   'GQ' => 'XAF',
-   'ER' => 'ERN',

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Revert "Add gateway_session_id to pending table"

2017-06-20 Thread Ejegg (Code Review)
Hello Mepps, Cdentinger, XenoRyet, Katie Horn, jenkins-bot, AndyRussG, Eileen, 
Awight,

I'd like you to do a code review.  Please visit

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

to review the following change.


Change subject: Revert "Add gateway_session_id to pending table"
..

Revert "Add gateway_session_id to pending table"

This reverts commit a1d631e5141b04464ffbe10b1b7615304fef9e88.

Change-Id: I4e1528bf71f7e72f83ca54741d6f1938a52a8819
---
M Core/DataStores/PendingDatabase.php
M Schema/mysql/001_CreatePendingTable.sql
M Schema/sqlite/001_CreatePendingTable.sql
M Tests/PendingDatabaseTest.php
4 files changed, 2 insertions(+), 54 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/46/360346/1

diff --git a/Core/DataStores/PendingDatabase.php 
b/Core/DataStores/PendingDatabase.php
index 81c82fb..dde9bd5 100644
--- a/Core/DataStores/PendingDatabase.php
+++ b/Core/DataStores/PendingDatabase.php
@@ -17,8 +17,7 @@
empty( $message['gateway'] ) ||
(   // need at least one transaction ID
empty( $message['gateway_txn_id'] ) &&
-   empty( $message['order_id'] ) &&
-   empty( $message['gateway_session_id'] )
+   empty( $message['order_id'] )
)
) {
throw new SmashPigException( 'Message missing required 
fields' );
@@ -38,11 +37,7 @@
// These fields (and date) have their own columns in the 
database
// Copy the values from the message to the record
$indexedFields = array(
-   'gateway',
-   'gateway_account',
-   'gateway_txn_id',
-   'order_id',
-   'gateway_session_id'
+   'gateway', 'gateway_account', 'gateway_txn_id', 
'order_id'
);
 
foreach ( $indexedFields as $fieldName ) {
@@ -80,31 +75,6 @@
$params = array(
'gateway' => $gatewayName,
'order_id' => $orderId,
-   );
-   $executed = $this->prepareAndExecute( $sql, $params );
-   $row = $executed->fetch( PDO::FETCH_ASSOC );
-   if ( !$row ) {
-   return null;
-   }
-   return $this->messageFromDbRow( $row );
-   }
-
-   /**
-* Return record matching a (gateway, gateway_session_id), or null
-*
-* @param $gatewayName string
-* @param $gatewaySessionId string
-* @return array|null Record related to a transaction, or null if 
nothing matches
-*/
-   public function fetchMessageByGatewaySessionId( $gatewayName, 
$gatewaySessionId ) {
-   $sql = 'select * from pending
-   where gateway = :gateway
-   and gateway_session_id = :gateway_session_id
-   limit 1';
-
-   $params = array(
-   'gateway' => $gatewayName,
-   'gateway_session_id' => $gatewaySessionId,
);
$executed = $this->prepareAndExecute( $sql, $params );
$row = $executed->fetch( PDO::FETCH_ASSOC );
diff --git a/Schema/mysql/001_CreatePendingTable.sql 
b/Schema/mysql/001_CreatePendingTable.sql
index 2d70fb2..76dd361 100644
--- a/Schema/mysql/001_CreatePendingTable.sql
+++ b/Schema/mysql/001_CreatePendingTable.sql
@@ -5,12 +5,10 @@
   `gateway_account` varchar(255) NULL,
   `order_id` varchar(255) NULL,
   `gateway_txn_id` varchar(255) NULL,
-  `gateway_session_id` varchar(255) NULL,
   `message` text NOT NULL,
   INDEX `idx_pending_date` (`date`),
   INDEX `idx_pending_date_gateway` (`date`, `gateway`),
   INDEX `idx_pending_order_id_gateway` (`order_id`, `gateway`),
   INDEX `idx_pending_gateway_txn_id_gateway` (`gateway_txn_id`, `gateway`),
-  INDEX `idx_pending_gateway_session_id_gateway` (`gateway_session_id`, 
`gateway`),
   PRIMARY KEY `pk_pending_id` (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
diff --git a/Schema/sqlite/001_CreatePendingTable.sql 
b/Schema/sqlite/001_CreatePendingTable.sql
index 758a8f6..0edcd69 100644
--- a/Schema/sqlite/001_CreatePendingTable.sql
+++ b/Schema/sqlite/001_CreatePendingTable.sql
@@ -5,6 +5,5 @@
   `gateway_account` varchar(255) NULL,
   `order_id` varchar(255) NULL,
   `gateway_txn_id` varchar(255) NULL,
-  `gateway_session_id` varchar(255) NULL,
   `message` text NOT NULL
 );
diff --git a/Tests/PendingDatabaseTest.php b/Tests/PendingDatabaseTest.php
index baf3ad7..8382eeb 100644
--- a/Tests/PendingDatabaseTest.php
+++ b/Tests/PendingDatabaseTest.php
@@ -32,7 +32,6 @@
'gateway' => 'test',
   

[MediaWiki-commits] [Gerrit] wikimedia...tools[deploy]: Merge branch 'master' into deploy

2017-06-19 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359962 )

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

Merge branch 'master' into deploy

961801a PayPal fixed the double space in their audit header

Change-Id: I02045f7d10f418cef77d8b1f9b2cd4a71a3fc94f
---
D audit/paypal/tests/data/express_checkout_donation.csv
D audit/paypal/tests/data/express_checkout_recurring_donation.csv
D audit/paypal/tests/data/express_checkout_recurring_refund.csv
D audit/paypal/tests/data/express_checkout_refund.csv
D audit/paypal/tests/test_trr_file.py
5 files changed, 0 insertions(+), 307 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/62/359962/1

diff --git a/audit/paypal/tests/data/express_checkout_donation.csv 
b/audit/paypal/tests/data/express_checkout_donation.csv
deleted file mode 100644
index f2c4d25..000
--- a/audit/paypal/tests/data/express_checkout_donation.csv
+++ /dev/null
@@ -1,5 +0,0 @@
-<<< HEAD   (585f54 Merge branch 'master' into deploy)
-===
-"CH","Transaction ID","Invoice ID","PayPal Reference ID","PayPal Reference ID 
Type","Transaction Event Code","Transaction Initiation Date","Transaction 
Completion Date","Transaction Debit or Credit","Gross Transaction 
Amount","Gross Transaction Currency","Fee Debit or Credit","Fee Amount","Fee 
Currency","Transactional Status","Insurance Amount","Sales Tax 
Amount","Shipping Amount","Transaction Subject","Transaction Note","Payer's 
Account ID","Payer Address Status","Item Name","Item ID","Option 1 
Name","Option 1 Value","Option 2 Name","Option 2 Value","Auction Site","Auction 
Buyer ID","Auction Closing Date","Shipping Address Line1","Shipping Address 
Line2","Shipping Address City","Shipping Address State","Shipping Address 
Zip","Shipping Address Country","Shipping Method","Custom Field","Billing 
Address Line1","Billing Address Line2","Billing Address City","Billing Address 
State","Billing Address Zip","Billing Address Country","Consumer ID","First 
Name","Last Name","Consumer Business Name","Card Type","Payment 
Source","Shipping Name","Authorization Review Status","Protection 
Eligibility","Payment Tracking ID"
-"SB","1V551844CE5526421","46239229.0","","","T0006",2017/03/02 09:59:55 
-0800,2017/03/02 09:59:55 
-0800,"CR",15000,"JPY","DR",4300,"JPY","S",,0,0,"Donation to the Wikimedia 
Foundation","","do...@generous.net","N","Donation to the Wikimedia 
Foundation","","","","","","","",,"","","","","","","","46239229","321 Notta 
Boulevard","","Whoville","OR","97211","US","RTWSDJI4S8DWK","Cindy 
Lou","Who","Cindy Lou Who","","Express Checkout","Cindy Lou, Who","01","02",""
->>> BRANCH (961801 PayPal fixed the double space in their audit header)
diff --git a/audit/paypal/tests/data/express_checkout_recurring_donation.csv 
b/audit/paypal/tests/data/express_checkout_recurring_donation.csv
deleted file mode 100644
index 98a3a53..000
--- a/audit/paypal/tests/data/express_checkout_recurring_donation.csv
+++ /dev/null
@@ -1,6 +0,0 @@
-<<< HEAD   (585f54 Merge branch 'master' into deploy)
-===
-"CH","Transaction ID","Invoice ID","PayPal Reference ID","PayPal Reference ID 
Type","Transaction Event Code","Transaction Initiation Date","Transaction 
Completion Date","Transaction Debit or Credit","Gross Transaction 
Amount","Gross Transaction Currency","Fee Debit or Credit","Fee Amount","Fee 
Currency","Transactional Status","Insurance Amount","Sales Tax 
Amount","Shipping Amount","Transaction Subject","Transaction Note","Payer's 
Account ID","Payer Address Status","Item Name","Item ID","Option 1 
Name","Option 1 Value","Option 2 Name","Option 2 Value","Auction Site","Auction 
Buyer ID","Auction Closing Date","Shipping Address Line1","Shipping Address 
Line2","Shipping Address City","Shipping Address State","Shipping Address 
Zip","Shipping Address Country","Shipping Method","Custom Field","Billing 
Address Line1","Billing Address Line2","Billing Address City","Billing Address 
State","Billing Address Zip","Billing Address Country","Consumer ID","First 
Name","Last Name","Consumer Business Name","Card Type","Payment 
Source","Shipping Name","Authorization Review Status","Protection 
Eligibility","Payment Tracking ID"
-"SB","4JH2438EE9876546W","45931681","I-SS5RD7POSD46","","T0002",2017/03/04 
05:36:05 -0800,2017/03/04 05:36:05 
-0800,"CR",15000,"JPY","DR",4300,"JPY","S",,,0,"Monthly donation to the 
Wikimedia Foundation","","do...@generous.net","N","Monthly donation to the 
Wikimedia 
Foundation","","","","","","","",,"","","","","","","","","","","","","","","RTWSDJI4S8DWK","Cindy
 Lou","Who","Cindy Lou Who","","Others","Cindy Lou, Who","01","02",""
-
->>> BRANCH (961801 PayPal fixed the double space in their audit header)
diff --git a/audit/paypal/tests/data/express_checkout_recurring_refund.csv 
b/audit/paypal/tests/data/express_checkout_recurring_refund.csv
deleted file mode 100644

[MediaWiki-commits] [Gerrit] wikimedia...tools[master]: PayPal fixed the double space in their audit header

2017-06-19 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359956 )

Change subject: PayPal fixed the double space in their audit header
..

PayPal fixed the double space in their audit header

Change-Id: I4cf9a3c3ba169ee8b801228547b2ba3ee2b2715f
TODO: trim, normalize spaces, maybe even ignore case
---
M audit/paypal/TrrFile.py
M audit/paypal/tests/data/express_checkout_donation.csv
M audit/paypal/tests/data/express_checkout_recurring_donation.csv
M audit/paypal/tests/data/express_checkout_recurring_refund.csv
M audit/paypal/tests/data/express_checkout_refund.csv
M audit/paypal/tests/test_trr_file.py
6 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/56/359956/1

diff --git a/audit/paypal/TrrFile.py b/audit/paypal/TrrFile.py
index f57def0..2b1e851 100644
--- a/audit/paypal/TrrFile.py
+++ b/audit/paypal/TrrFile.py
@@ -27,7 +27,7 @@
 "Transaction Event Code",
 "Transaction Initiation Date",
 "Transaction Completion Date",
-"Transaction  Debit or Credit",
+"Transaction Debit or Credit",
 "Gross Transaction Amount",
 "Gross Transaction Currency",
 "Fee Debit or Credit",
@@ -155,7 +155,7 @@
 out['subscr_id'] = row['PayPal Reference ID']
 if not out['subscr_id']:
 raise Exception('Missing field subscr_id')
-elif row['Transaction  Debit or Credit'] == 'DR':
+elif row['Transaction Debit or Credit'] == 'DR':
 # sic: double-space is coming from the upstream
 log.info("-Debit\t{id}\t{date}\tPayment 
to".format(id=out['gateway_txn_id'], date=out['date']))
 # This payment is from us!  Do not send to the CRM.
diff --git a/audit/paypal/tests/data/express_checkout_donation.csv 
b/audit/paypal/tests/data/express_checkout_donation.csv
index 1c9add6..18e603f 100644
--- a/audit/paypal/tests/data/express_checkout_donation.csv
+++ b/audit/paypal/tests/data/express_checkout_donation.csv
@@ -1,2 +1,2 @@
-"CH","Transaction ID","Invoice ID","PayPal Reference ID","PayPal Reference ID 
Type","Transaction Event Code","Transaction Initiation Date","Transaction 
Completion Date","Transaction  Debit or Credit","Gross Transaction 
Amount","Gross Transaction Currency","Fee Debit or Credit","Fee Amount","Fee 
Currency","Transactional Status","Insurance Amount","Sales Tax 
Amount","Shipping Amount","Transaction Subject","Transaction Note","Payer's 
Account ID","Payer Address Status","Item Name","Item ID","Option 1 
Name","Option 1 Value","Option 2 Name","Option 2 Value","Auction Site","Auction 
Buyer ID","Auction Closing Date","Shipping Address Line1","Shipping Address 
Line2","Shipping Address City","Shipping Address State","Shipping Address 
Zip","Shipping Address Country","Shipping Method","Custom Field","Billing 
Address Line1","Billing Address Line2","Billing Address City","Billing Address 
State","Billing Address Zip","Billing Address Country","Consumer ID","First 
Name","Last Name","Consumer Business Name","Card Type","Payment 
Source","Shipping Name","Authorization Review Status","Protection 
Eligibility","Payment Tracking ID"
+"CH","Transaction ID","Invoice ID","PayPal Reference ID","PayPal Reference ID 
Type","Transaction Event Code","Transaction Initiation Date","Transaction 
Completion Date","Transaction Debit or Credit","Gross Transaction 
Amount","Gross Transaction Currency","Fee Debit or Credit","Fee Amount","Fee 
Currency","Transactional Status","Insurance Amount","Sales Tax 
Amount","Shipping Amount","Transaction Subject","Transaction Note","Payer's 
Account ID","Payer Address Status","Item Name","Item ID","Option 1 
Name","Option 1 Value","Option 2 Name","Option 2 Value","Auction Site","Auction 
Buyer ID","Auction Closing Date","Shipping Address Line1","Shipping Address 
Line2","Shipping Address City","Shipping Address State","Shipping Address 
Zip","Shipping Address Country","Shipping Method","Custom Field","Billing 
Address Line1","Billing Address Line2","Billing Address City","Billing Address 
State","Billing Address Zip","Billing Address Country","Consumer ID","First 
Name","Last Name","Consumer Business Name","Card Type","Payment 
Source","Shipping Name","Authorization Review Status","Protection 
Eligibility","Payment Tracking ID"
 "SB","1V551844CE5526421","46239229.0","","","T0006",2017/03/02 09:59:55 
-0800,2017/03/02 09:59:55 
-0800,"CR",15000,"JPY","DR",4300,"JPY","S",,0,0,"Donation to the Wikimedia 
Foundation","","do...@generous.net","N","Donation to the Wikimedia 
Foundation","","","","","","","",,"","","","","","","","46239229","321 Notta 
Boulevard","","Whoville","OR","97211","US","RTWSDJI4S8DWK","Cindy 
Lou","Who","Cindy Lou Who","","Express Checkout","Cindy Lou, Who","01","02",""
diff --git 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Temporarily stop storing invoice id

2017-06-16 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359630 )

Change subject: Temporarily stop storing invoice id
..

Temporarily stop storing invoice id

Just commenting key lines out to make it easier to rebase the
unique-ifying change ( I96b1cbc04da9f376f74 ) on top of it.

Until then, it's more harmful than helpful to prevent the duplicates
from being entered in CiviCRM

Bug: T165918
Change-Id: Id30deb3ca050b8a3ca7dd9119f26cc04b7c29c5a
---
M sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/30/359630/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
index 6028af3..7e625f6 100644
--- a/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
@@ -61,7 +61,7 @@
'financial_type' => 'Cash',
'contribution_status' => 'Completed',
'payment_instrument' => 'Credit Card: Visa',
-   'invoice_id' => $message->get('order_id'),
+   // 'invoice_id' => $message->get('order_id'),
$campaignField => '',
);
$returnFields = array_keys( $expected );
@@ -101,7 +101,7 @@
'financial_type' => 'Cash',
'contribution_status' => 'Completed',
'payment_instrument' => 'Credit Card: Visa',
-   'invoice_id' => $message2->get('order_id'),
+   // 'invoice_id' => $message2->get('order_id'),
$campaignField => 'Benefactor Gift',
);
$this->assertArraySubset( $expected, $contribution2 );
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index aba9dd1..1426931 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -356,10 +356,10 @@
 
 // Store the identifier we generated on payments
 if ( !empty( $msg['order_id'] ) ) {
-$contribution['invoice_id'] = $msg['order_id'];
+//$contribution['invoice_id'] = $msg['order_id'];
 // The invoice_id column has a unique constraint
 if ( $msg['recurring'] ) {
-$contribution['invoice_id'] .= '|recur-' . 
UtcDate::getUtcTimestamp();
+//$contribution['invoice_id'] .= '|recur-' . 
UtcDate::getUtcTimestamp();
 }
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id30deb3ca050b8a3ca7dd9119f26cc04b7c29c5a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Add one more yahoo tld

2017-06-15 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359361 )

Change subject: Add one more yahoo tld
..

Add one more yahoo tld

Argentinians were getting .com.au autosuggestions.

Change-Id: Ia4baa81ad3c5fdecc3ced7e62d11e5575df751d0
---
M modules/js/ext.donationInterface.validation.js
1 file changed, 4 insertions(+), 3 deletions(-)


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

diff --git a/modules/js/ext.donationInterface.validation.js 
b/modules/js/ext.donationInterface.validation.js
index 6d92ddf..de472dd 100644
--- a/modules/js/ext.donationInterface.validation.js
+++ b/modules/js/ext.donationInterface.validation.js
@@ -83,9 +83,10 @@
'tiscali.co.uk', 'tiscali.it', 'tpg.com.au', 
'umich.edu',
'uol.com.br', 'videotron.ca', 'virgilio.it', 
'wanadoo.fr',
'web.de', 'windstream.net', 'wp.pl', 
'xs4all.nl', 'xtra.co.nz',
-   'yahoo.ca', 'yahoo.co.in', 'yahoo.co.jp', 
'yahoo.com.au',
-   'yahoo.com.br', 'yahoo.com.mx', 'yahoo.de', 
'yahoo.es',
-   'yahoo.fr', 'yahoo.it', 'ybb.ne.jp', 
'ymail.com', 'ziggo.nl'
+   'yahoo.ca', 'yahoo.co.in', 'yahoo.co.jp', 
'yahoo.com.ar',
+   'yahoo.com.au', 'yahoo.com.br', 'yahoo.com.mx', 
'yahoo.de',
+   'yahoo.es', 'yahoo.fr', 'yahoo.it', 
'ybb.ne.jp', 'ymail.com',
+   'ziggo.nl'
] ),
suggested: function ( element, suggestion ) {
var message = mw.msg(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4baa81ad3c5fdecc3ced7e62d11e5575df751d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...DjangoBannerStats[master]: Update LandingPage regex for new name

2017-06-15 Thread Ejegg (Code Review)
Ejegg has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/358487 )

Change subject: Update LandingPage regex for new name
..


Update LandingPage regex for new name

Special:FundraiserLandingPage will soon be redirecting to
Special:LandingPage.

DEPLOYMENT NOTE: do not deploy till after Ic29dfa36727161e is live
on donatewiki.

Change-Id: I70741c91abb88e4f0ea41a119938bea35191e570
---
M fundraiser/analytics/regex.py
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Mepps: Looks good to me, approved
  Ejegg: Verified



diff --git a/fundraiser/analytics/regex.py b/fundraiser/analytics/regex.py
index eccfde9..268efd4 100644
--- a/fundraiser/analytics/regex.py
+++ b/fundraiser/analytics/regex.py
@@ -190,7 +190,8 @@
   | w/index.php\?title=
 )
 (
-Special:FundraiserLandingPage
+Special:LandingPage
+#  | Special:FundraiserLandingPage # These will now 302 redirect 
to Special:LandingPage
 #  | Special:FundraiserRedirector # these 302 and should result in 
a valid call to S:FLP
 )
 """, re.VERBOSE | re.IGNORECASE

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I70741c91abb88e4f0ea41a119938bea35191e570
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools/DjangoBannerStats
Gerrit-Branch: master
Gerrit-Owner: Ejegg 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Mepps 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: TEST: do we need the refresh?

2017-06-15 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359233 )

Change subject: TEST: do we need the refresh?
..

TEST: do we need the refresh?

Change-Id: I4896c8460c8cb76f362066a10ca717c154af5ef7
---
M sites/all/modules/wmf_civicrm/tests/phpunit/PhoneImportTest.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/33/359233/1

diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/PhoneImportTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/PhoneImportTest.php
index 63cafcb..41ce6d0 100644
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/PhoneImportTest.php
+++ b/sites/all/modules/wmf_civicrm/tests/phpunit/PhoneImportTest.php
@@ -7,7 +7,7 @@
 class PhoneImportTest extends BaseWmfDrupalPhpUnitTestCase {
 
 public function testPhoneImport() {
-  $this->refreshStripFunction();
+  //$this->refreshStripFunction();
 
 $phoneNumber = '555-555-';
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4896c8460c8cb76f362066a10ca717c154af5ef7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: WIP send resultswitcher reloaders to TY page

2017-06-15 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359213 )

Change subject: WIP send resultswitcher reloaders to TY page
..

WIP send resultswitcher reloaders to TY page

This restores some logic we used to have that kept track of processed
orders in a key outside of the donor data.

TODO: tests

Also TODO: shouldn't globalcollectadapter return true for
isReturnProcessingRequired() ?

Bug: T167990
Change-Id: I9d23953e180b85d0d7ae357442760dd5c4d4619c
---
M gateway_common/GatewayPage.php
M gateway_common/gateway.adapter.php
M paypal_gateway/express_checkout/paypal_express.adapter.php
3 files changed, 53 insertions(+), 0 deletions(-)


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

diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index 4b1f2ba..9401b8f 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -400,6 +400,14 @@
 
if ( $deadSession ){
if ( $this->adapter->isReturnProcessingRequired() ) {
+   if ( $this->isRepeatReturnProcess() ) {
+   $this->logger->warning(
+   'Resultswitcher: session is 
dead, but the donor ' .
+   'is trying to process an 
already-processed payment.'
+   );
+   $this->displayThankYouPage( 'repeat 
return processing' );
+   return;
+   }
wfHttpError( 403, 'Forbidden', wfMessage( 
'donate_interface-error-http-403' )->text() );
throw new RuntimeException(
'Resultswitcher: Request forbidden. No 
active donation in the session. ' .
@@ -429,6 +437,7 @@
// feed processDonorReturn all the GET and POST vars
$requestValues = $this->getRequest()->getValues();
$result = $this->adapter->processDonorReturn( 
$requestValues );
+   $this->markReturnProcessed();
$this->renderResponse( $result );
return;
} else {
@@ -567,4 +576,31 @@
);
}
}
+
+   protected function isRepeatReturnProcess() {
+   $request = $this->getRequest();
+   $requestProcessId = $this->adapter->getRequestProcessId(
+   $request->getValues()
+   );
+   $processedRequests = $request->getSessionData( 
'processed_requests' );
+   return array_key_exists( $requestProcessId, $processedRequests 
);
+   }
+
+   protected function markReturnProcessed() {
+   $request = $this->getRequest();
+   $requestProcessId = $this->adapter->getRequestProcessId(
+   $request->getValues()
+   );
+   if ( !$requestProcessId ) {
+   return;
+   }
+   $processedRequests = $request->getSessionData( 
'processed_requests' );
+   if ( !$processedRequests ) {
+   $processedRequests = array();
+   }
+   // TODO: we could store the results of the last process here, 
but for now
+   // we just indicate we did SOMETHING with it
+   $processedRequests[$requestProcessId] = true;
+   $request->setSessionData( 'processed_requests', 
$processedRequests );
+   }
 }
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index f26ffd0..9a25296 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1452,6 +1452,18 @@
}
 
/**
+* Gateways which return true from isReturnProcessingRequired must
+* override this with logic to get an ID from the request which will
+* identify repeated attempts to process the same payment.
+*
+* @param array $requestValues
+* @return int|string Order id
+*/
+   protected function getRequestProcessId( $requestValues ) {
+   return null;
+   }
+
+   /**
 * Process the API response obtained from the payment processor and set
 * properties of transaction_response.
 * Default implementation just says we got a response.
@@ -2945,6 +2957,7 @@
'PaymentForms',
'numAttempt',
'order_status', //for post-payment activities
+   'processed_requests', //for post-payment 
activities

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Update doc link on paypal currency list

2017-06-15 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359185 )

Change subject: Update doc link on paypal currency list
..

Update doc link on paypal currency list

Looks like no more 'x.com'

Change-Id: I62cb1e56cc57ed36219eb3728f92ab7fec9b16d5
---
M paypal_gateway/express_checkout/config/currencies.yaml
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/paypal_gateway/express_checkout/config/currencies.yaml 
b/paypal_gateway/express_checkout/config/currencies.yaml
index 51369e9..9822e5a 100644
--- a/paypal_gateway/express_checkout/config/currencies.yaml
+++ b/paypal_gateway/express_checkout/config/currencies.yaml
@@ -1,4 +1,4 @@
-# see 
https://www.x.com/developers/paypal/documentation-tools/api/currency-codes
+# see https://developer.paypal.com/docs/classic/api/currency_codes/
 # TODO: Investigate per-country support at this URL
 # https://developer.paypal.com/docs/classic/api/currency_codes/#creditcard
 - AUD
@@ -8,7 +8,7 @@
 - DKK
 - EUR
 - HKD
-- HUF
+- HUF # no fractions
 - ILS
 - JPY # no fractions
 # - MYR # in-country only

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62cb1e56cc57ed36219eb3728f92ab7fec9b16d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

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


<    1   2   3   4   5   6   7   8   9   10   >