r60050 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60049‎ | r60050 | r60051 >
Date:22:47, 14 December 2009
Author:tomasz
Status:resolved (Comments)
Tags:
Comment:
Adding external thank you page. Removing duplicate optout setting. Increasing allowed amount of attempts. Adding 2009 heade.
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
@@ -259,6 +259,10 @@
260260 }
261261
262262 // intro text
 263+ if ( $wgWikipediForeverTheme ) {
 264+ $wgOut->addWikiText( '{{2009/Donate-header/' . $data[language] . '}}' );
 265+ }
 266+
263267 $form = Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ) .
264268 Xml::openElement( 'div', array( 'id' => 'mw-creditcard-intro' ) ) .
265269 Xml::tags( 'p', array( 'class' => 'mw-creditcard-intro-msg' ), wfMsg( 'payflowpro_gateway-form-message' ) ) .
@@ -678,7 +682,7 @@
679683 if( $errorCode == '1' ) {
680684 $this->fnPayflowDisplayApprovedResults( $data, $responseArray, $responseMsg );
681685 // give user a second chance to enter incorrect data
682 - } elseif( ( $errorCode == '3' ) && ( $data['numAttempt'] < '3' ) ) {
 686+ } elseif( ( $errorCode == '3' ) && ( $data['numAttempt'] < '5' ) ) {
683687 // pass responseMsg as an array key as required by displayForm
684688 $tryAgainResponse['retryMsg'] = $responseMsg;
685689 $this->fnPayflowDisplayForm( $data, $tryAgainResponse );
@@ -760,29 +764,12 @@
761765 * @param $responseMsg String: message supplied by getResults function
762766 */
763767 function fnPayflowDisplayApprovedResults( $data, $responseArray, $responseMsg ) {
764 - global $wgOut;
 768+ require_once( 'includes/countryCodes.inc' );
 769+
 770+ global $wgOut, $wgThankYouPage;
765771 $transaction = '';
766772 $tracked = '';
767773
768 - require_once( 'includes/countryCodes.inc' );
769 -
770 - // display response message
771 - $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' );
772 -
773 - // translate country code into text
774 - $countries = countryCodes();
775 -
776 - $rows = array(
777 - 'title' => array( wfMsg( 'payflowpro_gateway-post-transaction' ) ),
778 - 'amount' => array( wfMsg( 'payflowpro_gateway-donor-amount' ), $data['amount'] ),
779 - 'email' => array( wfMsg( 'payflowpro_gateway-donor-email' ), $data['email'] ),
780 - 'name' => array( wfMsg( 'payflowpro_gateway-donor-name' ), $data['fname'], $data['mname'], $data['lname'] ),
781 - 'address' => array( wfMsg( 'payflowpro_gateway-donor-address' ), $data['street'], $data['city'], $data['state'], $data['zip'], $countries[$data['country']] ),
782 - );
783 -
784 - // if we want to show the response
785 - $wgOut->addHTML( Xml::buildTable( $rows, array( 'class' => 'submitted-response' ) ) );
786 -
787774 // push to ActiveMQ server
788775 // include response message
789776 $transaction['response'] = $responseMsg;
@@ -794,12 +781,29 @@
795782 // put all data into one array
796783 $transaction += array_merge( $data, $responseArray );
797784
798 - //enable if we need this to get the Civi data to display correctly
799 - $transaction['optout'] = ($transaction['optout'] == "1") ? '0' : '1';
800 - $transaction['anonymous'] = ($transaction['anonymous'] == "1") ? '0' : '1';
801 -
802785 // hook to call stomp functions
803786 wfRunHooks( 'gwStomp', array( &$transaction ) );
 787+
 788+ if ( $wgExternalThankYou ) {
 789+ $wgOut->redirect( $wgThankYouPage . $data[language] );
 790+ } else {
 791+ // display response message
 792+ $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' );
 793+
 794+ // translate country code into text
 795+ $countries = countryCodes();
 796+
 797+ $rows = array(
 798+ 'title' => array( wfMsg( 'payflowpro_gateway-post-transaction' ) ),
 799+ 'amount' => array( wfMsg( 'payflowpro_gateway-donor-amount' ), $data['amount'] ),
 800+ 'email' => array( wfMsg( 'payflowpro_gateway-donor-email' ), $data['email'] ),
 801+ 'name' => array( wfMsg( 'payflowpro_gateway-donor-name' ), $data['fname'], $data['mname'], $data['lname'] ),
 802+ 'address' => array( wfMsg( 'payflowpro_gateway-donor-address' ), $data['street'], $data['city'], $data['state'], $data['zip'], $countries[$data['country']] ),
 803+ );
 804+
 805+ // if we want to show the response
 806+ $wgOut->addHTML( Xml::buildTable( $rows, array( 'class' => 'submitted-response' ) ) );
 807+ }
804808 }
805809
806810 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r60059Picking up r60048 - r60050tomasz02:13, 15 December 2009
r60444Cleanup r60050, use string 'language' instead of constant language.demon13:24, 28 December 2009

Comments

#Comment by Tim Starling (talk | contribs)   06:21, 21 December 2009

Should be $data['language'] not $data[language], in two places. PHP does have this bizarre feature where undefined constants are converted to string literals, following the Perl feature which apparently emulates shell script, but it is strongly discouraged in both languages due to the weird things that will happen if someone defines a constant called "language".

#Comment by 😂 (talk | contribs)   13:24, 28 December 2009

Fixed in r60444.

Status & tagging log