r60221 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60220‎ | r60221 | r60222 >
Date:23:49, 18 December 2009
Author:diana
Status:deferred
Tags:
Comment:
add pending queue transactions
Modified paths:
  • /trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js
@@ -53,7 +53,6 @@
5454 var cvv;
5555
5656 function PopupCVV() {
57 - payflowGatewayCVVExplain = 'ME ME Me';
5857 cvv = window.open("", 'cvvhelp','scrollbars=yes,resizable=yes,width=600,height=400,left=200,top=100');
5958 cvv.document.write( payflowproGatewayCVVExplain );
6059 cvv.focus();
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -580,10 +580,6 @@
581581
582582 $queryString = implode( '&', $query );
583583
584 - /* FOR TESTING: This is what the NV pair looks like, with string length included
585 - $payflow_query = "TRXTYPE=$payflow_data[trxtype]&TENDER=$payflow_data[tender]&USER=$payflow_data[user]&VENDOR=$payflow_data[vendor]&PARTNER=$payflow_data[partner]&PWD=$payflow_data[password]&ACCT=$data[card_num]&EXPDATE=$data[expiration]&AMT=$data[amount]&FIRSTNAME=$data[fname]&LASTNAME=$data[lname]&STREET=$data[street]&ZIP=$data[zip]&INVNUM=$payflow_data[order_id]&CVV2=$data[cvv]&CURRENCY=$data[currency]&VERBOSITY=$payflow_data[verbosity]&CUSTIP=$payflow_data[user_ip]";
586 - */
587 -
588584 $payflow_query = $queryString;
589585
590586 // assign header data necessary for the curl_setopt() function
@@ -692,7 +688,7 @@
693689 } elseif( ( $errorCode == '4' ) ) {
694690 $this->fnPayflowDisplayOtherResults( $responseMsg );
695691 } elseif( ( $errorCode == '5' ) ) {
696 - $this->fnPayflowDisplayPending( $responseMsg );
 692+ $this->fnPayflowDisplayPending( $data, $responseArray, $responseMsg );
697693 }
698694
699695 }// end display results
@@ -835,9 +831,26 @@
836832 // display response message
837833 $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . $responseMsg . '</h3>' );
838834 }
839 - function fnPayflowDisplayPending( $responseMsg ) {
 835+
 836+ function fnPayflowDisplayPending( $data, $responseArray, $responseMsg ) {
840837 global $wgOut;
 838+
 839+ $transaction = '';
841840
 841+ // push to ActiveMQ server
 842+ // include response message
 843+ $transaction['response'] = $responseMsg;
 844+ // include date
 845+ $transaction['date'] = time();
 846+ // send both the country as text and the three digit ISO code
 847+ $transaction['country_name'] = $countries[$data['country']];
 848+ $transaction['country_code'] = $data['country'];
 849+ // put all data into one array
 850+ $transaction += array_merge( $data, $responseArray );
 851+
 852+ // hook to call stomp functions
 853+ wfRunHooks( 'gwPendingStomp', array( &$transaction ) );
 854+
842855 $thankyou = wfMsg( 'payflowpro_gateway-thankyou' );
843856
844857 // display response message
Index: trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
@@ -61,6 +61,7 @@
6262 *
6363 */
6464 $wgHooks['gwStomp'][] = 'sendSTOMP';
 65+$wgHooks['gwPendingStomp'][] = 'sendPendingSTOMP';
6566
6667
6768 /*
@@ -95,6 +96,38 @@
9697 return true;
9798 }
9899
 100+/*
 101+* Hook to send transaction information to ActiveMQ server
 102+*/
 103+function sendPendingSTOMP($transaction) {
 104+ global $wgOut;
 105+ global $wgStompServer, $wgPendingStompQueueName;
 106+
 107+ $queueName = isset ( $wgStompQueueName ) ? $wgStompQueueName : 'pending';
 108+
 109+ // include a library
 110+ require_once("Stomp.php");
 111+
 112+ $message = json_encode(createQueueMessage($transaction));
 113+
 114+ // make a connection
 115+ $con = new Stomp($wgStompServer);
 116+
 117+ // connect
 118+ $con->connect();
 119+
 120+ // send a message to the queue
 121+ $result = $con->send("/queue/$queueName", $message, array('persistent' => 'true'));
 122+
 123+ if (!$result) {
 124+ wfDebugLog('activemq_stomp', 'Send to Pending Q failed for this message: ' . $message);
 125+}
 126+
 127+ $con->disconnect();
 128+
 129+ return true;
 130+}
 131+
99132 /**
100133 * Assign correct values to the array of data to be sent to the ActiveMQ server
101134 * TODO: include optout and comments option in the donation page

Status & tagging log