jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/355488 )

Change subject: Payments-init consumer can handle 'currency' message field.
......................................................................


Payments-init consumer can handle 'currency' message field.

Trying to standardize wire formats. Should fix the column name, but that's
a pretty huge table.

Bug: T165818
Change-Id: Ica71016fb92e50feb91daa5d4875241b1b885f7e
---
M sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
M sites/all/modules/queue2civicrm/tests/data/payments-init.json
M sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
3 files changed, 9 insertions(+), 4 deletions(-)

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



diff --git a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module 
b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
index 593be09..a12c1d1 100644
--- a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
+++ b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
@@ -111,7 +111,12 @@
       }
     }
   }
-
+  // FIXME: schema should match wire format & frontend name
+  // renaming message field here to match column.
+  if (empty($msg['currency_code']) && !empty($msg['currency'])) {
+    $msg['currency_code'] = $msg['currency'];
+    unset($msg['currency']);
+  }
   $data = array();
   foreach ($schemata[$table]['fields'] as $field => $definition) {
     if (!array_key_exists($field, $msg)) {
diff --git a/sites/all/modules/queue2civicrm/tests/data/payments-init.json 
b/sites/all/modules/queue2civicrm/tests/data/payments-init.json
index d586a02..4f2a10d 100644
--- a/sites/all/modules/queue2civicrm/tests/data/payments-init.json
+++ b/sites/all/modules/queue2civicrm/tests/data/payments-init.json
@@ -1,5 +1,4 @@
 {
-       "php-message-class": 
"SmashPig\\CrmLink\\Messages\\DonationInterfaceFinalStatus",
        "contribution_tracking_id": "12345",
        "gateway": "testgateway",
        "order_id": "",
@@ -10,7 +9,7 @@
        "payment_submethod": "",
        "country": "IT",
        "amount": "2.00",
-       "currency_code": "EUR",
+       "currency": "EUR",
        "server": "testpayments1002",
        "date": "1445990999"
 }
diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
index 6e2e3f5..0bbd9c1 100644
--- a/sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
@@ -74,11 +74,12 @@
                $fields = array(
                        'gateway',  'gateway_txn_id', 'validation_action',
                        'payments_final_status', 'payment_method', 
'payment_submethod',
-                       'country', 'amount', 'currency_code', 'server'
+                       'country', 'amount', 'server'
                );
                foreach ( $fields as $field ) {
                        $this->assertEquals( $message[$field], 
$dbEntries[0][$field] );
                }
+               $this->assertEquals( $message['currency'], 
$dbEntries[0]['currency_code'] );
                $this->assertEquals(
                        $message['date'], wmf_common_date_civicrm_to_unix( 
$dbEntries[0]['date'] )
                );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ica71016fb92e50feb91daa5d4875241b1b885f7e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to