r100837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100836‎ | r100837 | r100838 >
Date:18:39, 26 October 2011
Author:jpostlethwaite
Status:ok (Comments)
Tags:fundraising 
Comment:
Adding modules directory for GlobalCollect.
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/modules (added) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -191,25 +191,33 @@
192192
193193 $this->payment_methods = array();
194194
 195+ // Bank Transfers
 196+ $this->payment_methods['bt'] = array(
 197+ 'label' => 'Bank transfer',
 198+ 'types' => array( 'bt', ),
 199+ 'validation' => array( 'creditCard' => false, )
 200+ //'forms' => array( 'Gateway_Form_TwoStepAmount', ),
 201+ );
 202+
195203 // Credit Cards
196204 $this->payment_methods['cc'] = array(
197205 'label' => 'Credit Cards',
198206 'types' => array( '', 'visa', 'mc', 'amex', 'discover', 'maestro', 'solo', 'laser', 'jcb,', 'cb', ),
199207 );
200208
 209+ // Direct Debit
 210+ $this->payment_methods['dd'] = array(
 211+ 'label' => 'Direct Debit',
 212+ 'types' => array( 'dd_johnsen_nl', 'dd_johnsen_de', 'dd_johnsen_at', 'dd_johnsen_fr', 'dd_johnsen_gb', 'dd_johnsen_be', 'dd_johnsen_ch', 'dd_johnsen_it', 'dd_johnsen_es', ),
 213+ 'validation' => array( 'creditCard' => false, )
 214+ //'forms' => array( 'Gateway_Form_TwoStepAmount', ),
 215+ );
 216+
201217 // Real Time Bank Transfers
202218 $this->payment_methods['rtbt'] = array(
203219 'label' => 'Real time bank transfer',
204220 'types' => array( 'rtbt_ideal', 'rtbt_eps', 'rtbt_sofortuberweisung', 'rtbt_nordea_sweeden', 'rtbt_enets', ),
205221 );
206 -
207 - // Bank Transfers
208 - $this->payment_methods['bt'] = array(
209 - 'label' => 'Bank transfer',
210 - 'types' => array( 'bt', ),
211 - 'validation' => array( 'creditCard' => false, )
212 - //'forms' => array( 'Gateway_Form_TwoStepAmount', ),
213 - );
214222 }
215223
216224 /**
@@ -221,9 +229,24 @@
222230 $this->payment_submethods = array();
223231
224232 /*
225 - * Credit Card
 233+ * Bank transfers
226234 */
227235
 236+ // Bank Transfer
 237+ $this->payment_submethods['bt'] = array(
 238+ 'paymentproductid' => 11,
 239+ 'label' => 'Bank Transfer',
 240+ 'group' => 'bt',
 241+ 'validation' => array(),
 242+ );
 243+
 244+ /*
 245+ * Default => Credit Card
 246+ *
 247+ * Every payment_method should have a payment_submethod.
 248+ * This is just a catch to sure some validation happens.
 249+ */
 250+
228251 // None specified - This is a catchall to validate all options for credit cards.
229252 $this->payment_submethods[''] = array(
230253 'paymentproductid' => 0,
@@ -233,6 +256,18 @@
234257 );
235258
236259 /*
 260+ * Bank transfers
 261+ */
 262+
 263+ // Bank Transfer
 264+ $this->payment_submethods['bt'] = array(
 265+ 'paymentproductid' => 11,
 266+ 'label' => 'Bank Transfer',
 267+ 'group' => 'bt',
 268+ 'validation' => array(),
 269+ );
 270+
 271+ /*
237272 * Credit Card
238273 */
239274
@@ -309,12 +344,12 @@
310345 );
311346
312347 /*
313 - * Bank transfers
 348+ * Direct Debit
314349 */
315350
316351 // Bank Transfer
317 - $this->payment_submethods['bt'] = array(
318 - 'paymentproductid' => 11,
 352+ $this->payment_submethods['dd_johnsen_nl'] = array(
 353+ 'paymentproductid' => 711,
319354 'label' => 'Bank Transfer',
320355 'group' => 'bt',
321356 'validation' => array(),
@@ -649,39 +684,35 @@
650685
651686 /* Bank transfer */
652687 case 'bt':
653 - $this->postdata['payment_product'] = 11;
 688+ $this->postdata['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
654689 $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
655690 break;
 691+
 692+ /* Direct Debit */
 693+ case 'dd_johnsen_nl':
 694+ case 'dd_johnsen_de':
 695+ case 'dd_johnsen_at':
 696+ case 'dd_johnsen_fr':
 697+ case 'dd_johnsen_gb':
 698+ case 'dd_johnsen_be':
 699+ case 'dd_johnsen_ch':
 700+ case 'dd_johnsen_it':
 701+ case 'dd_johnsen_es':
 702+ $this->postdata['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
 703+ $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
 704+ break;
656705
657706 /* Real time bank transfer */
658707 case 'rtbt_nordea_sweeden':
659 - $this->postdata['payment_product'] = 805;
660 - $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
661 - break;
662 -
663 - case 'rtbt_ideal':
664 - $this->postdata['payment_product'] = 809;
665 - $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
666 - $this->var_map['ISSUERID'] = 'issuer_id';
667 -
668 - // Add the ISSUERID field if it does not exist
669 - if ( !in_array( 'ISSUERID', $this->transactions['INSERT_ORDERWITHPAYMENT']['request']['REQUEST']['PARAMS']['PAYMENT'] ) ) {
670 - $this->transactions['INSERT_ORDERWITHPAYMENT']['request']['REQUEST']['PARAMS']['PAYMENT'][] = 'ISSUERID';
671 - }
672 - break;
673 -
674708 case 'rtbt_enets':
675 - $this->postdata['payment_product'] = 810;
676 - $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
677 - break;
678 -
679709 case 'rtbt_sofortuberweisung':
680 - $this->postdata['payment_product'] = 836;
 710+ $this->postdata['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
681711 $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
682712 break;
683713
684714 case 'rtbt_eps':
685 - $this->postdata['payment_product'] = 856;
 715+ case 'rtbt_ideal':
 716+ $this->postdata['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
686717 $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
687718 $this->var_map['ISSUERID'] = 'issuer_id';
688719
@@ -690,6 +721,12 @@
691722 $this->transactions['INSERT_ORDERWITHPAYMENT']['request']['REQUEST']['PARAMS']['PAYMENT'][] = 'ISSUERID';
692723 }
693724 break;
 725+
 726+ /* Default Case */
 727+ default:
 728+ //$this->postdata['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
 729+ //$this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
 730+ break;
694731 }
695732 }
696733

Follow-up revisions

RevisionCommit summaryAuthorDate
r101068Removing duplicate bank transfer in payment_submethod. See r100837.jpostlethwaite21:44, 27 October 2011
r102236MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:06, 7 November 2011
r102237MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:07, 7 November 2011

Comments

#Comment by Jpostlethwaite (talk | contribs)   18:43, 26 October 2011

Added direct debit to GlobalCollect.

Simplified switch statement in stage_payment_method()

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

Going forward, it would be great to see most of the repeated code functionalized. (particularly good candidates seem to be congregating in stage_payment_method)

#Comment by Kaldari (talk | contribs)   19:34, 27 October 2011

You have $this->payment_submethods['bt'] = array(... in there twice.

#Comment by Jpostlethwaite (talk | contribs)   21:46, 27 October 2011

Fixed in r101068.

Status & tagging log