[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Stop shadowing Response

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

Change subject: Stop shadowing Response
..

Stop shadowing Response

Already a class in same NS that extends the Symfony one
Hat tip to Scrutinizer!

Change-Id: I0dfdbca8741e287334d8525ce2674652f3ab9a03
---
M Core/Http/HttpStatusValidator.php
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/12/348012/1

diff --git a/Core/Http/HttpStatusValidator.php 
b/Core/Http/HttpStatusValidator.php
index 7a88f0b..ab452f3 100644
--- a/Core/Http/HttpStatusValidator.php
+++ b/Core/Http/HttpStatusValidator.php
@@ -3,7 +3,6 @@
 namespace SmashPig\Core\Http;
 
 use SmashPig\Core\Logging\Logger;
-use Symfony\Component\HttpFoundation\Response;
 
 /**
  * Determines whether to retry HTTP requests based on status code

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0dfdbca8741e287334d8525ce2674652f3ab9a03
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]: New black and white WMF favicon

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

Change subject: New black and white WMF favicon
..

New black and white WMF favicon

Deployment note - coordinate with comms, also deploy a LocalSettings
change to point to the new logos:

$wgLogo = "images/e/eb/Wmf_logo.png";
$wgLogoHD = array(
"1.5x" => "images/f/fc/Wmf_logo_1.5x.png",
"2x" => "images/d/d1/Wmf_logo_2x.png"
);

Bug: T141921
Change-Id: If33a5e6fd0290ac5cdf63316606aa1eebae0dd80
---
M favicon.ico
1 file changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/04/347904/1

diff --git a/favicon.ico b/favicon.ico
index bde61ef..eb0c14c 100644
--- a/favicon.ico
+++ b/favicon.ico
Binary files differ

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If33a5e6fd0290ac5cdf63316606aa1eebae0dd80
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]: Use the ultra-crushed versions of the new logos

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

Change subject: Use the ultra-crushed versions of the new logos
..

Use the ultra-crushed versions of the new logos

Change-Id: Ic9102f1a60fe74c74827d09b226ad92e064c01d9
---
M images/d/d1/Wmf_logo_2x.png
M images/e/eb/Wmf_logo.png
M images/f/fc/Wmf_logo_1.5x.png
3 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/347902/1

diff --git a/images/d/d1/Wmf_logo_2x.png b/images/d/d1/Wmf_logo_2x.png
index 52f56d3..e26eb0b 100644
--- a/images/d/d1/Wmf_logo_2x.png
+++ b/images/d/d1/Wmf_logo_2x.png
Binary files differ
diff --git a/images/e/eb/Wmf_logo.png b/images/e/eb/Wmf_logo.png
index 29e8286..197efa5 100644
--- a/images/e/eb/Wmf_logo.png
+++ b/images/e/eb/Wmf_logo.png
Binary files differ
diff --git a/images/f/fc/Wmf_logo_1.5x.png b/images/f/fc/Wmf_logo_1.5x.png
index 4d52209..6c1643f 100644
--- a/images/f/fc/Wmf_logo_1.5x.png
+++ b/images/f/fc/Wmf_logo_1.5x.png
Binary files differ

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9102f1a60fe74c74827d09b226ad92e064c01d9
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]: Add new black and white logo in 3 sizes

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

Change subject: Add new black and white logo in 3 sizes
..

Add new black and white logo in 3 sizes

Change-Id: I4893e0cfdbdd27bd725579759f4a5c6e2835b97d
---
A images/d/d1/Wmf_logo_2x.png
A images/e/eb/Wmf_logo.png
A images/f/fc/Wmf_logo_1.5x.png
3 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/78/347878/1

diff --git a/images/d/d1/Wmf_logo_2x.png b/images/d/d1/Wmf_logo_2x.png
new file mode 100644
index 000..67f439d
--- /dev/null
+++ b/images/d/d1/Wmf_logo_2x.png
Binary files differ
diff --git a/images/e/eb/Wmf_logo.png b/images/e/eb/Wmf_logo.png
new file mode 100644
index 000..c4dfeaa
--- /dev/null
+++ b/images/e/eb/Wmf_logo.png
Binary files differ
diff --git a/images/f/fc/Wmf_logo_1.5x.png b/images/f/fc/Wmf_logo_1.5x.png
new file mode 100644
index 000..bed0ccc
--- /dev/null
+++ b/images/f/fc/Wmf_logo_1.5x.png
Binary files differ

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4893e0cfdbdd27bd725579759f4a5c6e2835b97d
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...tools[deploy]: Merge branch 'master' into deploy

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

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

Merge branch 'master' into deploy

ddc70dd Don't crash on missing ct_id

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


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/89/347789/1


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

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

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


[MediaWiki-commits] [Gerrit] wikimedia...tools[master]: Don't crash on missing ct_id

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

Change subject: Don't crash on missing ct_id
..

Don't crash on missing ct_id

Some records we'll ignore have none, let's not send failmail

Change-Id: I1ab2e4d3485cd18839dfaed1f0aed17786005714
---
M audit/paypal/TrrFile.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/87/347787/1

diff --git a/audit/paypal/TrrFile.py b/audit/paypal/TrrFile.py
index 25eab2c..d4a01eb 100644
--- a/audit/paypal/TrrFile.py
+++ b/audit/paypal/TrrFile.py
@@ -145,7 +145,7 @@
 # Here it can be the ct_id.attempt format
 out['contribution_tracking_id'] = row['Invoice ID'].split('.')[0]
 
-if out['contribution_tracking_id']:
+if 'contribution_tracking_id' in out:
 out['order_id'] = out['contribution_tracking_id']
 
 event_type = row['Transaction Event Code'][0:3]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ab2e4d3485cd18839dfaed1f0aed17786005714
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[master]: Get rid of subscription paths

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

Change subject: Get rid of subscription paths
..

Get rid of subscription paths

No need to change these in the UI, and most were'nt actually wired
up any more.

Change-Id: I21e379fb840c9578079726ff2f63818aaf8a7d28
---
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/recurring/recurring.module
M sites/all/modules/queue2civicrm/refund/wmf_refund_qc.module
M sites/all/modules/queue2civicrm/unsubscribe/wmf_unsubscribe_qc.module
5 files changed, 3 insertions(+), 55 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/72/347772/1

diff --git 
a/sites/all/modules/queue2civicrm/banner_history/banner_history.module 
b/sites/all/modules/queue2civicrm/banner_history/banner_history.module
index b3f4f11..07f5752 100644
--- a/sites/all/modules/queue2civicrm/banner_history/banner_history.module
+++ b/sites/all/modules/queue2civicrm/banner_history/banner_history.module
@@ -32,15 +32,6 @@
' queue and placed in a table.' ),
);
 
-   $form['banner_history_queue'] = array(
-   '#type' => 'textfield',
-   '#title' => t( 'Subscription path' ),
-   '#required' => true,
-   '#default_value' => variable_get(
-   'banner_history_queue', 'banner-history' ),
-   '#description'   => t( 'Queue for banner history log ID 
associations' ),
-   );
-
$form['banner_history_batch'] = array(
'#type' => 'textfield',
'#title' => t( 'Batch size' ),
@@ -77,10 +68,8 @@
 $config = Configuration::createForView();
 Context::initWithLogger( $config, 'banner_history' );
 
-   $queue = variable_get( 'banner_history_queue', 'banner-history' );
-
$qc = new BannerHistoryQueueConsumer(
-   $queue,
+   'banner-history',
variable_get( 'banner_history_batch_time', 0 ),
variable_get( 'banner_history_batch', 0 )
);
diff --git a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module 
b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
index 2c99b58..593be09 100644
--- a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
+++ b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
@@ -33,23 +33,6 @@
 '#default_value' => variable_get('fredge_qc_disable', false),
   );
 
-  $form['fredge_payments_init_queue'] = array(
-'#type' => 'textfield',
-'#title' => t('Payments-init queue name'),
-'#required' => TRUE,
-'#default_value' => variable_get('fredge_payments_init_queue', 
'payments-init'),
-'#description' => t('Config key under data-store for payments-init queue'),
-  );
-
-  $form['fredge_payments_antifraud_queue'] = array(
-'#type' => 'textfield',
-'#title' => t('Payments-antifraud queue name'),
-'#required' => TRUE,
-'#default_value' => variable_get('fredge_payments_antifraud_queue', 
'payments-antifraud'),
-'#description' => t('Config key under data-store for payments-antifraud 
queue'),
-  );
-//  payments-antifraud
-
   $form['fredge_batch_time'] = array(
 '#type' => 'textfield',
 '#title' => t('Job time limit (in seconds)'),
@@ -77,14 +60,14 @@
   $cycle_time = variable_get('fredge_batch_time', 0) / 2;
 
   $paymentsInitConsumer = new PaymentsInitQueueConsumer(
-variable_get('fredge_payments_init_queue', 'payments-init'),
+'payments-init',
 $cycle_time
   );
 
   $processed = $paymentsInitConsumer->dequeueMessages();
 
   $fraudQueueConsumer = new AntifraudQueueConsumer(
-variable_get('fredge_payments_antifraud_queue', 'payments-antifraud'),
+'payments-antifraud',
 $cycle_time
   );
 
diff --git a/sites/all/modules/queue2civicrm/recurring/recurring.module 
b/sites/all/modules/queue2civicrm/recurring/recurring.module
index 106e2b7..37419d3 100644
--- a/sites/all/modules/queue2civicrm/recurring/recurring.module
+++ b/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -48,14 +48,6 @@
 '#markup' => t('The recurring queue contains notifications pertaining 
to subscription donations, such as monthly payments, cancellation,and 
expiration.'),
   );
 
-  $form['recurring_subscription'] = array(
-'#type' => 'textfield',
-'#title' => t('Subscription path'),
-'#required' => TRUE,
-'#default_value' => variable_get('recurring_subscription', 
'/queue/donations_recurring'),
-'#description' => t( 'Queue to watch for recurring notifications' ),
-  );
-
   $form['recurring_batch'] = array(
 '#type' => 'select',
 '#title' => t('Cron batch size'),
diff --git a/sites/all/modules/queue2civicrm/refund/wmf_refund_qc.module 
b/sites/all/modules/queue2civicrm/refund/wmf_refund_qc.module

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Use constants for HTTP status codes

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

Change subject: Use constants for HTTP status codes
..

Use constants for HTTP status codes

Change-Id: I4325d080631c85c6187001487796ec0aa56b5593
---
M Core/Http/HttpStatusValidator.php
M Core/Http/RequestHandler.php
M Core/Listeners/RestListener.php
M PaymentProviders/Ingenico/RestResponseValidator.php
M PaymentProviders/PayPal/Listener.php
5 files changed, 19 insertions(+), 17 deletions(-)


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

diff --git a/Core/Http/HttpStatusValidator.php 
b/Core/Http/HttpStatusValidator.php
index 68c6859..7a88f0b 100644
--- a/Core/Http/HttpStatusValidator.php
+++ b/Core/Http/HttpStatusValidator.php
@@ -3,6 +3,7 @@
 namespace SmashPig\Core\Http;
 
 use SmashPig\Core\Logging\Logger;
+use Symfony\Component\HttpFoundation\Response;
 
 /**
  * Determines whether to retry HTTP requests based on status code
@@ -19,12 +20,12 @@
$body = $parsedResponse['body'];
 
switch ( $statusCode ) {
-   case 400:   // Oh noes! Bad request.. BAD CODE, BAD BAD 
CODE!
+   case Response::HTTP_BAD_REQUEST:   // Oh noes! Bad 
request.. BAD CODE, BAD BAD CODE!
$continue = false;
Logger::error( "Request returned (400) BAD 
REQUEST: $body" );
break;
 
-   case 403:   // Hmm, forbidden? Maybe if we ask it 
nicely again...
+   case Response::HTTP_FORBIDDEN:   // Hmm, forbidden? 
Maybe if we ask it nicely again...
$continue = true;
Logger::alert( "Request returned (403) 
FORBIDDEN: $body" );
break;
@@ -39,8 +40,8 @@
 
protected function getSuccessCodes() {
return array(
-   200, // Everything is AWESOME
-   201  // Also fine, and we created a thing
+   Response::HTTP_OK, // Everything is AWESOME
+   Response::HTTP_CREATED  // Also fine, and we created a 
thing
);
}
 }
diff --git a/Core/Http/RequestHandler.php b/Core/Http/RequestHandler.php
index 5036a69..4744e38 100644
--- a/Core/Http/RequestHandler.php
+++ b/Core/Http/RequestHandler.php
@@ -36,7 +36,7 @@
 
if ( count( $parts ) < 2 ) {
$response->setStatusCode(
-   403,
+   Response::HTTP_FORBIDDEN,
'Cannot process this request: bad URI format. A 
configuration node and an action is required'
);
return $response;
@@ -57,7 +57,7 @@
 
if ( $config->nodeExists( 'disabled' ) && $config->val( 
'disabled' ) ) {
Logger::debug( '403 will be given for disabled view.', 
$uri );
-   $response->setStatusCode( 403, "View '$view' disabled. 
Cannot continue." );
+   $response->setStatusCode( Response::HTTP_FORBIDDEN, 
"View '$view' disabled. Cannot continue." );
return $response;
}
 
@@ -80,7 +80,7 @@
Logger::info( "Starting processing for request, configuration 
view: '$view', action: '$action'" );
if ( !$config->nodeExists( "endpoints/$action" ) ) {
Logger::debug( '403 will be given for unknown action on 
inbound URL.', $uri );
-   $response->setStatusCode( 403, "Action '$action' not 
configured. Cannot continue." );
+   $response->setStatusCode( Response::HTTP_FORBIDDEN, 
"Action '$action' not configured. Cannot continue." );
return $response;
}
 
@@ -101,11 +101,11 @@
} else {
$str = "Requested action '$action' does not implement a 
known handler. Cannot continue.";
Logger::debug( $str );
-   $response->setStatusCode( 500, $str );
+   $response->setStatusCode( 
Response::HTTP_INTERNAL_SERVER_ERROR, $str );
}
 
$code = $response->getStatusCode();
-   if ( ( $code !== 200 ) && ( $code !== 302 ) ) {
+   if ( ( $code !== Response::HTTP_OK ) && ( $code !== 
Response::HTTP_FOUND ) ) {
$response->setContent( '' );
}
return $response;
@@ -125,7 +125,7 @@
 
$response = new Response();
$response->setPrivate();
-   $response->setStatusCode( 500, "Unhandled internal server 
error." );
+   $response->setStatusCode( Response::HTTP_INTERNAL_SERVER_ERROR, 

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

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

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

Get the width=device-width viewport value

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/347458/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index ef08626..400cd71 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit ef08626be87f9e71e756b4f8dd6c806ca5150614
+Subproject commit 400cd713fc8a988d1e7f8662ee307139d9dc25fb

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70624fa5c866403dd4db7b003115d723ef095018
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-04-10 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/347454 )

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

Merge branch 'master' into deployment

3be550e Add width=device-width to forms viewport meta

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


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


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87ae2ac69195bc501a30fd75d6ddfbb1e79018af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
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]: Add width=device-width to forms viewport meta

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

Change subject: Add width=device-width to forms viewport meta
..

Add width=device-width to forms viewport meta

This is currently being injected via the appeal template. Can't do
that any more!

Change-Id: I2be4e503411f6e3772b970fd55eb7b6aedb99a6a
---
M gateway_common/GatewayPage.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index 491add7..7e53803 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -101,7 +101,7 @@
Html::element(
'meta', array(
'name' => 'viewport',
-   'content' => 
'initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0',
+   'content' => 
'initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0, 
width=device-width',
)
)
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2be4e503411f6e3772b970fd55eb7b6aedb99a6a
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]: Merge branch 'REL1_27' into fundraising/REL1_27

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

Change subject: Merge branch 'REL1_27' into fundraising/REL1_27
..

Merge branch 'REL1_27' into fundraising/REL1_27

Get 1.27.2 updates, and reset DonationInterface to currently
deployed version.

Change-Id: I283251573b7d2ede9567a64287cfa67ae790e7f8
---
M extensions/DonationInterface
M includes/DefaultSettings.php
M includes/Title.php
M tests/phpunit/includes/user/UserTest.php
M vendor
5 files changed, 3 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/11/347411/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index ef08626..400cd71 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit ef08626be87f9e71e756b4f8dd6c806ca5150614
+Subproject commit 400cd713fc8a988d1e7f8662ee307139d9dc25fb
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index d972fe1..d5c9671 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -75,11 +75,7 @@
  * MediaWiki version number
  * @since 1.2
  */
-<<< HEAD   (a56fc7 Add blank index.html)
-$wgVersion = '1.27.0-fundraising';
-===
-$wgVersion = '1.27.2';
->>> BRANCH (1c409c Bump $wgVersion and finalise RELEASE-NOTES for 1.27.2)
+$wgVersion = '1.27.2-fundraising';
 
 /**
  * Name of the site. It must be changed in LocalSettings.php
diff --git a/includes/Title.php b/includes/Title.php
index 58e3cc5..4228f93 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -2338,10 +2338,6 @@
if ( $action === 'read' && !$wgBlockDisablesLogin ) {
return $errors;
}
-<<< HEAD   (a56fc7 Add blank index.html)
-
-===
->>> BRANCH (1c409c Bump $wgVersion and finalise RELEASE-NOTES for 1.27.2)
 
if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) {
$errors[] = [ 'confirmedittext' ];
diff --git a/tests/phpunit/includes/user/UserTest.php 
b/tests/phpunit/includes/user/UserTest.php
index 2efdd4b..fdda7dc 100644
--- a/tests/phpunit/includes/user/UserTest.php
+++ b/tests/phpunit/includes/user/UserTest.php
@@ -110,11 +110,7 @@
// Add a hook manipluating the rights
$this->mergeMwGlobalArrayValue( 'wgHooks', [ 'UserGetRights' => 
[ function ( $user, &$rights ) {
$rights[] = 'nukeworld';
-<<< HEAD   (a56fc7 Add blank index.html)
-   $rights = array_diff( $rights, array( 'writetest' ) );
-===
$rights = array_diff( $rights, [ 'writetest' ] );
->>> BRANCH (1c409c Bump $wgVersion and finalise RELEASE-NOTES for 1.27.2)
} ] ] );
 
$userWrapper->mRights = null;
diff --git a/vendor b/vendor
index 406e48f..799c808 16
--- a/vendor
+++ b/vendor
@@ -1 +1 @@
-Subproject commit 406e48fff4447c799303c4b067a2cce72f87fb73
+Subproject commit 799c8088346c7564a1937d53a378c4c892a42ff9

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I283251573b7d2ede9567a64287cfa67ae790e7f8
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/vendor[fundraising/REL1_27]: Update lessphp, use autoload_static

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

Change subject: Update lessphp, use autoload_static
..

Update lessphp, use autoload_static

No more php53lint to get tripped up by static

Change-Id: Ie048f6026d25edea469abec7b2a89662be62cb99
---
M composer/autoload_real.php
A composer/autoload_static.php
M composer/installed.json
M oyejorge/less.php/bin/lessc
4 files changed, 392 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor 
refs/changes/10/347410/1

diff --git a/composer/autoload_real.php b/composer/autoload_real.php
index b354a04..c54d8f0 100644
--- a/composer/autoload_real.php
+++ b/composer/autoload_real.php
@@ -23,24 +23,35 @@
 self::$loader = $loader = new \Composer\Autoload\ClassLoader();
 
spl_autoload_unregister(array('ComposerAutoloaderInit_mediawiki_vendor', 
'loadClassLoader'));
 
-$map = require __DIR__ . '/autoload_namespaces.php';
-foreach ($map as $namespace => $path) {
-$loader->set($namespace, $path);
-}
+$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
+if ($useStaticLoader) {
+require_once __DIR__ . '/autoload_static.php';
 
-$map = require __DIR__ . '/autoload_psr4.php';
-foreach ($map as $namespace => $path) {
-$loader->setPsr4($namespace, $path);
-}
+
call_user_func(\Composer\Autoload\ComposerStaticInit_mediawiki_vendor::getInitializer($loader));
+} else {
+$map = require __DIR__ . '/autoload_namespaces.php';
+foreach ($map as $namespace => $path) {
+$loader->set($namespace, $path);
+}
 
-$classMap = require __DIR__ . '/autoload_classmap.php';
-if ($classMap) {
-$loader->addClassMap($classMap);
+$map = require __DIR__ . '/autoload_psr4.php';
+foreach ($map as $namespace => $path) {
+$loader->setPsr4($namespace, $path);
+}
+
+$classMap = require __DIR__ . '/autoload_classmap.php';
+if ($classMap) {
+$loader->addClassMap($classMap);
+}
 }
 
 $loader->register(false);
 
-$includeFiles = require __DIR__ . '/autoload_files.php';
+if ($useStaticLoader) {
+$includeFiles = 
Composer\Autoload\ComposerStaticInit_mediawiki_vendor::$files;
+} else {
+$includeFiles = require __DIR__ . '/autoload_files.php';
+}
 foreach ($includeFiles as $fileIdentifier => $file) {
 composerRequire_mediawiki_vendor($fileIdentifier, $file);
 }
diff --git a/composer/autoload_static.php b/composer/autoload_static.php
new file mode 100644
index 000..0ab8dda
--- /dev/null
+++ b/composer/autoload_static.php
@@ -0,0 +1,367 @@
+ __DIR__ . '/..' . 
'/mediawiki/at-ease/src/Functions.php',
+'c3f7f0e81464740a933532e81fa26cc7' => __DIR__ . '/..' . 
'/wikimedia/base-convert/src/Functions.php',
+'d55c27a601de788b19a09b7d057d07ae' => __DIR__ . '/..' . 
'/wikimedia/relpath/src/RelPath.php',
+);
+
+public static $prefixLengthsPsr4 = array (
+'W' => 
+array (
+'WrappedString\\' => 14,
+'Wikimedia\\Composer\\' => 19,
+'Wikimedia\\Assert\\Test\\' => 22,
+'Wikimedia\\Assert\\' => 17,
+),
+'M' => 
+array (
+'Monolog\\' => 8,
+),
+'C' => 
+array (
+'Composer\\Semver\\' => 16,
+'CLDRPluralRuleParser\\' => 21,
+),
+);
+
+public static $prefixDirsPsr4 = array (
+'WrappedString\\' => 
+array (
+0 => __DIR__ . '/..' . '/wikimedia/wrappedstring/src',
+),
+'Wikimedia\\Composer\\' => 
+array (
+0 => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src',
+),
+'Wikimedia\\Assert\\Test\\' => 
+array (
+0 => __DIR__ . '/..' . '/wikimedia/assert/tests/phpunit',
+),
+'Wikimedia\\Assert\\' => 
+array (
+0 => __DIR__ . '/..' . '/wikimedia/assert/src',
+),
+'Monolog\\' => 
+array (
+0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
+),
+'Composer\\Semver\\' => 
+array (
+0 => __DIR__ . '/..' . '/composer/semver/src',
+),
+'CLDRPluralRuleParser\\' => 
+array (
+0 => __DIR__ . '/..' . '/wikimedia/cldr-plural-rule-parser/src',
+),
+);
+
+public static $prefixesPsr0 = array (
+'P' => 
+array (
+'Psr\\Log\\' => 
+array (
+0 => __DIR__ . '/..' . '/psr/log',
+),
+),
+'L' => 
+array (
+'Liuggio' => 
+array (

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

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

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

Merge branch 'master' into deployment

And make vendor match currently deployed version

601042e Update smashpig
dd35620 Localisation updates from https://translatewiki.net.
16b47a2 Localisation updates from https://translatewiki.net.
e6ba951 Reset SmashPig lib to currently deployed version

Change-Id: I78adb59681ca4028599b9cff2832480a65b4d264
---
D tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php
M vendor
2 files changed, 1 insertion(+), 222 deletions(-)


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

diff --git 
a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php
deleted file mode 100644
index a56cfca..000
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanRectifierTest.php
+++ /dev/null
@@ -1,221 +0,0 @@
-<<< HEAD   (ef0862 Merge branch 'master' into deployment)
-===
-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',
-   ),
-   ) );
-
-   $config = SmashPigDatabaseTestConfiguration::instance();
-   Context::init( $config );
-
-   $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();
-   $this->gateway->setDummyGatewayResponseCode( 
self::STATUS_COMPLETE );
-   $rectifier->processOrphans();
-
-   $fetched = $this->pendingDb->fetchMessageByGatewayOrderId(
-   'globalcollect', $orphan_complete['order_id'] );
-   $this->assertNull( $fetched,
-   'Message was popped' );
-
-   $this->assertGatewayCallsExactly( array(
-   'GET_ORDERSTATUS',
-   ) );
-
-   // TODO: test that we sent a 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Reset SmashPig lib to currently deployed version

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

Change subject: Reset SmashPig lib to currently deployed version
..

Reset SmashPig lib to currently deployed version

Rather than version that consults unofficial iDEAL API

Change-Id: I3e03b03b29ea0f34bcb4ddc855967f75a5b719ad
---
M composer.lock
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/composer.lock b/composer.lock
index 4807e85..39567d5 100644
--- a/composer.lock
+++ b/composer.lock
@@ -936,7 +936,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "40539770f2250e2af7f464aa604cc9dbc35e98be"
+"reference": "d1a135b94870ff263154c5dab084416eb318e05f"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -987,7 +987,7 @@
 "donations",
 "payments"
 ],
-"time": "2017-03-24 18:51:49"
+"time": "2017-03-20 17:58:32"
 },
 {
 "name": "zordius/lightncandy",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e03b03b29ea0f34bcb4ddc855967f75a5b719ad
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]: Use correct UDP_LOG_PATH

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

Change subject: Use correct UDP_LOG_PATH
..

Use correct UDP_LOG_PATH

From django.conf.settings, not default fundraiser.settings

Change-Id: I6b9e1b1f74a78a985724cd2dee0cf853d8c796ea
---
M fundraiser/analytics/management/commands/AggregateBannerImpressions.py
M fundraiser/analytics/management/commands/LoadBannerImpressions.py
M fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
M fundraiser/analytics/management/commands/LoadLPImpressions.py
4 files changed, 10 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools/DjangoBannerStats 
refs/changes/31/347131/1

diff --git 
a/fundraiser/analytics/management/commands/AggregateBannerImpressions.py 
b/fundraiser/analytics/management/commands/AggregateBannerImpressions.py
index 2b7a010..8edb4a6 100644
--- a/fundraiser/analytics/management/commands/AggregateBannerImpressions.py
+++ b/fundraiser/analytics/management/commands/AggregateBannerImpressions.py
@@ -10,7 +10,6 @@
 from fundraiser.analytics.functions import *
 from fundraiser.analytics.models import *
 from fundraiser.analytics.regex import *
-from fundraiser.settings import UDP_LOG_PATH
 
 class Command(BaseCommand):
 
@@ -147,4 +146,4 @@
 
 except Exception as e:
 transaction.rollback('default')
-raise e
\ No newline at end of file
+raise e
diff --git a/fundraiser/analytics/management/commands/LoadBannerImpressions.py 
b/fundraiser/analytics/management/commands/LoadBannerImpressions.py
index 0e748e9..fa92580 100644
--- a/fundraiser/analytics/management/commands/LoadBannerImpressions.py
+++ b/fundraiser/analytics/management/commands/LoadBannerImpressions.py
@@ -16,7 +16,7 @@
 from fundraiser.analytics.functions import *
 from fundraiser.analytics.models import *
 from fundraiser.analytics.regex import *
-from fundraiser.settings import UDP_LOG_PATH
+from django.conf import settings
 
 class Command(BaseCommand):
 
@@ -87,8 +87,8 @@
 
 now = "beaconImpressions-sampled*.tsv-%s*" % 
time_now.strftime("%Y%m%d-%H")
 pasthour = "beaconImpressions-sampled*.tsv-%s*" % 
time_minus1hr.strftime("%Y%m%d-%H")
-now_glob = os.path.join(UDP_LOG_PATH, time_now.strftime("%Y"), 
now)
-pasthour_glob = os.path.join(UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)
+now_glob = os.path.join(settings.UDP_LOG_PATH, 
time_now.strftime("%Y"), now)
+pasthour_glob = os.path.join(settings.UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)
 
 self.logger.info("Checking for files matching '{now}' or 
'{pasthour}'".format(now=now_glob, pasthour=pasthour_glob))
 
diff --git 
a/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py 
b/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
index e86e267..ee83ede 100644
--- 
a/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
+++ 
b/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
@@ -18,7 +18,7 @@
 from fundraiser.analytics.functions import *
 from fundraiser.analytics.models import *
 from fundraiser.analytics.regex import *
-from fundraiser.settings import UDP_LOG_PATH
+from django.conf import settings
 
 class Command(BaseCommand):
 
@@ -85,8 +85,8 @@
 now = "beaconImpressions-sampled*.tsv-%s*" % 
time_now.strftime("%Y%m%d-%H")
 pasthour = "beaconImpressions-sampled*.tsv-%s*" % 
time_minus1hr.strftime("%Y%m%d-%H")
 
-files.extend(glob.glob(os.path.join(UDP_LOG_PATH, 
time_now.strftime("%Y"), now)))
-files.extend(glob.glob(os.path.join(UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)))
+files.extend(glob.glob(os.path.join(settings.UDP_LOG_PATH, 
time_now.strftime("%Y"), now)))
+files.extend(glob.glob(os.path.join(settings.UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)))
 else:
 if os.path.isdir(filename):
 self.logger.info("Processing directory")
diff --git a/fundraiser/analytics/management/commands/LoadLPImpressions.py 
b/fundraiser/analytics/management/commands/LoadLPImpressions.py
index 43eca31..3ee30d6 100644
--- a/fundraiser/analytics/management/commands/LoadLPImpressions.py
+++ b/fundraiser/analytics/management/commands/LoadLPImpressions.py
@@ -17,7 +17,7 @@
 from fundraiser.analytics.functions import *
 from fundraiser.analytics.models import *
 from fundraiser.analytics.regex import *
-from fundraiser.settings import UDP_LOG_PATH
+from django.conf import settings
 
 class Command(BaseCommand):
 
@@ -94,8 +94,8 @@
 
 now = "landingpages.tsv-%s*" % time_now.strftime("%Y%m%d-%H")
 pasthour = "landingpages.tsv-%s*" 

[MediaWiki-commits] [Gerrit] wikimedia...DjangoBannerStats[master]: Add debugging output to recent file parsing

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

Change subject: Add debugging output to recent file parsing
..

Add debugging output to recent file parsing

Change-Id: I8ae01cf3eb93b3d68867fff43a5675af43c91387
FIXME: DRY
---
M fundraiser/analytics/management/commands/LoadBannerImpressions.py
M fundraiser/analytics/management/commands/LoadLPImpressions.py
2 files changed, 20 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools/DjangoBannerStats 
refs/changes/25/347125/1

diff --git a/fundraiser/analytics/management/commands/LoadBannerImpressions.py 
b/fundraiser/analytics/management/commands/LoadBannerImpressions.py
index dfc6026..0e748e9 100644
--- a/fundraiser/analytics/management/commands/LoadBannerImpressions.py
+++ b/fundraiser/analytics/management/commands/LoadBannerImpressions.py
@@ -81,14 +81,20 @@
 
 files = []
 if recent:
+self.logger.info("Processing recent files")
 time_now = datetime.now()
 time_minus1hr = time_now - timedelta(hours=1)
 
 now = "beaconImpressions-sampled*.tsv-%s*" % 
time_now.strftime("%Y%m%d-%H")
 pasthour = "beaconImpressions-sampled*.tsv-%s*" % 
time_minus1hr.strftime("%Y%m%d-%H")
+now_glob = os.path.join(UDP_LOG_PATH, time_now.strftime("%Y"), 
now)
+pasthour_glob = os.path.join(UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)
 
-files.extend(glob.glob(os.path.join(UDP_LOG_PATH, 
time_now.strftime("%Y"), now)))
-files.extend(glob.glob(os.path.join(UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)))
+self.logger.info("Checking for files matching '{now}' or 
'{pasthour}'".format(now=now_glob, pasthour=pasthour_glob))
+
+files.extend(glob.glob(now_glob))
+files.extend(glob.glob(pasthour_glob))
+
 else:
 if os.path.isdir(filename):
 self.logger.info("Processing directory")
@@ -98,6 +104,8 @@
 self.logger.info("Processing files matching %s" % filename)
 files = glob.glob(filename)
 
+self.logger.info("Examining {num} files".format(num=len(files)))
+
 for f in sorted(files):
 path, filename_only = f.rsplit('/', 1)
 if not os.path.isdir(f):
diff --git a/fundraiser/analytics/management/commands/LoadLPImpressions.py 
b/fundraiser/analytics/management/commands/LoadLPImpressions.py
index fcb32eb..a75e07e 100644
--- a/fundraiser/analytics/management/commands/LoadLPImpressions.py
+++ b/fundraiser/analytics/management/commands/LoadLPImpressions.py
@@ -88,14 +88,19 @@
 
 files = []
 if self.recent:
+self.logger.info("Processing recent files")
 time_now = datetime.now()
 time_minus1hr = time_now - timedelta(hours=1)
 
 now = "landingpages.tsv-%s*" % time_now.strftime("%Y%m%d-%H")
 pasthour = "landingpages.tsv-%s*" % 
time_minus1hr.strftime("%Y%m%d-%H")
+now_glob = os.path.join(UDP_LOG_PATH, time_now.strftime("%Y"), 
now)
+pasthour_glob = os.path.join(UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)
 
-files.extend(glob.glob(os.path.join(UDP_LOG_PATH, 
time_now.strftime("%Y"), now)))
-files.extend(glob.glob(os.path.join(UDP_LOG_PATH, 
time_minus1hr.strftime("%Y"), pasthour)))
+self.logger.info("Checking for files matching '{now}' or 
'{pasthour}'".format(now=now_glob, pasthour=pasthour_glob))
+
+files.extend(glob.glob(now_glob))
+files.extend(glob.glob(pasthour_glob))
 else:
 if os.path.isdir(filename):
 self.logger.info("Processing directory")
@@ -104,6 +109,8 @@
 else:
 self.logger.info("Processing files matching %s" % filename)
 files = glob.glob(filename)
+
+self.logger.info("Examining {num} files".format(num=len(files)))
 
 for f in files:
 path, filename_only = f.rsplit('/', 1)
@@ -435,7 +442,7 @@
 
 return results
 
-@transaction.commit_manually
+#@transaction.commit_manually
 def write(self, base_sql, impressions):
 """
 Commits a batch of transactions. Attempts a single query per model by 
splitting the

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

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


[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Add text to assertions

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

Change subject: Add text to assertions
..

Add text to assertions

Change-Id: I0352db2bcfab288e394954a823456c04e1b3c42a
---
M processcontrol/config.py
M processcontrol/job_spec.py
M processcontrol/output_streamer.py
M processcontrol/runner.py
4 files changed, 23 insertions(+), 17 deletions(-)


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

diff --git a/processcontrol/config.py b/processcontrol/config.py
index 9934806..862e083 100644
--- a/processcontrol/config.py
+++ b/processcontrol/config.py
@@ -84,7 +84,7 @@
 class MissingKeyException(Exception):
 
 def __init__(self, path):
-message = "Missing configuration key '" + path + "'"
+message = "Missing configuration key '{path}'".format(path=path)
 super(MissingKeyException, self).__init__(message)
 
 
@@ -108,12 +108,16 @@
 self.validate_global_config()
 
 def validate_global_config(self):
-assert "cron_template" in self.values
-assert "job_directory" in self.values
-assert "output_crontab" in self.values
-assert "output_directory" in self.values
-assert "runner_path" in self.values
-assert "user" in self.values
+required_settings = (
+"cron_template",
+"job_directory",
+"output_crontab",
+"output_directory",
+"runner_path",
+"user",
+)
+for setting in required_settings:
+assert setting in self.values, "Global config invalid: missing 
required '{setting}'".format(setting=setting)
 
 
 class JobConfiguration(Configuration):
@@ -132,19 +136,19 @@
 self.validate_job_config()
 
 def validate_job_config(self):
-assert "name" in self.values
+assert "name" in self.values, "Job config invalid: missing required 
'name'"
 
-assert "command" in self.values
-assert "\n" not in self.values["command"]
+assert "command" in self.values, "Job config invalid: missing required 
'command'"
+assert "\n" not in self.values["command"], "Job config invalid: 
'command' may not contain newlines"
 
 if "schedule" in self.values:
 # No tricky assignments.
-assert "=" not in self.values["schedule"]
+assert "=" not in self.values["schedule"], "Job config invalid: 
'schedule' may not contain the '=' character"
 # Legal cron, but I don't want to deal with it.
-assert "@" not in self.values["schedule"]
+assert "@" not in self.values["schedule"], "Job config invalid: 
'schedule' may not contain the '@' character"
 # No line breaks
-assert "\n" not in self.values["schedule"]
+assert "\n" not in self.values["schedule"], "Job config invalid: 
'schedule' may not contain newlines"
 
 # Be sure the schedule is valid.
 terms = self.values["schedule"].split()
-assert len(terms) == 5
+assert len(terms) == 5, "Job config invalid: 'schedule' must 
contain 5 values separated by whitespace"
diff --git a/processcontrol/job_spec.py b/processcontrol/job_spec.py
index 797a00e..93f095c 100644
--- a/processcontrol/job_spec.py
+++ b/processcontrol/job_spec.py
@@ -31,7 +31,9 @@
 self.config_path = job_path_for_slug(slug)
 
 # Validate that we're not allowing directory traversal.
-assert os.path.dirname(os.path.realpath(self.config_path)) == 
os.path.abspath(self.global_config.get("job_directory"))
+job_directory = 
os.path.abspath(self.global_config.get("job_directory"))
+assert os.path.dirname(os.path.realpath(self.config_path)) == 
job_directory, \
+"You may only run jobs with configuration files in 
'{path}'".format(path=job_directory)
 
 self.config = config.JobConfiguration(self.global_config, 
self.config_path)
 
diff --git a/processcontrol/output_streamer.py 
b/processcontrol/output_streamer.py
index 39e767b..8e6a5ac 100644
--- a/processcontrol/output_streamer.py
+++ b/processcontrol/output_streamer.py
@@ -12,7 +12,7 @@
 Makes the output file path and creates parent directory if needed
 """
 output_directory = config.GlobalConfiguration().get("output_directory")
-assert os.access(output_directory, os.W_OK)
+assert os.access(output_directory, os.W_OK), "Make sure directory '{path}' 
exists and is writable".format(path=output_directory)
 
 # per-job directory
 job_log_directory = output_directory + "/" + slug
diff --git a/processcontrol/runner.py b/processcontrol/runner.py
index d6a20fe..e4c3f45 100644
--- a/processcontrol/runner.py
+++ b/processcontrol/runner.py
@@ -28,7 +28,7 @@
 passwd_entry = pwd.getpwuid(int(service_user))
 else:
 passwd_entry = 

[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Add host name to failmail subject

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

Change subject: Add host name to failmail subject
..

Add host name to failmail subject

Would be cool to template this stuff. What else would we want?

Bug: T162214
Change-Id: Ie72e3b10f5b5b2de84a548ceaa3e769946112712
---
M processcontrol/mailer.py
1 file changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/processcontrol/mailer.py b/processcontrol/mailer.py
index 08bb432..d5be249 100644
--- a/processcontrol/mailer.py
+++ b/processcontrol/mailer.py
@@ -1,5 +1,6 @@
 from email.mime.text import MIMEText
 import smtplib
+import socket
 
 
 class Mailer(object):
@@ -17,7 +18,10 @@
 
 msg = MIMEText(body)
 
-msg["Subject"] = "Fail Mail : " + subject
+msg["Subject"] = "Fail Mail ({host}) run-job: {subject}".format(
+host=socket.gethostname(), # Why not os.gethostname?
+subject=subject
+)
 msg["From"] = self.from_address
 msg["To"] = self.to_address
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie72e3b10f5b5b2de84a548ceaa3e769946112712
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...process-control[master]: Add run-job[pid] to example syslog format

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

Change subject: Add run-job[pid] to example syslog format
..

Add run-job[pid] to example syslog format

Bug: T162189
Change-Id: I904415b8d3ea94484680602f7f2d8d73f059fc9b
---
M process-control.example.yaml
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/process-control.example.yaml b/process-control.example.yaml
index f89ed3c..d1ad3cb 100644
--- a/process-control.example.yaml
+++ b/process-control.example.yaml
@@ -27,8 +27,9 @@
 # Python logging config, 
https://docs.python.org/2/library/logging.config.html#logging-config-dictschema
 logging:
 version: 1
-#formatters:
-#-
+formatters:
+runjob:
+format: 'run-job[%(process)d]: %(message)s'
 
 #filters:
 #-
@@ -38,6 +39,7 @@
 class: logging.handlers.SysLogHandler
 level: DEBUG
 facility: daemon
+formatter: runjob
 
 loggers:
 process-control:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I904415b8d3ea94484680602f7f2d8d73f059fc9b
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...SmashPig[master]: WIP cache directory lookup 404s

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

Change subject: WIP cache directory lookup 404s
..

WIP cache directory lookup 404s

These are legitimate responses in REST-ese. Don't failmail when
someone tries to pay with iDEAL in an unsupported currency.
We should still route them elsewhere in the frontend, tho!

TODO: test with 404

Bug: T161072
Change-Id: I28a1bc71ffc7a8982b686028ab53a558032de3c7
---
M Core/Http/HttpStatusValidator.php
M PaymentProviders/Ingenico/Api.php
M PaymentProviders/Ingenico/ApiException.php
M PaymentProviders/Ingenico/BankPaymentProvider.php
A PaymentProviders/Ingenico/RestResponseValidator.php
M SmashPig.yaml
6 files changed, 51 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/90/345790/1

diff --git a/Core/Http/HttpStatusValidator.php 
b/Core/Http/HttpStatusValidator.php
index a36230b..68c6859 100644
--- a/Core/Http/HttpStatusValidator.php
+++ b/Core/Http/HttpStatusValidator.php
@@ -12,16 +12,13 @@
public function shouldRetry( $parsedResponse ) {
 
$statusCode = $parsedResponse['status'];
+   if ( array_search( $statusCode, $this->getSuccessCodes() ) !== 
false ) {
+   Logger::debug( "Successful request" );
+   return false;
+   }
$body = $parsedResponse['body'];
 
switch ( $statusCode ) {
-   case 200:   // Everything is AWESOME
-   case 201:   // Also fine, and we created a thing
-   $continue = false;
-
-   Logger::debug( "Successful request" );
-   break;
-
case 400:   // Oh noes! Bad request.. BAD CODE, BAD BAD 
CODE!
$continue = false;
Logger::error( "Request returned (400) BAD 
REQUEST: $body" );
@@ -39,4 +36,11 @@
}
return $continue;
}
+
+   protected function getSuccessCodes() {
+   return array(
+   200, // Everything is AWESOME
+   201  // Also fine, and we created a thing
+   );
+   }
 }
diff --git a/PaymentProviders/Ingenico/Api.php 
b/PaymentProviders/Ingenico/Api.php
index 5da77bb..3a7f0cc 100644
--- a/PaymentProviders/Ingenico/Api.php
+++ b/PaymentProviders/Ingenico/Api.php
@@ -84,7 +84,9 @@
$messages[] = "Error code {$error['code']}: 
{$error['message']}.";
}
$concatenated = implode( ' ', $messages );
-   throw new ApiException( $concatenated );
+   $ex = new ApiException( $concatenated );
+   $ex->setRawErrors( $decoded['errors'] );
+   throw $ex;
}
}
 }
diff --git a/PaymentProviders/Ingenico/ApiException.php 
b/PaymentProviders/Ingenico/ApiException.php
index 44af1fc..3f3ed73 100644
--- a/PaymentProviders/Ingenico/ApiException.php
+++ b/PaymentProviders/Ingenico/ApiException.php
@@ -6,4 +6,13 @@
 
 class ApiException extends SmashPigException {
 
+   protected $rawErrors;
+
+   public function setRawErrors( $errors ) {
+   $this->rawErrors = $errors;
+   }
+
+   public function getRawErrors() {
+   return $this->rawErrors;
+   }
 }
diff --git a/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/PaymentProviders/Ingenico/BankPaymentProvider.php
index 87c034d..5a479ce 100644
--- a/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -50,12 +50,21 @@
'currencyCode' => $currency
);
$path = "products/$productId/directory";
-   $response = $this->api->makeApiCall( $path, 'GET', 
$query );
-
$banks = array();
 
-   foreach ( $response['entries'] as $entry ) {
-   $banks[$entry['issuerId']] = 
$entry['issuerName'];
+   try {
+   $response = $this->api->makeApiCall( $path, 
'GET', $query );
+
+   foreach ( $response['entries'] as $entry ) {
+   $banks[$entry['issuerId']] = 
$entry['issuerName'];
+   }
+   } catch ( ApiException $ex ) {
+   $errors = $ex->getRawErrors();
+   if ( empty( $errors ) || 
$errors[0]['httpStatusCode'] !== 404 ) {
+   throw $ex;
+   }
+   // If there is a single 404 error, 

[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Merge environment, don't clobber

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

Change subject: Merge environment, don't clobber
..

Merge environment, don't clobber

Change-Id: Ide20e2ad2724715833fa2a7b15be08e7d3b7272c
FIXME: testing for this breaks things weirdly
---
M processcontrol/job_wrapper.py
1 file changed, 2 insertions(+), 3 deletions(-)


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

diff --git a/processcontrol/job_wrapper.py b/processcontrol/job_wrapper.py
index 699f522..5306c30 100644
--- a/processcontrol/job_wrapper.py
+++ b/processcontrol/job_wrapper.py
@@ -52,10 +52,9 @@
 if not self.config.has("schedule"):
 self.enabled = False
 
+self.environment = os.environ.copy()
 if self.config.has("environment"):
-self.environment = self.config.get("environment")
-else:
-self.environment = {}
+self.environment.update(self.config.get("environment"))
 
 def run(self):
 lock.begin(job_tag=self.slug)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide20e2ad2724715833fa2a7b15be08e7d3b7272c
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...SmashPig[master]: Break out unofficial iDEAL status lookup

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

Change subject: Break out unofficial iDEAL status lookup
..

Break out unofficial iDEAL status lookup

Maybe someone else can use this, but we can't!

Bug: T128692
Change-Id: Ib2475f7140abee78d9e89351465d4975507df363
---
M PaymentProviders/Ingenico/BankPaymentProvider.php
A PaymentProviders/Ingenico/IdealStatusProvider.php
M PaymentProviders/Ingenico/Tests/Data/availability.response
M PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
A PaymentProviders/Ingenico/Tests/phpunit/IdealStatusProviderTest.php
M SmashPig.yaml
6 files changed, 182 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/96/345696/1

diff --git a/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/PaymentProviders/Ingenico/BankPaymentProvider.php
index 4844bbc..87c034d 100644
--- a/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -4,7 +4,6 @@
 
 use SmashPig\Core\Context;
 use Psr\Cache\CacheItemPoolInterface;
-use SmashPig\Core\Http\OutboundRequest;
 
 /**
  * Handle bank payments via Ingenico
@@ -24,15 +23,9 @@
 */
protected $cache;
 
-   /**
-* @var array()
-*/
-   protected $availabilityParameters;
-
public function __construct( array $options = array() ) {
parent::__construct( $options );
$this->cacheParameters = $options['cache-parameters'];
-   $this->availabilityParameters = 
$options['availability-parameters'];
// FIXME: provide objects in constructor
$config = Context::get()->getConfiguration();
$this->cache = $config->object( 'cache' );
@@ -52,7 +45,7 @@
$cacheItem = $this->cache->getItem( $cacheKey );
 
if ( !$cacheItem->isHit() || $this->shouldBeExpired( $cacheItem 
) ) {
-   /*$query = array(
+   $query = array(
'countryCode' => $country,
'currencyCode' => $currency
);
@@ -63,28 +56,7 @@
 
foreach ( $response['entries'] as $entry ) {
$banks[$entry['issuerId']] = 
$entry['issuerName'];
-   }*/
-
-   $banks = array();
-
-   // HAAACK!
-   // Use undocumented API to get availability straight 
from iDEAL,
-   // until Ingenico can incorporate this into their 
directory
-   if ( $country === 'NL' && $currency === 'EUR' ) {
-   $url = $this->availabilityParameters['url'];
-   $threshold = 
$this->availabilityParameters['threshold'];
-
-   $request = new OutboundRequest( $url );
-   $rawResponse = $request->execute();
-   $response = json_decode( $rawResponse['body'], 
true );
-
-   foreach ( $response['Issuers'] as $issuer ) {
-   if ( $issuer['Percent'] >= $threshold ) 
{
-   $banks[$issuer['BankId']] = 
$issuer['BankName'];
-   }
-   }
}
-
$duration = $this->cacheParameters['duration'];
$cacheItem->set( array(
'value' => $banks,
diff --git a/PaymentProviders/Ingenico/IdealStatusProvider.php 
b/PaymentProviders/Ingenico/IdealStatusProvider.php
new file mode 100644
index 000..637207d
--- /dev/null
+++ b/PaymentProviders/Ingenico/IdealStatusProvider.php
@@ -0,0 +1,77 @@
+https://availability.ideal.nl
+ */
+class IdealStatusProvider {
+
+   /**
+* @var array()
+*/
+   protected $cacheParameters;
+
+   /**
+* @var CacheItemPoolInterface
+*/
+   protected $cache;
+
+   /**
+* @var string
+*/
+   protected $availabilityUrl;
+
+   public function __construct( array $options = array() ) {
+   $this->cacheParameters = $options['cache-parameters'];
+   $this->availabilityUrl = $options['availability-url'];
+   // FIXME: provide objects in constructor
+   $config = Context::get()->getConfiguration();
+   $this->cache = $config->object( 'cache' );
+   }
+
+   /**
+* Look up bank status
+* @return array Keys are bank codes, values are names
+*/
+   public function getBankStatus() {
+   $cacheKey = $this->cacheParameters['key'];
+   $cacheItem = $this->cache->getItem( 

[MediaWiki-commits] [Gerrit] mediawiki...vendor[master]: Update smashpig

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

Change subject: Update smashpig
..

Update smashpig

get https default for iDEAL lookup

Change-Id: I85357b25ec3d4e6e070e2957c789dd031b816751
---
M composer/installed.json
M wikimedia/smash-pig/SmashPig.yaml
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/composer/installed.json b/composer/installed.json
index 359c136..0292a77 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -1014,7 +1014,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "5abbd06ab629e218d7c1842443c0a0627c31d0c3"
+"reference": "40539770f2250e2af7f464aa604cc9dbc35e98be"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -1031,7 +1031,7 @@
 "jakub-onderka/php-parallel-lint": "^0.9",
 "phpunit/phpunit": "^4.8"
 },
-"time": "2017-03-23 17:11:20",
+"time": "2017-03-24 18:51:17",
 "type": "library",
 "installation-source": "source",
 "autoload": {
diff --git a/wikimedia/smash-pig/SmashPig.yaml 
b/wikimedia/smash-pig/SmashPig.yaml
index e68beb3..1688b5e 100644
--- a/wikimedia/smash-pig/SmashPig.yaml
+++ b/wikimedia/smash-pig/SmashPig.yaml
@@ -468,7 +468,7 @@
 duration: 900
 key-base: SMASHPIG_INGENICO_IDEAL_BANK_LIST
 availability-parameters:
-url: http://availability.ideal.nl/api/api/GetIssuers
+url: https://availability.ideal.nl/api/api/GetIssuers
 # percentage availability below which issuers are 
omitted
 threshold: 50
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85357b25ec3d4e6e070e2957c789dd031b816751
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface/vendor
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]: Update smashpig

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

Change subject: Update smashpig
..

Update smashpig

get https default for iDEAL lookup

Change-Id: I73fdff4f627f326daeb9ca4fc5c973702b961b96
---
M composer.lock
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/composer.lock b/composer.lock
index 617375c..4807e85 100644
--- a/composer.lock
+++ b/composer.lock
@@ -936,7 +936,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "5abbd06ab629e218d7c1842443c0a0627c31d0c3"
+"reference": "40539770f2250e2af7f464aa604cc9dbc35e98be"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -987,7 +987,7 @@
 "donations",
 "payments"
 ],
-"time": "2017-03-23 17:11:20"
+"time": "2017-03-24 18:51:49"
 },
 {
 "name": "zordius/lightncandy",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73fdff4f627f326daeb9ca4fc5c973702b961b96
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...process-control[master]: WIP stream subprocess stdout to log file

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

Change subject: WIP stream subprocess stdout to log file
..

WIP stream subprocess stdout to log file

Change-Id: Icf9fec6ced84b3107511a8ccc4c905076ad1ffd6
---
M processcontrol/job_wrapper.py
A processcontrol/output_streamer.py
2 files changed, 56 insertions(+), 36 deletions(-)


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

diff --git a/processcontrol/job_wrapper.py b/processcontrol/job_wrapper.py
index 321798b..2b3fa2e 100644
--- a/processcontrol/job_wrapper.py
+++ b/processcontrol/job_wrapper.py
@@ -8,6 +8,7 @@
 from . import config
 from . import lock
 from . import mailer
+from . import output_streamer
 
 
 # TODO: uh has no raison d'etre now other than to demonstrate factoryness.
@@ -64,6 +65,9 @@
 command = shlex.split(self.config.get("command"))
 
 self.process = subprocess.Popen(command, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, env=self.environment)
+streamer = output_streamer.OutputStreamer(self.process, self.slug, 
self.start_time)
+streamer.start()
+
 timer = threading.Timer(self.timeout, self.fail_timeout)
 timer.start()
 
@@ -71,7 +75,7 @@
 # FIXME: This doesn't stream, so large output will be buffered in 
memory.
 (stdout_data, stderr_data) = self.process.communicate()
 
-self.store_job_output(stdout_data, stderr_data)
+#self.store_job_output(stdout_data, stderr_data)
 
 if len(stderr_data) > 0:
 self.fail_has_stderr(stderr_data)
@@ -102,41 +106,6 @@
 config.log.error(message)
 self.mailer.fail_mail(message)
 # FIXME: Job will return SIGKILL now, fail_exitcode should ignore that 
signal now?
-
-def store_job_output(self, stdout_data, stderr_data):
-output_directory = self.global_config.get("output_directory")
-assert os.access(output_directory, os.W_OK)
-
-# per-job directory
-job_directory = output_directory + "/" + self.name
-if not os.path.exists(job_directory):
-os.makedirs(job_directory)
-
-timestamp = self.start_time.strftime("%Y%m%d-%H%M%S")
-filename = 
"{logdir}/{name}-{timestamp}.log".format(logdir=job_directory, name=self.name, 
timestamp=timestamp)
-with open(filename, "a") as out:
-header = (
-"===\n"
-"{name} ({pid}), started at {time}\n"
-"---\n"
-).format(name=self.name, pid=self.process.pid, 
time=self.start_time.isoformat())
-out.write(header)
-
-if len(stdout_data) == 0:
-buf = "* No output *\n"
-else:
-buf = stdout_data.decode("utf-8")
-out.write(buf)
-
-if len(stderr_data) > 0:
-header = (
-"---\n"
-"Even worse, the job emitted errors:\n"
-"---\n"
-)
-out.write(header)
-
-out.write(stderr_data.decode("utf-8"))
 
 def status(self):
 """Check for any running instances of this job, in this process or 
another.
diff --git a/processcontrol/output_streamer.py 
b/processcontrol/output_streamer.py
new file mode 100644
index 000..e09f3d0
--- /dev/null
+++ b/processcontrol/output_streamer.py
@@ -0,0 +1,51 @@
+import logging.config
+import os
+import threading
+
+from . import config
+
+class OutputStreamer(object):
+
+def __init__(self, process, slug, start_time):
+self.stream = process.stdout
+self.pid = process.pid
+self.slug = slug
+self.start_time = start_time
+
+def start(self):
+self.create_logger()
+out_thread = threading.Thread(target=self.read_output)
+out_thread.daemon = True
+out_thread.start()
+
+def read_output(self):
+while True:
+line = self.stream.readline()
+if line == '':
+break;
+self.logger.info(line)
+
+def create_logger(self):
+output_directory = config.GlobalConfiguration().get("output_directory")
+assert os.access(output_directory, os.W_OK)
+
+# per-job directory
+job_directory = output_directory + "/" + self.slug
+if not os.path.exists(job_directory):
+os.makedirs(job_directory)
+
+timestamp = self.start_time.strftime("%Y%m%d-%H%M%S")
+filename = 
"{logdir}/{name}-{timestamp}.log".format(logdir=job_directory, name=self.slug, 
timestamp=timestamp)
+
+self.logger = logging.getLogger(self.slug)
+self.logger.setLevel(logging.INFO)
+
+fh = logging.FileHandler(filename)
+formatter = logging.Formatter("%(asctime)s - %(message)s")
+

[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Fix logging.config import

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

Change subject: Fix logging.config import
..

Fix logging.config import

*shrug*

Change-Id: Ied1f9c31067b0ed43ec43e2f6c6cff96313fd20d
---
M processcontrol/config.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/processcontrol/config.py b/processcontrol/config.py
index dee4083..3f04106 100644
--- a/processcontrol/config.py
+++ b/processcontrol/config.py
@@ -1,5 +1,5 @@
 import copy
-import logging
+import logging.config
 import os
 import yaml
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied1f9c31067b0ed43ec43e2f6c6cff96313fd20d
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...process-control[master]: Show jobs with invalid configuration in --list-jobs

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

Change subject: Show jobs with invalid configuration in --list-jobs
..

Show jobs with invalid configuration in --list-jobs

Change-Id: Id10b85c6a4a6a99065512727c6582d63929d47cb
---
M bin/run-job
1 file changed, 8 insertions(+), 5 deletions(-)


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

diff --git a/bin/run-job b/bin/run-job
index 930710a..ae7e145 100755
--- a/bin/run-job
+++ b/bin/run-job
@@ -10,11 +10,14 @@
 
 def list_jobs():
for job_name in job_wrapper.list():
-   job = job_wrapper.load(job_name)
-   message = "{job} - {human_name}".format(job=job_name, 
human_name=job.name)
-   status = job.status()
-   if status is not None:
-   message += "" + yaml.dump(status)
+   try:
+   job = job_wrapper.load(job_name)
+   message = "{job} - {human_name}".format(job=job_name, 
human_name=job.name)
+   status = job.status()
+   if status is not None:
+   message += "" + yaml.dump(status)
+   except AssertionError:
+   message = "{job} ***Invalid 
configuration***".format(job=job_name)
print(message)
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id10b85c6a4a6a99065512727c6582d63929d47cb
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...process-control[master]: WIP still output when killed

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

Change subject: WIP still output when killed
..

WIP still output when killed

Really should fix that exit_code issue now
Also, test will need threading. Fun!

Change-Id: Iae9fcfa9634d482e1df786b3878d53e00a9f2006
---
M processcontrol/job_wrapper.py
1 file changed, 7 insertions(+), 0 deletions(-)


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

diff --git a/processcontrol/job_wrapper.py b/processcontrol/job_wrapper.py
index d84b83e..248420b 100644
--- a/processcontrol/job_wrapper.py
+++ b/processcontrol/job_wrapper.py
@@ -3,6 +3,7 @@
 import glob
 import os
 import shlex
+import signal
 import subprocess
 import sys
 import threading
@@ -56,6 +57,8 @@
 lock.begin(job_tag=self.name)
 
 command = shlex.split(self.config.get("command"))
+signal.signal(signal.SIGTERM, self.handle_sigterm)
+signal.signal(signal.SIGINT, self.handle_sigterm)
 
 self.process = subprocess.Popen(command, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, env=self.environment)
 timer = threading.Timer(self.timeout, self.fail_timeout)
@@ -149,3 +152,7 @@
 return {"status": "running", "pid": pid}
 
 return None
+
+def handle_sigterm(self, signum, frame):
+self.process.kill()
+print("Job {name} killed".format(name=self.name), file=sys.stderr)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae9fcfa9634d482e1df786b3878d53e00a9f2006
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...process-control[master]: Test for environment parameter

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

Change subject: Test for environment parameter
..


Test for environment parameter

Change-Id: I7739f28ca9fd3b11754a5eae0c10ee59a034d384
---
A tests/data/env.yaml
M tests/test_job_wrapper.py
2 files changed, 28 insertions(+), 1 deletion(-)

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



diff --git a/tests/data/env.yaml b/tests/data/env.yaml
new file mode 100644
index 000..bdc5ef3
--- /dev/null
+++ b/tests/data/env.yaml
@@ -0,0 +1,5 @@
+name: Env dumper
+command: /usr/bin/env
+environment:
+foo1: bar
+foo2: rebar
diff --git a/tests/test_job_wrapper.py b/tests/test_job_wrapper.py
index f95480c..ef290d5 100644
--- a/tests/test_job_wrapper.py
+++ b/tests/test_job_wrapper.py
@@ -79,7 +79,6 @@
 run_job("which_out.yaml")
 
 log_files = sorted(glob.glob(path_glob))
-assert len(log_files) == 1
 path = log_files[-1]
 contents = open(path, "r").read()
 lines = contents.split("\n")
@@ -88,3 +87,26 @@
 assert lines[4] == "/bin/bash"
 
 os.unlink(path)
+
+
+def test_environment():
+path_glob = "/tmp/Env dumper/Env dumper*.log"
+
+run_job("env.yaml")
+
+log_files = sorted(glob.glob(path_glob))
+path = log_files[-1]
+contents = open(path, "r").read()
+lines = contents.split("\n")
+print(lines)
+
+assert len(lines) == 7
+
+dumped_env = sorted(lines[4:6])
+expected = [
+"foo1=bar",
+"foo2=rebar",
+]
+assert expected == dumped_env
+
+os.unlink(path)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7739f28ca9fd3b11754a5eae0c10ee59a034d384
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Fixes suggested by thcipriani

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

Change subject: Fixes suggested by thcipriani
..


Fixes suggested by thcipriani

Change-Id: I03592650c63907ffa4e14a1a136372bff3038f79
---
M processcontrol/lock.py
1 file changed, 9 insertions(+), 11 deletions(-)

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



diff --git a/processcontrol/lock.py b/processcontrol/lock.py
index 6c91863..6af0bb5 100644
--- a/processcontrol/lock.py
+++ b/processcontrol/lock.py
@@ -5,7 +5,6 @@
 '''
 from __future__ import print_function
 import os
-import os.path
 import sys
 
 lockfile = None
@@ -17,13 +16,13 @@
 
 if os.path.exists(filename):
 print("Lockfile found!", file=sys.stderr)
-f = open(filename, "r")
-pid = None
-try:
-pid = int(f.read())
-except ValueError:
-pass
-f.close()
+with open(filename, "r") as f:
+pid = None
+try:
+pid = int(f.read())
+except ValueError:
+pass
+
 if not pid:
 print("Invalid lockfile contents.", file=sys.stderr)
 else:
@@ -37,9 +36,8 @@
 print("Removing old lockfile.", file=sys.stderr)
 os.unlink(filename)
 
-f = open(filename, "w")
-f.write(str(os.getpid()))
-f.close()
+with open(filename, "w") as f:
+f.write(str(os.getpid()))
 
 global lockfile
 lockfile = filename

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I03592650c63907ffa4e14a1a136372bff3038f79
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...tools[master]: WIP Test audit data for Express Checkout refunds

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

Change subject: WIP Test audit data for Express Checkout refunds
..

WIP Test audit data for Express Checkout refunds

Looks like the Item ID is the surest thing we have to distinguish them.
The note field can be filled in at the payment console, so it's not to
be trusted.

Bug: T161121
Change-Id: Id23f49c49e9c6a685eddaafd6828448d8f68ebef
---
M audit/paypal/tests/test_trr_file.py
1 file changed, 64 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/27/344727/1

diff --git a/audit/paypal/tests/test_trr_file.py 
b/audit/paypal/tests/test_trr_file.py
index 00ed5b7..6c66b37 100644
--- a/audit/paypal/tests/test_trr_file.py
+++ b/audit/paypal/tests/test_trr_file.py
@@ -30,7 +30,7 @@
 "Payer's Account ID": "pranks...@anonymous.net",
 "Payer Address Status": "N",
 "Item Name": "Generous benificence",
-"Item ID": "GIMME",
+"Item ID": "DONATE",
 "Option 1 Name": "",
 "Option 1 Value": "",
 "Option 2 Name": "",
@@ -75,8 +75,41 @@
 "Transaction  Debit or Credit": "DR",
 "Fee Debit or Credit": "CR",
 "Fee Amount": "55",
-"Transaction Note": "r",
-"Payer's Account ID": "pranks...@anonymous.net"
+"Transaction Note": "refund",
+})
+return row
+
+
+def get_ec_refund_row():
+
+row = get_base_row()
+row.update({
+"Invoice ID": "4123422",
+"PayPal Reference ID": "3GJH3GJ3334214812",
+"PayPal Reference ID Type": "TXN",
+"Transaction Event Code": "T1107",
+"Transaction  Debit or Credit": "DR",
+"Fee Debit or Credit": "CR",
+"Transaction Note": "refund",
+"Custom Field": "4123422",
+"Item ID": "",
+})
+return row
+
+
+def get_ec_recurring_refund_row():
+
+row = get_base_row()
+row.update({
+"Invoice ID": "4123422",
+"PayPal Reference ID": "3GJH3GJ3334214812",
+"PayPal Reference ID Type": "TXN",
+"Transaction Event Code": "T1107",
+"Transaction  Debit or Credit": "DR",
+"Fee Debit or Credit": "CR",
+"Transaction Note": "refund",
+"Custom Field": "",
+"Item ID": "",
 })
 return row
 
@@ -143,6 +176,34 @@
 @patch("queue.redis_wrap.Redis")
 @patch("civicrm.civicrm.Civicrm")
 @patch("process.globals")
+def test_ec_refund_send(MockGlobals, MockCivicrm, MockRedis):
+'''
+Test that express checkout refunds are marked as such
+'''
+row = get_ec_refund_row()
+row_recur = get_ec_recurring_refund_row()
+
+MockCivicrm().transaction_refunded.return_value = False
+
+parser = audit.paypal.TrrFile.TrrFile("dummy_path")
+
+parser.parse_line(row)
+parser.parse_line(row_recur)
+
+# Did we send it?
+args = MockRedis().send.call_args
+expected = {'last_name': 'Man', 'thankyou_date': 0, 'city': '', 
'payment_method': '', 'gateway_status': 'S', 'currency': 'USD', 'postal_code': 
'', 'date': '1474736101', 'gateway_refund_id': 'AS7D98AS7D9A8S7D9AS', 
'gateway': 'paypal_ec', 'state_province': '', 'gross': 10.0, 'first_name': 
'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'gross_currency': 'USD', 'country': '', 'payment_submethod': '', 'note': 'r', 
'supplemental_address_1': '', 'settled_date': '1474736101', 
'gateway_parent_id': '3GJH3GJ3334214812', 'type': 'refund', 'email': 
'pranks...@anonymous.net', 'street_address': '', 'contribution_tracking_id': 
'4123422', 'order_id': '4123422'}
+assert args[0][0] == 'refund'
+actual = args[0][1]
+assert cmp(actual, expected) == 0 
+assert args[1][0] == 'refund'
+actual = args[1][1]
+assert cmp(actual, expected) == 0 
+
+
+@patch("queue.redis_wrap.Redis")
+@patch("civicrm.civicrm.Civicrm")
+@patch("process.globals")
 def test_refund_duplicate(MockGlobals, MockCivicrm, MockRedis):
 '''
 Test that we do not send a refund for a donation that is refunded

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id23f49c49e9c6a685eddaafd6828448d8f68ebef
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...tools[master]: Fix dictionary comparison

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

Change subject: Fix dictionary comparison
..

Fix dictionary comparison

Oops! sorted(dict) was just leaving us with the keys

Change-Id: I9827b9fcdd62549583dd54031589306542c1f39b
---
M audit/paypal/tests/test_trr_file.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/25/344725/1

diff --git a/audit/paypal/tests/test_trr_file.py 
b/audit/paypal/tests/test_trr_file.py
index 2cf3c3e..00ed5b7 100644
--- a/audit/paypal/tests/test_trr_file.py
+++ b/audit/paypal/tests/test_trr_file.py
@@ -135,9 +135,9 @@
 # Did we send it?
 args = MockRedis().send.call_args
 assert args[0][0] == 'refund'
-expected = sorted({'last_name': 'Man', 'thankyou_date': 0, 'city': '', 
'payment_method': '', 'gateway_status': 'S', 'currency': 'USD', 'postal_code': 
'', 'date': '1474736101', 'gateway_refund_id': 'AS7D98AS7D9A8S7D9AS', 
'gateway': 'paypal', 'state_province': '', 'gross': 10.0, 'first_name': 
'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'gross_currency': 'USD', 'country': '', 'payment_submethod': '', 'note': 'r', 
'supplemental_address_1': '', 'settled_date': '1474736101', 
'gateway_parent_id': '3GJH3GJ3334214812', 'type': 'refund', 'email': 
'pranks...@anonymous.net', 'street_address': '', 'contribution_tracking_id': 
'1234567', 'order_id': '1234567'})
-actual = sorted(args[0][1])
-assert actual == expected
+expected = {'last_name': 'Man', 'thankyou_date': 0, 'city': '', 
'payment_method': '', 'gateway_status': 'S', 'currency': 'USD', 'postal_code': 
'', 'date': '1474736101', 'gateway_refund_id': 'AS7D98AS7D9A8S7D9AS', 
'gateway': 'paypal', 'state_province': '', 'gross': 10.0, 'first_name': 
'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'gross_currency': 'USD', 'country': '', 'payment_submethod': '', 'note': 'r', 
'supplemental_address_1': '', 'settled_date': '1474736101', 
'gateway_parent_id': '3GJH3GJ3334214812', 'type': 'refund', 'email': 
'pranks...@anonymous.net', 'street_address': '', 'contribution_tracking_id': 
'1234567', 'order_id': '1234567'}
+actual = args[0][1]
+assert cmp(actual, expected) == 0
 
 
 @patch("queue.redis_wrap.Redis")
@@ -175,6 +175,6 @@
 # Did we send it?
 args = MockRedis().send.call_args
 assert args[0][0] == 'recurring'
-expected = sorted({'last_name': 'Man', 'txn_type': 'subscr_payment', 
'thankyou_date': 0, 'city': '', 'payment_method': '', 'gateway_status': 'S', 
'currency': 'USD', 'postal_code': '', 'date': '1474736101', 'subscr_id': 
'3GJH3GJ3334214812', 'gateway': 'paypal', 'state_province': '', 'gross': 0.1, 
'first_name': 'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'country': '', 'payment_submethod': '', 'note': '', 'supplemental_address_1': 
'', 'settled_date': '1474736101', 'email': 'pranks...@anonymous.net', 
'street_address': '', 'contribution_tracking_id': '1234567', 'order_id': 
'1234567'})
-actual = sorted(args[0][1])
-assert actual == expected
+expected = {'last_name': 'Man', 'txn_type': 'subscr_payment', 
'thankyou_date': 0, 'city': '', 'payment_method': '', 'gateway_status': 'S', 
'currency': 'USD', 'postal_code': '', 'date': '1474736101', 'subscr_id': 
'3GJH3GJ3334214812', 'gateway': 'paypal', 'state_province': '', 'gross': 0.1, 
'first_name': 'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'country': '', 'payment_submethod': '', 'note': '', 'supplemental_address_1': 
'', 'settled_date': '1474736101', 'email': 'pranks...@anonymous.net', 
'street_address': '', 'contribution_tracking_id': '1234567', 'order_id': 
'1234567'}
+actual = args[0][1]
+assert cmp(actual, expected) == 0

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9827b9fcdd62549583dd54031589306542c1f39b
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...SmashPig[master]: Example refund IPNs from express checkout

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

Change subject: Example refund IPNs from express checkout
..

Example refund IPNs from express checkout

Bug: T161121
Change-Id: If9af85cd914b1cb99542c02888ed300780b110be
---
A PaymentProviders/PayPal/Tests/Data/refund_ec.json
A PaymentProviders/PayPal/Tests/Data/refund_recurring_ec.json
2 files changed, 79 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/01/344701/1

diff --git a/PaymentProviders/PayPal/Tests/Data/refund_ec.json 
b/PaymentProviders/PayPal/Tests/Data/refund_ec.json
new file mode 100644
index 000..03b6048
--- /dev/null
+++ b/PaymentProviders/PayPal/Tests/Data/refund_ec.json
@@ -0,0 +1,37 @@
+{
+  "mc_gross": "-150",
+  "invoice": "46239229.0",
+  "protection_eligibility": "Ineligible",
+  "payer_id": "RWASDASJ2AS3A",
+  "payment_date": "09:34:59 Mar 22, 2017 PDT",
+  "payment_status": "Refunded",
+  "charset": "UTF-8",
+  "first_name": "Testy",
+  "mc_fee": "-43",
+  "notify_version": "3.8",
+  "reason_code": "refund",
+  "custom": "46239229",
+  "business": "gi...@takers.org",
+  "verify_sign": "Ar65LQ8D4i5231dnJnwTy8lT8UaGAoJGWSH0c1M93d3B86D4ZGVpax3T",
+  "payer_email": "do...@generous.net",
+  "parent_txn_id": "1V551844CE5526421",
+  "txn_id": "3HD08833MR473623T",
+  "payment_type": "instant",
+  "last_name": "McTesterson",
+  "receiver_email": "gi...@takers.org",
+  "payment_fee": "",
+  "shipping_discount": "0",
+  "receiver_id": "TWDK67ASD2XXY",
+  "insurance_amount": "0",
+  "item_name": "Donation to the Wikimedia Foundation",
+  "discount": "0",
+  "mc_currency": "JPY",
+  "item_number": "",
+  "residence_country": "US",
+  "handling_amount": "0",
+  "shipping_method": "Default",
+  "transaction_subject": "Donation to the Wikimedia Foundation",
+  "payment_gross": "",
+  "shipping": "0",
+  "ipn_track_id": "4e93f423dd88b"
+}
diff --git a/PaymentProviders/PayPal/Tests/Data/refund_recurring_ec.json 
b/PaymentProviders/PayPal/Tests/Data/refund_recurring_ec.json
new file mode 100644
index 000..3311d5f
--- /dev/null
+++ b/PaymentProviders/PayPal/Tests/Data/refund_recurring_ec.json
@@ -0,0 +1,42 @@
+{
+  "mc_gross": "-150",
+  "period_type": " Regular",
+  "outstanding_balance": "0",
+  "next_payment_date": "N\/A",
+  "protection_eligibility": "Ineligible",
+  "payment_cycle": "Monthly",
+  "payer_id": "RWASDASJ2AS3A",
+  "payment_date": "09:33:51 Mar 22, 2017 PDT",
+  "payment_status": "Refunded",
+  "product_name": "Monthly donation to the Wikimedia Foundation",
+  "charset": "UTF-8",
+  "rp_invoice_id": "45931681",
+  "recurring_payment_id": "I-DD1FNAAAUU22",
+  "first_name": "Testy",
+  "mc_fee": "-43",
+  "notify_version": "3.8",
+  "amount_per_cycle": "150",
+  "reason_code": "refund",
+  "currency_code": "JPY",
+  "business": "gi...@takers.org",
+  "verify_sign": "APvissTSNYxEsF2tvyvfCnTn10fsA3zfe8wcXg8--8099IMv8ObkEkCi",
+  "payer_email": "do...@generous.net",
+  "parent_txn_id": "4GV70894MM323713P",
+  "initial_payment_amount": "0",
+  "profile_status": "Cancelled",
+  "amount": "150",
+  "txn_id": "4CX17568KP793000L",
+  "payment_type": "instant",
+  "last_name": "McTesterson",
+  "receiver_email": "gi...@takers.org",
+  "payment_fee": "",
+  "receiver_id": "TWDK67ASD2XXY",
+  "mc_currency": "JPY",
+  "residence_country": "US",
+  "transaction_subject": "Monthly donation to the Wikimedia Foundation",
+  "payment_gross": "",
+  "shipping": "0",
+  "product_type": "1",
+  "time_created": "16:54:13 Feb 01, 2017 PST",
+  "ipn_track_id": "d86d241a67ab"
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9af85cd914b1cb99542c02888ed300780b110be
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]: Use https endpoint for iDEAL availability

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

Change subject: Use https endpoint for iDEAL availability
..

Use https endpoint for iDEAL availability

Bug: T161153
Change-Id: I500e4188bb27261f7bf6e697cc567fa810dd34d9
---
M SmashPig.yaml
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/SmashPig.yaml b/SmashPig.yaml
index e68beb3..1688b5e 100644
--- a/SmashPig.yaml
+++ b/SmashPig.yaml
@@ -468,7 +468,7 @@
 duration: 900
 key-base: SMASHPIG_INGENICO_IDEAL_BANK_LIST
 availability-parameters:
-url: http://availability.ideal.nl/api/api/GetIssuers
+url: https://availability.ideal.nl/api/api/GetIssuers
 # percentage availability below which issuers are 
omitted
 threshold: 50
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I500e4188bb27261f7bf6e697cc567fa810dd34d9
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]: Add blank index.html

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

Change subject: Add blank index.html
..

Add blank index.html

Change-Id: I48d3ffa71a04a719969bb69900fdcc091f72a2c8
---
A index.html
1 file changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/344670/1

diff --git a/index.html b/index.html
new file mode 100644
index 000..e69de29
--- /dev/null
+++ b/index.html

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48d3ffa71a04a719969bb69900fdcc091f72a2c8
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[deployment]: Pull in orphan rectifier hotfix

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

Change subject: Pull in orphan rectifier hotfix
..

Pull in orphan rectifier hotfix

Minimal vendor update

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


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

diff --git a/vendor b/vendor
index f8bf486..f0e28be 16
--- a/vendor
+++ b/vendor
@@ -1 +1 @@
-Subproject commit f8bf48695ab0b11763322eed876dcbf5d3258793
+Subproject commit f0e28be01e1798ec36cf6e45a665f5730515f484

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I788cee3635ed2874f3c347a18de5312db84f5f51
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]: [HOTFIX] Patch orphan rectifier to drop non-cc records

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

Change subject: [HOTFIX] Patch orphan rectifier to drop non-cc records
..


[HOTFIX] Patch orphan rectifier to drop non-cc records

NOTE: Directly patched to avoid composer churn during code freeze.

Bug: T161160
Change-Id: Ia6fe7626ea21867055bb147ceef1e00c33c907bf
---
M 
wikimedia/donation-interface/globalcollect_gateway/GlobalCollectOrphanRectifier.php
1 file changed, 7 insertions(+), 0 deletions(-)

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



diff --git 
a/wikimedia/donation-interface/globalcollect_gateway/GlobalCollectOrphanRectifier.php
 
b/wikimedia/donation-interface/globalcollect_gateway/GlobalCollectOrphanRectifier.php
index ac404b1..6d44465 100644
--- 
a/wikimedia/donation-interface/globalcollect_gateway/GlobalCollectOrphanRectifier.php
+++ 
b/wikimedia/donation-interface/globalcollect_gateway/GlobalCollectOrphanRectifier.php
@@ -160,6 +160,13 @@
 * @return boolean True if the orphan has been rectified, false if not.
 */
protected function rectifyOrphan( $normalized ){
+   if ( $normalized['payment_method'] !== 'cc' ) {
+   // Skip other payment methods which shouldn't be in the 
pending
+   // queue anyway.  See 
https://phabricator.wikimedia.org/T161160
+   $this->logger->info( "Skipping non-credit card pending 
record." );
+   return false;
+   }
+
$this->logger->info( "Rectifying orphan: 
{$normalized['order_id']}" );
$is_rectified = false;
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6fe7626ea21867055bb147ceef1e00c33c907bf
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/vendor
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

___
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-03-23 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344497 )

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/97/344497/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index b0d94b7..ef08626 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit b0d94b7e1c3ba8dac3bc3925d87255376679f889
+Subproject commit ef08626be87f9e71e756b4f8dd6c806ca5150614

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1490517bdc82d0f2248cb0f3735ec87a63463ae
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...process-control[master]: Copy example configuration to docs during install

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

Change subject: Copy example configuration to docs during install
..


Copy example configuration to docs during install

Change-Id: I1862db40d06047864f87aefaa7d09d78754ea144
---
M debian/docs
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/debian/docs b/debian/docs
index b43bf86..22c7238 100644
--- a/debian/docs
+++ b/debian/docs
@@ -1 +1,2 @@
 README.md
+process-control.example.yaml

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1862db40d06047864f87aefaa7d09d78754ea144
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...vendor[master]: Update SmashPig lib

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

Change subject: Update SmashPig lib
..


Update SmashPig lib

Change-Id: I5c8ffb254fa143c52f760fcbafa64840bac45757
---
M composer/installed.json
M wikimedia/smash-pig/Core/Http/OutboundRequest.php
M wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
A wikimedia/smash-pig/PaymentProviders/Ingenico/Tests/Data/availability.response
M 
wikimedia/smash-pig/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
M wikimedia/smash-pig/PaymentProviders/PayPal/Job.php
M wikimedia/smash-pig/PaymentProviders/PayPal/PaymentMessage.php
M wikimedia/smash-pig/PaymentProviders/PayPal/RecurringMessage.php
M wikimedia/smash-pig/PaymentProviders/PayPal/RefundMessage.php
A wikimedia/smash-pig/PaymentProviders/PayPal/Tests/Data/recurring_payment.json
A 
wikimedia/smash-pig/PaymentProviders/PayPal/Tests/Data/recurring_payment_transformed.json
M 
wikimedia/smash-pig/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
M wikimedia/smash-pig/SmashPig.yaml
13 files changed, 215 insertions(+), 14 deletions(-)

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



diff --git a/composer/installed.json b/composer/installed.json
index 8e57f31..359c136 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -1014,7 +1014,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "d1a135b94870ff263154c5dab084416eb318e05f"
+"reference": "5abbd06ab629e218d7c1842443c0a0627c31d0c3"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -1031,7 +1031,7 @@
 "jakub-onderka/php-parallel-lint": "^0.9",
 "phpunit/phpunit": "^4.8"
 },
-"time": "2017-03-20 17:58:32",
+"time": "2017-03-23 17:11:20",
 "type": "library",
 "installation-source": "source",
 "autoload": {
diff --git a/wikimedia/smash-pig/Core/Http/OutboundRequest.php 
b/wikimedia/smash-pig/Core/Http/OutboundRequest.php
index 92e6cae..8eeb187 100644
--- a/wikimedia/smash-pig/Core/Http/OutboundRequest.php
+++ b/wikimedia/smash-pig/Core/Http/OutboundRequest.php
@@ -12,15 +12,18 @@
/**
 * @var array
 */
-   protected $headers;
+   protected $headers = array();
+
/**
 * @var Configuration
 */
protected $config;
+
/**
 * @var string HTTP method
 */
protected $method;
+
/**
 * @var string Request body
 */
diff --git 
a/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
index 87c034d..4844bbc 100644
--- a/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -4,6 +4,7 @@
 
 use SmashPig\Core\Context;
 use Psr\Cache\CacheItemPoolInterface;
+use SmashPig\Core\Http\OutboundRequest;
 
 /**
  * Handle bank payments via Ingenico
@@ -23,9 +24,15 @@
 */
protected $cache;
 
+   /**
+* @var array()
+*/
+   protected $availabilityParameters;
+
public function __construct( array $options = array() ) {
parent::__construct( $options );
$this->cacheParameters = $options['cache-parameters'];
+   $this->availabilityParameters = 
$options['availability-parameters'];
// FIXME: provide objects in constructor
$config = Context::get()->getConfiguration();
$this->cache = $config->object( 'cache' );
@@ -45,7 +52,7 @@
$cacheItem = $this->cache->getItem( $cacheKey );
 
if ( !$cacheItem->isHit() || $this->shouldBeExpired( $cacheItem 
) ) {
-   $query = array(
+   /*$query = array(
'countryCode' => $country,
'currencyCode' => $currency
);
@@ -56,7 +63,28 @@
 
foreach ( $response['entries'] as $entry ) {
$banks[$entry['issuerId']] = 
$entry['issuerName'];
+   }*/
+
+   $banks = array();
+
+   // HAAACK!
+   // Use undocumented API to get availability straight 
from iDEAL,
+   // until Ingenico can incorporate this into their 
directory
+   if ( $country === 'NL' && $currency === 'EUR' ) {
+   $url = $this->availabilityParameters['url'];
+   $threshold = 
$this->availabilityParameters['threshold'];
+
+   

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

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

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

Merge branch 'master' into deployment

And update vendor

badf7d0 Localisation updates from https://translatewiki.net.
0aa3873 Update SmashPig

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


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

diff --git a/vendor b/vendor
index 145de2a..13319ac 16
--- a/vendor
+++ b/vendor
@@ -1 +1 @@
-Subproject commit 145de2a81260066518539ceed410eb6ec615b663
+Subproject commit 13319acc0cf5d03b95e8b1024d9f1f8504971041

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7c2463e64d9360d25ee28d26c74fe81c3a50524
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
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...vendor[master]: Update SmashPig lib

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

Change subject: Update SmashPig lib
..

Update SmashPig lib

Change-Id: I5c8ffb254fa143c52f760fcbafa64840bac45757
---
M composer/installed.json
M wikimedia/smash-pig/Core/Http/OutboundRequest.php
M wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
A wikimedia/smash-pig/PaymentProviders/Ingenico/Tests/Data/availability.response
M 
wikimedia/smash-pig/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
M wikimedia/smash-pig/PaymentProviders/PayPal/Job.php
M wikimedia/smash-pig/PaymentProviders/PayPal/PaymentMessage.php
M wikimedia/smash-pig/PaymentProviders/PayPal/RecurringMessage.php
M wikimedia/smash-pig/PaymentProviders/PayPal/RefundMessage.php
A wikimedia/smash-pig/PaymentProviders/PayPal/Tests/Data/recurring_payment.json
A 
wikimedia/smash-pig/PaymentProviders/PayPal/Tests/Data/recurring_payment_transformed.json
M 
wikimedia/smash-pig/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
M wikimedia/smash-pig/SmashPig.yaml
13 files changed, 215 insertions(+), 14 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface/vendor 
refs/changes/54/344454/1

diff --git a/composer/installed.json b/composer/installed.json
index 8e57f31..359c136 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -1014,7 +1014,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "d1a135b94870ff263154c5dab084416eb318e05f"
+"reference": "5abbd06ab629e218d7c1842443c0a0627c31d0c3"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -1031,7 +1031,7 @@
 "jakub-onderka/php-parallel-lint": "^0.9",
 "phpunit/phpunit": "^4.8"
 },
-"time": "2017-03-20 17:58:32",
+"time": "2017-03-23 17:11:20",
 "type": "library",
 "installation-source": "source",
 "autoload": {
diff --git a/wikimedia/smash-pig/Core/Http/OutboundRequest.php 
b/wikimedia/smash-pig/Core/Http/OutboundRequest.php
index 92e6cae..8eeb187 100644
--- a/wikimedia/smash-pig/Core/Http/OutboundRequest.php
+++ b/wikimedia/smash-pig/Core/Http/OutboundRequest.php
@@ -12,15 +12,18 @@
/**
 * @var array
 */
-   protected $headers;
+   protected $headers = array();
+
/**
 * @var Configuration
 */
protected $config;
+
/**
 * @var string HTTP method
 */
protected $method;
+
/**
 * @var string Request body
 */
diff --git 
a/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
index 87c034d..4844bbc 100644
--- a/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/wikimedia/smash-pig/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -4,6 +4,7 @@
 
 use SmashPig\Core\Context;
 use Psr\Cache\CacheItemPoolInterface;
+use SmashPig\Core\Http\OutboundRequest;
 
 /**
  * Handle bank payments via Ingenico
@@ -23,9 +24,15 @@
 */
protected $cache;
 
+   /**
+* @var array()
+*/
+   protected $availabilityParameters;
+
public function __construct( array $options = array() ) {
parent::__construct( $options );
$this->cacheParameters = $options['cache-parameters'];
+   $this->availabilityParameters = 
$options['availability-parameters'];
// FIXME: provide objects in constructor
$config = Context::get()->getConfiguration();
$this->cache = $config->object( 'cache' );
@@ -45,7 +52,7 @@
$cacheItem = $this->cache->getItem( $cacheKey );
 
if ( !$cacheItem->isHit() || $this->shouldBeExpired( $cacheItem 
) ) {
-   $query = array(
+   /*$query = array(
'countryCode' => $country,
'currencyCode' => $currency
);
@@ -56,7 +63,28 @@
 
foreach ( $response['entries'] as $entry ) {
$banks[$entry['issuerId']] = 
$entry['issuerName'];
+   }*/
+
+   $banks = array();
+
+   // HAAACK!
+   // Use undocumented API to get availability straight 
from iDEAL,
+   // until Ingenico can incorporate this into their 
directory
+   if ( $country === 'NL' && $currency === 'EUR' ) {
+   $url = $this->availabilityParameters['url'];
+   $threshold = 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Update SmashPig

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

Change subject: Update SmashPig
..

Update SmashPig

Get the iDEAL availability hack

Change-Id: I1a3d2cbb5a3a9f917249c8bda3a28322efb9ee3f
---
M composer.lock
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/composer.lock b/composer.lock
index 39567d5..617375c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -936,7 +936,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "d1a135b94870ff263154c5dab084416eb318e05f"
+"reference": "5abbd06ab629e218d7c1842443c0a0627c31d0c3"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -987,7 +987,7 @@
 "donations",
 "payments"
 ],
-"time": "2017-03-20 17:58:32"
+"time": "2017-03-23 17:11:20"
 },
 {
 "name": "zordius/lightncandy",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a3d2cbb5a3a9f917249c8bda3a28322efb9ee3f
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]: Headers default to empty array, not null

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

Change subject: Headers default to empty array, not null
..

Headers default to empty array, not null

Prevents an e_notice if user doesn't set any headers.

Change-Id: Ic62f2b66848347905844b2726e1366bdae234407
---
M Core/Http/OutboundRequest.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/30/344430/1

diff --git a/Core/Http/OutboundRequest.php b/Core/Http/OutboundRequest.php
index 92e6cae..8eeb187 100644
--- a/Core/Http/OutboundRequest.php
+++ b/Core/Http/OutboundRequest.php
@@ -12,15 +12,18 @@
/**
 * @var array
 */
-   protected $headers;
+   protected $headers = array();
+
/**
 * @var Configuration
 */
protected $config;
+
/**
 * @var string HTTP method
 */
protected $method;
+
/**
 * @var string Request body
 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic62f2b66848347905844b2726e1366bdae234407
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...process-control[master]: Comments and cleanup for config

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

Change subject: Comments and cleanup for config
..


Comments and cleanup for config

Change-Id: Ia1afe7fe3770866d33781a4cd4626a46a5aae09a
---
M processcontrol/config.py
1 file changed, 17 insertions(+), 7 deletions(-)

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



diff --git a/processcontrol/config.py b/processcontrol/config.py
index d58cd8f..79117f7 100644
--- a/processcontrol/config.py
+++ b/processcontrol/config.py
@@ -1,4 +1,4 @@
-import glob
+import copy
 import os
 import yaml
 
@@ -9,6 +9,13 @@
 self.values = defaults
 
 def get(self, path, default=None):
+"""Get a value from configuration.
+You can get a nested property by using a path delimited by
+forward slashes (/).
+If you provide a default value, it will be used when the
+desired property does not exist. If there is no default,
+trying to get a missing property raises a MissingKeyException.
+"""
 parts = path.split("/")
 current = self.values
 
@@ -21,6 +28,9 @@
 return current
 
 def has(self, path):
+"""Test for existance of a property.
+As with get(), use forward slashes to represent nested properties.
+"""
 try:
 self.get(path)
 except MissingKeyException:
@@ -50,11 +60,11 @@
 ]
 
 def load_global_config(self):
-# load configuration from global config paths
-# later entries override earlier entries
-for search_path in self.global_config_paths():
-file_paths = glob.glob(search_path)
-for file_path in file_paths:
+"""Load configuration from global config paths.
+Later entries override earlier entries.
+"""
+for file_path in self.global_config_paths():
+if os.access(file_path, os.R_OK):
 config = yaml.safe_load(open(file_path, "r"))
 self.values.update(config)
 
@@ -63,7 +73,7 @@
 
 def __init__(self, global_config, config_path):
 if global_config.has("default_job_config"):
-defaults = global_config.get("default_job_config").copy()
+defaults = copy.deepcopy(global_config.get("default_job_config"))
 else:
 defaults = {}
 Configuration.__init__(self, defaults)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1afe7fe3770866d33781a4cd4626a46a5aae09a
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Ejegg 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Hack to get availability straight from iDEAL

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

Change subject: Hack to get availability straight from iDEAL
..

Hack to get availability straight from iDEAL

If noone vetoes this, maybe put it in a different class.

Bug: T161153
Change-Id: I0d24f86a0ca2bd89337e5d3acec723db05cb69f0
---
M PaymentProviders/Ingenico/BankPaymentProvider.php
A PaymentProviders/Ingenico/Tests/Data/availability.response
M PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
M SmashPig.yaml
4 files changed, 57 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/72/344272/1

diff --git a/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/PaymentProviders/Ingenico/BankPaymentProvider.php
index 87c034d..4844bbc 100644
--- a/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -4,6 +4,7 @@
 
 use SmashPig\Core\Context;
 use Psr\Cache\CacheItemPoolInterface;
+use SmashPig\Core\Http\OutboundRequest;
 
 /**
  * Handle bank payments via Ingenico
@@ -23,9 +24,15 @@
 */
protected $cache;
 
+   /**
+* @var array()
+*/
+   protected $availabilityParameters;
+
public function __construct( array $options = array() ) {
parent::__construct( $options );
$this->cacheParameters = $options['cache-parameters'];
+   $this->availabilityParameters = 
$options['availability-parameters'];
// FIXME: provide objects in constructor
$config = Context::get()->getConfiguration();
$this->cache = $config->object( 'cache' );
@@ -45,7 +52,7 @@
$cacheItem = $this->cache->getItem( $cacheKey );
 
if ( !$cacheItem->isHit() || $this->shouldBeExpired( $cacheItem 
) ) {
-   $query = array(
+   /*$query = array(
'countryCode' => $country,
'currencyCode' => $currency
);
@@ -56,7 +63,28 @@
 
foreach ( $response['entries'] as $entry ) {
$banks[$entry['issuerId']] = 
$entry['issuerName'];
+   }*/
+
+   $banks = array();
+
+   // HAAACK!
+   // Use undocumented API to get availability straight 
from iDEAL,
+   // until Ingenico can incorporate this into their 
directory
+   if ( $country === 'NL' && $currency === 'EUR' ) {
+   $url = $this->availabilityParameters['url'];
+   $threshold = 
$this->availabilityParameters['threshold'];
+
+   $request = new OutboundRequest( $url );
+   $rawResponse = $request->execute();
+   $response = json_decode( $rawResponse['body'], 
true );
+
+   foreach ( $response['Issuers'] as $issuer ) {
+   if ( $issuer['Percent'] >= $threshold ) 
{
+   $banks[$issuer['BankId']] = 
$issuer['BankName'];
+   }
+   }
}
+
$duration = $this->cacheParameters['duration'];
$cacheItem->set( array(
'value' => $banks,
diff --git a/PaymentProviders/Ingenico/Tests/Data/availability.response 
b/PaymentProviders/Ingenico/Tests/Data/availability.response
new file mode 100644
index 000..74f0def
--- /dev/null
+++ b/PaymentProviders/Ingenico/Tests/Data/availability.response
@@ -0,0 +1,14 @@
+HTTP/1.1 200 OK
+Cache-Control: no-cache
+Pragma: no-cache
+Content-Length: 656
+Content-Type: application/json; charset=utf-8
+Content-Encoding: gzip
+Expires: -1
+Vary: Accept-Encoding
+Server: Microsoft-IIS/8.0
+X-AspNet-Version: 4.0.30319
+X-Powered-By: ASP.NET
+Date: Wed, 22 Mar 2017 22:42:05 GMT
+
+{"Issuers":[{"BankId":"ABNANL2A","BankName":"ABN 
AMRO","LogoPath":"/Content/icons/banks/abn.png","Status":"Green","Percent":"40","Details":"","MoreDetails":"","LogoStatus":"/Content/icons/green.png","URL":"/History?bank=ABN_AMRO"},{"BankId":"INGBNL2A","BankName":"Issuer
 Simulation V3 - 
ING","LogoPath":"/Content/icons/banks/sim.png","Status":"Green","Percent":"100","Details":"","MoreDetails":"","LogoStatus":"/Content/icons/green.png","URL":"/History?bank=Simulated_Bank"}],"Message":"","IssuerMessageCalculationFailed":false,"LastUpdate":"22-3-2017,
 23:40","AllGreen":true}
diff --git 
a/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
index d9a2e3e..18ef9e7 100644
--- 

[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Comments and cleanup for config

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

Change subject: Comments and cleanup for config
..

Comments and cleanup for config

Change-Id: Ia1afe7fe3770866d33781a4cd4626a46a5aae09a
---
M processcontrol/config.py
1 file changed, 17 insertions(+), 7 deletions(-)


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

diff --git a/processcontrol/config.py b/processcontrol/config.py
index 69fa24e..4914ea8 100644
--- a/processcontrol/config.py
+++ b/processcontrol/config.py
@@ -1,4 +1,4 @@
-import glob
+import copy
 import os
 import yaml
 
@@ -9,6 +9,13 @@
 self.values = defaults
 
 def get(self, path, default=None):
+"""Get a value from configuration.
+You can get a nested property by using a path delimited by
+forward slashes (/).
+If you provide a default value, it will be used when the
+desired property does not exist. If there is no default,
+trying to get a missing property raises a MissingKeyException.
+"""
 parts = path.split("/")
 current = self.values
 
@@ -21,6 +28,9 @@
 return current
 
 def has(self, path):
+"""Test for existance of a property.
+As with get(), use forward slashes to represent nested properties.
+"""
 try:
 self.get(path)
 except MissingKeyException:
@@ -52,11 +62,11 @@
 ]
 
 def load_global_config(self):
-# load configuration from global config paths
-# later entries override earlier entries
-for search_path in self.global_config_paths():
-file_paths = glob.glob(search_path)
-for file_path in file_paths:
+"""Load configuration from global config paths.
+Later entries override earlier entries.
+"""
+for file_path in self.global_config_paths():
+if os.access(file_path, os.R_OK):
 config = yaml.safe_load(open(file_path, "r"))
 self.values.update(config)
 
@@ -65,7 +75,7 @@
 
 def __init__(self, global_config, config_path):
 if global_config.has("default_job_config"):
-defaults = global_config.get("default_job_config").copy()
+defaults = copy.deepcopy(global_config.get("default_job_config"))
 else:
 defaults = {}
 Configuration.__init__(self, defaults)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1afe7fe3770866d33781a4cd4626a46a5aae09a
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...process-control[master]: Move some things into global config

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

Change subject: Move some things into global config
..

Move some things into global config

Change-Id: I402b4f65af2c6a4e75edd5ebd787a2ebaf78c3cd
---
M process-control.yaml
M processcontrol/crontab.py
M processcontrol/job_wrapper.py
M processcontrol/mailer.py
4 files changed, 20 insertions(+), 25 deletions(-)


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

diff --git a/process-control.yaml b/process-control.yaml
index 7084186..78f684e 100644
--- a/process-control.yaml
+++ b/process-control.yaml
@@ -1,3 +1,9 @@
+cron_template: "# Generated from {source}\n{schedule} {user} {command}\n"
+
 default_job_config:
-from_address: "Fail Mail "
-to_address: "fr-t...@wikimedia.org"
+failmail:
+from_address: "Fail Mail "
+to_address: "fr-t...@wikimedia.org"
+
+timeout: 600
+user: jenkins
diff --git a/processcontrol/crontab.py b/processcontrol/crontab.py
index c3d1703..e6d3ff9 100644
--- a/processcontrol/crontab.py
+++ b/processcontrol/crontab.py
@@ -3,14 +3,7 @@
 
 import job_wrapper
 
-# FIXME: Move to global config
-DEFAULT_USER = "jenkins"
-
-CRON_TEMPLATE = """# Generated from {source}
-{schedule} {user} {command}
-"""
-
-RUNNER_PATH = os.path.dirname(__file__) + "/crash-override"
+RUNNER_PATH = os.path.dirname(__file__) + "/bin/run-job"
 
 
 def make_cron(config_dir):
@@ -45,11 +38,13 @@
 command = "{runner} {conf}".format(
 runner=RUNNER_PATH,
 conf=self.job.config_path)
+
+template = self.job.global_config.get("cron_template")
 
-out = CRON_TEMPLATE.format(
+out = template.format(
 source=self.job.config_path,
 schedule=self.job.config.get("schedule"),
-user=DEFAULT_USER,
+user=self.job.config.get("user"),
 command=command)
 
 return out
diff --git a/processcontrol/job_wrapper.py b/processcontrol/job_wrapper.py
index 6b8423e..fefcf25 100644
--- a/processcontrol/job_wrapper.py
+++ b/processcontrol/job_wrapper.py
@@ -9,9 +9,6 @@
 from . import lock
 from . import mailer
 
-# FIXME: move to global config
-DEFAULT_TIMEOUT = 600
-
 
 class JobWrapper(object):
 def __init__(self, config_path=None):
@@ -22,11 +19,7 @@
 self.name = self.config.get("name")
 self.start_time = datetime.datetime.utcnow().isoformat()
 self.mailer = mailer.Mailer(self.config)
-
-if self.config.has("timeout"):
-self.timeout = self.config.get("timeout")
-else:
-self.timeout = DEFAULT_TIMEOUT
+self.timeout = self.config.get("timeout")
 
 if self.config.has("disabled") and self.config.get("disabled") is True:
 self.enabled = False
diff --git a/processcontrol/mailer.py b/processcontrol/mailer.py
index 35e3a07..08bb432 100644
--- a/processcontrol/mailer.py
+++ b/processcontrol/mailer.py
@@ -4,7 +4,8 @@
 
 class Mailer(object):
 def __init__(self, config):
-self.config = config
+self.from_address = config.get("failmail/from_address")
+self.to_address = config.get("failmail/to_address")
 # FIXME: this is set to ensure one failmail per instance. Should
 # do something more sophisticated to collect all calls and send
 # the mail before exiting.
@@ -17,13 +18,13 @@
 msg = MIMEText(body)
 
 msg["Subject"] = "Fail Mail : " + subject
-msg["From"] = self.config.get("from_address")
-msg["To"] = self.config.get("to_address")
+msg["From"] = self.from_address
+msg["To"] = self.to_address
 
 mailer = smtplib.SMTP("localhost")
 mailer.sendmail(
-self.config.get("from_address"),
-self.config.get("to_address"),
+self.from_address,
+self.to_address,
 msg.as_string()
 )
 mailer.quit()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I402b4f65af2c6a4e75edd5ebd787a2ebaf78c3cd
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...process-control[master]: WIP config object

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

Change subject: WIP config object
..

WIP config object

Change-Id: I64d0e15af51415cc7537d8e2acbe7d5a90ab4f84
TODO: what else is there that shouldn't go under the job key?
FIXME: tests not gonna pass
---
A processcontrol/config.py
M processcontrol/job_wrapper.py
2 files changed, 60 insertions(+), 26 deletions(-)


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

diff --git a/processcontrol/config.py b/processcontrol/config.py
new file mode 100644
index 000..05d2a26
--- /dev/null
+++ b/processcontrol/config.py
@@ -0,0 +1,48 @@
+import glob
+import os
+import yaml
+
+
+class Config(object):
+
+def __init__(self, extra_paths=[]):
+search_paths = [
+dirname(__file__) + "/../processcontrol.yaml"
+"/etc/fundraising/processcontrol.yaml",
+"/etc/fundraising/processcontrol.d/*.yaml",
+os.path.expanduser("~") + "/.fundraising/processcontrol.yaml"
+] + extra_paths
+load_config(search_paths)
+
+def load_config(self, search_paths):
+self.config = {}
+for search_path in search_paths:
+file_paths = glob.glob(search_path)
+for file_path in file_path:
+config = yaml.safe_load(open(file_path, "r"))
+self.config.update(config)
+self.validate_job_config()
+
+def load_job_config(self, job_config_path):
+job_config = yaml.safe_load(open(job_config_path, "r"))
+self.config["job"].update(job_config)
+self.validate_job_config()
+
+def validate_job_config(self):
+job_config = self.config["job"]
+assert "name" in job_config
+assert "command" in job_config
+if "schedule" in job_config:
+# No tricky assignments.
+assert "=" not in job_config["schedule"]
+# Legal cron, but I don't want to deal with it.
+assert "@" not in job_config["schedule"]
+
+# Be sure the schedule is valid.
+terms = job_config["schedule"].split()
+assert len(terms) == 5
+
+def __getattr__(self, attr):
+if attr in self.config:
+return self.config[attr]
+return None
diff --git a/processcontrol/job_wrapper.py b/processcontrol/job_wrapper.py
index 4c3cae6..35f1662 100644
--- a/processcontrol/job_wrapper.py
+++ b/processcontrol/job_wrapper.py
@@ -4,42 +4,40 @@
 import subprocess
 import sys
 import threading
-import yaml
 
+import config
 import lock
 import mailer
 
-# TODO: Global config.
 DEFAULT_TIMEOUT = 600
 
 
 class JobWrapper(object):
-def __init__(self, config_path=None):
-self.config_path = config_path
-self.config = yaml.safe_load(open(config_path, "r"))
-self.validate_config()
+def __init__(self, job_config_path=None):
+self.config = config.Config()
+self.config.load_job_config(job_config_path)
 
-self.name = self.config["name"]
+self.name = self.config.job["name"]
 self.start_time = datetime.datetime.utcnow().isoformat()
 self.mailer = mailer.Mailer(self.config)
 
-if "timeout" in self.config:
-self.timeout = self.config["timeout"]
+if "timeout" in self.config.job:
+self.timeout = self.config.job["timeout"]
 else:
 self.timeout = DEFAULT_TIMEOUT
 
-if "disabled" in self.config and self.config["disabled"] is True:
+if "disabled" in self.config.job and self.config.job["disabled"] is 
True:
 self.enabled = False
 else:
 self.enabled = True
 
-if "schedule" not in self.config:
+if "schedule" not in self.config.job:
 self.enabled = False
 
 def run(self):
 lock.begin(job_tag=self.name)
 
-command = shlex.split(self.config["command"])
+command = shlex.split(self.config.job["command"])
 
 self.process = subprocess.Popen(command, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
 timer = threading.Timer(self.timeout, self.fail_timeout)
@@ -82,10 +80,10 @@
 # FIXME: Job will return SIGKILL now, fail_exitcode should ignore that 
signal now?
 
 def store_job_output(self, stdout_data):
-if "stdout_destination" not in self.config:
+if "stdout_destination" not in self.config.job:
 return
 
-destination = self.config["stdout_destination"]
+destination = self.config.job["stdout_destination"]
 out = open(destination, "a")
 
 header = (
@@ -97,15 +95,3 @@
 
 out.write(stdout_data.decode("utf-8"))
 
-def validate_config(self):
-assert "name" in self.config
-assert "command" in self.config
-if "schedule" in self.config:
-# No tricky assignments.
-  

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

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

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/74/343774/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index 84aa10f..b0d94b7 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit 84aa10f20e0c72d5d55629e4bcbd10830b985a32
+Subproject commit b0d94b7e1c3ba8dac3bc3925d87255376679f889

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6758e46793d3eab7903a7efe3789cf32b219fba3
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-03-20 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/343732 )

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

Merge branch 'master' into deployment

And update vendor

a1ec96b Copy accepted currencies from PayPal legacy to express checkout
7728083 More verbose test titles
5796f47 Comments and whitespace
71acea7 Check for maintenance mode before anything
68e2fac Comments
d7a0445 Localisation updates from https://translatewiki.net.
6d573ef Localisation updates from https://translatewiki.net.
957137b Update smashpig lib

Change-Id: Id2625cb82c7221e3681b92a5c68dc50bbab42ac1
---
D tests/phpunit/GatewayPageTest.php
M vendor
2 files changed, 1 insertion(+), 214 deletions(-)


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

diff --git a/tests/phpunit/GatewayPageTest.php 
b/tests/phpunit/GatewayPageTest.php
deleted file mode 100644
index a76a6da..000
--- a/tests/phpunit/GatewayPageTest.php
+++ /dev/null
@@ -1,213 +0,0 @@
-<<< HEAD   (84aa10 Merge branch 'master' into deployment)
-===
-page = new TestingGatewayPage();
-   // put these here so tests can override them
-   TestingGenericAdapter::$fakeGlobals = array ( 
'FallbackCurrency' => 'USD' );
-   TestingGenericAdapter::$acceptedCurrencies[] = 'USD';
-   TestingGenericAdapter::$fakeIdentifier = 'globalcollect';
-   $this->setMwGlobals( array(
-   'wgPaypalGatewayEnabled' => true,
-   'wgDonationInterfaceAllowedHtmlForms' => array(
-   'paypal' => array(
-   'gateway' => 'paypal',
-   'payment_methods' => array('paypal' => 
'ALL'),
-   ),
-   ),
-   ) );
-   parent::setUp();
-   }
-
-   protected function setUpAdapter( $extra = array() ) {
-   $externalData = array_merge(
-   array(
-   'amount' => '200',
-   'currency_code' => 'BBD',
-   'contribution_tracking_id' => mt_rand( 1, 
1000 ),
-   ),
-   $extra
-   );
-   $this->adapter = new TestingGenericAdapter( array(
-   'external_data' => $externalData,
-   ) );
-   $this->page->adapter = $this->adapter;
-   }
-
-   public function tearDown() {
-   TestingGenericAdapter::$acceptedCurrencies = array();
-   TestingGenericAdapter::$fakeGlobals = array();
-   TestingGenericAdapter::$fakeIdentifier = false;
-   parent::tearDown();
-   }
-
-   public function testCurrencyFallbackWithNotification() {
-   TestingGenericAdapter::$fakeGlobals['NotifyOnConvert'] = true;
-   $this->setUpAdapter();
-
-   $this->page->validateForm();
-
-   $this->assertTrue( $this->adapter->validatedOK() );
-
-   $manualErrors = $this->adapter->getManualErrors();
-   $msg = $this->page->msg( 
'donate_interface-fallback-currency-notice', 'USD' )->text();
-   $this->assertEquals( $msg, $manualErrors['general'] );
-   $this->assertEquals( 100, 
$this->adapter->getData_Unstaged_Escaped( 'amount' ) );
-   $this->assertEquals( 'USD', 
$this->adapter->getData_Unstaged_Escaped( 'currency_code' ) );
-   }
-
-   public function testCurrencyFallbackIntermediateConversion() {
-   TestingGenericAdapter::$fakeGlobals['FallbackCurrency'] = 'OMR';
-   TestingGenericAdapter::$fakeGlobals['NotifyOnConvert'] = true;
-   TestingGenericAdapter::$acceptedCurrencies[] = 'OMR';
-   // FIXME: Relies on app default exchange rate.  Set explicitly 
instead.
-   $this->setUpAdapter();
-
-   $this->page->validateForm();
-
-   $manualErrors = $this->adapter->getManualErrors();
-   $msg = $this->page->msg( 
'donate_interface-fallback-currency-notice', 'OMR' )->text();
-   $this->assertEquals( $msg, $manualErrors['general'] );
-   $this->assertEquals( 38, 
$this->adapter->getData_Unstaged_Escaped( 'amount' ) );
-   $this->assertEquals( 'OMR', 
$this->adapter->getData_Unstaged_Escaped( 'currency_code' ) );
-   }
-
-   public function testCurrencyFallbackWithoutNotification() {
-   TestingGenericAdapter::$fakeGlobals['NotifyOnConvert'] = false;
-   $this->setUpAdapter();
-
-   $this->page->validateForm();
-
-   $this->assertTrue( $this->adapter->validatedOK() );
-
-   $manualErrors = $this->adapter->getManualErrors();
-

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Update smashpig lib

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

Change subject: Update smashpig lib
..

Update smashpig lib

Get the memcache expiry workaround

Change-Id: I0ddc5f549d2bd60d1aa935b821b27082a3b1f6e4
---
M composer.lock
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/composer.lock b/composer.lock
index bcc8efa..39567d5 100644
--- a/composer.lock
+++ b/composer.lock
@@ -936,7 +936,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "4625e68bd0fde15a2dc3ff646cc01bcd4325d8fc"
+"reference": "d1a135b94870ff263154c5dab084416eb318e05f"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -987,7 +987,7 @@
 "donations",
 "payments"
 ],
-"time": "2017-02-23 20:48:06"
+"time": "2017-03-20 17:58:32"
 },
 {
 "name": "zordius/lightncandy",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ddc5f549d2bd60d1aa935b821b27082a3b1f6e4
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[master]: Split out queue tests

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

Change subject: Split out queue tests
..

Split out queue tests

Separate files for one-time donations, recurring, and refunds
TODO: better cleanup

Change-Id: I1ddbcd72d62c0085e11def6d8a410914a40b8c27
---
A sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
A sites/all/modules/queue2civicrm/tests/phpunit/RecurringQueueTest.php
A sites/all/modules/queue2civicrm/tests/phpunit/RefundQueueTest.php
4 files changed, 702 insertions(+), 577 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/21/343421/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
new file mode 100644
index 000..ab978fa
--- /dev/null
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
@@ -0,0 +1,336 @@
+pendingDb = PendingDatabase::get();
+   $this->pendingDb->createTable();
+   $this->queueConsumer = new DonationQueueConsumer( 'test' );
+   }
+
+   /**
+* Process an ordinary (one-time) donation message
+*/
+   public function testDonation() {
+   $message = new TransactionMessage(
+   array( 'gross' => 400, 'original_gross' => 400, 
'original_currency' => 'USD' )
+   );
+   $message2 = new TransactionMessage();
+
+   exchange_rate_cache_set( 'USD', $message->get( 'date' ), 1 );
+   exchange_rate_cache_set( $message->get( 'currency' ), 
$message->get( 'date' ), 3 );
+
+   $this->queueConsumer->processMessage( $message->getBody() );
+   $this->queueConsumer->processMessage( $message2->getBody() );
+
+   $campaignField = wmf_civicrm_get_custom_field_name( 'campaign' 
);
+
+   $expected = array(
+   'contact_type' => 'Individual',
+   'sort_name' => 'laast, firrst',
+   'display_name' => 'firrst laast',
+   'first_name' => 'firrst',
+   'last_name' => 'laast',
+   'currency' => 'USD',
+   'total_amount' => '400.00',
+   'fee_amount' => '0.00',
+   'net_amount' => '400.00',
+   'trxn_id' => 'GLOBALCOLLECT ' . 
$message->getGatewayTxnId(),
+   'contribution_source' => 'USD 400',
+   'financial_type' => 'Cash',
+   'contribution_status' => 'Completed',
+   'payment_instrument' => 'Credit Card: Visa',
+   $campaignField => '',
+   );
+   $returnFields = array_keys( $expected );
+
+   $contribution = civicrm_api3(
+   'Contribution',
+   'getsingle',
+   array(
+   wmf_civicrm_get_custom_field_name( 
'gateway_txn_id' ) => $message->getGatewayTxnId(),
+   'return' => $returnFields
+   )
+   );
+
+   $this->assertArraySubset( $expected, $contribution );
+
+   $contribution2 = civicrm_api3(
+   'Contribution',
+   'getsingle',
+   array(
+   wmf_civicrm_get_custom_field_name( 
'gateway_txn_id' ) => $message2->getGatewayTxnId(),
+   'return' => $returnFields
+   )
+   );
+
+   $expected = array(
+   'contact_type' => 'Individual',
+   'sort_name' => 'laast, firrst',
+   'display_name' => 'firrst laast',
+   'first_name' => 'firrst',
+   'last_name' => 'laast',
+   'currency' => 'USD',
+   'total_amount' => '2857.02',
+   'fee_amount' => '0.00',
+   'net_amount' => '2857.02',
+   'trxn_id' => 'GLOBALCOLLECT ' . 
$message2->getGatewayTxnId(),
+   'contribution_source' => 'PLN 952.34',
+   'financial_type' => 'Cash',
+   'contribution_status' => 'Completed',
+   'payment_instrument' => 'Credit Card: Visa',
+   $campaignField => 'Benefactor Gift',
+   );
+   $this->assertArraySubset( $expected, $contribution2 );
+   $this->assertNotEquals( $contribution['contact_id'], 
$contribution2['contact_id'] );
+   }
+
+   /**
+* Process an ordinary (one-time) donation message 

[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Global config

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

Change subject: Global config
..

Global config

Defaults for everything go in /etc/fundraising/crash-override.yaml

Change-Id: I8d6041730dc315fab28dc08a340a7985676bd1fb
---
M job_wrapper.py
1 file changed, 9 insertions(+), 3 deletions(-)


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

diff --git a/job_wrapper.py b/job_wrapper.py
index e1cc9d6..4c0276b 100644
--- a/job_wrapper.py
+++ b/job_wrapper.py
@@ -1,5 +1,6 @@
 from __future__ import print_function
 import datetime
+import os
 import shlex
 import subprocess
 import sys
@@ -9,14 +10,19 @@
 import lock
 import mailer
 
-# TODO: Global config.
 DEFAULT_TIMEOUT = 600
-
+GLOBAL_CONFIG_PATH = "/etc/fundraising/crash-override.yaml"
 
 class JobWrapper(object):
 def __init__(self, config_path=None):
+# load global config if it exists
+try:
+self.config = yaml.safe_load(open(GLOBAL_CONFIG_PATH, "r"))
+except:
+self.config = {}
+
 self.config_path = config_path
-self.config = yaml.safe_load(open(config_path, "r"))
+self.config.update(yaml.safe_load(open(config_path, "r")))
 self.validate_config()
 
 self.name = self.config["name"]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d6041730dc315fab28dc08a340a7985676bd1fb
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...process-control[master]: Send failmail

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

Change subject: Send failmail
..

Send failmail

Change-Id: I987df527c07e95b5bde31c89118d72681673d94a
TODO: check the send args in tests
---
M job_wrapper.py
M tests/test_job_wrapper.py
2 files changed, 34 insertions(+), 8 deletions(-)


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

diff --git a/job_wrapper.py b/job_wrapper.py
index 4813b3a..4a07833 100644
--- a/job_wrapper.py
+++ b/job_wrapper.py
@@ -1,6 +1,8 @@
 from __future__ import print_function
 import datetime
+from email.mime.text import MIMEText
 import shlex
+import smtplib
 import subprocess
 import sys
 import threading
@@ -61,18 +63,39 @@
 self.fail_exitcode(return_code)
 
 def fail_exitcode(self, return_code):
-print("Job {name} failed with code {code}".format(name=self.name, 
code=return_code), file=sys.stderr)
+message = "Job {name} failed with code {code}".format(name=self.name, 
code=return_code)
+print(message, file=sys.stderr)
 # TODO: Prevent future jobs according to config.
+self.fail_mail(message)
 
 def fail_has_stderr(self, stderr_data):
-print("Job {name} printed things to stderr:".format(name=self.name), 
file=sys.stderr)
-print(stderr_data.decode("utf-8"), file=sys.stderr)
+message = "Job {name} printed things to stderr:".format(name=self.name)
+print(message, file=sys.stderr)
+data = stderr_data.decode("utf-8")
+print(data, file=sys.stderr)
+self.fail_mail(message, data)
 
 def fail_timeout(self):
 self.process.kill()
-print("Job {name} timed out after {timeout} 
seconds".format(name=self.name, timeout=self.timeout), file=sys.stderr)
+message = "Job {name} timed out after {timeout} 
seconds".format(name=self.name, timeout=self.timeout)
+print(message, file=sys.stderr)
+self.fail_mail(message)
 # FIXME: Job will return SIGKILL now, fail_exitcode should ignore that 
signal now?
 
+def fail_mail(self, subject, body="Hope your wits are freshly sharpened!"):
+msg = MIMEText(body)
+# TODO: get these from our global config
+from_address = "Fail Mail "
+to_address = "fr-t...@wikimedia.org"
+
+msg["Subject"] = "Fail Mail : " + subject
+msg["From"] = from_address
+msg["To"] = to_address
+
+mailer = smtplib.SMTP("localhost")
+mailer.sendmail(from_address, to_address, msg.as_string())
+mailer.quit()
+
 def store_job_output(self, stdout_data):
 if "stdout_destination" not in self.config:
 return
diff --git a/tests/test_job_wrapper.py b/tests/test_job_wrapper.py
index 730ca2c..d4ef6dd 100644
--- a/tests/test_job_wrapper.py
+++ b/tests/test_job_wrapper.py
@@ -1,3 +1,4 @@
+from mock import patch
 import iocapture
 import nose
 import os
@@ -22,8 +23,8 @@
 assert captured.stdout == ""
 assert captured.stderr == ""
 
-
-def test_return_code():
+@patch("smtplib.SMTP")
+def test_return_code(MockSmtp):
 with iocapture.capture() as captured:
 run_job("return_code.yaml")
 
@@ -33,7 +34,8 @@
 
 # Must finish in less than two seconds, i.e. must have timed out.
 @nose.tools.timed(2)
-def test_timeout():
+@patch("smtplib.SMTP")
+def test_timeout(MockSmtp):
 with iocapture.capture() as captured:
 run_job("timeout.yaml")
 
@@ -44,7 +46,8 @@
 )
 
 
-def test_stderr():
+@patch("smtplib.SMTP")
+def test_stderr(MockSmtp):
 with iocapture.capture() as captured:
 run_job("errors.yaml")
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I987df527c07e95b5bde31c89118d72681673d94a
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] operations/puppet[production]: Enable mcrypt extension on CI slaves

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

Change subject: Enable mcrypt extension on CI slaves
..

Enable mcrypt extension on CI slaves

This is required for the upstream version of civicrm-buildkit, which
fundraising uses to set up fresh Civi installs for each test. This
patch will allow fr-tech to stop using a fork of -buildkit.

Mcrypt is deprecated in PHP 7, so we'll see what the Civi folks are
planning around that.

Change-Id: Id21615d558a17048f008756592fda5674c1b7ec1
---
M modules/contint/manifests/packages/php.pp
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/23/343223/1

diff --git a/modules/contint/manifests/packages/php.pp 
b/modules/contint/manifests/packages/php.pp
index f438663..8a0057e 100644
--- a/modules/contint/manifests/packages/php.pp
+++ b/modules/contint/manifests/packages/php.pp
@@ -5,6 +5,8 @@
 'php5-dev',  # phpize
 'php5-ldap',  # OpenStackManager/LdapAuthentication T125158
 'php5-gd',
+# mcrypt is used by fundraising's CiviCRM setup, deprecated in PHP 7
+'php5-mcrypt',
 'php5-pgsql',
 'php5-sqlite',
 'php5-tidy',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id21615d558a17048f008756592fda5674c1b7ec1
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Correct failopen test

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

Change subject: Correct failopen test
..


Correct failopen test

Change-Id: I2316941b63079c8a7845cf957091c72ddfdda8d1
---
M tests/test_lock.py
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/tests/test_lock.py b/tests/test_lock.py
index 54f1227..6c4c55b 100644
--- a/tests/test_lock.py
+++ b/tests/test_lock.py
@@ -55,7 +55,7 @@
 @nose.tools.raises(lock.LockError)
 def test_stale_lock_failopen():
 tag = "stale-open"
-lock.begin(job_tag=tag, failopen=True)
+lock.begin(job_tag=tag)
 
 # Make the lockfile stale by changing the process ID.
 assert lock.lockfile
@@ -63,7 +63,7 @@
 f.write("-1")
 f.close()
 
-lock.begin(job_tag=tag)
+lock.begin(job_tag=tag, failopen=True)
 
 
 def test_invalid_lock():

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2316941b63079c8a7845cf957091c72ddfdda8d1
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: test failopen; py2

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

Change subject: test failopen; py2
..


test failopen; py2

Change-Id: Id33866f7887aa404f453cf5ced6307fd83e2c2fd
---
M tests/test_lock.py
1 file changed, 14 insertions(+), 0 deletions(-)

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



diff --git a/tests/test_lock.py b/tests/test_lock.py
index cc3d71b..54f1227 100644
--- a/tests/test_lock.py
+++ b/tests/test_lock.py
@@ -52,6 +52,20 @@
 lock.end()
 
 
+@nose.tools.raises(lock.LockError)
+def test_stale_lock_failopen():
+tag = "stale-open"
+lock.begin(job_tag=tag, failopen=True)
+
+# Make the lockfile stale by changing the process ID.
+assert lock.lockfile
+f = open(lock.lockfile, "w")
+f.write("-1")
+f.close()
+
+lock.begin(job_tag=tag)
+
+
 def test_invalid_lock():
 tag = "stale"
 lock.begin(job_tag=tag)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id33866f7887aa404f453cf5ced6307fd83e2c2fd
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/fundraising/process-control
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Ejegg 

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


[MediaWiki-commits] [Gerrit] wikimedia...process-control[master]: Tests for the lock module

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

Change subject: Tests for the lock module
..


Tests for the lock module

Change-Id: I242a42518e1eaab5c8b039af2ac75615db9d01cc
---
M lock.py
M tests/data/timeout.yaml
M tests/test_job_wrapper.py
A tests/test_lock.py
M tox.ini
5 files changed, 101 insertions(+), 21 deletions(-)

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



diff --git a/lock.py b/lock.py
index 523b56c..67e2cdd 100644
--- a/lock.py
+++ b/lock.py
@@ -3,6 +3,7 @@
 
 Self-corrects stale locks unless "failopen" is True.
 '''
+from __future__ import print_function
 import os
 import os.path
 import sys
@@ -17,7 +18,7 @@
 filename = "/tmp/{name}.lock".format(name=job_tag)
 
 if os.path.exists(filename):
-log.warn("Lockfile found!")
+print("Lockfile found!", file=sys.stderr)
 f = open(filename, "r")
 pid = None
 try:
@@ -26,18 +27,16 @@
 pass
 f.close()
 if not pid:
-log.error("Invalid lockfile contents.")
+print("Invalid lockfile contents.", file=sys.stderr)
 else:
 try:
 os.getpgid(pid)
-log.error("Aborting! Previous process ({pid}) is still alive. 
Remove lockfile manually if in error: {path}".format(pid=pid, path=filename))
-sys.exit(1)
+raise LockError("Aborting! Previous process ({pid}) is still 
alive. Remove lockfile manually if in error: {path}".format(pid=pid, 
path=filename))
 except OSError:
 if failopen:
-log.fatal("Aborting until stale lockfile is investigated: 
{path}".format(path=filename))
-sys.exit(1)
-log.error("Lockfile is stale.")
-log.info("Removing old lockfile.")
+raise LockError("Aborting until stale lockfile is 
investigated: {path}".format(path=filename))
+print("Lockfile is stale.", file=sys.stderr)
+print("Removing old lockfile.", file=sys.stderr)
 os.unlink(filename)
 
 f = open(filename, "w")
@@ -50,7 +49,11 @@
 
 def end():
 global lockfile
-if lockfile:
+if lockfile and os.path.exists(lockfile):
 os.unlink(lockfile)
 else:
-raise RuntimeError("Already unlocked!")
+raise LockError("Already unlocked!")
+
+
+class LockError(RuntimeError):
+pass
diff --git a/tests/data/timeout.yaml b/tests/data/timeout.yaml
index 5dfe4ee..9e01920 100644
--- a/tests/data/timeout.yaml
+++ b/tests/data/timeout.yaml
@@ -1,3 +1,3 @@
 name: Timing out job
-command: /bin/sleep 2
+command: /bin/sleep 10
 timeout: 0.1
diff --git a/tests/test_job_wrapper.py b/tests/test_job_wrapper.py
index 463edbd..cea8ef6 100644
--- a/tests/test_job_wrapper.py
+++ b/tests/test_job_wrapper.py
@@ -1,5 +1,6 @@
 import datetime
 import iocapture
+import nose
 import os
 
 import job_wrapper
@@ -31,9 +32,9 @@
 assert captured.stderr == "Job False job failed with code 1\n"
 
 
+# Must finish in less than two seconds, i.e. must have timed out.
+@nose.tools.timed(2)
 def test_timeout():
-start_time = datetime.datetime.utcnow()
-
 with iocapture.capture() as captured:
 run_job("timeout.yaml")
 
@@ -42,11 +43,6 @@
 "Job Timing out job timed out after 0.1 seconds\n"
 "Job Timing out job failed with code -9\n"
 )
-
-end_time = datetime.datetime.utcnow()
-delta = end_time - start_time
-
-assert delta.total_seconds() < 2
 
 
 def test_stderr():
diff --git a/tests/test_lock.py b/tests/test_lock.py
new file mode 100644
index 000..cc3d71b
--- /dev/null
+++ b/tests/test_lock.py
@@ -0,0 +1,84 @@
+import nose
+import os.path
+
+import lock
+
+
+def tearDown():
+# Clean up any old lockfiles.
+if lock.lockfile != None:
+if os.path.exists(lock.lockfile):
+os.unlink(lock.lockfile)
+
+
+def test_success():
+tag = "success"
+lock.begin(job_tag=tag)
+assert lock.lockfile
+assert os.path.exists(lock.lockfile)
+
+lock.end()
+assert not os.path.exists(lock.lockfile)
+
+
+@nose.tools.raises(lock.LockError)
+def test_live_lock():
+tag = "live"
+lock.begin(job_tag=tag)
+
+# Will die because the process (this one) is still running.
+lock.begin(job_tag=tag)
+
+
+def test_stale_lock():
+tag = "stale"
+lock.begin(job_tag=tag)
+
+# Make the lockfile stale by changing the process ID.
+assert lock.lockfile
+f = open(lock.lockfile, "w")
+f.write("-1")
+f.close()
+
+lock.begin(job_tag=tag)
+
+# Check that we overwrote the contents with the current PID.
+assert lock.lockfile
+f = open(lock.lockfile, "r")
+pid = int(f.read())
+f.close()
+assert pid == os.getpid()
+
+lock.end()
+
+
+def test_invalid_lock():
+tag = "stale"
+lock.begin(job_tag=tag)
+
+

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

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

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

Merge branch 'master' into deployment

And update vendor submodule for autoload_static

1dedfce Set street address to NULL where placeholder info has been used.
38ace7f Update civicrm subrepo

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


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/25/343125/1

diff --git a/vendor b/vendor
index 8c0bb4b..f8bf486 16
--- a/vendor
+++ b/vendor
@@ -1 +1 @@
-Subproject commit 8c0bb4bc7a5addb575358d6dfc1b6272c4f8b2f1
+Subproject commit f8bf48695ab0b11763322eed876dcbf5d3258793

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5954d38e1283f7fb92e3dc9ebfee2769eba733e9
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]: Update civicrm subrepo

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

Change subject: Update civicrm subrepo
..

Update civicrm subrepo

91d02f7 CRM-20061 Add tables as a parameter on the revert api
abcc6c3 Restore autoload_static

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


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/23/343123/1

diff --git a/civicrm b/civicrm
index 91d02f7..abcc6c3 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 91d02f7dce6faf2b61a5a8366257200acc4494c2
+Subproject commit abcc6c35855bb22d0e3bdccf4ddc79e88c890c5e

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic239d9afb7f69e019182da470a2c58ef07f89b0b
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...vendor[master]: Update to using autoload_static

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

Change subject: Update to using autoload_static
..


Update to using autoload_static

Supposed to give us a slight performance boost on PHP5.6

Change-Id: Ie770c132e225090b8635684907e45dee90955af5
---
M composer/autoload_real.php
A composer/autoload_static.php
2 files changed, 302 insertions(+), 12 deletions(-)

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



diff --git a/composer/autoload_real.php b/composer/autoload_real.php
index 0075dfc..9aa02d1 100644
--- a/composer/autoload_real.php
+++ b/composer/autoload_real.php
@@ -27,24 +27,35 @@
 array_push($includePaths, get_include_path());
 set_include_path(join(PATH_SEPARATOR, $includePaths));
 
-$map = require __DIR__ . '/autoload_namespaces.php';
-foreach ($map as $namespace => $path) {
-$loader->set($namespace, $path);
-}
+$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
+if ($useStaticLoader) {
+require_once __DIR__ . '/autoload_static.php';
 
-$map = require __DIR__ . '/autoload_psr4.php';
-foreach ($map as $namespace => $path) {
-$loader->setPsr4($namespace, $path);
-}
+
call_user_func(\Composer\Autoload\ComposerStaticInit713b445f683293f4a04a72f73555246e::getInitializer($loader));
+} else {
+$map = require __DIR__ . '/autoload_namespaces.php';
+foreach ($map as $namespace => $path) {
+$loader->set($namespace, $path);
+}
 
-$classMap = require __DIR__ . '/autoload_classmap.php';
-if ($classMap) {
-$loader->addClassMap($classMap);
+$map = require __DIR__ . '/autoload_psr4.php';
+foreach ($map as $namespace => $path) {
+$loader->setPsr4($namespace, $path);
+}
+
+$classMap = require __DIR__ . '/autoload_classmap.php';
+if ($classMap) {
+$loader->addClassMap($classMap);
+}
 }
 
 $loader->register(true);
 
-$includeFiles = require __DIR__ . '/autoload_files.php';
+if ($useStaticLoader) {
+$includeFiles = 
Composer\Autoload\ComposerStaticInit713b445f683293f4a04a72f73555246e::$files;
+} else {
+$includeFiles = require __DIR__ . '/autoload_files.php';
+}
 foreach ($includeFiles as $fileIdentifier => $file) {
 composerRequire713b445f683293f4a04a72f73555246e($fileIdentifier, 
$file);
 }
diff --git a/composer/autoload_static.php b/composer/autoload_static.php
new file mode 100644
index 000..310bb21
--- /dev/null
+++ b/composer/autoload_static.php
@@ -0,0 +1,279 @@
+ __DIR__ . '/..' . 
'/ircmaxell/password-compat/lib/password.php',
+'edc6464955a37aa4d5fbf39d40fb6ee7' => __DIR__ . '/..' . 
'/symfony/polyfill-php55/bootstrap.php',
+'3e2471375464aac821502deb0ac64275' => __DIR__ . '/..' . 
'/symfony/polyfill-php54/bootstrap.php',
+'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . 
'/symfony/polyfill-mbstring/bootstrap.php',
+'3919eeb97e98d4648304477f8ef734ba' => __DIR__ . '/..' . 
'/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
+'bf34263f834e2781b79cae4d55a1d350' => __DIR__ . '/..' . 
'/wikimedia/donation-interface/gateway_common/WmfFramework.php',
+);
+
+public static $prefixLengthsPsr4 = array (
+'S' => 
+array (
+'Symfony\\Polyfill\\Php55\\' => 23,
+'Symfony\\Polyfill\\Php54\\' => 23,
+'Symfony\\Polyfill\\Mbstring\\' => 26,
+'Symfony\\Component\\Yaml\\' => 23,
+'Symfony\\Component\\HttpFoundation\\' => 33,
+'Symfony\\Component\\EventDispatcher\\' => 34,
+'SmashPig\\' => 9,
+),
+'P' => 
+array (
+'Psr\\Log\\' => 8,
+'Predis\\' => 7,
+'PayWithAmazon\\' => 14,
+),
+'M' => 
+array (
+'Monolog\\' => 8,
+),
+);
+
+public static $prefixDirsPsr4 = array (
+'Symfony\\Polyfill\\Php55\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/polyfill-php55',
+),
+'Symfony\\Polyfill\\Php54\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/polyfill-php54',
+),
+'Symfony\\Polyfill\\Mbstring\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
+),
+'Symfony\\Component\\Yaml\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/yaml',
+),
+'Symfony\\Component\\HttpFoundation\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/http-foundation',
+),
+'Symfony\\Component\\EventDispatcher\\' => 
+array (
+  

[MediaWiki-commits] [Gerrit] wikimedia...vendor[master]: Update to using autoload_static

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

Change subject: Update to using autoload_static
..

Update to using autoload_static

Supposed to give us a slight performance boost on PHP5.6

Change-Id: Ie770c132e225090b8635684907e45dee90955af5
---
M composer/autoload_real.php
A composer/autoload_static.php
2 files changed, 302 insertions(+), 12 deletions(-)


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

diff --git a/composer/autoload_real.php b/composer/autoload_real.php
index 0075dfc..9aa02d1 100644
--- a/composer/autoload_real.php
+++ b/composer/autoload_real.php
@@ -27,24 +27,35 @@
 array_push($includePaths, get_include_path());
 set_include_path(join(PATH_SEPARATOR, $includePaths));
 
-$map = require __DIR__ . '/autoload_namespaces.php';
-foreach ($map as $namespace => $path) {
-$loader->set($namespace, $path);
-}
+$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
+if ($useStaticLoader) {
+require_once __DIR__ . '/autoload_static.php';
 
-$map = require __DIR__ . '/autoload_psr4.php';
-foreach ($map as $namespace => $path) {
-$loader->setPsr4($namespace, $path);
-}
+
call_user_func(\Composer\Autoload\ComposerStaticInit713b445f683293f4a04a72f73555246e::getInitializer($loader));
+} else {
+$map = require __DIR__ . '/autoload_namespaces.php';
+foreach ($map as $namespace => $path) {
+$loader->set($namespace, $path);
+}
 
-$classMap = require __DIR__ . '/autoload_classmap.php';
-if ($classMap) {
-$loader->addClassMap($classMap);
+$map = require __DIR__ . '/autoload_psr4.php';
+foreach ($map as $namespace => $path) {
+$loader->setPsr4($namespace, $path);
+}
+
+$classMap = require __DIR__ . '/autoload_classmap.php';
+if ($classMap) {
+$loader->addClassMap($classMap);
+}
 }
 
 $loader->register(true);
 
-$includeFiles = require __DIR__ . '/autoload_files.php';
+if ($useStaticLoader) {
+$includeFiles = 
Composer\Autoload\ComposerStaticInit713b445f683293f4a04a72f73555246e::$files;
+} else {
+$includeFiles = require __DIR__ . '/autoload_files.php';
+}
 foreach ($includeFiles as $fileIdentifier => $file) {
 composerRequire713b445f683293f4a04a72f73555246e($fileIdentifier, 
$file);
 }
diff --git a/composer/autoload_static.php b/composer/autoload_static.php
new file mode 100644
index 000..310bb21
--- /dev/null
+++ b/composer/autoload_static.php
@@ -0,0 +1,279 @@
+ __DIR__ . '/..' . 
'/ircmaxell/password-compat/lib/password.php',
+'edc6464955a37aa4d5fbf39d40fb6ee7' => __DIR__ . '/..' . 
'/symfony/polyfill-php55/bootstrap.php',
+'3e2471375464aac821502deb0ac64275' => __DIR__ . '/..' . 
'/symfony/polyfill-php54/bootstrap.php',
+'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . 
'/symfony/polyfill-mbstring/bootstrap.php',
+'3919eeb97e98d4648304477f8ef734ba' => __DIR__ . '/..' . 
'/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
+'bf34263f834e2781b79cae4d55a1d350' => __DIR__ . '/..' . 
'/wikimedia/donation-interface/gateway_common/WmfFramework.php',
+);
+
+public static $prefixLengthsPsr4 = array (
+'S' => 
+array (
+'Symfony\\Polyfill\\Php55\\' => 23,
+'Symfony\\Polyfill\\Php54\\' => 23,
+'Symfony\\Polyfill\\Mbstring\\' => 26,
+'Symfony\\Component\\Yaml\\' => 23,
+'Symfony\\Component\\HttpFoundation\\' => 33,
+'Symfony\\Component\\EventDispatcher\\' => 34,
+'SmashPig\\' => 9,
+),
+'P' => 
+array (
+'Psr\\Log\\' => 8,
+'Predis\\' => 7,
+'PayWithAmazon\\' => 14,
+),
+'M' => 
+array (
+'Monolog\\' => 8,
+),
+);
+
+public static $prefixDirsPsr4 = array (
+'Symfony\\Polyfill\\Php55\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/polyfill-php55',
+),
+'Symfony\\Polyfill\\Php54\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/polyfill-php54',
+),
+'Symfony\\Polyfill\\Mbstring\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
+),
+'Symfony\\Component\\Yaml\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/yaml',
+),
+'Symfony\\Component\\HttpFoundation\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/http-foundation',
+),
+

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Restore autoload_static

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

Change subject: Restore autoload_static
..

Restore autoload_static

php53lint is dead, and we're upgrading to 5.6

Wh!

Change-Id: I9d13bbed66a4fedc73867148fa38b14147a955fd
---
A vendor/composer/autoload_static.php
1 file changed, 305 insertions(+), 0 deletions(-)


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

diff --git a/vendor/composer/autoload_static.php 
b/vendor/composer/autoload_static.php
new file mode 100644
index 000..60c4a0e
--- /dev/null
+++ b/vendor/composer/autoload_static.php
@@ -0,0 +1,305 @@
+ __DIR__ . '/..' . 
'/phpseclib/phpseclib/phpseclib/bootstrap.php',
+'3919eeb97e98d4648304477f8ef734ba' => __DIR__ . '/..' . 
'/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
+);
+
+public static $prefixLengthsPsr4 = array (
+'Z' => 
+array (
+'Zend\\Validator\\' => 15,
+'Zend\\Stdlib\\' => 12,
+'Zend\\Escaper\\' => 13,
+),
+'P' => 
+array (
+'PhpOffice\\PhpWord\\' => 18,
+'PhpOffice\\Common\\' => 17,
+),
+'D' => 
+array (
+'Dompdf\\' => 7,
+),
+'C' => 
+array (
+'Civi\\Cxn\\Rpc\\' => 13,
+),
+);
+
+public static $prefixDirsPsr4 = array (
+'Zend\\Validator\\' => 
+array (
+0 => __DIR__ . '/..' . '/zendframework/zend-validator/src',
+),
+'Zend\\Stdlib\\' => 
+array (
+0 => __DIR__ . '/..' . '/zendframework/zend-stdlib/src',
+),
+'Zend\\Escaper\\' => 
+array (
+0 => __DIR__ . '/..' . '/zendframework/zend-escaper/src',
+),
+'PhpOffice\\PhpWord\\' => 
+array (
+0 => __DIR__ . '/..' . '/phpoffice/phpword/src/PhpWord',
+),
+'PhpOffice\\Common\\' => 
+array (
+0 => __DIR__ . '/..' . '/phpoffice/common/src/Common',
+),
+'Dompdf\\' => 
+array (
+0 => __DIR__ . '/..' . '/dompdf/dompdf/src',
+),
+'Civi\\Cxn\\Rpc\\' => 
+array (
+0 => __DIR__ . '/..' . '/civicrm/civicrm-cxn-rpc/src',
+),
+);
+
+public static $prefixesPsr0 = array (
+'V' => 
+array (
+'Validate' => 
+array (
+0 => __DIR__ . '/..' . '/pear/validate_finance_creditcard',
+),
+),
+'S' => 
+array (
+'System' => 
+array (
+0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
+),
+'Symfony\\Component\\Process\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/process',
+),
+'Symfony\\Component\\Finder\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/finder',
+),
+'Symfony\\Component\\Filesystem\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/filesystem',
+),
+'Symfony\\Component\\EventDispatcher\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/event-dispatcher',
+),
+'Symfony\\Component\\DependencyInjection\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/dependency-injection',
+),
+'Symfony\\Component\\Config\\' => 
+array (
+0 => __DIR__ . '/..' . '/symfony/config',
+),
+'Svg\\' => 
+array (
+0 => __DIR__ . '/..' . '/phenx/php-svg-lib/src',
+),
+),
+'P' => 
+array (
+'Psr\\Log\\' => 
+array (
+0 => __DIR__ . '/..' . '/psr/log',
+),
+'PHPUnit_' => 
+array (
+0 => __DIR__ . '/../..' . '/packages',
+),
+'PEAR' => 
+array (
+0 => __DIR__ . '/..' . '/pear/pear_exception',
+),
+),
+'N' => 
+array (
+'Net' => 
+array (
+0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
+),
+),
+'M' => 
+array (
+'Math' => 
+array (
+0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
+),
+),
+'F' => 
+array (
+'FontLib\\' => 
+array (
+0 => __DIR__ . '/..' . '/phenx/php-font-lib/src',
+),
+'File' => 
+array (
+0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
+),
+),
+'C' => 
+array (
+

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: WIP detect normalized paypal messages in queue consumer

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

Change subject: WIP detect normalized paypal messages in queue consumer
..

WIP detect normalized paypal messages in queue consumer

Needs tests

Change-Id: Iabb137015452c8b77c75719b242eb2bc89112a5c
---
M sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/96/342896/1

diff --git 
a/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php 
b/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php
index e6ac6df..f04b9a2 100644
--- a/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php
+++ b/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php
@@ -83,8 +83,12 @@
if ( isset( $msg['gateway'] ) && $msg['gateway'] === 'amazon' ) 
{
// should not require special normalization
} else if ( !isset( $msg[ 'contribution_tracking_id' ]) ) {
-   // we can safely assume we have a raw msg from paypal 
if contribution_tracking_id isn't set
-   $msg = $this->normalizePaypalMessage( $msg );
+   $msg_normalized[ 'contribution_tracking_id' ] = 
recurring_get_contribution_tracking_id( $msg );
+   // TODO: remove this after deploying audit and IPN 
updates to do message normalization there
+   if ( isset( $msg['payer_email'] ) ) {
+   // This is an old-school non-normalized PayPal 
message.
+   $msg = $this->normalizePaypalMessage( $msg );
+   }
} else {
$msg['contribution_tracking_update'] = false;
}
@@ -125,7 +129,6 @@
// the subscription id
$msg_normalized[ 'subscr_id' ] = $msg[ 'subscr_id' ];
$msg_normalized[ 'txn_type' ] = $msg[ 'txn_type' ];
-   $msg_normalized[ 'contribution_tracking_id' ] = 
recurring_get_contribution_tracking_id( $msg );
$msg_normalized[ 'email' ] = $msg[ 'payer_email' ];
 
// Premium info

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabb137015452c8b77c75719b242eb2bc89112a5c
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...tools[master]: Cast a wider net when searching for ct_id

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

Change subject: Cast a wider net when searching for ct_id
..

Cast a wider net when searching for ct_id

Change-Id: Ib569785cb38717c744716e1b364db7785e068538
FIXME: should we set transaction_subject to ct_id for express checkout?
---
M audit/paypal/TrrFile.py
M audit/paypal/tests/test_trr_file.py
2 files changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/93/342893/1

diff --git a/audit/paypal/TrrFile.py b/audit/paypal/TrrFile.py
index a73a5f3..a884681 100644
--- a/audit/paypal/TrrFile.py
+++ b/audit/paypal/TrrFile.py
@@ -143,9 +143,17 @@
 if row['PayPal Reference ID Type'] == 'SUB':
 out['subscr_id'] = row['PayPal Reference ID']
 
+# Look in all the places we might have stuck a ct_id
 if re.search('^[0-9]+$', row['Transaction Subject']):
 out['contribution_tracking_id'] = row['Transaction Subject']
-out['order_id'] = row['Transaction Subject']
+elif row['Custom Field']:
+out['contribution_tracking_id'] = row['Custom Field']
+elif row['Invoice ID']:
+# Here it can be the ct_id.attempt format
+out['contribution_tracking_id'] = row['Invoice ID'].split('.')[0]
+
+if out['contribution_tracking_id']:
+out['order_id'] = out['contribution_tracking_id']
 
 event_type = row['Transaction Event Code'][0:3]
 
diff --git a/audit/paypal/tests/test_trr_file.py 
b/audit/paypal/tests/test_trr_file.py
index db4533b..2cf3c3e 100644
--- a/audit/paypal/tests/test_trr_file.py
+++ b/audit/paypal/tests/test_trr_file.py
@@ -135,7 +135,7 @@
 # Did we send it?
 args = MockRedis().send.call_args
 assert args[0][0] == 'refund'
-expected = sorted({'last_name': 'Man', 'thankyou_date': 0, 'city': '', 
'payment_method': '', 'gateway_status': 'S', 'currency': 'USD', 'postal_code': 
'', 'date': '1474736101', 'gateway_refund_id': 'AS7D98AS7D9A8S7D9AS', 
'gateway': 'paypal', 'state_province': '', 'gross': 10.0, 'first_name': 
'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'gross_currency': 'USD', 'country': '', 'payment_submethod': '', 'note': 'r', 
'supplemental_address_1': '', 'settled_date': '1474736101', 
'gateway_parent_id': '3GJH3GJ3334214812', 'type': 'refund', 'email': 
'pranks...@anonymous.net', 'street_address': ''})
+expected = sorted({'last_name': 'Man', 'thankyou_date': 0, 'city': '', 
'payment_method': '', 'gateway_status': 'S', 'currency': 'USD', 'postal_code': 
'', 'date': '1474736101', 'gateway_refund_id': 'AS7D98AS7D9A8S7D9AS', 
'gateway': 'paypal', 'state_province': '', 'gross': 10.0, 'first_name': 
'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'gross_currency': 'USD', 'country': '', 'payment_submethod': '', 'note': 'r', 
'supplemental_address_1': '', 'settled_date': '1474736101', 
'gateway_parent_id': '3GJH3GJ3334214812', 'type': 'refund', 'email': 
'pranks...@anonymous.net', 'street_address': '', 'contribution_tracking_id': 
'1234567', 'order_id': '1234567'})
 actual = sorted(args[0][1])
 assert actual == expected
 
@@ -175,6 +175,6 @@
 # Did we send it?
 args = MockRedis().send.call_args
 assert args[0][0] == 'recurring'
-expected = sorted({'last_name': 'Man', 'txn_type': 'subscr_payment', 
'thankyou_date': 0, 'city': '', 'payment_method': '', 'gateway_status': 'S', 
'currency': 'USD', 'postal_code': '', 'date': '1474736101', 'subscr_id': 
'3GJH3GJ3334214812', 'gateway': 'paypal', 'state_province': '', 'gross': 0.1, 
'first_name': 'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'country': '', 'payment_submethod': '', 'note': '', 'supplemental_address_1': 
'', 'settled_date': '1474736101', 'email': 'pranks...@anonymous.net', 
'street_address': ''})
+expected = sorted({'last_name': 'Man', 'txn_type': 'subscr_payment', 
'thankyou_date': 0, 'city': '', 'payment_method': '', 'gateway_status': 'S', 
'currency': 'USD', 'postal_code': '', 'date': '1474736101', 'subscr_id': 
'3GJH3GJ3334214812', 'gateway': 'paypal', 'state_province': '', 'gross': 0.1, 
'first_name': 'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS', 
'country': '', 'payment_submethod': '', 'note': '', 'supplemental_address_1': 
'', 'settled_date': '1474736101', 'email': 'pranks...@anonymous.net', 
'street_address': '', 'contribution_tracking_id': '1234567', 'order_id': 
'1234567'})
 actual = sorted(args[0][1])
 assert actual == expected

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

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


[MediaWiki-commits] [Gerrit] wikimedia...tools[master]: WIP stop denormalizing paypal recurring messages in audit

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

Change subject: WIP stop denormalizing paypal recurring messages in audit
..

WIP stop denormalizing paypal recurring messages in audit

Change-Id: I6b0c881a16a4d5ab6f60dfe401aea576ccbf6f03
---
M audit/paypal/TrrFile.py
M audit/paypal/tests/test_trr_file.py
2 files changed, 85 insertions(+), 125 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/93/342693/1

diff --git a/audit/paypal/TrrFile.py b/audit/paypal/TrrFile.py
index bdd8b02..4ced975 100644
--- a/audit/paypal/TrrFile.py
+++ b/audit/paypal/TrrFile.py
@@ -153,7 +153,8 @@
 if event_type in ('T00', 'T03', 'T05', 'T07', 'T22'):
 if row['Transaction Event Code'] == 'T0002':
 queue = 'recurring'
-out = self.normalize_recurring(out)
+if 'subscr_id' not in out or not out['subscr_id']:
+raise Exception('Missing field subscr_id')
 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']))
@@ -207,36 +208,3 @@
 
 self.redis.send(queue_name, msg)
 
-def normalize_recurring(self, msg):
-'Synthesize a raw PayPal message'
-
-if 'fee' not in msg:
-msg['fee'] = 0
-
-# TODO: Move validation elsewhere.
-required_fields = ['subscr_id']
-for field in required_fields:
-if field not in msg or not msg[field]:
-raise Exception("Missing field " + field)
-
-# FIXME: Are the names available in these records?  That would save us
-# an API to fetch_donor_name.
-out = {
-'gateway': 'paypal',
-'txn_type': 'subscr_payment',
-'gateway_txn_id': msg['gateway_txn_id'],
-'txn_id': msg['gateway_txn_id'],
-'subscr_id': msg['subscr_id'],
-'payment_date': msg['date'],
-'payer_email': msg['email'],
-'mc_currency': msg['currency'],
-'mc_gross': msg['gross'],
-'mc_fee': msg['fee'],
-'address_street': "\n".join([msg['street_address'], 
msg['supplemental_address_1']]),
-'address_city': msg['city'],
-'address_zip': msg['postal_code'],
-'address_state': msg['state_province'],
-'address_country_code': msg['country'],
-}
-
-return out
diff --git a/audit/paypal/tests/test_trr_file.py 
b/audit/paypal/tests/test_trr_file.py
index fc1981c..1f3bc93 100644
--- a/audit/paypal/tests/test_trr_file.py
+++ b/audit/paypal/tests/test_trr_file.py
@@ -4,103 +4,21 @@
 import audit.paypal.TrrFile
 
 
-@patch("queue.redis_wrap.Redis")
-@patch("civicrm.civicrm.Civicrm")
-@patch("process.globals")
-@patch("audit.paypal.paypal_api.PaypalApiClassic")
-def test_recurring_charge_without_subscription(MockPaypalApi, MockGlobals, 
MockCivicrm, MockRedis):
-'''
-Regression test for T143903
-'''
-row = {
-"Column Type": "",
-"Transaction ID": "",
-"Invoice ID": "",
-"PayPal Reference ID": "",
-"PayPal Reference ID Type": "SUB",
-"Transaction Event Code": "T0002",
-# FIXME: Use and test real date format.
-"Transaction Initiation Date": "Thu Oct 13 19:53:57 UTC 2016",
-"Transaction Completion Date": "Thu Oct 13 19:53:58 UTC 2016",
-# sic.
-"Transaction  Debit or Credit": "",
-"Gross Transaction Amount": "10.00",
-"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": 

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Work around Memcache not expiring some things

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

Change subject: Work around Memcache not expiring some things
..

Work around Memcache not expiring some things

Memcache sometimes holds things too long when given unix timestamps for
expiry. This adds an application-level check for expiration in the one
place we're currently using the cache. If we need to use the cache in
other places before we figure out the Memcache issue, we should move
this logic to Core\Cache.

Bug: T128692
Change-Id: I0cd23d8dc7d97e5f7e7628215f8d35c7da250391
---
M PaymentProviders/Ingenico/BankPaymentProvider.php
M PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
2 files changed, 52 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/66/342266/1

diff --git a/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/PaymentProviders/Ingenico/BankPaymentProvider.php
index 85491b2..5540e27 100644
--- a/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -44,7 +44,7 @@
$cacheKey = $this->makeCacheKey( $country, $currency, 
$productId );
$cacheItem = $this->cache->getItem( $cacheKey );
 
-   if ( !$cacheItem->isHit() ) {
+   if ( !$cacheItem->isHit() || $this->shouldBeExpired( $cacheItem 
) ) {
$query = array(
'countryCode' => $country,
'currencyCode' => $currency
@@ -57,16 +57,35 @@
foreach ( $response['entries'] as $entry ) {
$banks[$entry['issuerId']] = 
$entry['issuerName'];
}
-   $cacheItem->set( $banks );
$duration = $this->cacheParameters['duration'];
+   $cacheItem->set( array(
+   'value' => $banks,
+   'expiration' => time() + $duration
+   ) );
$cacheItem->expiresAfter( $duration );
$this->cache->save( $cacheItem );
}
-   return $cacheItem->get();
+   $cached = $cacheItem->get();
+   return $cached['value'];
}
 
protected function makeCacheKey( $country, $currency, $productId ) {
$base = $this->cacheParameters['key-base'];
return "{$base}_{$country}_{$currency}_{$productId}";
}
+
+   /**
+* Lame workaround to mysterious Memcache non-expiry bug. Memcache
+* seems to hold things for too long in certain circumstances.
+* TODO: move to Core if we need to use this elsewhere. Though another
+* layer of cache wrapping seems unfun.
+*
+* @param \Psr\Cache\CacheItemInterface $cacheItem
+* @return bool True if the item should have been dropped by Memcache
+*/
+   protected function shouldBeExpired( $cacheItem ) {
+   $value = $cacheItem->get();
+   $expiration = $value['expiration'];
+   return $expiration < time();
+   }
 }
diff --git 
a/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
index 1edfe84..d9a2e3e 100644
--- a/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
+++ b/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
@@ -2,6 +2,8 @@
 namespace SmashPig\PaymentProviders\Ingenico\Tests;
 
 use PHPUnit_Framework_MockObject_MockObject;
+use Psr\Cache\CacheItemPoolInterface;
+use SmashPig\Core\Cache\HashCacheItem;
 use SmashPig\Core\Http\CurlWrapper;
 use SmashPig\PaymentProviders\Ingenico\BankPaymentProvider;
 use SmashPig\Tests\BaseSmashPigUnitTestCase;
@@ -21,9 +23,15 @@
 */
protected $provider;
 
+   /**
+* @var CacheItemPoolInterface
+*/
+   protected $cache;
+
public function setUp() {
$config = $this->setConfig( 'ingenico' );
$this->curlWrapper = $this->getMock( 
'\SmashPig\Core\Http\CurlWrapper' );
+   $this->cache = $config->object( 'cache', true );
$config->overrideObjectInstance( 'curl/wrapper', 
$this->curlWrapper );
$config->object( 'cache' )->clear();
$this->provider = new BankPaymentProvider( array(
@@ -61,6 +69,28 @@
$this->assertEquals( $results, $cachedResults );
}
 
+   public function testBustedCacheExpiration() {
+   $cacheItem = new HashCacheItem(
+   'BLAH_BLAH_NL_EUR_809',
+   array(
+   'value' => array( 'STALE' => 'NotValid' ),
+   'expiration' => 

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

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

Change subject: Update DonationInterface submodule
..

Update DonationInterface submodule

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/75/341375/1

diff --git a/extensions/DonationInterface b/extensions/DonationInterface
index c75e32f..84aa10f 16
--- a/extensions/DonationInterface
+++ b/extensions/DonationInterface
@@ -1 +1 @@
-Subproject commit c75e32ff03169cd5b5de6197d9c362c30171eb71
+Subproject commit 84aa10f20e0c72d5d55629e4bcbd10830b985a32

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1ce32e3dc5f6007f0e3c9e3334aba1aca38f676
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-03-06 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/341367 )

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

Merge branch 'master' into deployment

4ed8897 Use HashBag instead of EmptyBag

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


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


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19dbfca661e1fd3eec70916b34adbd379936
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
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]: Just zap the comment

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

Change subject: Just zap the comment
..

Just zap the comment

Still getting an unknown DB error on prod. :(

Flail...

Change-Id: I81f081df47efe0e55a504155e5495ddd7aa136f9
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/12/340912/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 6ac66c2..35dbd7a 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2586,7 +2586,7 @@
AND contact_type = 'Individual'
AND first_name IS NULL
AND last_name IS NULL
-   AND sort_name LIKE '%, %' /* leading % seems to be OK after all 
the other conditions */
+   AND sort_name LIKE '%, %'
 ");
// Some of the contacts have been touched since creation, and Civi has 
helpfully
// destroyed the sort_name. log_civicrm_contact to the rescue!

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81f081df47efe0e55a504155e5495ddd7aa136f9
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]: Merge branch 'master' into deployment

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

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

Merge branch 'master' into deployment

4cf6fcf Fix busted SQL comment

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


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/10/340910/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6105da4909bb54c7aefdeb279494af22bd47ff7
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]: Fix busted SQL comment

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

Change subject: Fix busted SQL comment
..

Fix busted SQL comment

-- needs to be at the start of the line, oops!

Change-Id: I7e835c49613821c702210066abfd449109bef2ce
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/08/340908/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index fc54cd9..6ac66c2 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2586,7 +2586,7 @@
AND contact_type = 'Individual'
AND first_name IS NULL
AND last_name IS NULL
-   AND sort_name LIKE '%, %' --leading % seems to be OK after all 
the other conditions
+   AND sort_name LIKE '%, %' /* leading % seems to be OK after all 
the other conditions */
 ");
// Some of the contacts have been touched since creation, and Civi has 
helpfully
// destroyed the sort_name. log_civicrm_contact to the rescue!

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e835c49613821c702210066abfd449109bef2ce
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]: Split error check into own function

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

Change subject: Split error check into own function
..

Split error check into own function

Thanks for the best practices nudge, Scrutinizer!

Change-Id: I567da17632fe4c5b4bc479cae0cbcef30ac4ec14
---
M PaymentProviders/Ingenico/Api.php
1 file changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/05/340905/1

diff --git a/PaymentProviders/Ingenico/Api.php 
b/PaymentProviders/Ingenico/Api.php
index f6e4258..5da77bb 100644
--- a/PaymentProviders/Ingenico/Api.php
+++ b/PaymentProviders/Ingenico/Api.php
@@ -61,6 +61,17 @@
$response = $request->execute();
 
$decoded = json_decode( $response['body'], true );
+   $this->checkErrors( $response, $decoded );
+
+   return $decoded;
+   }
+
+   /**
+* @param array $response The CurlWrapper-formatteed response from 
Ingenico
+* @param array $decoded The decoded JSON response body. Null if bad 
JSON
+* @throws ApiException
+*/
+   protected function checkErrors( $response, $decoded ) {
if ( $decoded === null ) {
throw new ApiException( "Response body is not valid 
JSON: '{$response['body']}'" );
}
@@ -69,13 +80,11 @@
if ( !empty( $decoded['errorId'] ) ) {
$messages[] = "Ingenico error id 
{$decoded['errorId']}.";
}
-   foreach( $decoded['errors'] as $error ) {
+   foreach ( $decoded['errors'] as $error ) {
$messages[] = "Error code {$error['code']}: 
{$error['message']}.";
}
$concatenated = implode( ' ', $messages );
throw new ApiException( $concatenated );
}
-
-   return $decoded;
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I567da17632fe4c5b4bc479cae0cbcef30ac4ec14
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...crm[deployment]: Merge branch 'master' into deployment

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

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

Merge branch 'master' into deployment

07ff70d Create table of blank addresses.
361717d Fix (most) missing names
42e6650 Extend fix to contacts that have been touched

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


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/99/340899/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f943ea4edd6d9c411928bd9848af3adb627d779
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]: Extend fix to contacts that have been touched

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

Change subject: Extend fix to contacts that have been touched
..

Extend fix to contacts that have been touched

Civi nukes the sort and display fields, but they're still in the
log tables.

Bug: T159455
Change-Id: I25ad26701e586610faf8f1fa23d565e3ff4c41ca
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/97/340897/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 9310130..fc54cd9 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2577,6 +2577,7 @@
  */
 function wmf_civicrm_update_7480() {
civicrm_initialize();
+   // First the easy ones
CRM_Core_DAO::executeQuery(
"UPDATE civicrm_contact
SET last_name = SUBSTRING_INDEX(sort_name, ', ', 1),
@@ -2585,7 +2586,20 @@
AND contact_type = 'Individual'
AND first_name IS NULL
AND last_name IS NULL
-   AND is_deleted = 0
AND sort_name LIKE '%, %' --leading % seems to be OK after all 
the other conditions
 ");
+   // Some of the contacts have been touched since creation, and Civi has 
helpfully
+   // destroyed the sort_name. log_civicrm_contact to the rescue!
+   CRM_Core_DAO::executeQuery(
+   "UPDATE civicrm_contact c
+   INNER JOIN log_civicrm_contact l ON c.id = l.id
+   SET c.last_name = SUBSTRING_INDEX(l.sort_name, ', ', 1),
+   c.first_name = SUBSTRING_INDEX(l.sort_name, ', ', -1)
+   WHERE c.created_date BETWEEN '2017-02-28' AND '2017-03-03'
+   AND c.contact_type = 'Individual'
+   AND c.first_name IS NULL
+   AND c.last_name IS NULL
+   AND c.sort_name NOT LIKE '%, %'
+   AND l.sort_name LIKE '%, %'
+");
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25ad26701e586610faf8f1fa23d565e3ff4c41ca
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 missing names

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

Change subject: Fix missing names
..

Fix missing names

Turns out we WERE filling in the sort name field after all.

Nice to have that nonstandard SUBSTRING_INDEX for splits in MariaDB!

Bug: T159455
Change-Id: Ief4e7fe566c8e8ebdb3652c3c43f3249c171a90a
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/91/340891/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 712a6c9..393b51e 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2568,3 +2568,22 @@
   );
 
 }
+
+
+/**
+ * Fill in missing first and last names from the sort_name field
+ *
+ * Bug: T159455
+ */
+function wmf_civicrm_update_7480() {
+   civicrm_initialize();
+   CRM_Core_DAO::executeQuery(
+   "UPDATE civicrm_contact
+   SET last_name = SUBSTRING_INDEX(sort_name, ', ', 1),
+   first_name = SUBSTRING_INDEX(sort_name, ', ', -1)
+   WHERE created_date BETWEEN '2017-02-28' AND '2017-03-03'
+   AND contact_type = 'Individual'
+   AND first_name IS NULL
+   AND last_name IS NULL
+");
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief4e7fe566c8e8ebdb3652c3c43f3249c171a90a
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]: WIP Test more fields on import

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

Change subject: WIP Test more fields on import
..

WIP Test more fields on import

Errr, dang. I thought this would fail without being rebased on top of
awight's fix

Change-Id: I4d595f751866b3eb135d421ac21018b30a998d14
---
M sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
1 file changed, 32 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/85/340885/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
index c1d2284..7df0dd4 100644
--- a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
@@ -81,17 +81,46 @@
 
 $contribution = civicrm_api3('Contribution', 'getsingle', array(
   wmf_civicrm_get_custom_field_name('gateway_txn_id') => 
$message->getGatewayTxnId(),
-  'return' => array(wmf_civicrm_get_custom_field_name('Campaign'), 
'total_amount'),
 ));
 
$this->assertEmpty($contribution[wmf_civicrm_get_custom_field_name('campaign')] 
);
+$expected = array(
+  'contact_type' => 'Individual',
+  'sort_name' => 'laast, firrst',
+  'display_name' => 'firrst laast',
+  'currency' => 'USD',
+  'total_amount' => '400.00',
+  'fee_amount' => '0.00',
+  'net_amount' => '400.00',
+  'trxn_id' => 'GLOBALCOLLECT ' . $message->getGatewayTxnId(),
+  'contribution_source' => 'USD 400',
+  'financial_type' => 'Cash',
+  'accounting_code' => 'CASH',
+  'contribution_status' => 'Completed',
+  'payment_instrument' => 'Credit Card: Visa'
+);
+$this->assertArraySubset( $expected, $contribution );
 
 $contribution2 = civicrm_api3('Contribution', 'getsingle', array(
   wmf_civicrm_get_custom_field_name('gateway_txn_id') => 
$message2->getGatewayTxnId(),
-  'return' => array(wmf_civicrm_get_custom_field_name('Campaign'), 
'total_amount'),
 ));
 
 $this->assertEquals('Benefactor Gift', 
$contribution2[wmf_civicrm_get_custom_field_name('campaign')] );
-
+$expected = array(
+  'contact_type' => 'Individual',
+  'sort_name' => 'laast, firrst',
+  'display_name' => 'firrst laast',
+  'currency' => 'USD',
+  'total_amount' => '2857.02',
+  'fee_amount' => '0.00',
+  'net_amount' => '2857.02',
+  'trxn_id' => 'GLOBALCOLLECT ' . $message2->getGatewayTxnId(),
+  'contribution_source' => 'PLN 952.34',
+  'financial_type' => 'Cash',
+  'accounting_code' => 'CASH',
+  'contribution_status' => 'Completed',
+  'payment_instrument' => 'Credit Card: Visa'
+);
+$this->assertArraySubset( $expected, $contribution2 );
 $this->assertNotEquals( $contribution['contact_id'], 
$contribution2['contact_id'] );
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d595f751866b3eb135d421ac21018b30a998d14
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]: WIP only cry DUPLICATE if there's no change

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

Change subject: WIP only cry DUPLICATE if there's no change
..

WIP only cry DUPLICATE if there's no change

Still need to change rest of the logic to update the contact rather
than try inserting anew

Bug: T159455
Change-Id: I128cb085788a8730c527af9d2a538d40ccd37410
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 25 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/10/340810/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index d887500..b31e193 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -996,21 +996,37 @@
 }
 
 /**
- * Throw an exception if a contribution already exists
+ * Throw an exception if a contribution already exists. Do not complain if 
there are
  *
  * @param string $gateway
  * @param string $gateway_txn_id
  * @throws WmfException
  */
-function wmf_civicrm_check_for_duplicates( $gateway, $gateway_txn_id ) {
-$txn = wmf_civicrm_get_contributions_from_gateway_id(
-$gateway, $gateway_txn_id
-);
+function wmf_civicrm_check_for_duplicates( $message ) {
+   $query = "SELECT cntc.*, cx.*, cc.* FROM wmf_contribution_extra cx
+LEFT JOIN civicrm_contribution cc ON cc.id = cx.entity_id
+LEFT JOIN civicrm_contact cntc ON cc.contact_id = cntc.id
+   WHERE gateway = %1 AND gateway_txn_id = %2";
+
+   $dao = CRM_Core_DAO::executeQuery( $query, array(
+   1 => array( $message['gateway'], 'String' ),
+   2 => array( $message['gateway_txn_id'], 'String' ),
+   ) );
+   $txn = wmf_civicrm_dao_to_list( $dao );
 if ( $txn ) {
-throw new WmfException(
-'DUPLICATE_CONTRIBUTION',
-'Contribution already exists. Ignoring message.'
-);
+   $changed = false;
+   $checkFields = array( 'first_name', 'last_name' );
+   foreach( $checkFields as $field ) {
+   if ( $txn[$field] !== $message[$field] ) {
+   $changed = true;
+   }
+   }
+   if ( !$changed ) {
+   throw new WmfException(
+   'DUPLICATE_CONTRIBUTION',
+   'Contribution already exists. Ignoring message.'
+   );
+   }
 }
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I128cb085788a8730c527af9d2a538d40ccd37410
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-03-02 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/340773 )

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

Merge branch 'master' into deployment

Also delete tests and update libs

ebf4488 Look up iDEAL banks, provide PSR6 to SmashPig
e0f6612 Fixes for iDEAL/PSR-6 caching
68c72fa Update SmashPig library
e41d3bd Another SmashPig initialization fix
43555e7 Set SmashPig logging prefix
75b2bd8 Localisation updates from https://translatewiki.net.
c71f07b Remove deprecated langonly file for loading i18n messages on donatewiki

Change-Id: I0d374c0c760f3b00f74e5728d94fc9ea841ac613
---
D tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php
D tests/phpunit/IPVelocityTest.php
M vendor
3 files changed, 1 insertion(+), 461 deletions(-)


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

diff --git 
a/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php 
b/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php
deleted file mode 100644
index 60bb9e2..000
--- a/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php
+++ /dev/null
@@ -1,370 +0,0 @@
-<<< HEAD   (c75e32 process payment before popping out of iframe)
-===
-bankPaymentProvider = $this->getMockBuilder(
-   
'\SmashPig\PaymentProviders\Ingenico\BankPaymentProvider'
-   )->disableOriginalConstructor()->getMock();
-
-   $config->overrideObjectInstance( 'payment-provider/rtbt', 
$this->bankPaymentProvider );
-
-   $this->bankPaymentProvider->method( 'getBankList' )
-   ->willReturn( array(
-   'Test1234' => 'Test Bank 1234',
-   'Test5678' => 'Test Bank 5678',
-   ) );
-
-
-   $this->setMwGlobals( array(
-   'wgGlobalCollectGatewayEnabled' => true,
-   'wgDonationInterfaceAllowedHtmlForms' => array(
-   'rtbt-ideal' => array(
-   'gateway' => 'globalcollect',
-   'payment_methods' => array('rtbt' => 
'rtbt_ideal'),
-   'countries' => array( '+' => 'NL' ),
-   'currencies' => array( '+' => 'EUR' ),
-   ),
-   ),
-   ) );
-   }
-
-   /**
-* Test for ideal form loading
-*/
-   public function testGCFormLoad_rtbt_Ideal() {
-   $init = $this->getDonorTestData( 'NL' );
-   unset( $init['order_id'] );
-   $init['payment_method'] = 'rtbt';
-   $init['ffname'] = 'rtbt-ideal';
-
-   $assertNodes = array (
-   'amount' => array (
-   'nodename' => 'input',
-   'value' => '1.55',
-   ),
-   'currency_code' => array (
-   'nodename' => 'select',
-   'selected' => 'EUR',
-   ),
-   'country' => array (
-   'nodename' => 'input',
-   'value' => 'NL',
-   ),
-   'issuer_id' => array (
-   'innerhtmlmatches' => '/Test Bank 1234/'
-   )
-   );
-
-   $this->verifyFormOutput( 'GlobalCollectGateway', $init, 
$assertNodes, true );
-   }
-
-   /**
-* testBuildRequestXmlWithIssuerId21
-*
-* Rabobank: 21
-*
-* @covers GatewayAdapter::__construct
-* @covers GatewayAdapter::setCurrentTransaction
-* @covers GatewayAdapter::buildRequestXML
-* @covers GatewayAdapter::getData_Unstaged_Escaped
-*/
-   public function testBuildRequestXmlWithIssuerId21() {
-   
-   $optionsForTestData = array(
-   'form_name' => 'TwoStepAmount',
-   'payment_method' => 'rtbt',
-   'payment_submethod' => 'rtbt_ideal',
-   'payment_product_id' => 809,
-   'issuer_id' => 21,
-   );
-
-   //somewhere else?
-   $options = $this->getDonorTestData( 'ES' );
-   $options = array_merge( $options, $optionsForTestData );
-   unset( $options['payment_product_id'] );
-
-   $this->buildRequestXmlForGlobalCollect( $optionsForTestData, 
$options );
-   }
-
-   /**
-* testBuildRequestXmlWithIssuerId31
-*
-* ABN AMRO: 31
-*
-* @covers GatewayAdapter::__construct
-* @covers 

[MediaWiki-commits] [Gerrit] mediawiki...vendor[master]: Missed some files in the last commit

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

Change subject: Missed some files in the last commit
..


Missed some files in the last commit

Change-Id: I8e1a8661e5739fbe8f7a2dc55df55fa8becfeeb0
---
M composer/autoload_classmap.php
M composer/autoload_psr4.php
M composer/installed.json
3 files changed, 129 insertions(+), 7 deletions(-)

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



diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php
index 2eba902..8dd13cf 100644
--- a/composer/autoload_classmap.php
+++ b/composer/autoload_classmap.php
@@ -6,6 +6,11 @@
 $baseDir = dirname($vendorDir);
 
 return array(
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCache' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCache.php',
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheException' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheException.php',
+
'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheInvalidArgumentException'
 => $vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheInvalidArgumentException.php',
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheItem' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheItem.php',
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheTest' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheTest.php',
 'AdyenAdapter' => $baseDir . '/adyen_gateway/adyen.adapter.php',
 'AdyenGateway' => $baseDir . '/adyen_gateway/adyen_gateway.body.php',
 'AdyenGatewayResult' => $baseDir . 
'/adyen_gateway/adyen_resultswitcher.body.php',
@@ -85,6 +90,7 @@
 'IsoDate' => $baseDir . '/gateway_common/IsoDate.php',
 'LCRun3' => $vendorDir . '/zordius/lightncandy/src/lightncandy.php',
 'LightnCandy' => $vendorDir . '/zordius/lightncandy/src/lightncandy.php',
+'LocalClusterPsr6Cache' => $baseDir . 
'/gateway_common/LocalClusterPsr6Cache.php',
 'LogPrefixProvider' => $baseDir . '/gateway_common/LogPrefixProvider.php',
 'MessageUtils' => $baseDir . '/gateway_common/MessageUtils.php',
 'Monolog\\ErrorHandler' => $vendorDir . 
'/monolog/monolog/src/Monolog/ErrorHandler.php',
@@ -516,13 +522,15 @@
 'Predis\\Transaction\\AbortedMultiExecException' => $vendorDir . 
'/predis/predis/src/Transaction/AbortedMultiExecException.php',
 'Predis\\Transaction\\MultiExec' => $vendorDir . 
'/predis/predis/src/Transaction/MultiExec.php',
 'Predis\\Transaction\\MultiExecState' => $vendorDir . 
'/predis/predis/src/Transaction/MultiExecState.php',
+'Psr\\Cache\\CacheException' => $vendorDir . 
'/psr/cache/src/CacheException.php',
+'Psr\\Cache\\CacheItemInterface' => $vendorDir . 
'/psr/cache/src/CacheItemInterface.php',
+'Psr\\Cache\\CacheItemPoolInterface' => $vendorDir . 
'/psr/cache/src/CacheItemPoolInterface.php',
+'Psr\\Cache\\InvalidArgumentException' => $vendorDir . 
'/psr/cache/src/InvalidArgumentException.php',
 'Psr\\Log\\AbstractLogger' => $vendorDir . 
'/psr/log/Psr/Log/AbstractLogger.php',
 'Psr\\Log\\InvalidArgumentException' => $vendorDir . 
'/psr/log/Psr/Log/InvalidArgumentException.php',
 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
 'Psr\\Log\\LoggerAwareInterface' => $vendorDir . 
'/psr/log/Psr/Log/LoggerAwareInterface.php',
-'Psr\\Log\\LoggerAwareTrait' => $vendorDir . 
'/psr/log/Psr/Log/LoggerAwareTrait.php',
 'Psr\\Log\\LoggerInterface' => $vendorDir . 
'/psr/log/Psr/Log/LoggerInterface.php',
-'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
 'Psr\\Log\\Test\\DummyTest' => $vendorDir . 
'/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . 
'/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
@@ -535,6 +543,8 @@
 'SessionHandlerInterface' => $vendorDir . 
'/symfony/polyfill-php54/Resources/stubs/SessionHandlerInterface.php',
 'SmashPig\\Core\\Actions\\IListenerMessageAction' => $vendorDir . 
'/wikimedia/smash-pig/Core/Actions/IListenerMessageAction.php',
 'SmashPig\\Core\\Actions\\IncomingMessage' => $vendorDir . 
'/wikimedia/smash-pig/Core/Actions/IncomingMessage.php',
+'SmashPig\\Core\\Cache\\HashCache' => $vendorDir . 
'/wikimedia/smash-pig/Core/Cache/HashCache.php',
+'SmashPig\\Core\\Cache\\HashCacheItem' => $vendorDir . 
'/wikimedia/smash-pig/Core/Cache/HashCacheItem.php',
 'SmashPig\\Core\\Configuration' => $vendorDir . 
'/wikimedia/smash-pig/Core/Configuration.php',
 'SmashPig\\Core\\ConfigurationException' => $vendorDir . 
'/wikimedia/smash-pig/Core/Configuration.php',
 

[MediaWiki-commits] [Gerrit] mediawiki...vendor[master]: Missed some files in the last commit

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

Change subject: Missed some files in the last commit
..

Missed some files in the last commit

Change-Id: I8e1a8661e5739fbe8f7a2dc55df55fa8becfeeb0
---
M composer/autoload_classmap.php
M composer/autoload_psr4.php
M composer/installed.json
3 files changed, 129 insertions(+), 7 deletions(-)


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

diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php
index 2eba902..8dd13cf 100644
--- a/composer/autoload_classmap.php
+++ b/composer/autoload_classmap.php
@@ -6,6 +6,11 @@
 $baseDir = dirname($vendorDir);
 
 return array(
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCache' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCache.php',
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheException' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheException.php',
+
'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheInvalidArgumentException'
 => $vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheInvalidArgumentException.php',
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheItem' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheItem.php',
+'Addshore\\Psr\\Cache\\MWBagOStuffAdapter\\BagOStuffPsrCacheTest' => 
$vendorDir . 
'/addshore/psr-6-mediawiki-bagostuff-adapter/src/BagOStuffPsrCacheTest.php',
 'AdyenAdapter' => $baseDir . '/adyen_gateway/adyen.adapter.php',
 'AdyenGateway' => $baseDir . '/adyen_gateway/adyen_gateway.body.php',
 'AdyenGatewayResult' => $baseDir . 
'/adyen_gateway/adyen_resultswitcher.body.php',
@@ -85,6 +90,7 @@
 'IsoDate' => $baseDir . '/gateway_common/IsoDate.php',
 'LCRun3' => $vendorDir . '/zordius/lightncandy/src/lightncandy.php',
 'LightnCandy' => $vendorDir . '/zordius/lightncandy/src/lightncandy.php',
+'LocalClusterPsr6Cache' => $baseDir . 
'/gateway_common/LocalClusterPsr6Cache.php',
 'LogPrefixProvider' => $baseDir . '/gateway_common/LogPrefixProvider.php',
 'MessageUtils' => $baseDir . '/gateway_common/MessageUtils.php',
 'Monolog\\ErrorHandler' => $vendorDir . 
'/monolog/monolog/src/Monolog/ErrorHandler.php',
@@ -516,13 +522,15 @@
 'Predis\\Transaction\\AbortedMultiExecException' => $vendorDir . 
'/predis/predis/src/Transaction/AbortedMultiExecException.php',
 'Predis\\Transaction\\MultiExec' => $vendorDir . 
'/predis/predis/src/Transaction/MultiExec.php',
 'Predis\\Transaction\\MultiExecState' => $vendorDir . 
'/predis/predis/src/Transaction/MultiExecState.php',
+'Psr\\Cache\\CacheException' => $vendorDir . 
'/psr/cache/src/CacheException.php',
+'Psr\\Cache\\CacheItemInterface' => $vendorDir . 
'/psr/cache/src/CacheItemInterface.php',
+'Psr\\Cache\\CacheItemPoolInterface' => $vendorDir . 
'/psr/cache/src/CacheItemPoolInterface.php',
+'Psr\\Cache\\InvalidArgumentException' => $vendorDir . 
'/psr/cache/src/InvalidArgumentException.php',
 'Psr\\Log\\AbstractLogger' => $vendorDir . 
'/psr/log/Psr/Log/AbstractLogger.php',
 'Psr\\Log\\InvalidArgumentException' => $vendorDir . 
'/psr/log/Psr/Log/InvalidArgumentException.php',
 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
 'Psr\\Log\\LoggerAwareInterface' => $vendorDir . 
'/psr/log/Psr/Log/LoggerAwareInterface.php',
-'Psr\\Log\\LoggerAwareTrait' => $vendorDir . 
'/psr/log/Psr/Log/LoggerAwareTrait.php',
 'Psr\\Log\\LoggerInterface' => $vendorDir . 
'/psr/log/Psr/Log/LoggerInterface.php',
-'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
 'Psr\\Log\\Test\\DummyTest' => $vendorDir . 
'/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . 
'/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
@@ -535,6 +543,8 @@
 'SessionHandlerInterface' => $vendorDir . 
'/symfony/polyfill-php54/Resources/stubs/SessionHandlerInterface.php',
 'SmashPig\\Core\\Actions\\IListenerMessageAction' => $vendorDir . 
'/wikimedia/smash-pig/Core/Actions/IListenerMessageAction.php',
 'SmashPig\\Core\\Actions\\IncomingMessage' => $vendorDir . 
'/wikimedia/smash-pig/Core/Actions/IncomingMessage.php',
+'SmashPig\\Core\\Cache\\HashCache' => $vendorDir . 
'/wikimedia/smash-pig/Core/Cache/HashCache.php',
+'SmashPig\\Core\\Cache\\HashCacheItem' => $vendorDir . 
'/wikimedia/smash-pig/Core/Cache/HashCacheItem.php',
 'SmashPig\\Core\\Configuration' => $vendorDir . 
'/wikimedia/smash-pig/Core/Configuration.php',
 'SmashPig\\Core\\ConfigurationException' => $vendorDir . 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Update SmashPig library

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

Change subject: Update SmashPig library
..

Update SmashPig library

Get some Ingenico error handling

Change-Id: Ica848b6dcec3ce215d0e76b95d403cea6a4bce01
---
M composer.lock
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/composer.lock b/composer.lock
index c941554..bcc8efa 100644
--- a/composer.lock
+++ b/composer.lock
@@ -936,7 +936,7 @@
 "source": {
 "type": "git",
 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git;,
-"reference": "d581a349e42a73ea7bf3166506262a7fb582b9e6"
+"reference": "4625e68bd0fde15a2dc3ff646cc01bcd4325d8fc"
 },
 "require": {
 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -987,7 +987,7 @@
 "donations",
 "payments"
 ],
-"time": "2017-02-17 00:27:55"
+"time": "2017-02-23 20:48:06"
 },
 {
 "name": "zordius/lightncandy",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica848b6dcec3ce215d0e76b95d403cea6a4bce01
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]: Set SmashPig logging prefix

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

Change subject: Set SmashPig logging prefix
..

Set SmashPig logging prefix

Not perfect, as it happens after any SmashPig library calls that happen
in the gateway object constructor. Trying to keep the silly static stuff
near the surface, or I'd set the prefix right after creating the
DonationData object.

Change-Id: Ie458247c806bcf9d7a2bbe9439489f6b34eb2f14
---
M gateway_common/GatewayPage.php
M gateway_common/donation.api.php
2 files changed, 10 insertions(+), 0 deletions(-)


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

diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index 5dbc747..2d39490 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -15,6 +15,7 @@
  * GNU General Public License for more details.
  *
  */
+use SmashPig\Core\Logging\Logger;
 
 /**
  * GatewayPage
@@ -82,6 +83,10 @@
try {
$this->adapter = new $className();
$this->logger = DonationLoggerFactory::getLogger( 
$this->adapter );
+
+   // FIXME: SmashPig should just use Monolog.
+   Logger::getContext()->enterContext( 
$this->adapter->getLogMessagePrefix() );
+
$out = $this->getOutput();
$out->addModuleStyles( 'donationInterface.styles' );
$out->addModules( 'donationInterface.skinOverride' );
diff --git a/gateway_common/donation.api.php b/gateway_common/donation.api.php
index 9f41ded..d560699 100644
--- a/gateway_common/donation.api.php
+++ b/gateway_common/donation.api.php
@@ -1,4 +1,6 @@
 gateway );
$gatewayObj = $this->getGatewayObject();
 
+   // FIXME: SmashPig should just use Monolog.
+   Logger::getContext()->enterContext( 
$gatewayObj->getLogMessagePrefix() );
+
if ( !$gatewayObj ) {
return; // already failed with a dieUsage call
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie458247c806bcf9d7a2bbe9439489f6b34eb2f14
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]: Throw SmashPig exception on Ingenico API errors

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

Change subject: Throw SmashPig exception on Ingenico API errors
..

Throw SmashPig exception on Ingenico API errors

Instead of letting the downstream thing look for elements that may
not exist.

Change-Id: I2df2b635e5869763b53d6c32acf1bc97e9a59e78
---
M PaymentProviders/Ingenico/Api.php
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/31/339331/1

diff --git a/PaymentProviders/Ingenico/Api.php 
b/PaymentProviders/Ingenico/Api.php
index 2ef21d2..24042d4 100644
--- a/PaymentProviders/Ingenico/Api.php
+++ b/PaymentProviders/Ingenico/Api.php
@@ -6,6 +6,7 @@
 use DateTimeZone;
 use SmashPig\Core\Context;
 use SmashPig\Core\Http\OutboundRequest;
+use SmashPig\Core\SmashPigException;
 
 /**
  * Prepares and sends requests to the Ingenico Connect API.
@@ -58,7 +59,16 @@
$this->authenticator->signRequest( $request );
 
$response = $request->execute();
-   // TODO error handling
+
+   if ( !empty( $response['errors'] ) ) {
+   $messages = array();
+   foreach( $response['errors'] as $error ) {
+   $messages = "Ingenico error {$error['code']}: 
{$error['message']}.";
+   }
+   $concatenated = implode( ' ', $messages );
+   throw new SmashPigException( $concatenated );
+   }
+
return $response;
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2df2b635e5869763b53d6c32acf1bc97e9a59e78
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...DonationInterface[master]: Use HashBag instead of EmptyBag

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

Change subject: Use HashBag instead of EmptyBag
..

Use HashBag instead of EmptyBag

If the local cluster cache is an EmptyBagOfStuff, fall back to a
HashBagOStuff to at least cache for the duration of the request.

Change-Id: I570cdcc7347312bb246848b5d43d22ce1720d3f1
---
M gateway_common/LocalClusterPsr6Cache.php
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/gateway_common/LocalClusterPsr6Cache.php 
b/gateway_common/LocalClusterPsr6Cache.php
index 30740d8..c307100 100644
--- a/gateway_common/LocalClusterPsr6Cache.php
+++ b/gateway_common/LocalClusterPsr6Cache.php
@@ -13,6 +13,9 @@
 class LocalClusterPsr6Cache extends BagOStuffPsrCache {
public function __construct() {
$mainCache = ObjectCache::getLocalClusterInstance();
+   if ( $mainCache instanceof EmptyBagOStuff ) {
+   $mainCache = new HashBagOStuff();
+   }
parent::__construct( $mainCache );
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I570cdcc7347312bb246848b5d43d22ce1720d3f1
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]: Another SmashPig initialization fix

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

Change subject: Another SmashPig initialization fix
..

Another SmashPig initialization fix

Need to initialize the logger too. We should provide a logger
prefix, but the bloated gateway constructor needs SmashPig already
initialized.

Change-Id: Iaac0f061904adb559b3cb0516300c1c9601e69d8
---
M DonationInterface.class.php
M gateway_common/donation.api.php
2 files changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/DonationInterface.class.php b/DonationInterface.class.php
index 40a5648..9132a26 100644
--- a/DonationInterface.class.php
+++ b/DonationInterface.class.php
@@ -89,7 +89,9 @@
 */
public static function initializeSmashPig( $view ) {
$spConfig = Configuration::createForView( $view );
-   Context::init( $spConfig );
+   // FIXME: should set a logger prefix here, but we've got a 
chicken
+   // and egg problem with the Gateway constructor
+   Context::initWithLogger( $spConfig );
return $spConfig;
}
 }
diff --git a/gateway_common/donation.api.php b/gateway_common/donation.api.php
index 447a389..9f41ded 100644
--- a/gateway_common/donation.api.php
+++ b/gateway_common/donation.api.php
@@ -15,8 +15,8 @@
// @todo FIXME: Unused local variable.
$submethod = $this->donationData['payment_submethod'];
 
-   $gatewayObj = $this->getGatewayObject();
DonationInterface::initializeSmashPig( $this->gateway );
+   $gatewayObj = $this->getGatewayObject();
 
if ( !$gatewayObj ) {
return; // already failed with a dieUsage call

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaac0f061904adb559b3cb0516300c1c9601e69d8
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]: Throw a descendent of SmashPig exception on cURL fail

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

Change subject: Throw a descendent of SmashPig exception on cURL fail
..

Throw a descendent of SmashPig exception on cURL fail

Instead of a thing that apparently doesn't exist.

Change-Id: I4f25e473e9f899340a4dfcdba490ebb02cda5dfe
---
M Core/Http/CurlWrapper.php
1 file changed, 1 insertion(+), 2 deletions(-)


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

diff --git a/Core/Http/CurlWrapper.php b/Core/Http/CurlWrapper.php
index 8f4f862..c39cc59 100644
--- a/Core/Http/CurlWrapper.php
+++ b/Core/Http/CurlWrapper.php
@@ -2,7 +2,6 @@
 
 namespace SmashPig\Core\Http;
 
-use HttpRuntimeException;
 use SmashPig\Core\Configuration;
 use SmashPig\Core\Context;
 use SmashPig\Core\Logging\Logger;
@@ -85,7 +84,7 @@
 
if ( $response === false ) {
// no valid response after multiple tries
-   throw new HttpRuntimeException(
+   throw new HttpException(
"{$method} request to {$url} failed $loopCount 
times."
);
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f25e473e9f899340a4dfcdba490ebb02cda5dfe
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...DonationInterface[master]: Fixes for iDEAL/PSR-6 caching

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

Change subject: Fixes for iDEAL/PSR-6 caching
..

Fixes for iDEAL/PSR-6 caching

Autoload, constructor name and visibility, break statement

Bug: T128692
Change-Id: I8d6bf9c2fbaf73fb7e6f917fdabfead61238584d
---
M extension.json
M gateway_common/LocalClusterPsr6Cache.php
M globalcollect_gateway/globalcollect.adapter.php
3 files changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/extension.json b/extension.json
index dc2b360..b693bed 100644
--- a/extension.json
+++ b/extension.json
@@ -87,6 +87,7 @@
"GatewayType": "gateway_common/GatewayType.php",
"IsoDate": "gateway_common/IsoDate.php",
"DataValidator": "gateway_common/DataValidator.php",
+   "LocalClusterPsr6Cache": 
"gateway_common/LocalClusterPsr6Cache.php",
"LogPrefixProvider": "gateway_common/LogPrefixProvider.php",
"MessageUtils": "gateway_common/MessageUtils.php",
"NationalCurrencies": "gateway_common/NationalCurrencies.php",
diff --git a/gateway_common/LocalClusterPsr6Cache.php 
b/gateway_common/LocalClusterPsr6Cache.php
index e485987..f5b6655 100644
--- a/gateway_common/LocalClusterPsr6Cache.php
+++ b/gateway_common/LocalClusterPsr6Cache.php
@@ -14,7 +14,7 @@
  * (no constructor-parameters need to be specified)
  */
 class LocalClusterPsr6Cache extends BagOStuffPsrCache {
-   function __construct__() {
+   public function __construct() {
$mainCache = ObjectCache::getLocalClusterInstance();
parent::__construct( $mainCache );
}
diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index e362617..3527c96 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -1630,6 +1630,7 @@
break;
case 'rtbt':
$this->getBankList();
+   break;
}
 
// Use staged data so we pick up tricksy -_country variants

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d6bf9c2fbaf73fb7e6f917fdabfead61238584d
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]: Reduce Configuration use in BankPaymentProvider

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

Change subject: Reduce Configuration use in BankPaymentProvider
..

Reduce Configuration use in BankPaymentProvider

Provide cache params as constructor arguments

Bug: T158374
Change-Id: Ib0f5d0c1e67517c7331a2fb1bccc8dac612d603e
---
M PaymentProviders/Ingenico/BankPaymentProvider.php
M PaymentProviders/Ingenico/IngenicoPaymentProvider.php
M PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
M SmashPig.yaml
4 files changed, 46 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/06/338306/1

diff --git a/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/PaymentProviders/Ingenico/BankPaymentProvider.php
index 8803ae9..9bd376b 100644
--- a/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -2,6 +2,9 @@
 
 namespace SmashPig\PaymentProviders\Ingenico;
 
+use SmashPig\Core\Context;
+use Psr\Cache\CacheItemPoolInterface;
+
 /**
  * Handle bank payments via Ingenico
  * Will eventually implement PaymentProvider, but right now just looks
@@ -9,6 +12,24 @@
  * config key 'cache'.
  */
 class BankPaymentProvider extends IngenicoPaymentProvider {
+
+   /**
+* @var array()
+*/
+   protected $cacheParameters;
+
+   /**
+* @var CacheItemPoolInterface
+*/
+   protected $cache;
+
+   public function __construct( array $options = array() ) {
+   parent::__construct( $options );
+   $this->cacheParameters = $options['cache-parameters'];
+   // FIXME: provide objects in constructor
+   $config = Context::get()->getConfiguration();
+   $this->cache = $config->object( 'cache' );
+   }
 
/**
 * Look up banks
@@ -21,8 +42,7 @@
 */
public function getBankList( $country, $currency, $productId = 809 ) {
$cacheKey = $this->makeCacheKey( $country, $currency, 
$productId );
-   $cache = $this->config->object( 'cache' );
-   $cacheItem = $cache->getItem( $cacheKey );
+   $cacheItem = $this->cache->getItem( $cacheKey );
 
if ( !$cacheItem->isHit() ) {
$query = array(
@@ -32,7 +52,7 @@
$path = "products/$productId/directory";
$response = $this->makeApiCall( $path, 'GET', $query );
 
-   // TODO: base class should probably decode
+   // TODO: api class should probably decode
$decoded = json_decode( $response['body'] );
 
$banks = array();
@@ -41,15 +61,15 @@
$banks[$entry->issuerId] = $entry->issuerName;
}
$cacheItem->set( $banks );
-   $duration = $this->config->val( 'bank-cache/duration' );
+   $duration = $this->cacheParameters['duration'];
$cacheItem->expiresAfter( $duration );
-   $cache->save( $cacheItem );
+   $this->cache->save( $cacheItem );
}
return $cacheItem->get();
}
 
protected function makeCacheKey( $country, $currency, $productId ) {
-   $base = $this->config->val( 'bank-cache/key' );
+   $base = $this->cacheParameters['key-base'];
return "{$base}_{$country}_{$currency}_{$productId}";
}
 }
diff --git a/PaymentProviders/Ingenico/IngenicoPaymentProvider.php 
b/PaymentProviders/Ingenico/IngenicoPaymentProvider.php
index 3ad939a..85e2c9a 100644
--- a/PaymentProviders/Ingenico/IngenicoPaymentProvider.php
+++ b/PaymentProviders/Ingenico/IngenicoPaymentProvider.php
@@ -21,7 +21,7 @@
 */
protected $config;
 
-   public function __construct() {
+   public function __construct( $options = array() ) {
$this->config = Context::get()->getConfiguration();
}
 
diff --git 
a/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
index bf3d702..1edfe84 100644
--- a/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
+++ b/PaymentProviders/Ingenico/Tests/phpunit/BankPaymentProviderTest.php
@@ -16,18 +16,28 @@
 */
protected $curlWrapper;
 
+   /**
+* @var BankPaymentProvider
+*/
+   protected $provider;
+
public function setUp() {
$config = $this->setConfig( 'ingenico' );
$this->curlWrapper = $this->getMock( 
'\SmashPig\Core\Http\CurlWrapper' );
$config->overrideObjectInstance( 'curl/wrapper', 
$this->curlWrapper );
$config->object( 'cache' 

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Move Ingenico base API wrapper functions to own class

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

Change subject: Move Ingenico base API wrapper functions to own class
..

Move Ingenico base API wrapper functions to own class

Tests for higher level functions shouldn't have to mock all the way
down at the cURL response level.

Bug: T158374
Change-Id: Icafa897a0a79430170a35b5c85427527132e5baf
---
A PaymentProviders/Ingenico/Api.php
M PaymentProviders/Ingenico/BankPaymentProvider.php
M PaymentProviders/Ingenico/IngenicoPaymentProvider.php
M SmashPig.yaml
4 files changed, 74 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/03/338303/1

diff --git a/PaymentProviders/Ingenico/Api.php 
b/PaymentProviders/Ingenico/Api.php
new file mode 100644
index 000..2ef21d2
--- /dev/null
+++ b/PaymentProviders/Ingenico/Api.php
@@ -0,0 +1,64 @@
+baseUrl = $baseUrl;
+   $this->merchantId = $merchantId;
+   // FIXME: provide objects in constructor
+   $config = Context::get()->getConfiguration();
+   $this->authenticator = $config->object( 'authenticator' );
+   }
+
+   public function makeApiCall( $path, $method = 'POST', $data = null ) {
+   if ( is_array( $data ) ) {
+   // FIXME: this is weird, maybe OutboundRequest should 
handle this part
+   if ( $method === 'GET' ) {
+   $path .= '?' . http_build_query( $data );
+   $data = null;
+   } else {
+   $data = json_encode( $data );
+   }
+   }
+   $url = $this->baseUrl . self::API_VERSION . 
"/{$this->merchantId}/$path";
+   $request = new OutboundRequest( $url, $method );
+   $request->setBody( $data );
+   if ( $method !== 'GET' ) {
+   $request->setHeader( 'Content-Type', 'application/json' 
);
+   }
+   // Set date header manually so we can use it in signature 
generation
+   $date = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
+   $request->setHeader( 'Date', $date->format( 'D, d M Y H:i:s T' 
) );
+
+   // set more headers...
+
+   $this->authenticator->signRequest( $request );
+
+   $response = $request->execute();
+   // TODO error handling
+   return $response;
+   }
+}
diff --git a/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/PaymentProviders/Ingenico/BankPaymentProvider.php
index 8803ae9..b7b0e05 100644
--- a/PaymentProviders/Ingenico/BankPaymentProvider.php
+++ b/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -30,7 +30,7 @@
'currencyCode' => $currency
);
$path = "products/$productId/directory";
-   $response = $this->makeApiCall( $path, 'GET', $query );
+   $response = $this->api->makeApiCall( $path, 'GET', 
$query );
 
// TODO: base class should probably decode
$decoded = json_decode( $response['body'] );
diff --git a/PaymentProviders/Ingenico/IngenicoPaymentProvider.php 
b/PaymentProviders/Ingenico/IngenicoPaymentProvider.php
index 3ad939a..9fe7ad2 100644
--- a/PaymentProviders/Ingenico/IngenicoPaymentProvider.php
+++ b/PaymentProviders/Ingenico/IngenicoPaymentProvider.php
@@ -2,12 +2,7 @@
 
 namespace SmashPig\PaymentProviders\Ingenico;
 
-use DateTime;
-use DateTimeZone;
 use SmashPig\Core\Context;
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Http\OutboundRequest;
-use SmashPig\Core\UtcDate;
 
 /**
  * Base class for Ingenico payments. Each payment product group should get
@@ -15,48 +10,12 @@
  */
 abstract class IngenicoPaymentProvider {
 
-   const API_VERSION = 'v1';
-   /**
-* @var Configuration
-*/
+   protected $api;
protected $config;
 
-   public function __construct() {
+   public function __construct( $options = array() ) {
+   // FIXME: provide objects in constructor
$this->config = Context::get()->getConfiguration();
-   }
-
-   protected function makeApiCall( $path, $method = 'POST', $data = null ) 
{
-   if ( is_array( $data ) ) {
-   // FIXME: this is weird, maybe OutboundRequest should 
handle this part
-   if ( $method === 'GET' ) {
-   $path .= '?' . http_build_query( $data );
-   $data = null;
-   } else {
-   $data = json_encode( $data );
-   }
-   }
-   $base = $this->config->val( 'base-url' );
-   if ( substr( 

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Get some static Config access out of Authenticator

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

Change subject: Get some static Config access out of Authenticator
..

Get some static Config access out of Authenticator

Provide credentials via constructor params

Bug: T158374
Change-Id: I59c54829f4ac197ca9c5681f338a415c9abb6764
---
M PaymentProviders/Ingenico/Authenticator.php
M PaymentProviders/Ingenico/Tests/phpunit/AuthenticatorTest.php
M SmashPig.yaml
3 files changed, 24 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/00/338300/1

diff --git a/PaymentProviders/Ingenico/Authenticator.php 
b/PaymentProviders/Ingenico/Authenticator.php
index bbb..cbb389c 100644
--- a/PaymentProviders/Ingenico/Authenticator.php
+++ b/PaymentProviders/Ingenico/Authenticator.php
@@ -11,24 +11,28 @@
  */
 class Authenticator {
 
+   protected $keyId;
+   protected $secret;
+
+   public function __construct( $keyId, $secret ) {
+   $this->keyId = $keyId;
+   $this->secret = $secret;
+   }
+
public function signRequest( OutboundRequest $request ) {
-   $config = Context::get()->getConfiguration();
 
$toSign = $this->getStringToSign( $request );
-   $secretApiKey = $config->val( 'credentials/api-secret' );
 
$signature = base64_encode(
hash_hmac(
'sha256',
$toSign,
-   $secretApiKey,
+   $this->secret,
true
)
);
 
-   $apiKeyId = $config->val( 'credentials/api-key-id' );
-
-   $authHeader = "GCS v1HMAC:$apiKeyId:$signature";
+   $authHeader = "GCS v1HMAC:{$this->keyId}:$signature";
$request->setHeader( 'Authorization', $authHeader );
}
 
diff --git a/PaymentProviders/Ingenico/Tests/phpunit/AuthenticatorTest.php 
b/PaymentProviders/Ingenico/Tests/phpunit/AuthenticatorTest.php
index b9d9fd9..d242f6a 100644
--- a/PaymentProviders/Ingenico/Tests/phpunit/AuthenticatorTest.php
+++ b/PaymentProviders/Ingenico/Tests/phpunit/AuthenticatorTest.php
@@ -14,14 +14,16 @@
  */
 class AuthenticatorTest extends BaseSmashPigUnitTestCase {
 
+   /**
+* @var Authenticator
+*/
+   protected $authenticator;
+
public function setUp() {
-   $config = $this->setConfig( 'ingenico' );
-   $config->override( array(
-   'credentials' => array(
-   'api-key-id' => '5e45c937b9db33ae',
-   'api-secret' => 
'I42Zf4pVnRdroHfuHnRiJjJ2B6+22h0yQt/R3nZR8Xg='
-   )
-   ) );
+   $this->authenticator = new Authenticator(
+   '5e45c937b9db33ae',
+   'I42Zf4pVnRdroHfuHnRiJjJ2B6+22h0yQt/R3nZR8Xg='
+   );
parent::setUp();
}
 
@@ -31,8 +33,7 @@
public function testBasicSignature() {
$request = new OutboundRequest( 
'https://api.globalcollect.com/v1/9991/tokens/123456789' );
$request->setHeader( 'Date', 'Fri, 06 Jun 2014 13:39:43 GMT' );
-   $authenticator = new Authenticator();
-   $authenticator->signRequest( $request );
+   $this->authenticator->signRequest( $request );
$headers = $request->getHeaders();
$this->assertEquals(
'GCS 
v1HMAC:5e45c937b9db33ae:J5LjfSBvrQNhu7gG0gvifZt+IWNDReGCmHmBmth6ueI=',
@@ -43,8 +44,7 @@
public function testEncodedQuery() {
$request = new OutboundRequest( 
'https://api.globalcollect.com/v1/consumer/ANDR%C3%89E/?q=na%20me' );
$request->setHeader( 'Date', 'Fri, 06 Jun 2014 13:39:43 GMT' );
-   $authenticator = new Authenticator();
-   $authenticator->signRequest( $request );
+   $this->authenticator->signRequest( $request );
$headers = $request->getHeaders();
$this->assertEquals(
'GCS 
v1HMAC:5e45c937b9db33ae:x9S2hQmLhLTbpK0YdTuYCD8TB4D+Kf60tNW0Xw5Xls0=',
diff --git a/SmashPig.yaml b/SmashPig.yaml
index ce84b07..db44c38 100644
--- a/SmashPig.yaml
+++ b/SmashPig.yaml
@@ -446,12 +446,12 @@
 
 credentials:
 merchant-id: 1234
-api-key-id: 'apiKey'
-api-secret: 'apiSecret'
 
 authenticator:
 class: SmashPig\PaymentProviders\Ingenico\Authenticator
-constructor-parameters: []
+constructor-parameters:
+- 'apiKey'
+- 'apiSecret'
 
 bank-cache:
 key: SMASHPIG_INGENICO_IDEAL_BANK_LIST

-- 
To view, visit https://gerrit.wikimedia.org/r/338300
To 

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Factory for payment providers

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

Change subject: Factory for payment providers
..

Factory for payment providers

Don't make anybody new() up the PaymentProvider classes or call on
SmashPig::Configuration from higher level libraries.

Change-Id: I6ff9a837326f2714398d439a5d14a5a17ad4b564
---
M Core/Configuration.php
A PaymentProviders/PaymentProviderFactory.php
M SmashPig.yaml
3 files changed, 28 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/96/338296/1

diff --git a/Core/Configuration.php b/Core/Configuration.php
index 095daec..f94d72c 100644
--- a/Core/Configuration.php
+++ b/Core/Configuration.php
@@ -274,6 +274,9 @@
 
// Optional keys
$arguments = array();
+   // It would be nice to be able to provide other objects defined
+   // in config as arguments. We might have had that 
pre-simplification
+   // with nodes that referred to other nodes.
if ( $this->nodeExists( $node . '/constructor-parameters' ) ) {
$arguments = $this->val( $node . 
'/constructor-parameters' );
}
diff --git a/PaymentProviders/PaymentProviderFactory.php 
b/PaymentProviders/PaymentProviderFactory.php
new file mode 100644
index 000..f84f5f2
--- /dev/null
+++ b/PaymentProviders/PaymentProviderFactory.php
@@ -0,0 +1,19 @@
+getConfiguration();
+   $node = "payment-provider/$paymentMethod";
+   return $config->object( $node );
+   }
+}
diff --git a/SmashPig.yaml b/SmashPig.yaml
index ce84b07..70655f0 100644
--- a/SmashPig.yaml
+++ b/SmashPig.yaml
@@ -170,6 +170,8 @@
 listener:
 class: SmashPig\PaymentProviders\Adyen\AdyenListener
 
+# FIXME: let's use this node to map payment methods to classes that
+# implement doPayment (aka gateway adapters). See ingenico below.
 payment-provider:
 adyen:
 api:
@@ -457,6 +459,10 @@
 key: SMASHPIG_INGENICO_IDEAL_BANK_LIST
 duration: 300
 
+payment-provider:
+rtbt:
+class: SmashPig\PaymentProviders\Ingenico\BankPaymentProvider
+
 # deprecated, delete when projects using SmashPig rename adaptors
 globalcollect:
 <<: *INGENICO

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ff9a837326f2714398d439a5d14a5a17ad4b564
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...DonationInterface[master]: Use dependency injection to get BankPaymentProvider

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

Change subject: Use dependency injection to get BankPaymentProvider
..

Use dependency injection to get BankPaymentProvider

This way we don't need to mock the low-level cURL response.
Unfortunately, we need to write a substitute class. Would it really
be so bad to use SmashPig's Configuration::object in DonationInterface
code?

Bug: T128692
Change-Id: I3b35350bf944207786e8bded33d04caf1f287dbf
---
M DonationInterface.class.php
M extension.json
M globalcollect_gateway/globalcollect.adapter.php
M tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php
4 files changed, 40 insertions(+), 36 deletions(-)


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

diff --git a/DonationInterface.class.php b/DonationInterface.class.php
index 5ffe3ba..d6756c9 100644
--- a/DonationInterface.class.php
+++ b/DonationInterface.class.php
@@ -74,12 +74,21 @@
return true;
}
 
-   public static function getAdapterClassForGateway( $gateway ) {
+   public static function getAdapterClassForGateway( $gateway, 
$payment_method = null ) {
global $wgDonationInterfaceGatewayAdapters;
if ( !key_exists( $gateway, $wgDonationInterfaceGatewayAdapters 
) ) {
throw new OutOfRangeException( "No adapter configured 
for $gateway" );
}
-   return $wgDonationInterfaceGatewayAdapters[$gateway];
+   $entry = $wgDonationInterfaceGatewayAdapters[$gateway];
+   if ( !is_array( $entry ) ) {
+   return $entry;
+   }
+   if ( !key_exists( $payment_method, $entry ) ) {
+   throw new OutOfRangeException(
+   "$gateway has no payment provider for 
$payment_method configured"
+   );
+   }
+   return $entry[ $payment_method ];
}
 
/**
diff --git a/extension.json b/extension.json
index dc2b360..908c221 100644
--- a/extension.json
+++ b/extension.json
@@ -451,7 +451,10 @@
"adyen": "AdyenAdapter",
"astropay": "AstroPayAdapter",
"paypal_ec": "PaypalExpressAdapter",
-   "paypal": "PaypalLegacyAdapter"
+   "paypal": "PaypalLegacyAdapter",
+   "ingenico": {
+   "rtbt": 
"SmashPig\\PaymentProviders\\Ingenico\\BankPaymentProvider"
+   }
},
"DonationInterfaceAllowedHtmlForms": []
},
diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index aadbedc..6ea54f6 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -1759,7 +1759,11 @@
return;
}
try {
-   $provider = new BankPaymentProvider();
+   $providerClass = 
DonationInterface::getAdapterClassForGateway(
+   'ingenico',
+   'rtbt'
+   );
+   $provider = new $providerClass();
$banks = $provider->getBankList( $country, $currency );
$meta['issuers'] = $banks;
}
diff --git 
a/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php 
b/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php
index 426999c..a0f8e73 100644
--- a/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php
@@ -17,6 +17,7 @@
  */
 use SmashPig\Core\Configuration;
 use SmashPig\Core\Context;
+use SmashPig\PaymentProviders\Ingenico\BankPaymentProvider;
 
 /**
  * 
@@ -26,42 +27,17 @@
  * @group RealTimeBankTransfer
  */
 class DonationInterface_Adapter_GlobalCollect_RealTimeBankTransferIdealTest 
extends DonationInterfaceTestCase {
-   /**
-* @var PHPUnit_Framework_MockObject_MockObject
-*/
-   protected $cache;
-   protected $curlWrapper;
 
public function setUp() {
parent::setUp();
-
-   $config = Configuration::createForView( 'ingenico' );
-   Context::initWithLogger( $config ); // gets torn down in parent
-
-   $this->cache = new HashBagOStuff();
-   $cacheWrapper = new 
Addshore\Psr\Cache\MWBagOStuffAdapter\BagOStuffPsrCache( $this->cache );
-   $config->overrideObjectInstance( 'cache', $cacheWrapper );
-
-   // FIXME: This is all wrong - in this project we should be 
mocking the
-   // parsed API 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Normalized subscr_ messages for tests

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

Change subject: Normalized subscr_ messages for tests
..

Normalized subscr_ messages for tests

This is what the messages coming out of the listener should look like
after we move the normalization from RecurringQueueConsumer. It should
be able to handle these without double-normalizing.

Bug: T107372
Change-Id: I1ecf5cbf41bdcb02b2c22fae89ed230c8694c093
---
A sites/all/modules/queue2civicrm/tests/data/subscr_payment_normalized.json
A sites/all/modules/queue2civicrm/tests/data/subscr_signup_normalized.json
2 files changed, 46 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/45/338145/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/data/subscr_payment_normalized.json 
b/sites/all/modules/queue2civicrm/tests/data/subscr_payment_normalized.json
new file mode 100644
index 000..e513314
--- /dev/null
+++ b/sites/all/modules/queue2civicrm/tests/data/subscr_payment_normalized.json
@@ -0,0 +1,22 @@
+{
+"date": 1383346353,
+"subscr_id": null,
+"txn_type": "subscr_payment",
+"contribution_tracking_id": "15017277",
+"email": "test...@wikimedia.org",
+"first_name": "Gen",
+"middle_name": "",
+"last_name": "Russ",
+"street_address": "1211122 132 st",
+"city": "Edmonton",
+"state_province": "Alberta",
+"country": "CA",
+"postal_code": "T4V 2L2",
+"gateway_txn_id": 1765009520,
+"currency": "CAD",
+"gross": "3.00",
+"fee": "0.33",
+"net": 2.67,
+"gateway": "paypal",
+"recurring": true
+}
diff --git 
a/sites/all/modules/queue2civicrm/tests/data/subscr_signup_normalized.json 
b/sites/all/modules/queue2civicrm/tests/data/subscr_signup_normalized.json
new file mode 100644
index 000..cc512f6
--- /dev/null
+++ b/sites/all/modules/queue2civicrm/tests/data/subscr_signup_normalized.json
@@ -0,0 +1,24 @@
+{
+"subscr_id": 2048343366,
+"txn_type": "subscr_signup",
+"contribution_tracking_id": "15028173",
+"email": "test+recur...@wikimedia.org",
+"first_name": "Gen D",
+"middle_name": "",
+"last_name": "Russ",
+"street_address": "5109 Lockwood Rd",
+"city": "Bethel Park",
+"state_province": "PA",
+"country": "US",
+"postal_code": "15110-1232",
+"frequency_interval": "1",
+"frequency_unit": "month",
+"installments": 0,
+"gross": "3.00",
+"currency": "CAD",
+"create_date": 1383347225,
+"start_date": 1383347225,
+"date": 1383347225,
+"gateway": "paypal",
+"recurring": true
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ecf5cbf41bdcb02b2c22fae89ed230c8694c093
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...vendor[master]: Update PHPMailer

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

Change subject: Update PHPMailer
..


Update PHPMailer

Change-Id: I57f02bc76164dcd78d4b937bcddfd828ef2b4634
---
M composer/installed.json
M phpmailer/phpmailer/VERSION
M phpmailer/phpmailer/class.phpmailer.php
M phpmailer/phpmailer/class.phpmaileroauthgoogle.php
M phpmailer/phpmailer/class.pop3.php
M phpmailer/phpmailer/class.smtp.php
A phpmailer/phpmailer/examples/contactform.phps
M phpmailer/phpmailer/examples/contentsutf8.html
M phpmailer/phpmailer/examples/scripts/XRegExp.js
M phpmailer/phpmailer/examples/send_file_upload.phps
M phpmailer/phpmailer/examples/send_multiple_file_upload.phps
M phpmailer/phpmailer/extras/htmlfilter.php
M phpmailer/phpmailer/get_oauth_token.php
13 files changed, 174 insertions(+), 88 deletions(-)

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



diff --git a/composer/installed.json b/composer/installed.json
index 13bee3b..4dd1b02 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -566,68 +566,6 @@
 ]
 },
 {
-"name": "phpmailer/phpmailer",
-"version": "v5.2.21",
-"version_normalized": "5.2.21.0",
-"source": {
-"type": "git",
-"url": "https://github.com/PHPMailer/PHPMailer.git;,
-"reference": "1d51856b76c06fc687fcd9180efa7a0bed0d761e"
-},
-"dist": {
-"type": "zip",
-"url": 
"https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1d51856b76c06fc687fcd9180efa7a0bed0d761e;,
-"reference": "1d51856b76c06fc687fcd9180efa7a0bed0d761e",
-"shasum": ""
-},
-"require": {
-"php": ">=5.0.0"
-},
-"require-dev": {
-"phpdocumentor/phpdocumentor": "*",
-"phpunit/phpunit": "4.7.*"
-},
-"suggest": {
-"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
-},
-"time": "2016-12-28 15:35:48",
-"type": "library",
-"installation-source": "dist",
-"autoload": {
-"classmap": [
-"class.phpmailer.php",
-"class.phpmaileroauth.php",
-"class.phpmaileroauthgoogle.php",
-"class.smtp.php",
-"class.pop3.php",
-"extras/EasyPeasyICS.php",
-"extras/ntlm_sasl_client.php"
-]
-},
-"notification-url": "https://packagist.org/downloads/;,
-"license": [
-"LGPL-2.1"
-],
-"authors": [
-{
-"name": "Jim Jagielski",
-"email": "jim...@gmail.com"
-},
-{
-"name": "Marcus Bointon",
-"email": "phpmai...@synchromedia.co.uk"
-},
-{
-"name": "Andy Prevost",
-"email": "codeworxt...@users.sourceforge.net"
-},
-{
-"name": "Brent R. Matzelle"
-}
-],
-"description": "PHPMailer is a full-featured email creation and 
transfer class for PHP"
-},
-{
 "name": "minfraud/http",
 "version": "v1.71",
 "version_normalized": "1.71.0.0",
@@ -1238,5 +1176,67 @@
 "donations",
 "payments"
 ]
+},
+{
+"name": "phpmailer/phpmailer",
+"version": "v5.2.22",
+"version_normalized": "5.2.22.0",
+"source": {
+"type": "git",
+"url": "https://github.com/PHPMailer/PHPMailer.git;,
+"reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663"
+},
+"dist": {
+"type": "zip",
+"url": 
"https://api.github.com/repos/PHPMailer/PHPMailer/zipball/b18cb98131bd83103ccb26a888fdfe3177b8a663;,
+"reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663",
+"shasum": ""
+},
+"require": {
+"php": ">=5.0.0"
+},
+"require-dev": {
+"phpdocumentor/phpdocumentor": "*",
+"phpunit/phpunit": "4.7.*"
+},
+"suggest": {
+"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
+},
+"time": "2017-01-09 09:33:47",
+"type": "library",
+"installation-source": "dist",
+"autoload": {
+"classmap": [
+"class.phpmailer.php",
+"class.phpmaileroauth.php",
+"class.phpmaileroauthgoogle.php",
+"class.smtp.php",
+"class.pop3.php",
+"extras/EasyPeasyICS.php",
+"extras/ntlm_sasl_client.php"
+]
+},
+"notification-url": "https://packagist.org/downloads/;,
+"license": [
+"LGPL-2.1"
+],
+"authors": [
+

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

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

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

Merge branch 'master' into deployment

And update 'vendor' submodule

afd2d95 Fix command in CurrencyRates template header
6f3d25c Update PHPMailer to 5.2.22

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


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

diff --git a/vendor b/vendor
index e3c1e1c..8c0bb4b 16
--- a/vendor
+++ b/vendor
@@ -1 +1 @@
-Subproject commit e3c1e1c5474b032280763d753c31479e942124bf
+Subproject commit 8c0bb4bc7a5addb575358d6dfc1b6272c4f8b2f1

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19f78e4307bba823c56e7a60e36d846cdfad03f1
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]: Update PHPMailer

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

Change subject: Update PHPMailer
..

Update PHPMailer

Change-Id: I57f02bc76164dcd78d4b937bcddfd828ef2b4634
---
M composer/installed.json
M phpmailer/phpmailer/VERSION
M phpmailer/phpmailer/class.phpmailer.php
M phpmailer/phpmailer/class.phpmaileroauthgoogle.php
M phpmailer/phpmailer/class.pop3.php
M phpmailer/phpmailer/class.smtp.php
A phpmailer/phpmailer/examples/contactform.phps
M phpmailer/phpmailer/examples/contentsutf8.html
M phpmailer/phpmailer/examples/scripts/XRegExp.js
M phpmailer/phpmailer/examples/send_file_upload.phps
M phpmailer/phpmailer/examples/send_multiple_file_upload.phps
M phpmailer/phpmailer/extras/htmlfilter.php
M phpmailer/phpmailer/get_oauth_token.php
13 files changed, 174 insertions(+), 88 deletions(-)


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

diff --git a/composer/installed.json b/composer/installed.json
index 13bee3b..4dd1b02 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -566,68 +566,6 @@
 ]
 },
 {
-"name": "phpmailer/phpmailer",
-"version": "v5.2.21",
-"version_normalized": "5.2.21.0",
-"source": {
-"type": "git",
-"url": "https://github.com/PHPMailer/PHPMailer.git;,
-"reference": "1d51856b76c06fc687fcd9180efa7a0bed0d761e"
-},
-"dist": {
-"type": "zip",
-"url": 
"https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1d51856b76c06fc687fcd9180efa7a0bed0d761e;,
-"reference": "1d51856b76c06fc687fcd9180efa7a0bed0d761e",
-"shasum": ""
-},
-"require": {
-"php": ">=5.0.0"
-},
-"require-dev": {
-"phpdocumentor/phpdocumentor": "*",
-"phpunit/phpunit": "4.7.*"
-},
-"suggest": {
-"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
-},
-"time": "2016-12-28 15:35:48",
-"type": "library",
-"installation-source": "dist",
-"autoload": {
-"classmap": [
-"class.phpmailer.php",
-"class.phpmaileroauth.php",
-"class.phpmaileroauthgoogle.php",
-"class.smtp.php",
-"class.pop3.php",
-"extras/EasyPeasyICS.php",
-"extras/ntlm_sasl_client.php"
-]
-},
-"notification-url": "https://packagist.org/downloads/;,
-"license": [
-"LGPL-2.1"
-],
-"authors": [
-{
-"name": "Jim Jagielski",
-"email": "jim...@gmail.com"
-},
-{
-"name": "Marcus Bointon",
-"email": "phpmai...@synchromedia.co.uk"
-},
-{
-"name": "Andy Prevost",
-"email": "codeworxt...@users.sourceforge.net"
-},
-{
-"name": "Brent R. Matzelle"
-}
-],
-"description": "PHPMailer is a full-featured email creation and 
transfer class for PHP"
-},
-{
 "name": "minfraud/http",
 "version": "v1.71",
 "version_normalized": "1.71.0.0",
@@ -1238,5 +1176,67 @@
 "donations",
 "payments"
 ]
+},
+{
+"name": "phpmailer/phpmailer",
+"version": "v5.2.22",
+"version_normalized": "5.2.22.0",
+"source": {
+"type": "git",
+"url": "https://github.com/PHPMailer/PHPMailer.git;,
+"reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663"
+},
+"dist": {
+"type": "zip",
+"url": 
"https://api.github.com/repos/PHPMailer/PHPMailer/zipball/b18cb98131bd83103ccb26a888fdfe3177b8a663;,
+"reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663",
+"shasum": ""
+},
+"require": {
+"php": ">=5.0.0"
+},
+"require-dev": {
+"phpdocumentor/phpdocumentor": "*",
+"phpunit/phpunit": "4.7.*"
+},
+"suggest": {
+"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
+},
+"time": "2017-01-09 09:33:47",
+"type": "library",
+"installation-source": "dist",
+"autoload": {
+"classmap": [
+"class.phpmailer.php",
+"class.phpmaileroauth.php",
+"class.phpmaileroauthgoogle.php",
+"class.smtp.php",
+"class.pop3.php",
+"extras/EasyPeasyICS.php",
+"extras/ntlm_sasl_client.php"
+]
+},
+"notification-url": "https://packagist.org/downloads/;,
+"license": [
+"LGPL-2.1"
+ 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update PHPMailer to 5.2.22

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

Change subject: Update PHPMailer to 5.2.22
..

Update PHPMailer to 5.2.22

Bug: T158214
Change-Id: I3f4f0bee86e69cb47d4c0fba0f542a7133afeb53
---
M composer.json
M composer.lock
2 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/29/337929/1

diff --git a/composer.json b/composer.json
index d6a3181..afb6d1d 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
 "cogpowered/finediff": "0.*",
 "wikimedia/donation-interface": "dev-master",
 "wikimedia/smash-pig": "dev-master",
-"phpmailer/phpmailer": "5.2.21",
+"phpmailer/phpmailer": "5.2.*",
 "phpseclib/phpseclib": "0.3.7",
 "predis/predis": "1.*",
 "twig/twig": "1.*"
diff --git a/composer.lock b/composer.lock
index 0f07766..ea29207 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
 "Read more about it at 
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file;,
 "This file is @generated automatically"
 ],
-"hash": "c2a08d033ae69a5ecbae72fdbe929a2a",
-"content-hash": "824641a9a433422fd2773d67876f5d7b",
+"hash": "3d6f8c32ad33ad35ce6ea1c9c53e9a9d",
+"content-hash": "d55d94a44358dcbf751118edd5798fe3",
 "packages": [
 {
 "name": "amzn/login-and-pay-with-amazon-sdk-php",
@@ -398,16 +398,16 @@
 },
 {
 "name": "phpmailer/phpmailer",
-"version": "v5.2.21",
+"version": "v5.2.22",
 "source": {
 "type": "git",
 "url": "https://github.com/PHPMailer/PHPMailer.git;,
-"reference": "1d51856b76c06fc687fcd9180efa7a0bed0d761e"
+"reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663"
 },
 "dist": {
 "type": "zip",
-"url": 
"https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1d51856b76c06fc687fcd9180efa7a0bed0d761e;,
-"reference": "1d51856b76c06fc687fcd9180efa7a0bed0d761e",
+"url": 
"https://api.github.com/repos/PHPMailer/PHPMailer/zipball/b18cb98131bd83103ccb26a888fdfe3177b8a663;,
+"reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663",
 "shasum": ""
 },
 "require": {
@@ -454,7 +454,7 @@
 }
 ],
 "description": "PHPMailer is a full-featured email creation and 
transfer class for PHP",
-"time": "2016-12-28 15:35:48"
+"time": "2017-01-09 09:33:47"
 },
 {
 "name": "phpseclib/phpseclib",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f4f0bee86e69cb47d4c0fba0f542a7133afeb53
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


<    4   5   6   7   8   9   10   11   12   13   >