r102685 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102684‎ | r102685 | r102686 >
Date:20:47, 10 November 2011
Author:jpostlethwaite
Status:ok (Comments)
Tags:fundraising 
Comment:
Implemented Online bank transfer BPAY in GlobalCollectGateway.
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -150,6 +150,16 @@
151151 }
152152
153153 }
 154+ elseif ( $payment_method == 'obt' ) {
 155+
 156+ $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
 157+
 158+ if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {
 159+
 160+ return $this->displayOnlineBankTransferInformation();
 161+ }
 162+
 163+ }
154164 else {
155165 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
156166 }
@@ -279,6 +289,58 @@
280290 return $wgOut->addHTML( $return );
281291 }
282292
 293+ /**
 294+ * Display information for online bank transfer
 295+ */
 296+ protected function displayOnlineBankTransferInformation() {
 297+
 298+ global $wgOut;
 299+
 300+ $results = $this->adapter->getTransactionAllResults();
 301+
 302+ $return = '';
 303+ $fields = array(
 304+ 'CUSTOMERPAYMENTREFERENCE' => array('translation' => 'donate_interface-obt-customer_payment_reference', ),
 305+ 'BILLERID' => array('translation' => 'donate_interface-obt-biller_id', ),
 306+ );
 307+
 308+ $id = 'bank_transfer_information';
 309+
 310+ $return .= Xml::openElement( 'div', array( 'id' => $id ) ); // $id
 311+
 312+ $return .= Xml::tags( 'h2', array(), wfMsg( 'donate_interface-obt-information' ) );
 313+
 314+ $return .= Xml::openElement( 'table', array( 'id' => $id . '_table' ) );
 315+
 316+ foreach ( $fields as $field => $meta ) {
 317+
 318+ if ( isset( $results['data'][ $field ] ) ) {
 319+ $return .= Xml::openElement( 'tr', array() );
 320+
 321+ $return .= Xml::tags( 'th', array(), wfMsg( $meta['translation'] ) );
 322+ $return .= Xml::tags( 'td', array(), $results['data'][ $field ] );
 323+
 324+ $return .= Xml::closeElement( 'tr' );
 325+ }
 326+ }
 327+
 328+ $return .= Xml::closeElement( 'table' ); // close $id . '_table'
 329+
 330+ $return .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-online_bank_transfer_message' ) );
 331+
 332+ $queryString = '?payment_method=' . $this->adapter->getPaymentMethod() . '&payment_submethod=' . $this->adapter->getPaymentSubmethod();
 333+
 334+ $url = $this->adapter->getThankYouPage() . $queryString;
 335+
 336+ $link = Xml::tags( 'a', array( 'href' => $url ), wfMsg( 'donate_interface-bt-finished' ) );
 337+
 338+ $return .= Xml::tags( 'p', array(), $link );
 339+
 340+ $return .= Xml::closeElement( 'div' ); // $id
 341+
 342+ return $wgOut->addHTML( $return );
 343+ }
 344+
283345 }
284346
285347 // end class

Follow-up revisions

RevisionCommit summaryAuthorDate
r103847MFT r102338, r102681, r102685, r102810, r102828, r102829, r102832, r102836, r...khorn22:30, 21 November 2011
r103848MFT r102338, r102681, r102685, r102810, r102828, r102829, r102832, r102836, r...khorn22:31, 21 November 2011

Comments

#Comment by Khorn (WMF) (talk | contribs)   21:21, 21 November 2011

I'm seeing a lot of:

if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {

It would be great if that was just a function you could add to the main gateway adapter at some point.

#Comment by Jpostlethwaite (talk | contribs)   21:38, 21 November 2011

good idea

Status & tagging log