Ejegg has uploaded a new change for review.

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

Change subject: Roll back donation-interface lib, revert module updates
......................................................................

Roll back donation-interface lib, revert module updates

Till we get more confident about recurring GC code path
This reverts commit e6b3532397586bbc025e11c695d56e6d791d5109.

Change-Id: I52cf8d3b02b8544e82a22a17bbdf223d6f52a917
---
M composer.json
M composer.lock
M sites/all/modules/recurring_globalcollect/recurring_globalcollect.module
M sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php
M sites/all/modules/wmf_civicrm/DonationInterface.php
5 files changed, 29 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/42/225342/1

diff --git a/composer.json b/composer.json
index 7b90bab..decc1e0 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
     "require": {
         "coderkungfu/php-queue": "dev-master",
         "cogpowered/finediff": "0.*",
-        "wikimedia/donation-interface": "dev-master",
+        "wikimedia/donation-interface": 
"dev-master#f2a16464ea48f833dff9d504c5a282e55b2bc13f",
         "wikimedia/smash-pig": "dev-master",
         "fusesource/stomp-php": "2.*",
         "phpmailer/phpmailer": "5.2.6",
diff --git a/composer.lock b/composer.lock
index 499a677..1e87748 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at 
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";,
         "This file is @generated automatically"
     ],
-    "hash": "2b36382b6d20b05e807d014f5f30e938",
+    "hash": "8e3fd028ab927325912337abe0ae408a",
     "packages": [
         {
             "name": "clio/clio",
@@ -379,7 +379,6 @@
                     "phpseclib/Crypt/Random.php"
                 ]
             },
-            "notification-url": "https://packagist.org/downloads/";,
             "include-path": [
                 "phpseclib/"
             ],
@@ -429,6 +428,10 @@
                 "x.509",
                 "x509"
             ],
+            "support": {
+                "source": "https://github.com/phpseclib/phpseclib/tree/0.3.7";,
+                "issues": "https://github.com/phpseclib/phpseclib/issues";
+            },
             "time": "2014-07-05 16:36:21"
         },
         {
diff --git 
a/sites/all/modules/recurring_globalcollect/recurring_globalcollect.module 
b/sites/all/modules/recurring_globalcollect/recurring_globalcollect.module
index 0688854..8e16239 100644
--- a/sites/all/modules/recurring_globalcollect/recurring_globalcollect.module
+++ b/sites/all/modules/recurring_globalcollect/recurring_globalcollect.module
@@ -237,8 +237,13 @@
   foreach ($contribution_batch as $contribution_recur)
   {
       try {
-          recurring_globalcollect_charge($contribution_recur->id, $options);
-          $succeeded[] = $contribution_recur;
+          $status = recurring_globalcollect_charge($contribution_recur->id, 
$options);
+
+          if ($status) {
+              $succeeded[] = $contribution_recur;
+          } else {
+              $failed[] = $contribution_recur;
+          }
       }
       catch ( WmfException $e )
       {
@@ -270,6 +275,8 @@
  * @param int $contribution_recur_id
  * @param array $options Accepts the following optional keys:
  *      contribution_tags - array of tags to associate with the contribution
+ *
+ * @return array adapter result details
  *
  * @throws WmfException if the payment fails or any other error occurs.
  */
@@ -307,22 +314,26 @@
       'effort_id' => $subscription->processor_id + 1,
   ) );
 
-  $result = $adapter->do_transaction( 'Recurring_Charge' );
-  $communicationStatus = $result->getCommunicationStatus();
-  $errors = $result->getErrors();
+  $result = $adapter->do_transaction('Recurring_Charge');
 
   // If success, add a record to the contribution table and send a thank you 
email.
-  if ( $communicationStatus && empty( $errors ) ) {
+  if ($result['status'] && empty($result['errors'])) {
     // Mark this donation as successful, and reschedule it for next month
     // This is done before anything else, otherwise any errors that occur 
while storing the contribution
     // record in civi might cause this subscription to end up in a weird state 
and not recur correctly.
     // If storing the donation in civi fails, that's not a big deal, we'll get 
the data eventually
     // by reconciling the data we get from the payment processor.
-    _recurring_globalcollect_update_record_success( $contribution_recur_id );
+    _recurring_globalcollect_update_record_success($contribution_recur_id);
 
     $msg = recurring_globalcollect_create_message( $contribution_recur_id );
 
-    wmf_civicrm_contribution_message_import( $msg );
+    $contribution = wmf_civicrm_contribution_message_import( $msg );
+
+    // FIXME: what is this nonsense?
+    $contribution['contribution_id'] = $contribution['id'];
+    unset( $contribution['id'] );
+
+    return $result;
   }
   else
   {
diff --git 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php
 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php
index f6524ef..047f932 100644
--- 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php
+++ 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php
@@ -28,7 +28,7 @@
             'installments' => 0,
             'processor_id' => 1,
             'currency' => 'USD',
-            'trxn_id' => "RECURRING GLOBALCOLLECT {$this->subscription_id}",
+            'trxn_id' => "RECURRING TESTGATEWAY {$this->subscription_id}",
         ) );
         $this->contribution_recur_id = $result['id'];
 
@@ -49,7 +49,8 @@
         // FIXME: don't make real API calls, rely on DI test fixture responses 
instead.
         $this->markTestSkipped( 'Makes API calls.' );
 
-        recurring_globalcollect_charge( $this->contribution_recur_id );
+        $result = recurring_globalcollect_charge( $this->contribution_recur_id 
);
+        $this->assertEquals( 'completed', $result['status'] );
 
         $result = civicrm_api3( 'Contribution', 'get', array(
             'contact_id' => $this->contact_id,
diff --git a/sites/all/modules/wmf_civicrm/DonationInterface.php 
b/sites/all/modules/wmf_civicrm/DonationInterface.php
index a75ce8e..9fa57d2 100644
--- a/sites/all/modules/wmf_civicrm/DonationInterface.php
+++ b/sites/all/modules/wmf_civicrm/DonationInterface.php
@@ -23,8 +23,7 @@
             $wgDonationInterfacePriceCeiling,
             $wgGlobalCollectGatewayAccountInfo,
             $wgGlobalCollectGatewayURL,
-            $wgGlobalCollectGatewayMerchantID,
-            $wgDonationInterfaceGatewayAdapters;
+            $wgGlobalCollectGatewayMerchantID;
 
         // Adapt Drupal configuration into MediaWiki globals.
         $wgGlobalCollectGatewayMerchantID = 
variable_get('recurring_globalcollect_merchant_id', 0);
@@ -41,8 +40,6 @@
         $wgDonationInterfacePriceCeiling = 10000.00;
 
         $className = "{$type}Adapter";
-        $wgDonationInterfaceGatewayAdapters = array( $className );
-
         $adapter = new $className( $adapterOptions );
         return $adapter;
     }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52cf8d3b02b8544e82a22a17bbdf223d6f52a917
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

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

Reply via email to