r59819 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59818‎ | r59819 | r59820 >
Date:02:32, 8 December 2009
Author:tomasz
Status:ok
Tags:
Comment:
re-enabling tracking. adding abondmonment based on numattempt=1. fixing lots of odd spacing.
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -46,7 +46,7 @@
4747 );
4848
4949
50 - $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
 50+ $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
5151
5252 // create token if one doesn't already exist
5353 $token = $wgUser->editToken( 'mrxc877668DwQQ' );
@@ -175,6 +175,14 @@
176176
177177 global $wgOut, $wgLang;
178178
 179+ // save contrib tracking id early to track abondonment
 180+ if ( $data[ 'numAttempt' ] == 0 ) {
 181+ if ( !$tracked = $this->fnPayflowSaveContributionTracking( $data ) ) {
 182+ $when = time();
 183+ wfDebugLog( 'payflowpro_gateway', 'Unable to save data to the contribution_tracking table ' . $when );
 184+ }
 185+ }
 186+
179187 // create drop down of countries
180188 $countries = countryCodes();
181189
@@ -231,22 +239,22 @@
232240
233241 $currencyMenu = '';
234242
235 - foreach( $currencies as $value => $fullName ) {
236 - $currencyMenu .= Xml::option( $fullName, $value );
237 - }
 243+ foreach( $currencies as $value => $fullName ) {
 244+ $currencyMenu .= Xml::option( $fullName, $value );
 245+ }
238246
239 - // Build currency options
240 - $default_currency = $data['currency'];
 247+ // Build currency options
 248+ $default_currency = $data['currency'];
241249
242 - $currency_options = '';
 250+ $currency_options = '';
243251
244 - foreach ( $currencies as $code => $name ) {
245 - $selected = '';
246 - if ( $code == $default_currency ) {
247 - $selected = ' selected="selected"';
248 - }
249 - $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>';
250 - }
 252+ foreach ( $currencies as $code => $name ) {
 253+ $selected = '';
 254+ if ( $code == $default_currency ) {
 255+ $selected = ' selected="selected"';
 256+ }
 257+ $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>';
 258+ }
251259
252260 // intro text
253261 $form = Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ) .
@@ -270,9 +278,9 @@
271279 Xml::label( wfMsg( 'payflowpro_gateway-donor-currency-label' ), 'currency_code' ) .
272280 $endCell .
273281 Xml::openElement( 'select', array( 'name' => 'currency_code', 'id' => "input_currency_code" )) .
274 - $currency_options .
275 - Xml::closeElement( 'select' ) .
276 - $endRow .
 282+ $currency_options .
 283+ Xml::closeElement( 'select' ) .
 284+ $endRow .
277285 Xml::label( wfMsg( 'payflowpro_gateway-donor-email' ), 'emailAdd' ) .
278286 $endCell .
279287 Xml::input( 'emailAdd', '30', $data['email'], array( 'maxlength' => '64', 'id' => 'emailAdd' ) ) .
@@ -663,6 +671,7 @@
664672 $errorCode = $this->fnPayflowGetResponseMsg( $resultCode, $responseMsg );
665673
666674 // if approved, display results and send transaction to the queue
 675+
667676 if( $errorCode == '1' ) {
668677 $this->fnPayflowDisplayApprovedResults( $data, $responseArray, $responseMsg );
669678 // give user a second chance to enter incorrect data
@@ -698,7 +707,7 @@
699708 $errorCode = '1';
700709 break;
701710 case '126':
702 - $responseMsg = wfMsg( 'payflowpro_gateway-response-126' );
 711+ $responseMsg = wfMsg( 'payflowpro_gateway-response-126-2' );
703712 $errorCode = '5';
704713 break;
705714 case '12':
@@ -730,7 +739,7 @@
731740 $errorCode = '3';
732741 break;
733742 case '125':
734 - $responseMsg = wfMsg( 'payflowpro_gateway-response-125' );
 743+ $responseMsg = wfMsg( 'payflowpro_gateway-response-125-2' );
735744 $errorCode = '3';
736745 break;
737746 default:
@@ -754,13 +763,6 @@
755764
756765 require_once( 'includes/countryCodes.inc' );
757766
758 - //save data to the contribution tracking database
759 - if ( !$tracked = $this->fnPayflowSaveContributionTracking( $data ) ) {
760 - $when = time();
761 - wfDebugLog( 'payflowpro_gateway', 'Unable to save data to the contribution_tracking table ' . $when );
762 - }
763 -
764 -
765767 // display response message
766768 $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' );
767769
@@ -826,23 +828,26 @@
827829 // display response message
828830 $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . $responseMsg . '</h3>' );
829831 }
830 -
831832 function fnPayflowDisplayPending( $responseMsg ) {
832833 global $wgOut;
833834
 835+ $thankyou = wfMsg( 'payflowpro_gateway-thankyou' );
 836+
834837 // display response message
835 - $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' );
 838+ $wgOut->addHTML( '<h2 class="response_message">' . $thankyou . '</h2>' );
 839+ $wgOut->addHTML( '<p>' . $responseMsg );
 840+
836841 }
837842
838843 function fnPayflowSaveContributionTracking( &$data ) {
839 - $data['optout'] = ($data['optout'] == "1") ? '0' : '1';
840 - $data['anonymous'] = ($data['anonymous'] == "1") ? '0' : '1';
 844+ $data['optout'] = ($data['optout'] == "1") ? '0' : '1';
 845+ $data['anonymous'] = ($data['anonymous'] == "1") ? '0' : '1';
841846
842 - $db = payflowGatewayConnection();
 847+ $db = payflowGatewayConnection();
843848
844 - if (!$db) { return true ; }
 849+ if (!$db) { return true ; }
845850
846 - $ts = $db->timestamp();
 851+ $ts = $db->timestamp();
847852
848853 $tracked_contribution = array(
849854 'note' => $data['comment'],
@@ -865,7 +870,7 @@
866871
867872 // Store the contribution data
868873 if ($db->insert( 'contribution_tracking', $tracked_contribution ) ) {
869 - // $data['contribution_tracking_id'] = $db->insertId();
 874+ $data['contribution_tracking_id'] = $db->insertId();
870875 return true;
871876 } else { return false; }
872877

Status & tagging log