r100460 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100459‎ | r100460 | r100461 >
Date:21:56, 21 October 2011
Author:jpostlethwaite
Status:deferred (Comments)
Tags:
Comment:
Changed $transaction_groups to $payment_methods. Changed $transaction_types to $payment_submethods. Added get methods for access to payment_methods and payment_submethods.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -108,18 +108,18 @@
109109 protected $transactions;
110110
111111 /**
112 - * $transaction_groups will be defined by the adapter.
 112+ * $payment_methods will be defined by the adapter.
113113 *
114 - * @var array $transaction_groups
 114+ * @var array $payment_methods
115115 */
116 - protected $transaction_groups = array();
 116+ protected $payment_methods = array();
117117
118118 /**
119 - * $transaction_types will be defined by the adapter.
 119+ * $payment_submethods will be defined by the adapter.
120120 *
121 - * @var array $transaction_types
 121+ * @var array $payment_submethods
122122 */
123 - protected $transaction_types = array();
 123+ protected $payment_submethods = array();
124124
125125 /**
126126 * Staged variables. This is affected by the transaction type.
@@ -184,7 +184,7 @@
185185 $this->defineReturnValueMap();
186186
187187 //Don't bother setting the transaction type if it's not something.
188 - if ( $this->dataObj->isSomething( 'transaction_type' ) ) {
 188+ if ( $this->dataObj->isSomething( 'payment_method' ) ) {
189189 $this->currentTransaction('INSERT_ORDERWITHPAYMENT');
190190 }
191191
@@ -292,7 +292,14 @@
293293 return $gotten[$varname];
294294 }
295295
296 - function getValue( $gateway_field_name, $token = false ) {
 296+ /**
 297+ * getValue
 298+ *
 299+ * @todo
 300+ * - This is specific to transactions.
 301+ * - This method probably needs to be renamed.
 302+ */
 303+ public function getValue( $gateway_field_name, $token = false ) {
297304 if ( empty( $this->transactions ) ) {
298305 //TODO: These dies should all throw exceptions or something less completely fatal.
299306 $msg = self::getGatewayName() . ': Transactions structure is empty! No transaction can be constructed.';
@@ -652,8 +659,61 @@
653660 }
654661 return $current_transaction;
655662 }
656 -
 663+
657664 /**
 665+ * Define payment methods
 666+ *
 667+ * Payment methods include:
 668+ * - Paypal
 669+ * - Credit Card
 670+ * - Debit
 671+ * - Bank Transfer
 672+ * - Real Time Bank Transfer
 673+ *
 674+ * Not all payment methods are available within an adapter
 675+ *
 676+ * @return array Returns the available payment methods for the specific adapter
 677+ */
 678+ public function getPaymentMethods() {
 679+
 680+ // Define the payment methods if they have not been set yet.
 681+ if ( empty( $this->payment_methods ) ) {
 682+
 683+ $this->definePaymentMethods();
 684+ }
 685+
 686+ return $this->payment_methods;
 687+ }
 688+
 689+ /**
 690+ * Define payment methods
 691+ *
 692+ * @todo
 693+ * - this is not implemented in all adapters yet
 694+ *
 695+ * Payment methods include:
 696+ * - Paypal: paypal, recurring paypal
 697+ * - Credit Card: Master Card
 698+ * - Debit
 699+ * - Bank Transfer
 700+ * - Real Time Bank Transfer
 701+ *
 702+ * Not all payment submethods are available within an adapter
 703+ *
 704+ * @return array Returns the available payment submethods for the specific adapter
 705+ */
 706+ public function getPaymentSubmethods() {
 707+
 708+ // Define the payment methods if they have not been set yet.
 709+ if ( empty( $this->payment_submethods ) ) {
 710+
 711+ $this->definePaymentSubmethods();
 712+ }
 713+
 714+ return $this->payment_methods;
 715+ }
 716+
 717+ /**
658718 * Sends a name-value pair string to Payflow gateway
659719 *
660720 * @param $data String: The exact thing we want to send.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100456Reallocating fields in forms: payment_method. Adding fields: payment_submetho...jpostlethwaite21:42, 21 October 2011

Comments

#Comment by Khorn (WMF) (talk | contribs)   02:42, 27 October 2011

A couple things would make this a fixme, but they're both gone by now. (getValue going public when it should be internal use only, using 'INSERT_ORDERWITHPAYMENT' in the abstract class)

Only one comment: If we intend to implement definePaymentMethods and definePaymentSubMethods for all adapters, they should both be in the interface, and get called initially in the main gateway.adapter's constructor so all the gateways remain consistent. As this isn't an issue right now (and would definitely cause more problems than it would solve), I'm just going to leave this note here and call it "deferred".

Status & tagging log