r98478 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98477‎ | r98478 | r98479 >
Date:22:25, 29 September 2011
Author:jpostlethwaite
Status:ok (Comments)
Tags:fundraising 
Comment:
Added transaction_type variable with a setter and a getter for the value.
Modified paths:
  • /branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)

Diff [purge]

Index: branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -82,6 +82,16 @@
8383 protected $accountInfo;
8484 protected $url;
8585 protected $transactions;
 86+
 87+ /**
 88+ * $transaction_type will be set in the GatewayForm::execute()
 89+ *
 90+ * @var string|false
 91+ *
 92+ * @see GatewayForm::execute()
 93+ */
 94+ protected $transaction_type = false;
 95+
8696 protected $return_value_map;
8797 protected $postdata;
8898 protected $postdatadefaults;
@@ -94,7 +104,7 @@
95105 const COMMUNICATION_TYPE = 'xml'; //this needs to be either 'xml' or 'namevalue'
96106 const GLOBAL_PREFIX = 'wgDonationGateway'; //...for example.
97107
98 - function __construct() {
 108+ public function __construct() {
99109 global $wgDonationInterfaceTest; //this is so the forms can see it.
100110 //TODO: Alter the forms so they don't need the global?
101111 if ( !self::getGlobal( 'Test' ) ) {
@@ -786,4 +796,25 @@
787797 return $ret;
788798 }
789799
 800+ /**
 801+ * Get the transaction type
 802+ *
 803+ * @return string|false
 804+ */
 805+ public function getTransactionType() {
 806+
 807+ return $this->transaction_type;
 808+ }
 809+
 810+ /**
 811+ * Set the transaction type
 812+ *
 813+ * @param string|false $transaction_type
 814+ */
 815+ public function setTransactionType( $transaction_type ) {
 816+
 817+ $transaction_type = empty( $transaction_type ) ? false : $transaction_type;
 818+
 819+ $this->transaction_type = $transaction_type;
 820+ }
790821 }

Comments

#Comment by Awjrichards (talk | contribs)   22:34, 7 October 2011
+	public function setTransactionType( $transaction_type ) {
+		
+		$transaction_type = empty( $transaction_type ) ? false : $transaction_type;
+		
+		$this->transaction_type = $transaction_type;
+	}

IIRC, elsewhere you're pulling transaction_type with $wgGetText( 'transaction_type', null ); While probably not a big deal, and perhaps even remedied by this function, it would be nice to keep an empty transaction_type value consistent. Feel free to argue this!

#Comment by Jpostlethwaite (talk | contribs)   23:20, 7 October 2011

There are some issues with how the transaction type is being set.

This is an attempt to unify this value.

Status & tagging log