Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -1046,7 +1046,9 @@ |
1047 | 1047 | public function do_transaction( $transaction ){ |
1048 | 1048 | switch ( $transaction ){ |
1049 | 1049 | case 'Confirm_CreditCard' : |
1050 | | - return $this->transactionConfirm_CreditCard(); |
| 1050 | + $this->getStopwatch( __FUNCTION__, true ); |
| 1051 | + $result = $this->transactionConfirm_CreditCard(); |
| 1052 | + $this->saveCommunicationStats( __FUNCTION__, $transaction ); |
1051 | 1053 | break; |
1052 | 1054 | default: |
1053 | 1055 | return parent::do_transaction( $transaction ); |
— | — | @@ -1195,21 +1197,10 @@ |
1196 | 1198 | } |
1197 | 1199 | |
1198 | 1200 | if ( $deletelimbomessageflag ) { |
1199 | | - //ack the message out of the limbo queue. |
1200 | | - |
1201 | | - //TODO: Test this in a batch situation. I have reason to suspect that the selectors won't work if the stomp connection isn't being reset properly. |
1202 | | - $limbo_messages = stompFetchMessages( 'limbo', "JMSCorrelationID = '" . $this->getCorrelationID() . "'" ); |
1203 | | - $msgCount = count($limbo_messages); |
1204 | | - if ($msgCount){ |
1205 | | - stompAckMessages($limbo_messages); |
1206 | | - if ($msgCount > 1){ |
1207 | | - self::log($this->getData_Raw( 'contribution_tracking_id' ) . ':' . $this->getData_Raw( 'order_id' ) . " - Deleted $msgCount limbo messages."); |
1208 | | - } |
1209 | | - } else { |
1210 | | - self::log($this->getData_Raw( 'contribution_tracking_id' ) . ':' . $this->getData_Raw( 'order_id' ) . " - No limbo messages found."); |
1211 | | - } |
1212 | | - |
1213 | | - closeDIStompConnection(); |
| 1201 | + //As it happens, we can't remove things from the queue here: It |
| 1202 | + //takes way too dang long. (~5 seconds!) |
| 1203 | + //So, instead, I'll add an anti-message and deal with it later. (~.01 seconds) |
| 1204 | + $this->doLimboStompTransaction( true ); |
1214 | 1205 | } |
1215 | 1206 | |
1216 | 1207 | if ( $problemflag ){ |
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -832,14 +832,14 @@ |
833 | 833 | |
834 | 834 | // If the payment processor requires XML, package our data into XML. |
835 | 835 | if ( $this->getCommunicationType() === 'xml' ) { |
836 | | - $this->getStopwatch( "buildRequestXML" ); // begin profiling |
| 836 | + $this->getStopwatch( "buildRequestXML", true ); // begin profiling |
837 | 837 | $curlme = $this->buildRequestXML(); // build the XML |
838 | 838 | $this->saveCommunicationStats( "buildRequestXML", $transaction ); // save profiling data |
839 | 839 | } |
840 | 840 | |
841 | 841 | // If the payment processor requires name/value pairs, package our data into name/value pairs. |
842 | 842 | if ( $this->getCommunicationType() === 'namevalue' ) { |
843 | | - $this->getStopwatch( "buildRequestNameValueString" ); // begin profiling |
| 843 | + $this->getStopwatch( "buildRequestNameValueString", true ); // begin profiling |
844 | 844 | $curlme = $this->buildRequestNameValueString(); // build the name/value pairs |
845 | 845 | $this->saveCommunicationStats( "buildRequestNameValueString", $transaction ); // save profiling data |
846 | 846 | } |
— | — | @@ -1283,11 +1283,15 @@ |
1284 | 1284 | |
1285 | 1285 | /** |
1286 | 1286 | * |
1287 | | - * @param type $function |
1288 | | - * @param type $additional |
1289 | | - * @param type $vars |
| 1287 | + * @param string $function This is the function name that identifies the |
| 1288 | + * stopwatch that should have already been started with the getStopwatch |
| 1289 | + * function. |
| 1290 | + * @param string $additional Additional information about the thing we're |
| 1291 | + * currently timing. Meant to be easily searchable. |
| 1292 | + * @param string $vars Intended to be particular values of any variables |
| 1293 | + * that might be of interest. |
1290 | 1294 | */ |
1291 | | - function saveCommunicationStats( $function = '', $additional = '', $vars = '' ) { |
| 1295 | + public function saveCommunicationStats( $function = '', $additional = '', $vars = '' ) { |
1292 | 1296 | static $saveStats = null; |
1293 | 1297 | static $saveDB = null; |
1294 | 1298 | |
— | — | @@ -1521,7 +1525,7 @@ |
1522 | 1526 | * TODO: Functionalize some of the code copied from doStompTransaction. |
1523 | 1527 | * @return null |
1524 | 1528 | */ |
1525 | | - protected function doLimboStompTransaction() { |
| 1529 | + protected function doLimboStompTransaction( $antimessage = false ) { |
1526 | 1530 | if ( !$this->getGlobal( 'EnableStomp' ) ){ |
1527 | 1531 | return; |
1528 | 1532 | } |
— | — | @@ -1530,26 +1534,40 @@ |
1531 | 1535 | |
1532 | 1536 | $stomp_fields = $this->dataObj->getStompMessageFields(); |
1533 | 1537 | |
1534 | | - $transaction = array( |
1535 | | - 'response' => $this->getTransactionMessage(), |
1536 | | - 'date' => time(), |
1537 | | - 'gateway_txn_id' => $this->getTransactionGatewayTxnID(), |
1538 | | - 'correlation-id' => $this->getCorrelationID(), |
1539 | | - 'payment_method' => $this->getData_Raw( 'payment_method' ) |
1540 | | - ); |
1541 | | - |
1542 | | - $raw_data = array(); |
1543 | | - foreach ( $stomp_fields as $field ){ |
1544 | | - $raw_data[$field] = $this->getData_Raw( $field ); |
| 1538 | + if ($antimessage){ |
| 1539 | + $transaction = array( |
| 1540 | + 'date' => time(), |
| 1541 | + 'gateway_txn_id' => $this->getTransactionGatewayTxnID(), |
| 1542 | + 'correlation-id' => $this->getCorrelationID(), |
| 1543 | + 'payment_method' => $this->getData_Raw( 'payment_method' ), |
| 1544 | + 'antimessage' => 'true' |
| 1545 | + ); |
| 1546 | + } else { |
| 1547 | + $transaction = array( |
| 1548 | + 'response' => $this->getTransactionMessage(), |
| 1549 | + 'date' => time(), |
| 1550 | + 'gateway_txn_id' => $this->getTransactionGatewayTxnID(), |
| 1551 | + 'correlation-id' => $this->getCorrelationID(), |
| 1552 | + 'payment_method' => $this->getData_Raw( 'payment_method' ), |
| 1553 | + ); |
| 1554 | + |
| 1555 | + $raw_data = array(); |
| 1556 | + foreach ( $stomp_fields as $field ){ |
| 1557 | + $raw_data[$field] = $this->getData_Raw( $field ); |
| 1558 | + } |
| 1559 | + $transaction = array_merge( $raw_data, $transaction ); |
1545 | 1560 | } |
1546 | | - |
1547 | | - $transaction = array_merge( $raw_data, $transaction ); |
1548 | 1561 | |
1549 | 1562 | try { |
1550 | 1563 | wfRunHooks( $hook, array( $transaction ) ); |
1551 | 1564 | } catch ( Exception $e ) { |
1552 | 1565 | self::log( "STOMP ERROR. Could not add message. " . $e->getMessage() , LOG_CRIT ); |
1553 | 1566 | } |
| 1567 | + if ($antimessage){ |
| 1568 | + $antimessage = "Anti-message = true"; |
| 1569 | + } else { |
| 1570 | + $antimessage = ''; |
| 1571 | + } |
1554 | 1572 | } |
1555 | 1573 | |
1556 | 1574 | protected function getCorrelationID(){ |
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -1017,6 +1017,8 @@ |
1018 | 1018 | 'zip2', |
1019 | 1019 | 'gateway', |
1020 | 1020 | 'gateway_txn_id', |
| 1021 | + 'payment_method', |
| 1022 | + 'payment_submethod', |
1021 | 1023 | 'response', |
1022 | 1024 | 'currency_code', |
1023 | 1025 | 'amount', |
Index: trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php |
— | — | @@ -135,19 +135,24 @@ |
136 | 136 | // include a library |
137 | 137 | require_once( "Stomp.php" ); |
138 | 138 | |
139 | | - $message = json_encode( createQueueMessage( $transaction ) ); |
| 139 | + $properties = array( |
| 140 | + 'persistent' => 'true', |
| 141 | + 'correlation-id' => $transaction['correlation-id'], |
| 142 | + 'payment_method' => $transaction['payment_method'] |
| 143 | + ); |
| 144 | + |
| 145 | + if ( array_key_exists( 'antimessage', $transaction ) ) { |
| 146 | + $message = ''; |
| 147 | + $properties['antimessage'] = 'true'; |
| 148 | + } else { |
| 149 | + $message = json_encode( createQueueMessage( $transaction ) ); |
| 150 | + } |
140 | 151 | |
141 | 152 | // make a connection |
142 | 153 | $con = new Stomp( $wgStompServer ); |
143 | 154 | |
144 | 155 | // connect |
145 | 156 | $con->connect(); |
146 | | - |
147 | | - $properties = array( |
148 | | - 'persistent' => 'true', |
149 | | - 'correlation-id' => $transaction['correlation-id'], |
150 | | - 'payment_method' => $transaction['payment_method'] |
151 | | - ); |
152 | 157 | |
153 | 158 | // send a message to the queue |
154 | 159 | $result = $con->send( "/queue/$queueName", $message, $properties ); |
— | — | @@ -212,6 +217,8 @@ |
213 | 218 | 'postal_code_2' => $transaction['zip2'], |
214 | 219 | 'gateway' => $transaction['gateway'], |
215 | 220 | 'gateway_txn_id' => $transaction['gateway_txn_id'], |
| 221 | + 'payment_method' => $transaction['payment_method'], |
| 222 | + 'payment_submethod' => $transaction['payment_submethod'], |
216 | 223 | 'response' => $transaction['response'], |
217 | 224 | 'currency' => $transaction['currency_code'], |
218 | 225 | 'original_currency' => $transaction['currency_code'], |