jenkins-bot has submitted this change and it was merged. Change subject: Revert "Revert "Mirror messages to new queues in GC audit"" ......................................................................
Revert "Revert "Mirror messages to new queues in GC audit"" double-backwards day! This reverts commit edc8ed49d1e241ceb8b954963308568dd6d63b51. Change-Id: I01fbc0ee4e785bf12213288a9067f839ee6da893 --- M sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc M sites/all/modules/globalcollect_audit/globalcollect_audit.module 2 files changed, 23 insertions(+), 7 deletions(-) Approvals: Ejegg: Looks good to me, approved jenkins-bot: Verified diff --git a/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc b/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc index a2e6947..f7e55c3 100644 --- a/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc +++ b/sites/all/modules/globalcollect_audit/globalcollect_audit.drush.inc @@ -7,6 +7,9 @@ * @TODO print some useful info to STDOUT */ +use SmashPig\Core\Context; +use SmashPig\Core\Configuration; + /** * Implementation of hook_drush_command() */ @@ -69,6 +72,9 @@ * TODO: More comments here-ish. */ function drush_globalcollect_audit() { + $config = Configuration::createForView( 'globalcollect' ); + Context::initWithLogger( $config, 'globalcollect_audit' ); + //$args = drush_get_arguments(); //if the last execution died before we got back here diff --git a/sites/all/modules/globalcollect_audit/globalcollect_audit.module b/sites/all/modules/globalcollect_audit/globalcollect_audit.module index 7e28d98..3e25a94 100644 --- a/sites/all/modules/globalcollect_audit/globalcollect_audit.module +++ b/sites/all/modules/globalcollect_audit/globalcollect_audit.module @@ -1,4 +1,6 @@ -<?php +<?php +use SmashPig\Core\Configuration; +use SmashPig\Core\ConfigurationKeyException; define( 'GC_AUDIT_WR1_PARSER_DIR', '/usr/local/src/Wr1Parser/' ); define( 'GC_AUDIT_WR1_FILES_DIR', '/usr/local/src/Wr1_files/' ); @@ -350,7 +352,7 @@ $local_found_ids[] = $order_id; globalcollect_audit_echo('!'); } else { - if ( globalcollect_audit_send_stomp( 'donations', $missing_txn_message ) ){ + if ( globalcollect_audit_send_queue_message( 'donations', $missing_txn_message ) ){ watchdog('globalcollect_audit', __FUNCTION__ . ': Message sent to stomp successfully: ' . print_r( $missing_txn_message, true ), array(), WATCHDOG_INFO); $local_found_ids[] = $order_id; globalcollect_audit_echo('!'); @@ -393,7 +395,7 @@ $local_built_ids[] = $order_id; globalcollect_audit_echo('!'); } else { - if ( globalcollect_audit_send_stomp( 'donations', $missing_txn_message ) ){ + if ( globalcollect_audit_send_queue_message( 'donations', $missing_txn_message ) ){ watchdog('globalcollect_audit', __FUNCTION__ . ': Message sent to stomp successfully: ' . print_r( $missing_txn_message, true ), array(), WATCHDOG_INFO); $local_built_ids[] = $order_id; globalcollect_audit_echo('!'); @@ -650,8 +652,6 @@ 'optout' => array( 'contribution_tracking', 'optout' ), 'anonymous' => array( 'contribution_tracking', 'anonymous' ), 'comment' => array( 'contribution_tracking', 'note' ), //I think. - 'size', - 'premium_language', 'utm_source' => array( 'contribution_tracking', 'utm_source' ), 'utm_medium' => array( 'contribution_tracking', 'utm_medium' ), 'utm_campaign' => array( 'contribution_tracking', 'utm_campaign' ), @@ -667,6 +667,7 @@ 'country' => array( 'donor_data', 'COUNTRYCODE' ), 'postal_code' => array( 'donor_data', 'ZIP' ), 'gateway_txn_id' => array( 'donor_data', 'ORDERID' ), + 'order_id' => array( 'donor_data', 'ORDERID' ), //fixme: should be merchant reference 'response', //? Maybe some dummy value for "found it in the audit phase" 'currency' => array( 'donor_data', 'CURRENCYCODE' ), 'date' => array( 'contribution_tracking', 'ts' ), //double-check how the dates work @@ -1046,7 +1047,7 @@ 'type' => wr1_get_negative_type( $wr1 ), //refund or chargeback ); echo print_r( $send_message, true ); - globalcollect_audit_send_stomp( 'refund', $send_message ); + globalcollect_audit_send_queue_message( 'refund', $send_message ); $count += 1; globalcollect_audit_echo( '.' ); unset( $missing[$index] ); //only unset if we killed it @@ -2007,7 +2008,7 @@ } } -function globalcollect_audit_send_stomp( $queueId, $body ) { +function globalcollect_audit_send_queue_message( $queueId, $body ) { static $q; if ( !$q ) { @@ -2017,15 +2018,24 @@ // FIXME: register the queue mapping somewhere sane if ( $queueId === 'donations' ) { $queuePath = variable_get( 'queue2civicrm_subscription', '/queue/donations' ); + $configKey = 'data-store/verified-new'; } elseif ( $queueId === 'refund' ) { $queuePath = variable_get( 'refund_queue', '/queue/refund' ); + $configKey = 'data-store/refund-new'; } else { throw new Exception( "What kind of a queue is this??: {$queueId}" ); } $headers = array(); wmf_common_set_message_source( $headers, 'audit', 'GlobalCollect WR1 Auditor' ); + wmf_common_set_message_source( $body, 'audit', 'GlobalCollect WR1 Auditor' ); + try { + $newQueue = Configuration::getDefaultConfig()->object( $configKey, true ); + $newQueue->push( $body ); + } catch ( ConfigurationKeyException $ex ) { + // do nothing + } return $q->enqueue( json_encode( $body ), $headers, $queuePath ); } -- To view, visit https://gerrit.wikimedia.org/r/313533 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I01fbc0ee4e785bf12213288a9067f839ee6da893 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: deployment Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits