r98921 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98920‎ | r98921 | r98922 >
Date:21:05, 4 October 2011
Author:khorn
Status:ok
Tags:fundraising 
Comment:
Even more bug fixes and adjustments. The biggest one in this batch would be a new array key on the transaction types that would turn off the pre- and post-processing hooks for a transaction type. We need this because when we're doing something like checking a status, we certainly don't need to validate the donation first. But, depending on the gateway and out workflow, we may need to treat it as the end of a successful transaction and add a stomp message to the correct queue. r98498
Modified paths:
  • /branches/fundraising/extensions/DonationInterface/donationinterface.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/payflowpro_gateway/payflowpro.adapter.php (modified) (history)

Diff [purge]

Index: branches/fundraising/extensions/DonationInterface/donationinterface.php
@@ -78,6 +78,7 @@
7979 /**
8080 * Default Thank You and Fail pages for all of donationinterface - language will be calc'd and appended at runtime.
8181 */
 82+//$wgDonationInterfaceThankYouPage = 'https://wikimediafoundation.org/wiki/Thank_You';
8283 $wgDonationInterfaceThankYouPage = 'Donate-thanks';
8384 $wgDonationInterfaceFailPage = 'Donate-error';
8485
Index: branches/fundraising/extensions/DonationInterface/payflowpro_gateway/payflowpro.adapter.php
@@ -78,6 +78,8 @@
7979 'TENDER' => 'C',
8080 'VERBOSITY' => 'MEDIUM',
8181 ),
 82+ 'do_validation' => 'true',
 83+ 'do_processhooks' => 'true',
8284 );
8385 }
8486
Index: branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -95,11 +95,11 @@
9696 break;
9797
9898 case 'INSERT_ORDERWITHPAYMENT':
99 - $options['creditCard'] = true;
 99+ $options['creditCard'] = false;
100100 break;
101101
102102 default:
103 - $options['creditCard'] = true;
 103+ $options['creditCard'] = false;
104104 }
105105
106106 $form_errors = $this->validateForm( $data, $this->errors, $options );
Index: branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -155,6 +155,8 @@
156156 'HOSTEDINDICATOR' => '1',
157157 //'PAYMENTPRODUCTID' => '11',
158158 ),
 159+ 'do_validation' => 'true',
 160+ 'do_processhooks' => 'true',
159161 );
160162
161163 $this->transactions['TEST_CONNECTION'] = array(
Index: branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -158,9 +158,9 @@
159159 global $wgLang;
160160 $language = $wgLang->getCode();
161161 $page = self::getGlobal( "ThankYouPage" ) . "/$language";
162 - $returnTitle = Title::newFromText( $page );
163 - $returnto = $returnTitle->getFullURL();
164 - return $returnto;
 162+// $returnTitle = Title::newFromText( $page );
 163+// $returnto = $returnTitle->getFullURL();
 164+ return $page;
165165 }
166166
167167 function getFailPage() {
@@ -352,26 +352,27 @@
353353 );
354354 }
355355
356 - // expose a hook for external handling of trxns ready for processing
357 - wfRunHooks( 'GatewayProcess', array( &$this ) ); //don't think anybody is using this yet, but you could!
 356+ // expose a hook for external handling of trxns ready for processing
 357+ if (array_key_exists('do_processhooks', $this->transactions[$this->currentTransaction()]) &&
 358+ $this->transactions[$this->currentTransaction()]['do_processhooks'] === 'true'){
 359+ wfRunHooks( 'GatewayProcess', array( &$this ) ); //don't think anybody is using this yet, but you could!
 360+ }
358361
359362 $this->dataObj->updateContributionTracking( defined( 'OWA' ) );
360363 if ( $this->getCommunicationType() === 'xml' ) {
361364 $this->getStopwatch( "buildRequestXML" );
362 - $xml = $this->buildRequestXML();
 365+ $curlme = $this->buildRequestXML();
363366 $this->saveCommunicationStats( "buildRequestXML", $transaction );
364 - $txn_ok = $this->curl_transaction( $xml );
365 - //put the response in a universal form, and return it.
366367 }
367368
368369 if ( $this->getCommunicationType() === 'namevalue' ) {
369370 //buildRequestNameValueString()
370371 $this->getStopwatch( "buildRequestNameValueString" );
371 - $namevalstring = $this->buildRequestNameValueString();
 372+ $curlme = $this->buildRequestNameValueString();
372373 $this->saveCommunicationStats( "buildRequestNameValueString", $transaction );
373 - $txn_ok = $this->curl_transaction( $namevalstring );
374 - //put the response in a universal form, and return it.
375374 }
 375+
 376+ $txn_ok = $this->curl_transaction( $curlme );
376377
377378 if ( $txn_ok === false ) { //nothing to process, so we have to build it manually
378379 self::log( "Transaction Communication failed" . print_r( $this->getTransactionAllResults(), true ) );
@@ -400,7 +401,10 @@
401402 $this->setTransactionResult( $pulled_data, 'data' );
402403
403404 // expose a hook for any post processing
404 - wfRunHooks( 'GatewayPostProcess', array( &$this ) ); //conversion log (at least)
 405+ if (array_key_exists('do_processhooks', $this->transactions[$this->currentTransaction()]) &&
 406+ $this->transactions[$this->currentTransaction()]['do_processhooks'] === 'true'){
 407+ wfRunHooks( 'GatewayPostProcess', array( &$this ) ); //conversion log (at least)
 408+ }
405409
406410 $this->processResponse( $pulled_data );
407411 $this->dataObj->unsetEditToken();
@@ -967,30 +971,34 @@
968972 }
969973
970974 function runPreProcess() {
 975+ if (array_key_exists('do_validation', $this->transactions[$this->currentTransaction()]) &&
 976+ $this->transactions[$this->currentTransaction()]['do_validation'] === 'true'){
 977+ // allow any external validators to have their way with the data
 978+ self::log( $this->getData( 'order_id' ) . " Preparing to query MaxMind" );
 979+ wfRunHooks( 'GatewayValidate', array( &$this ) );
 980+ self::log( $this->getData( 'order_id' ) . ' Finished querying Maxmind' );
971981
972 - // allow any external validators to have their way with the data
973 - self::log( $this->getData( 'order_id' ) . " Preparing to query MaxMind" );
974 - wfRunHooks( 'GatewayValidate', array( &$this ) );
975 - self::log( $this->getData( 'order_id' ) . ' Finished querying Maxmind' );
 982+ // if the transaction was flagged for review
 983+ if ( $this->action == 'review' ) {
 984+ // expose a hook for external handling of trxns flagged for review
 985+ wfRunHooks( 'GatewayReview', array( &$this ) );
 986+ }
976987
977 - // if the transaction was flagged for review
978 - if ( $this->action == 'review' ) {
979 - // expose a hook for external handling of trxns flagged for review
980 - wfRunHooks( 'GatewayReview', array( &$this ) );
981 - }
 988+ // if the transaction was flagged to be 'challenged'
 989+ if ( $this->action == 'challenge' ) {
 990+ // expose a hook for external handling of trxns flagged for challenge (eg captcha)
 991+ wfRunHooks( 'GatewayChallenge', array( &$this ) );
 992+ }
982993
983 - // if the transaction was flagged to be 'challenged'
984 - if ( $this->action == 'challenge' ) {
985 - // expose a hook for external handling of trxns flagged for challenge (eg captcha)
986 - wfRunHooks( 'GatewayChallenge', array( &$this ) );
 994+ // if the transaction was flagged for rejection
 995+ if ( $this->action == 'reject' ) {
 996+ // expose a hook for external handling of trxns flagged for rejection
 997+ wfRunHooks( 'GatewayReject', array( &$this ) );
 998+ $this->dataObj->unsetEditToken();
 999+ }
 1000+ } else {
 1001+ $this->action = 'process';
9871002 }
988 -
989 - // if the transaction was flagged for rejection
990 - if ( $this->action == 'reject' ) {
991 - // expose a hook for external handling of trxns flagged for rejection
992 - wfRunHooks( 'GatewayReject', array( &$this ) );
993 - $this->dataObj->unsetEditToken();
994 - }
9951003 }
9961004
9971005 }
Index: branches/fundraising/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -234,7 +234,7 @@
235235
236236 if ( empty( $data['email'] ) ) {
237237
238 - $error['email'] = wfMsg( $gateway_identifier . '_gateway-error-email-empty' );
 238+ $error['email'] = wfMsg( $this->adapter->getIdentifier() . '_gateway-error-email-empty' );
239239
240240 $this->setValidateFormResult( false );
241241 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98498Rebuilding the payflowpro gateway and adapter, Part 2 of Several!...khorn01:45, 30 September 2011

Status & tagging log