http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97780
Revision: 97780
Author: khorn
Date: 2011-09-22 02:02:46 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Card #282, and a significant redefinition of what it means to stage gateway
data (we get to do it backwards now! Yes!)
Modified Paths:
--------------
branches/fundraising/extensions/DonationInterface/activemq_stomp/Stomp.php
branches/fundraising/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
branches/fundraising/extensions/DonationInterface/donationinterface.php
branches/fundraising/extensions/DonationInterface/gateway_common/DonationData.php
branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php
branches/fundraising/extensions/DonationInterface/gateway_forms/Form.php
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
Modified:
branches/fundraising/extensions/DonationInterface/activemq_stomp/Stomp.php
===================================================================
--- branches/fundraising/extensions/DonationInterface/activemq_stomp/Stomp.php
2011-09-22 01:35:41 UTC (rev 97779)
+++ branches/fundraising/extensions/DonationInterface/activemq_stomp/Stomp.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -456,6 +456,8 @@
{
if ( $this->clientId != null ) {
$headers["client-id"] = $this->clientId;
+ } else {
+ $headers = array();
}
if ( is_resource( $this->_socket ) ) {
Modified:
branches/fundraising/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
===================================================================
---
branches/fundraising/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
2011-09-22 01:35:41 UTC (rev 97779)
+++
branches/fundraising/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -1,11 +1,12 @@
<?php
+
# Alert the user that this is not a valid entry point to MediaWiki if they try
to access the special pages file directly.
if ( !defined( 'MEDIAWIKI' ) ) {
- echo <<<EOT
+ echo <<<EOT
To install my extension, put the following line in LocalSettings.php:
require_once(
"\$IP/extensions/DonationInterface/activemq_stomp/activemq_stomp.php" );
EOT;
- exit( 1 );
+ exit( 1 );
}
$wgExtensionCredits['other'][] = array(
@@ -19,15 +20,15 @@
$dir = dirname( __FILE__ ) . '/';
$wgAutoloadClasses['activemq_stomp'] = $dir . 'activemq_stomp.php'; # Tell
MediaWiki to load the extension body.
-
// default variables that should be set in LocalSettings
$wgStompServer = "";
$wgHooks['ParserFirstCallInit'][] = 'efStompSetup';
/*
-* Create <donate /> tag to include landing page donation form
-*/
+ * Create <donate /> tag to include landing page donation form
+ */
+
function efStompSetup( &$parser ) {
// redundant and causes Fatal Error
// $parser->disableCache();
@@ -48,19 +49,20 @@
}
/**
-* Hook to get user provided and order data
-*
-*/
+ * Hook to get user provided and order data
+ *
+ */
$wgHooks['gwStomp'][] = 'sendSTOMP';
$wgHooks['gwPendingStomp'][] = 'sendPendingSTOMP';
/*
-* Hook to send transaction information to ActiveMQ server
-*/
+ * Hook to send transaction information to ActiveMQ server
+ */
+
function sendSTOMP( $transaction ) {
global $wgStompServer, $wgStompQueueName;
- $queueName = isset ( $wgStompQueueName ) ? $wgStompQueueName : 'test';
+ $queueName = isset( $wgStompQueueName ) ? $wgStompQueueName : 'test';
// include a library
require_once( "Stomp.php" );
@@ -77,7 +79,7 @@
$result = $con->send( "/queue/$queueName", $message, array(
'persistent' => 'true' ) );
if ( !$result ) {
- wfDebugLog( 'activemq_stomp', 'Send to Q failed for
this message: ' . $message );
+ wfDebugLog( 'activemq_stomp', 'Send to Q failed for this
message: ' . $message );
}
$con->disconnect();
@@ -86,12 +88,13 @@
}
/*
-* Hook to send transaction information to ActiveMQ server
-*/
+ * Hook to send transaction information to ActiveMQ server
+ */
+
function sendPendingSTOMP( $transaction ) {
global $wgStompServer, $wgPendingStompQueueName;
- $queueName = isset ( $wgPendingStompQueueName ) ?
$wgPendingStompQueueName : 'pending';
+ $queueName = isset( $wgPendingStompQueueName ) ?
$wgPendingStompQueueName : 'pending';
// include a library
require_once( "Stomp.php" );
@@ -108,7 +111,7 @@
$result = $con->send( "/queue/$queueName", $message, array(
'persistent' => 'true' ) );
if ( !$result ) {
- wfDebugLog( 'activemq_stomp', 'Send to Pending Q failed
for this message: ' . $message );
+ wfDebugLog( 'activemq_stomp', 'Send to Pending Q failed for
this message: ' . $message );
}
$con->disconnect();
@@ -134,44 +137,44 @@
// edit this array to include/ignore transaction data sent to the server
$message = array(
'contribution_tracking_id' =>
$transaction['contribution_tracking_id'],
- 'optout' => $transaction['optout'],
- 'anonymous' => $transaction['anonymous'],
- 'comment' => $transaction['comment'],
- 'size' => $transaction['size'],
- 'premium_language' => $transaction['premium_language'],
- 'utm_source' => $transaction['utm_source'],
- 'utm_medium' => $transaction['utm_medium'],
- 'utm_campaign' => $transaction['utm_campaign'],
- 'language' => $transaction['language'],
- 'referrer' => $transaction['referrer'],
- 'email' => $transaction['email'],
- 'first_name' => $transaction['fname'],
- 'middle_name' => $transaction['mname'],
- 'last_name' => $transaction['lname'],
- 'street_address' => $transaction['street'],
+ 'optout' => $transaction['optout'],
+ 'anonymous' => $transaction['anonymous'],
+ 'comment' => $transaction['comment'],
+ 'size' => $transaction['size'],
+ 'premium_language' => $transaction['premium_language'],
+ 'utm_source' => $transaction['utm_source'],
+ 'utm_medium' => $transaction['utm_medium'],
+ 'utm_campaign' => $transaction['utm_campaign'],
+ 'language' => $transaction['language'],
+ 'referrer' => $transaction['referrer'],
+ 'email' => $transaction['email'],
+ 'first_name' => $transaction['fname'],
+ 'middle_name' => $transaction['mname'],
+ 'last_name' => $transaction['lname'],
+ 'street_address' => $transaction['street'],
'supplemental_address_1' => '',
- 'city' => $transaction['city'],
- 'state_province' => $transaction['state'],
- 'country' => $transaction['country'],
- 'postal_code' => $transaction['zip'],
- 'first_name_2' => $transaction['fname2'],
- 'last_name_2' => $transaction['lname2'],
- 'street_address_2' => $transaction['street2'],
+ 'city' => $transaction['city'],
+ 'state_province' => $transaction['state'],
+ 'country' => $transaction['country'],
+ 'postal_code' => $transaction['zip'],
+ 'first_name_2' => $transaction['fname2'],
+ 'last_name_2' => $transaction['lname2'],
+ 'street_address_2' => $transaction['street2'],
'supplemental_address_2' => '',
- 'city_2' => $transaction['city2'],
- 'state_province_2' => $transaction['state2'],
- 'country_2' => $transaction['country2'],
- 'postal_code_2' => $transaction['zip'],
- 'gateway' => $transaction[ 'gateway' ],
- 'gateway_txn_id' => $transaction['PNREF'],
- 'response' => $transaction['RESPMSG'],
- 'currency' => $transaction['currency'],
- 'original_currency' => $transaction['currency'],
- 'original_gross' => $transaction['amount'],
- 'fee' => '0',
- 'gross' => $transaction['amount'],
- 'net' => $transaction['amount'],
- 'date' => $transaction['date'],
+ 'city_2' => $transaction['city2'],
+ 'state_province_2' => $transaction['state2'],
+ 'country_2' => $transaction['country2'],
+ 'postal_code_2' => $transaction['zip2'],
+ 'gateway' => $transaction['gateway'],
+ 'gateway_txn_id' => $transaction['order_id'], //pretty sure.
+ 'response' => $transaction['response'],
+ 'currency' => $transaction['currency'],
+ 'original_currency' => $transaction['currency'],
+ 'original_gross' => $transaction['amount'],
+ 'fee' => '0',
+ 'gross' => $transaction['amount'],
+ 'net' => $transaction['amount'],
+ 'date' => $transaction['date'],
);
return $message;
Modified:
branches/fundraising/extensions/DonationInterface/donationinterface.php
===================================================================
--- branches/fundraising/extensions/DonationInterface/donationinterface.php
2011-09-22 01:35:41 UTC (rev 97779)
+++ branches/fundraising/extensions/DonationInterface/donationinterface.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -21,6 +21,7 @@
$donationinterface_dir = dirname( __FILE__ ) . '/';
require_once( $donationinterface_dir . 'donate_interface/donate_interface.php'
);
+require_once( $donationinterface_dir . 'activemq_stomp/activemq_stomp.php' );
/**
Modified:
branches/fundraising/extensions/DonationInterface/gateway_common/DonationData.php
===================================================================
---
branches/fundraising/extensions/DonationInterface/gateway_common/DonationData.php
2011-09-22 01:35:41 UTC (rev 97779)
+++
branches/fundraising/extensions/DonationInterface/gateway_common/DonationData.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -29,13 +29,8 @@
}
$this->doCacheStuff();
+ $this->normalizeAndSanitize();
- if ( !empty( $this->normalized ) ) {
- $this->setNormalizedAmount();
- $this->setNormalizedOrderIDs();
- $this->setGateway();
- array_walk( $this->normalized, array( $this,
'sanitizeInput' ) );
- }
//TODO: determine if _nocache_ is still a thing anywhere.
if ( !empty( $this->normalized ) && ( $this->getVal(
'numAttempt' ) == '0' && ((!$this->getVal( 'utm_source_id' ) == false ) ||
$this->getVal( '_nocache_' ) == 'true' ) ) ) {
$this->saveContributionTracking();
@@ -209,6 +204,16 @@
}
}
+ function normalizeAndSanitize() {
+ if ( !empty( $this->normalized ) ) {
+ $this->setNormalizedAmount();
+ $this->setNormalizedOrderIDs();
+ $this->setGateway();
+ $this->setNormalizedOptOuts();
+ array_walk( $this->normalized, array( $this,
'sanitizeInput' ) );
+ }
+ }
+
function setNormalizedAmount() {
if ( !($this->isSomething( 'amount' )) || !(preg_match(
'/^\d+(\.(\d+)?)?$/', $this->getVal( 'amount' ) ) ) ) {
@@ -244,7 +249,6 @@
}
$this->setVal( 'order_id', $this->generateOrderId() );
-
if ( !$this->isSomething( 'i_order_id' ) ) {
$this->setVal( 'i_order_id', $this->generateOrderId() );
}
@@ -526,10 +530,14 @@
* are backwards (they are really opt-in) relative to
contribution_tracking
* (which is opt-out), we need to reverse the values
*/
- public function getOptOuts() {
+ function setNormalizedOptOuts() {
$optout['optout'] = ( $this->isSomething( 'email-opt' ) &&
$this->getVal( 'email-opt' ) == "1" ) ? '0' : '1';
$optout['anonymous'] = ( $this->isSomething( 'comment-option' )
&& $this->getVal( 'comment-option' ) == "1" ) ? '0' : '1';
- return $optout;
+ foreach ( $optout as $thing => $stuff ) {
+ $this->setVal( $thing, $stuff );
+ }
+ $this->expunge( 'email-opt' );
+ $this->expunge( 'comment-option' );
}
/**
@@ -540,7 +548,7 @@
* 'null' values.
* @param bool $clean_opouts
*/
- public function getCleanTrackingData( $clean_optouts = false ) {
+ public function getCleanTrackingData() {
// define valid tracking fields
$tracking_fields = array(
@@ -563,13 +571,6 @@
}
}
- // clean up the optout values if necessary
- if ( $clean_optouts ) {
- $optouts = $this->getOptOuts();
- $tracking_data['optout'] = $optouts['optout'];
- $tracking_data['anonymous'] = $optouts['anonymous'];
- }
-
return $tracking_data;
}
@@ -577,7 +578,7 @@
//so, basically, if this is the first attempt. This seems to get called
nowhere else.
function saveContributionTracking() {
- $tracked_contribution = $this->getCleanTrackingData( true );
+ $tracked_contribution = $this->getCleanTrackingData();
// insert tracking data and get the tracking id
$result = self::insertContributionTracking(
$tracked_contribution );
@@ -641,7 +642,7 @@
return true;
} ///wait, what? TODO: This line was straight copied from the
_gateway.body. Find out if there's a good reason we're not returning false here.
- $tracked_contribution = $this->getCleanTrackingData( true );
+ $tracked_contribution = $this->getCleanTrackingData();
// if contrib tracking id is not already set, we need to insert
the data, otherwise update
if ( !$this->getVal( 'contribution_tracking_id' ) ) {
@@ -673,6 +674,12 @@
}
}
+ public function populateDonorFromSession() {
+ if ( array_key_exists( 'Donor', $_SESSION ) ) {
+ $this->addData( $_SESSION['Donor'] );
+ }
+ }
+
/**
* TODO: Consider putting all the session data for a gateway under
something like
* $_SESSION[$gateway_identifier]
@@ -683,6 +690,17 @@
$this->unsetEditToken();
}
+ public function addData( $newdata ) {
+ if ( is_array( $newdata ) && !empty( $newdata ) ) {
+ foreach ( $newdata as $key => $val ) {
+ if ( !is_array( $val ) ) {
+ $this->setVal( $key, $val );
+ }
+ }
+ }
+ $this->normalizeAndSanitize();
+ }
+
}
?>
Modified:
branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php
===================================================================
---
branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php
2011-09-22 01:35:41 UTC (rev 97779)
+++
branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -35,9 +35,10 @@
function processResponse( $response );
/**
- * Anything we need to do to the data coming in, before we send it off.
+ * Should be a list of our variables that need special staging.
+ * Define $this->staged_vars
*/
- function stageData();
+ function defineStagedVars();
/**
* defineTransactions will define the $transactions array.
@@ -645,4 +646,84 @@
$this->dataObj->unsetAllDDSessionData();
}
+ function doStompTransaction( $responseArray, $responseMsg, $status,
$useSession = false ) {
+ $hook = '';
+ switch ( $status ) {
+ case 'complete':
+ $hook = 'gwStomp';
+ break;
+ case 'pending':
+ case 'pending-poke':
+ $hook = 'gwPendingStomp';
+ break;
+ }
+ if ( $hook === '' ) {
+ return;
+ }
+
+ foreach ( $responseArray as $key => $val ) {
+ if ( array_key_exists( $key, $this->var_map ) ) {
+ $responseArray[$this->var_map[$key]] = $val;
+ unset( $responseArray[$key] );
+ }
+ }
+
+ //Gah. I might want to move all this data prep business
upstream more than somewhat.
+ //...but that's for later.
+ // Add the session vars to the data object
+ if ( $useSession ) {
+ $this->dataObj->populateDonorFromSession();
+ }
+
+ // Add our response vars to the data object.
+ $this->dataObj->addData( $responseArray );
+
+ // refresh our data
+ $this->postdata = $this->dataObj->getData();
+
+ // stage the gateway data
+ $this->stageData( 'response' );
+
+ // send the thing.
+ $transaction = array(
+ 'response' => $responseMsg,
+ 'date' => time(),
+ );
+ $transaction += $this->getData();
+
+ self::log( "Intended STOMP transaction: " . print_r(
$transaction, true ) );
+
+ wfRunHooks( $hook, array( $transaction ) );
+ }
+
+ function smooshVarsForStaging() {
+
+ foreach ( $this->staged_vars as $field ) {
+ if ( !array_key_exists( $field, $this->postdata ) ||
empty( $this->postdata[$field] ) ) {
+ if ( array_key_exists( $field,
$this->postdatadefaults ) ) {
+ $this->postdata[$field] =
$this->postdatadefaults[$field];
+ }
+ }
+ //what do we do in the event that we're still nothing?
(just move on.)
+ }
+ }
+
+ /**
+ *
+ * @param type $type Whatever types of staging you feel like having in
your child class.
+ * ...but usually request and response. I think.
+ */
+ function stageData( $type = 'request' ) {
+ $this->defineStagedVars();
+ $this->smooshVarsForStaging(); //yup, we do need to do this
seperately.
+ //If we tried to piggyback off the same loop, all the vars
wouldn't be ready, and some staging functions will require
+ //multiple variables.
+ foreach ( $this->staged_vars as $field ) {
+ $function_name = 'stage_' . $field;
+ if ( method_exists( $this, $function_name ) ) {
+ $this->{$function_name}( $type );
+ }
+ }
+ }
+
}
Modified:
branches/fundraising/extensions/DonationInterface/gateway_forms/Form.php
===================================================================
--- branches/fundraising/extensions/DonationInterface/gateway_forms/Form.php
2011-09-22 01:35:41 UTC (rev 97779)
+++ branches/fundraising/extensions/DonationInterface/gateway_forms/Form.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -127,7 +127,8 @@
* @return array
*/
public function getCountries() {
- return PayflowProGateway::getCountries();
+ require_once( dirname( __FILE__ ) .
'/includes/countryCodes.inc' );
+ return countryCodes();
}
/**
Modified:
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
===================================================================
---
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
2011-09-22 01:35:41 UTC (rev 97779)
+++
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -6,48 +6,6 @@
const COMMUNICATION_TYPE = 'xml';
const GLOBAL_PREFIX = 'wgGlobalCollectGateway';
- /**
- * stageData should alter the postdata array in all ways necessary in
preparation for
- * communication with the gateway.
- */
- function stageData() {
- $this->postdata['amount'] = $this->postdata['amount'] * 100;
-
- $card_type = '';
- if ( array_key_exists( 'card_type', $this->postdata ) &&
!empty( $this->postdata['card_type'] ) ) {
- $card_type = $this->postdata['card_type'];
- } else {
- $card_type = $this->postdatadefaults['card_type'];
- }
-
- switch ( $card_type ) {
- case 'visa':
- $this->postdata['card_type'] = 1;
- break;
- case 'mastercard':
- $this->postdata['card_type'] = 3;
- break;
- case 'american':
- $this->postdata['card_type'] = 2;
- break;
- case 'discover':
- $this->postdata['card_type'] = 128;
- break;
- }
-
- $this->postdata['expiry'] = $this->postdata['expiration']; //.
($this->postdata['year'] % 100);
- $this->postdata['card_num'] = str_replace( ' ', '',
$this->postdata['card_num'] );
-
- $returnto = '';
- if ( array_key_exists( 'returnto', $this->postdata ) ) {
- $returnto = $this->postdata['returnto'];
- } else {
- $returnto = $this->postdatadefaults['returnto'];
- }
-
- $this->postdata['returnto'] = $returnto . "?order_id=" .
$this->postdata['order_id'];
- }
-
function defineAccountInfo() {
$this->accountInfo = array(
'MERCHANTID' => self::getGlobal( 'MerchantID' ),
@@ -68,7 +26,7 @@
'IPADDRESS' => 'user_ip', //TODO: Not sure if this
should be OUR ip, or the user's ip. Hurm.
'PAYMENTPRODUCTID' => 'card_type',
'CVV' => 'cvv',
- 'EXPIRYDATE' => 'expiry',
+ 'EXPIRYDATE' => 'expiration',
'CREDITCARDNUMBER' => 'card_num',
'FIRSTNAME' => 'fname',
'SURNAME' => 'lname',
@@ -273,4 +231,58 @@
//TODO: Stuff.
}
-}
+ function defineStagedVars() {
+ //OUR field names.
+ $this->staged_vars = array(
+ 'amount',
+ 'card_type',
+ 'card_num',
+ 'returnto',
+ 'order_id', //This may or may not oughta-be-here...
+ );
+ }
+
+ protected function stage_amount( $type = 'request' ) {
+ switch ( $type ) {
+ case 'request':
+ $this->postdata['amount'] =
$this->postdata['amount'] * 100;
+ break;
+ case 'response':
+ $this->postdata['amount'] =
$this->postdata['amount'] / 100;
+ break;
+ }
+ }
+
+ protected function stage_card_type( $type = 'request' ) {
+
+ $types = array(
+ 'visa' => '1',
+ 'mastercard' => '3',
+ 'american' => '2',
+ 'discover' => '128'
+ );
+
+ if ( $type === 'response' ) {
+ $types = array_flip( $types );
+ }
+
+ if ( array_key_exists( $this->postdata['card_type'], $types ) )
{
+ $this->postdata['card_type'] =
$types[$this->postdata['card_type']];
+ } else {
+ //$this->postdata['card_type'] = '';
+ //iono: maybe nothing?
+ }
+ }
+
+ protected function stage_card_num( $type = 'request' ) {
+ //I realize that the $type isn't used. Voodoo.
+ $this->postdata['card_num'] = str_replace( ' ', '',
$this->postdata['card_num'] );
+ }
+
+ protected function stage_returnto( $type = 'request' ) {
+ if ( $type === 'request' ) {
+ $this->postdata['returnto'] =
$this->postdata['returnto'] . "?order_id=" . $this->postdata['order_id'];
+ }
+ }
+
+}
\ No newline at end of file
Modified:
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
===================================================================
---
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
2011-09-22 01:35:41 UTC (rev 97779)
+++
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -103,11 +103,10 @@
if ( $this->adapter->checkTokens() ) {
if ( $this->adapter->posted && $data['payment_method']
== 'processed' ) {
// The form was submitted and the payment
method has been set
- $this->adapter->log("Form posted and payment
method set.");
+ $this->adapter->log( "Form posted and payment
method set." );
// increase the count of attempts
//++$data['numAttempt'];
-
// Check form for errors
$form_errors = $this->fnPayflowValidateForm(
$data, $this->errors );
@@ -119,14 +118,13 @@
$result =
$this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
$this->adapter->addDonorDataToSession();
//$result =
$this->adapter->do_transaction( 'TEST_CONNECTION' );
-
- $this->displayResultsForDebug($result);
+ $this->displayResultsForDebug( $result
);
+
if ( !empty( $result['data'] ) ) {
-
- if
(array_key_exists('FORMACTION', $result['data'])){
- $paymentFrame =
Xml::openElement( 'iframe',
- array(
+
+ if ( array_key_exists(
'FORMACTION', $result['data'] ) ) {
+ $paymentFrame =
Xml::openElement( 'iframe', array(
'id' =>
'globalcollectframe',
'name'
=> 'globalcollectframe',
'width'
=> '680',
@@ -134,12 +132,11 @@
'frameborder' => '0',
'style'
=> 'display:block;',
'src'
=> $result['data']['FORMACTION']
- )
+ )
);
$paymentFrame .=
Xml::closeElement( 'iframe' );
$wgOut->addHTML(
$paymentFrame );
-
}
}
@@ -183,11 +180,10 @@
} else {
// Display form for the first time
$oid = $wgRequest->getText( 'order_id' );
- if ($oid && !empty($oid)){
- $wgOut->addHTML("<pre>CAME BACK FROM
SOMETHING.</pre>");
+ if ( $oid && !empty( $oid ) ) {
+ $wgOut->addHTML( "<pre>CAME BACK FROM
SOMETHING.</pre>" );
$result =
$this->adapter->do_transaction( 'GET_ORDERSTATUS' );
- $this->displayResultsForDebug($result);
-
+ $this->displayResultsForDebug( $result
);
}
$this->adapter->log( "Not posted, or not
processed. Showing the form for the first time." );
$this->fnPayflowDisplayForm( $data,
$this->errors );
@@ -200,11 +196,11 @@
$this->fnPayflowDisplayForm( $data, $this->errors );
}
}
-
- function displayResultsForDebug($results){
+
+ function displayResultsForDebug( $results ) {
global $wgOut;
$wgOut->addHTML( $results['message'] );
-
+
if ( !empty( $results['errors'] ) ) {
$wgOut->addHTML( "<ul>" );
foreach ( $results['errors'] as $code => $value ) {
@@ -212,13 +208,13 @@
}
$wgOut->addHTML( "</ul>" );
}
-
+
if ( !empty( $results['data'] ) ) {
$wgOut->addHTML( "<ul>" );
foreach ( $results['data'] as $key => $value ) {
- if (is_array($value)){
+ if ( is_array( $value ) ) {
$wgOut->addHTML( "<li>$key:<ul>" );
- foreach ($value as $key2 => $val2){
+ foreach ( $value as $key2 => $val2 ) {
$wgOut->addHTML( "<li>$key2:
$val2" );
}
$wgOut->addHTML( "</ul>" );
@@ -228,16 +224,16 @@
}
$wgOut->addHTML( "</ul>" );
} else {
- $wgOut->addHTML("Empty Results");
+ $wgOut->addHTML( "Empty Results" );
}
- if (array_key_exists('Donor', $_SESSION)){
- $wgOut->addHTML("Session Donor Vars:<ul>");
- foreach ($_SESSION['Donor'] as $key=>$val){
+ if ( array_key_exists( 'Donor', $_SESSION ) ) {
+ $wgOut->addHTML( "Session Donor Vars:<ul>" );
+ foreach ( $_SESSION['Donor'] as $key => $val ) {
$wgOut->addHTML( "<li>$key: $val" );
}
- $wgOut->addHTML("</ul>");
+ $wgOut->addHTML( "</ul>" );
} else {
- $wgOut->addHTML("No Session Donor Vars:<ul>");
+ $wgOut->addHTML( "No Session Donor Vars:<ul>" );
}
}
@@ -509,8 +505,6 @@
* @return array
*/
public function prepareStompTransaction( $data, $responseArray,
$responseMsg ) {
- $countries = $this->getCountries();
-
$transaction = array( );
// include response message
Modified:
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
===================================================================
---
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
2011-09-22 01:35:41 UTC (rev 97779)
+++
branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
2011-09-22 02:02:46 UTC (rev 97780)
@@ -42,13 +42,13 @@
$wgPayFlowProGatewayCSSVersion;
$referrer = $wgRequest->getHeader( 'referer' );
-
+
global $wgServer;
//TODO: Whitelist! We only want to do this for servers we are
configured to like!
//I didn't do this already, because this may turn out to be
backwards anyway. It might be good to do the work in the iframe,
//and then pop out. Maybe. We're probably going to have to test
it a couple different ways, for user experience.
//However, we're _definitely_ going to need to pop out _before_
we redirect to the thank you or fail pages.
- if ( strpos( $referrer, $wgServer ) === false ) {
+ if ( strpos( $referrer, $wgServer ) === false ) {
$wgOut->allowClickjacking();
$wgOut->addModules( 'iframe.liberator' );
return;
@@ -96,8 +96,8 @@
$go =
$this->adapter->getFailPage();
break;
}
-
- //TODO: Save your user session data before you
get here...
+ $this->adapter->doStompTransaction(
$result['data'], $result['message'], $result['data']['WMF_STATUS'], true );
+
$this->adapter->unsetAllGatewaySessionData();
$wgOut->addHTML( "<br>Redirecting to page $go"
);
$wgOut->redirect( $go );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs