r103848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103847‎ | r103848 | r103849 >
Date:22:31, 21 November 2011
Author:khorn
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/extras (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/extras/custom_filters/custom_filters.body.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/us-states.i18n.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/forms/TwoStepAmount.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd-AU.html (added) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.alias.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.i18n.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/html/lightbox1.html (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro.adapter.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.alias.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php (modified) (history)

Diff [purge]

Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.alias.php
___________________________________________________________________
Modified: svn:mergeinfo
11 Merged /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.alias.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -64,11 +64,8 @@
6565 // Display form for the first time
6666 $this->displayForm( $this->errors );
6767 }
68 - } else {
69 - if ( !$this->adapter->isCaching() ) {
70 - // if we're not caching, there's a token mismatch
71 - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
72 - }
 68+ } else {//token mismatch
 69+ $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
7370 $this->displayForm( $this->errors );
7471 }
7572 }
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/html/lightbox1.html
@@ -61,8 +61,8 @@
6262 </div>
6363 </div>
6464 <!-- The appeal -->
65 - <h2 id="appeal-head"><span class="mw-headline">{{LanguageSwitch|2011FR/@appeal-title|@language}}</span></h2>
66 - <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal|@language}}</div>
 65+ <h2 id="appeal-head"><span class="mw-headline">{{LanguageSwitch|2011FR/@appeal/title|@language}}</span></h2>
 66+ <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal/text|@language}}</div>
6767 </div>
6868 </div>
6969
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms
___________________________________________________________________
Modified: svn:mergeinfo
7070 Merged /trunk/extensions/DonationInterface/payflowpro_gateway/forms:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro.adapter.php
@@ -16,6 +16,19 @@
1717 }
1818
1919 /**
 20+ * Define dataConstraints
 21+ *
 22+ * @todo
 23+ * - Implement this for PayFlowPro
 24+ *
 25+ */
 26+ public function defineDataConstraints() {
 27+
 28+ $this->dataConstraints = array(
 29+ );
 30+ }
 31+
 32+ /**
2033 * Define error_map
2134 *
2235 * @todo
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
2336 Merged /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway
___________________________________________________________________
Modified: svn:mergeinfo
2437 Merged /trunk/extensions/DonationInterface/payflowpro_gateway:r102338,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/extras/custom_filters/custom_filters.body.php
___________________________________________________________________
Modified: svn:mergeinfo
2538 Merged /trunk/extensions/DonationInterface/extras/custom_filters/custom_filters.body.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103244,103411,103413,103500,103503,103515,103608,103633,103775,103839
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/extras
___________________________________________________________________
Modified: svn:mergeinfo
2639 Merged /trunk/extensions/DonationInterface/extras:r102338,102681,102685,102810,102828-102829,102832,102836,103244,103411,103413,103500,103503,103515,103608,103633,103775,103839
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms
___________________________________________________________________
Modified: svn:mergeinfo
2740 Merged /trunk/extensions/DonationInterface/gateway_forms:r102338,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103503,103608,103633,103775,103839
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.alias.php
___________________________________________________________________
Modified: svn:mergeinfo
2841 Merged /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.alias.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/forms/TwoStepAmount.php
@@ -353,7 +353,6 @@
354354 'bank_code' => array( 'required' => true, ),
355355 'bank_name' => array( 'required' => true, ),
356356 'branch_code' => array( 'required' => true, ),
357 - 'direct_debit_text' => array( 'required' => true, ),
358357 'iban' => array( 'required' => true, ),
359358 );
360359
@@ -367,8 +366,6 @@
368367 }
369368 elseif ( $country == 'BE' ) {
370369
371 - unset( $fields['bank_code'] );
372 - unset( $fields['bank_check_digit'] );
373370 unset( $fields['branch_code'] );
374371 unset( $fields['iban'] );
375372 }
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/forms/TwoStepAmount.php
___________________________________________________________________
Modified: svn:mergeinfo
376373 Merged /trunk/extensions/DonationInterface/globalcollect_gateway/forms/TwoStepAmount.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd-AU.html
@@ -0,0 +1,166 @@
 2+<script type="text/javascript">
 3+ mw.loader.load('gc.form.rapidhtml.webitects.2nd.US');
 4+ // these must go through RapidHTML and thus are inline
 5+ var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape'];
 6+ var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape'];
 7+ var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
 8+ var actionURL = "@action";
 9+ var scriptPath = "@script_path";
 10+</script>
 11+<!--[if lt IE 7]>
 12+<script type="text/javascript">
 13+ mw.loader.load('gc.form.rapidhtml.webitects.ie6');
 14+</script>
 15+<style type="text/css">
 16+ body{
 17+ behavior: url("@script_path/skins/vector/csshover.min.htc");
 18+ }
 19+</style><![endif]-->
 20+<!--[if IE 7]>
 21+<style>
 22+ .gainlayout {
 23+ zoom: 1;
 24+ height: 1%;
 25+ }
 26+</style>
 27+<![endif]-->
 28+
 29+<div class="ltr">
 30+ <table id="layouttable">
 31+ <tr>
 32+ <td>
 33+ <div id="appeal">
 34+ <div id="appeal-content">
 35+ <h2 id="appeal-head"> <span class="mw-headline">{{LanguageSwitch|2011FR/@appeal/title|@language}}</span></h2>
 36+ <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal/text|@language}}</div>
 37+ </div>
 38+ </div>
 39+ </td>
 40+ <td>
 41+ <div id="donate">
 42+ <div id="donate-content">
 43+ <div id="donate-body" style="padding: 0 1em;">
 44+ <form method="post" name="paypalcontribution">
 45+ <div id="step1header"><h3>%donate_interface-amount-legend% <span id="selected-amount">(AUD)</span> <span class="mute" id="change-amount" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div>
 46+ <div id="step1wrapper" style="display: none;">
 47+ <div id="amtErrorMessages" class="small"></div>
 48+ <table id="amount-table-white">
 49+ <tr>
 50+ <td><label><input id="amountRadio0" type="radio" name="amountRadio" value="10" /> <span id="amountSpan0">10</span></label></td>
 51+ <td><label><input id="amountRadio1" type="radio" name="amountRadio" value="20" /> <span id="amountSpan1">20</span></label></td>
 52+ <td><label><input id="amountRadio2" type="radio" name="amountRadio" value="25" /> <span id="amountSpan2">25</span></label></td>
 53+ <td><label><input id="amountRadio3" type="radio" name="amountRadio" value="35" /> <span id="amountSpan3">35</span></label></td>
 54+ </tr>
 55+ <tr>
 56+ <td><label><input id="amountRadio4" type="radio" name="amountRadio" value="50" /> <span id="amountSpan4">50</span></label></td>
 57+ <td><label><input id="amountRadio5" type="radio" name="amountRadio" value="75" /> <span id="amountSpan5">75</span></label></td>
 58+ <td><label><input id="amountRadio6" type="radio" name="amountRadio" value="100" /> <span id="amountSpan6">100</span></label></td>
 59+ <td><input type="radio" name="amountRadio" id="input_amount_other" value="other" /> <label><span id="amountSpanOther"></span><input type="text" class="txt-sm hint" name="amountGiven" size="4" id="other-amount" title="%donate_interface-other%" placeholder="%donate_interface-other%" onfocus="this.form.input_amount_other.checked=true;"/></label></td>
 60+ </tr>
 61+ </table>
 62+ </div>
 63+ <div id="step2header"><h3>%donate_interface-billing-address% <span class="mute" id="change-billing" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div>
 64+ <div id="step2wrapper">
 65+ <div id="billing-content" class="gainlayout">
 66+ <div id="billingErrorMessages" class="small"></div>
 67+ <div class="name-fields">
 68+ <span class="name-first"><input class="txt" id="fname" name="fname" title="%donate_interface-donor-fname%" value="@fname" placeholder="%donate_interface-donor-fname%"/></span>
 69+ <span class="name-last"><input class="txt" id="lname" name="lname" title="%donate_interface-donor-lname%" value="@lname" placeholder="%donate_interface-donor-lname%"/></span>
 70+ </div>
 71+ <div class="loc-fields">
 72+ <span class="loc-street"><input class="txt" id="street" name="street" title="%donate_interface-donor-street%" value="@street" placeholder="%donate_interface-donor-street%"/></span>
 73+ <span class="loc-city"><input class="txt" id="city" name="city" title="Locality" value="@city" placeholder="Locality"/></span>
 74+ <span class="loc-state">
 75+ <select id="state" name="state" class="txt" value="@state" >
 76+ <option value="">%donate_interface-donor-state%</option>
 77+ <option value="ACT">ACT</option>
 78+ <option value="JBT">JBT</option>
 79+ <option value="NSW">NSW</option>
 80+ <option value="NT">NT</option>
 81+ <option value="QLD">QLD</option>
 82+ <option value="SA">SA</option>
 83+ <option value="TAS">TAS</option>
 84+ <option value="VIC">VIC</option>
 85+ <option value="WA">WA</option>
 86+ </select>
 87+ </span>
 88+ <span class="loc-postal"><input class="txt" id="zip" name="zip" title="%donate_interface-zip%" value="@zip" placeholder="%donate_interface-donor-zip%"/></span> <!-- TODO: use postal code on non-US -->
 89+ </div>
 90+ <p><input class="txt" title="%donate_interface-donor-email%" id="emailAdd" name="emailAdd" value="@emailAdd" placeholder="%donate_interface-donor-email%"/></p>
 91+
 92+ <dl class="">
 93+ <dt><span id="select-credit-card" class="label">%donate_interface-select-credit-card%</span></dt>
 94+ <dd class="field" style="margin-bottom: 0;">
 95+ <ul class="options-h" id="cards" style="margin: 0;">
 96+ <li><input id="cc-visa" name="cardtype" type="radio" value="visa" class="cardradio" /> <label for="cc-visa"><img alt="Visa" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-visa.png" /></label></li>
 97+ <li><input id="cc-mastercard" name="cardtype" type="radio" value="mastercard" class="cardradio" /> <label for="cc-mastercard"><img alt="MasterCard" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" /></label></li>
 98+ <li><input id="cc-amex" name="cardtype" type="radio" value="american" class="cardradio" /> <label for="cc-amex"><img alt="American Express" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-amex.png" /></label></li>
 99+ <!--<li><input id="cc-discover" name="cardtype" type="radio" value="discover" class="cardradio" /> <label for="cc-discover"><img alt="Discover" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-discover.png" /></label></li>-->
 100+ <li><input id="cc-jcb" name="cardtype" type="radio" value="jcb" class="cardradio" /> <label for="cc-jcb"><img alt="JCB" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-jcb.png" /></label></li>
 101+ </ul>
 102+ <div id="paymentContinue" style="margin-top: 10px; display: none;"> <input class="btn" id="paymentContinueBtn" type="button" value="%donate_interface-continue%" /></div>
 103+ </dd>
 104+ </dl>
 105+ </div>
 106+ </div>
 107+ <div id="step3header"><h3>%donate_interface-cc-form-header-payment% <span class="mute" id="change-payment" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div>
 108+ <div id="step3wrapper" style="display: none;">
 109+ <div id="payment" class="gainlayout" style="height:314px;text-align:center;"></div>
 110+ </div>
 111+
 112+ <input type="hidden" name="returnto" value="Thank_You/en" />
 113+ <input type="hidden" value="0" name="PaypalRedirect" id="PaypalRedirect">
 114+
 115+ <input type="hidden" value="@amount" name="amount" />
 116+ <input type="hidden" value="AU" name="country" id="country" />
 117+ <input type="hidden" value="AUD" name="currency_code" />
 118+ <input type="hidden" value="@utm_source" name="utm_source"/>
 119+ <input type="hidden" value="@utm_medium" name="utm_medium"/>
 120+ <input type="hidden" value="@utm_campaign" name="utm_campaign"/>
 121+ <input type="hidden" value="@language" name="language"/>
 122+ <input type="hidden" value="@referrer" name="referrer"/>
 123+ <input type="hidden" value="@comment" name="comment"/>
 124+ <input type="hidden" value="@comment-option" name="comment-option"/>
 125+ <input type="hidden" value="1" name="email-opt"/>
 126+ <input type="hidden" value="@token" name="token"/>
 127+ <input type="hidden" value="@order_id" name="order_id"/>
 128+ <input type="hidden" value="@numAttempt" name="numAttempt"/>
 129+ <input type="hidden" value="@contribution_tracking_id" name="contribution_tracking_id"/>
 130+ <input type="hidden" value="@data_hash" name="data_hash"/>
 131+ <input type="hidden" value="@owa_session" name="owa_session"/>
 132+ <input type="hidden" value="@owa_ref" name="owa_ref"/>
 133+ <!-- new required fields -->
 134+ <input type="hidden" value="@gateway" name="gateway"/>
 135+ <input type="hidden" value="@payment_method" name="payment_method"/>
 136+ </form>
 137+ <div id="where-content">
 138+ {{LanguageSwitch|2011FR/core-appeal-whitebox-nodiv|@language}}
 139+ </div>
 140+ </div>
 141+ </div>
 142+ <p id="informationsharing">%donate_interface-informationsharing|url%</p>
 143+ <table>
 144+ <tr>
 145+ <td>
 146+ <ul id="moreinfolinks">
 147+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Monthly_donations&language=@language&uselang=@language&country=@country">%donate_interface-monthly-donation%</a></li>
 148+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Ways_to_Give&language=@language&uselang=@language&country=@country">%donate_interface-otherways-short%</a></li>
 149+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=FAQ&language=@language&uselang=@language&country=@country">%donate_interface-faqs%</a></li>
 150+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Tax_Deductibility&language=@language&uselang=@language&country=@country">%donate_interface-tax-info%</a></li>
 151+ </ul>
 152+ </td>
 153+ <td>@verisign_logo</td>
 154+ </tr>
 155+ </table>
 156+ </div>
 157+ </td>
 158+ </tr>
 159+ </table>
 160+
 161+
 162+
 163+</div>
 164+
 165+<!-- Wikimedia Project logo
 166+<li id="footer-copyrightico"><a href="https://www.mediawiki.org//wikimediafoundation.org/"><img src="//bits.wikimedia.org/images/wikimedia-button.png" width="88" height="31" alt="Wikimedia Foundation"/></a></li>
 167+ -->
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd-AU.html
___________________________________________________________________
Added: svn:eol-style
1168 + native
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -27,7 +27,7 @@
2828 */
2929 public function __construct() {
3030 $this->adapter = new GlobalCollectAdapter();
31 - parent::__construct(); //the next layer up will know who we are.
 31+ parent::__construct(); //the next layer up will know who we are.
3232 }
3333
3434 /**
@@ -79,20 +79,20 @@
8080 $this->paypalRedirect();
8181 return;
8282 }
83 -
8483
 84+
8585 // dispatch forms/handling
86 - if ( $this->adapter->checkTokens() ) {
 86+ if ( $this->adapter->checkTokens() ) {
8787
8888 if ( $this->adapter->posted ) {
89 -
 89+
9090 // The form was submitted and the payment method has been set
9191 $payment_method = $this->adapter->getPaymentMethod();
9292 $payment_submethod = $this->adapter->getPaymentSubmethod();
9393
9494 // Check form for errors
9595 $form_errors = $this->validateForm( $this->errors, $this->adapter->getPaymentSubmethodFormValidation() );
96 -
 96+
9797 // If there were errors, redisplay form, otherwise proceed to next step
9898 if ( $form_errors ) {
9999
@@ -104,62 +104,77 @@
105105 if ( $payment_method == 'cc' ) {
106106
107107 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
108 -
 108+
109109 // Display an iframe for credit cards
110110 if ( $this->executeIframeForCreditCard() ) {
111111 $this->displayResultsForDebug();
112112 // Nothing left to process
113113 return;
114114 }
115 - }
116 - elseif ( $payment_method == 'bt' ) {
 115+ } elseif ( $payment_method == 'bt' ) {
117116
118117 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
119118
120119 if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {
121 -
 120+
122121 return $this->displayBankTransferInformation();
123122 }
124123
125 - }
126 - elseif ( $payment_method == 'rtbt' ) {
 124+ } elseif ( $payment_method == 'dd' ) {
127125
 126+ $this->adapter->do_transaction( 'DO_BANKVALIDATION' );
 127+
 128+ // Check to see if validations were successful, if so, proceed with order.
 129+ if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {
 130+
 131+ $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
 132+ }
 133+ else {
 134+
 135+ // Attach the error messages to the form
 136+ $this->adapter->setBankValidationErrors();
 137+ }
 138+ } elseif ( $payment_method == 'ew' ) {
 139+
128140 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
129141
130142 $formAction = $this->adapter->getTransactionDataFormAction();
131 -
 143+
132144 // Redirect to the bank
133145 if ( !empty( $formAction ) ) {
134146 return $wgOut->redirect( $formAction );
135147 }
136148
137 - }
138 - elseif ( $payment_method == 'dd' ) {
 149+ } elseif ( $payment_method == 'obt' ) {
139150
140 - $this->adapter->do_transaction( 'DO_BANKVALIDATION' );
 151+ $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
141152
142 - // Check to see if validations were successful, if so, proceed with order.
143153 if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {
144154
145 - $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
 155+ return $this->displayOnlineBankTransferInformation();
146156 }
147 - else {
148157
149 - // Attach the error messages to the form
150 - $this->adapter->setBankValidationErrors();
 158+ } elseif ( $payment_method == 'rtbt' ) {
 159+
 160+ $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
 161+
 162+ $formAction = $this->adapter->getTransactionDataFormAction();
 163+
 164+ // Redirect to the bank
 165+ if ( !empty( $formAction ) ) {
 166+ return $wgOut->redirect( $formAction );
151167 }
152 -
153 - }
154 - else {
 168+
 169+ } else {
155170 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
156171 }
157 -
 172+
158173 return $this->resultHandler();
159174
160175 }
161176 } else {
162177 // Display form
163 -
 178+
164179 // See GlobalCollectAdapter::stage_returnto()
165180 $oid = $wgRequest->getText( 'order_id' );
166181 if ( $oid ) {
@@ -167,22 +182,19 @@
168183 $this->displayResultsForDebug();
169184 }
170185
171 - //TODO: Get rid of $data out here completely, by putting this logic inside the adapter somewhere.
172 - //All we seem to be doing with it now, is internal adapter logic outside of the adapter.
 186+ //TODO: Get rid of $data out here completely, by putting this logic inside the adapter somewhere.
 187+ //All we seem to be doing with it now, is internal adapter logic outside of the adapter.
173188 $data = $this->adapter->getData_Raw();
174 -
 189+
175190 // If the result of the previous transaction was failure, set the retry message.
176191 if ( $data && array_key_exists( 'response', $data ) && $data['response'] == 'failure' ) {
177192 $this->errors['retryMsg'] = wfMsg( 'php-response-declined' );
178193 }
179 -
 194+
180195 $this->displayForm( $this->errors );
181196 }
182 - } else {
183 - if ( !$this->adapter->isCaching() ) {
184 - // if we're not caching, there's a token mismatch
185 - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
186 - }
 197+ } else { //token mismatch
 198+ $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
187199 $this->displayForm( $this->errors );
188200 }
189201 }
@@ -197,7 +209,7 @@
198210 global $wgOut;
199211
200212 $formAction = $this->adapter->getTransactionDataFormAction();
201 -
 213+
202214 if ( $formAction ) {
203215
204216 $paymentFrame = Xml::openElement( 'iframe', array(
@@ -213,7 +225,7 @@
214226 $paymentFrame .= Xml::closeElement( 'iframe' );
215227
216228 $wgOut->addHTML( $paymentFrame );
217 -
 229+
218230 return true;
219231 }
220232
@@ -241,23 +253,23 @@
242254 'SWIFTCODE' => array('translation' => 'donate_interface-bt-swift_code', ),
243255 'SPECIALID' => array('translation' => 'donate_interface-bt-special_id', ),
244256 );
245 -
 257+
246258 $id = 'bank_transfer_information';
247 -
 259+
248260 $return .= Xml::openElement( 'div', array( 'id' => $id ) ); // $id
249261
250262 $return .= Xml::tags( 'h2', array(), wfMsg( 'donate_interface-bt-information' ) );
251 -
 263+
252264 $return .= Xml::openElement( 'table', array( 'id' => $id . '_table' ) );
253265
254266 foreach ( $fields as $field => $meta ) {
255 -
 267+
256268 if ( isset( $results['data'][ $field ] ) ) {
257269 $return .= Xml::openElement( 'tr', array() );
258 -
 270+
259271 $return .= Xml::tags( 'th', array(), wfMsg( $meta['translation'] ) );
260272 $return .= Xml::tags( 'td', array(), $results['data'][ $field ] );
261 -
 273+
262274 $return .= Xml::closeElement( 'tr' );
263275 }
264276 }
@@ -269,16 +281,106 @@
270282 $queryString = '?payment_method=' . $this->adapter->getPaymentMethod() . '&payment_submethod=' . $this->adapter->getPaymentSubmethod();
271283
272284 $url = $this->adapter->getThankYouPage() . $queryString;
273 -
274 - $link = Xml::tags( 'a', array( 'href' => $url ), wfMsg( 'donate_interface-bt-finished' ) );
275 -
 285+
 286+ $link = HTML::input('MyButton', 'finished', 'button', array( 'onclick' => "window.location = '$url'" ) );
 287+
276288 $return .= Xml::tags( 'p', array(), $link );
277 -
 289+
278290 $return .= Xml::closeElement( 'div' ); // $id
279 -
 291+
280292 return $wgOut->addHTML( $return );
281293 }
282294
 295+ /**
 296+ * Display information for online bank transfer
 297+ */
 298+ protected function displayOnlineBankTransferInformation() {
 299+
 300+ global $wgOut, $wgScriptPath;
 301+
 302+ $results = $this->adapter->getTransactionAllResults();
 303+
 304+ $return = '';
 305+ $fields = array(
 306+ 'CUSTOMERPAYMENTREFERENCE' => array('translation' => 'donate_interface-obt-customer_payment_reference', ),
 307+ 'BILLERID' => array('translation' => 'donate_interface-obt-biller_id', ),
 308+ );
 309+
 310+ $id = 'bank_transfer_information';
 311+
 312+ $return .= Xml::openElement( 'div', array( 'id' => $id ) ); // $id
 313+
 314+ $return .= Xml::tags( 'h2', array(), wfMsg( 'donate_interface-obt-information' ) );
 315+
 316+ $return .= Xml::openElement( 'table', array( 'id' => $id . '_table' ) );
 317+
 318+ foreach ( $fields as $field => $meta ) {
 319+
 320+ if ( isset( $results['data'][ $field ] ) ) {
 321+ $return .= Xml::openElement( 'tr', array() );
 322+
 323+ $return .= Xml::tags( 'th', array(), wfMsg( $meta['translation'] ) );
 324+ $return .= Xml::tags( 'td', array(), $results['data'][ $field ] );
 325+
 326+ $return .= Xml::closeElement( 'tr' );
 327+ }
 328+ }
 329+
 330+ $return .= Xml::closeElement( 'table' ); // close $id . '_table'
 331+
 332+ $return .= Xml::openElement( 'table' ); //open info table
 333+
 334+ $return .= Xml::openElement( 'tr' );
 335+
 336+ $return .= Xml::openElement ( 'td', array( 'colspan' => '2' ) );
 337+
 338+ $return .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-online_bank_transfer_message' ) );
 339+
 340+ $return .= Xml::closeElement ( 'td' );
 341+
 342+ $return .= Xml::closeElement ( 'tr' );
 343+
 344+ $return .= Xml::openElement ( 'tr' );
 345+
 346+ $return .= Xml::openElement( 'td' );
 347+
 348+ $return .= Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/BPAY_Landscape_MONO.gif", 'style' => 'vertical-align:center; width:100px; margin-right: 1em;' ) );
 349+
 350+ $return .= Xml::closeElement ( 'td' );
 351+
 352+ $return .= Xml::openElement ( 'td' );
 353+
 354+ $return .= Xml::tags( 'p', array(), 'Contact your bank or financial institution <br /> to make this payment from your cheque, <br /> debit, credit card or transaction account. <br /> More info: www.bpay.com.au ' );
 355+
 356+ $return .= Xml::closeElement ( 'td' );
 357+
 358+ $return .= Xml::closeElement ( 'tr' );
 359+
 360+ $return .= Xml::openElement ( 'tr' );
 361+
 362+ $return .= Xml::openElement ( 'td', array( 'colspan' => '2' ) );
 363+
 364+ $return .= Xml::tags( 'p', array(), '<br /> &reg; Registered to BPAY Pty Ltd ABN 69 079 137 518');
 365+
 366+ $return .= Xml::closeElement ( 'td' );
 367+
 368+ $return .= Xml::closeElement ( 'tr' );
 369+
 370+ $return .= Xml::closeElement ( 'table' ); //close info table
 371+
 372+ $queryString = '?payment_method=' . $this->adapter->getPaymentMethod() . '&payment_submethod=' . $this->adapter->getPaymentSubmethod();
 373+
 374+ $url = $this->adapter->getThankYouPage() . $queryString;
 375+
 376+ $link = HTML::input('MyButton', 'finished', 'button', array( 'onclick' => "window.location = '$url'" ) );
 377+
 378+ $return .= Xml::tags( 'p', array(), $link );
 379+
 380+ $return .= Xml::closeElement( 'div' ); // $id
 381+
 382+ return $wgOut->addHTML( $return );
 383+ }
 384+
283385 }
284386
285387 // end class
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -1,5 +1,25 @@
22 <?php
 3+/**
 4+ * Wikimedia Foundation
 5+ *
 6+ * LICENSE
 7+ *
 8+ * This program is free software; you can redistribute it and/or modify
 9+ * it under the terms of the GNU General Public License as published by
 10+ * the Free Software Foundation; either version 2 of the License, or
 11+ * (at your option) any later version.
 12+ *
 13+ * This program is distributed in the hope that it will be useful,
 14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 16+ * GNU General Public License for more details.
 17+ *
 18+ */
319
 20+/**
 21+ * GlobalCollectAdapter
 22+ *
 23+ */
424 class GlobalCollectAdapter extends GatewayAdapter {
525 const GATEWAY_NAME = 'Global Collect';
626 const IDENTIFIER = 'globalcollect';
@@ -30,47 +50,20 @@
3151 }
3252
3353 /**
34 - * Define error_map
 54+ * Define dataConstraints
3555 *
3656 * @todo
37 - * - Add: Error messages
38 - */
39 - public function defineErrorMap() {
40 -
41 - $this->error_map = array(
42 - 0 => 'globalcollect_gateway-response-default',
43 - 430452 => 'globalcollect_gateway-response-default', // Not authorised :: This message was generated when trying to attempt a direct debit transaction from Belgium.
44 - 430900 => 'globalcollect_gateway-response-default', // NO VALID PROVIDERS FOUND FOR COMBINATION MERCHANTID: NNNN, PAYMENTPRODUCT: NNN, COUNTRYCODE: XX, CURRENCYCODE: XXX
45 -
46 - // Internal messages
47 - 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks.
48 - 'internal-0001' => 'donate_interface-processing-error', // Transaction could not be processed due to an internal error.
49 - 'internal-0002' => 'donate_interface-processing-error', // Communication failure
50 -
51 - // Do bank validation messages
52 - //'dbv-50' => 'globalcollect_gateway-response-dbv-50', // Account number format incorrect
53 - //'dbv-80' => 'globalcollect_gateway-response-dbv-80', // Account details missing
54 - //'dbv-330' => 'globalcollect_gateway-response-dbv-330', // Check digit format is incorrect
55 - //'dbv-340' => 'globalcollect_gateway-response-dbv-340', // Branch code not submitted
56 -
57 - );
58 - }
59 -
60 - /**
61 - * Define data_constraints
62 - *
63 - * @todo
6457 * - card_type: what do we do about this one? It is also payment_product.
6558 *
6659 */
6760 public function defineDataConstraints() {
6861
69 - $this->data_constraints = array(
 62+ $this->dataConstraints = array(
7063
7164 // General fields
7265
7366 //'ACCOUNTHOLDER' => 'account_holder', AN50
74 - 'account_holder' => array('type' => 'alphanumeric', 'length' => 50, ),
 67+ 'account_holder' => array( 'type' => 'alphanumeric', 'length' => 50, ),
7568
7669 //'ACCOUNTNAME' => 'account_name' AN35
7770 'account_name' => array( 'type' => 'alphanumeric', 'length' => 35, ),
@@ -121,8 +114,8 @@
122115 //'BRANCHCODE' => 'branch_code' N5
123116 'branch_code' => array( 'type' => 'numeric', 'length' => 5, ),
124117
125 - //'CITY' => 'city' AN50
126 - 'city' => array( 'type' => 'alphanumeric', 'length' => 50, ),
 118+ //'CITY' => 'city' AN40
 119+ 'city' => array( 'type' => 'alphanumeric', 'length' => 40, ),
127120
128121 //'COUNTRYCODE' => 'country' AN2
129122 'country' => array( 'type' => 'alphanumeric', 'length' => 2, ),
@@ -231,6 +224,33 @@
232225 'zip' => array( 'type' => 'alphanumeric', 'length' => 10, ),
233226 );
234227 }
 228+
 229+ /**
 230+ * Define error_map
 231+ *
 232+ * @todo
 233+ * - Add: Error messages
 234+ */
 235+ public function defineErrorMap() {
 236+
 237+ $this->error_map = array(
 238+ 0 => 'globalcollect_gateway-response-default',
 239+ 430452 => 'globalcollect_gateway-response-default', // Not authorised :: This message was generated when trying to attempt a direct debit transaction from Belgium.
 240+ 430900 => 'globalcollect_gateway-response-default', // NO VALID PROVIDERS FOUND FOR COMBINATION MERCHANTID: NNNN, PAYMENTPRODUCT: NNN, COUNTRYCODE: XX, CURRENCYCODE: XXX
 241+
 242+ // Internal messages
 243+ 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks.
 244+ 'internal-0001' => 'donate_interface-processing-error', // Transaction could not be processed due to an internal error.
 245+ 'internal-0002' => 'donate_interface-processing-error', // Communication failure
 246+
 247+ // Do bank validation messages
 248+ //'dbv-50' => 'globalcollect_gateway-response-dbv-50', // Account number format incorrect
 249+ //'dbv-80' => 'globalcollect_gateway-response-dbv-80', // Account details missing
 250+ //'dbv-330' => 'globalcollect_gateway-response-dbv-330', // Check digit format is incorrect
 251+ //'dbv-340' => 'globalcollect_gateway-response-dbv-340', // Branch code not submitted
 252+
 253+ );
 254+ }
235255
236256 /**
237257 * Define var_map
@@ -587,6 +607,14 @@
588608 //'forms' => array( 'Gateway_Form_TwoStepAmount', ),
589609 );
590610
 611+ // Bank Transfers
 612+ $this->payment_methods['obt'] = array(
 613+ 'label' => 'Online bank transfer',
 614+ 'types' => array( 'bpay', ),
 615+ 'validation' => array( 'creditCard' => false, )
 616+ //'forms' => array( 'Gateway_Form_TwoStepAmount', ),
 617+ );
 618+
591619 // Real Time Bank Transfers
592620 $this->payment_methods['rtbt'] = array(
593621 'label' => 'Real time bank transfer',
@@ -730,7 +758,7 @@
731759 'label' => 'Direct debit: AT',
732760 'group' => 'dd',
733761 'validation' => array(),
734 - 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', 'BANKNAME', 'DIRECTDEBITTEXT', ),
 762+ 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', /*'BANKNAME',*/ 'DIRECTDEBITTEXT', ),
735763 );
736764
737765 // Direct debit: BE
@@ -740,6 +768,7 @@
741769 'group' => 'dd',
742770 'validation' => array(),
743771 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'AUTHORISATIONID', 'BANKCHECKDIGIT', 'BANKCODE', 'BANKNAME', 'DIRECTDEBITTEXT', ),
 772+ //'keys' => array( /*'ACCOUNTNAME',*/ 'ACCOUNTNUMBER', 'AUTHORISATIONID', /*'BANKCHECKDIGIT',*/ 'BANKCODE', /*'BANKNAME',*/ 'DIRECTDEBITTEXT', ),
744773 );
745774
746775 // Direct debit: CH
@@ -748,7 +777,7 @@
749778 'label' => 'Direct debit: CH',
750779 'group' => 'dd',
751780 'validation' => array(),
752 - 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'ADDRESSLINE1E', 'ADDRESSLINE2', 'ADDRESSLINE3', 'ADDRESSLINE4', 'BANKCODE', 'BANKNAME', 'CUSTOMERBANKCITY', 'CUSTOMERBANKNUMBER', 'CUSTOMERBANKSTREET', 'CUSTOMERBANKZIP', 'DIRECTDEBITTEXT', 'IBAN', ),
 781+ 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'ADDRESSLINE1E', 'ADDRESSLINE2', 'ADDRESSLINE3', 'ADDRESSLINE4', 'BANKCODE', /*'BANKNAME',*/ /*'CUSTOMERBANKCITY', 'CUSTOMERBANKNUMBER', 'CUSTOMERBANKSTREET', 'CUSTOMERBANKZIP',*/ 'DIRECTDEBITTEXT', 'IBAN', ),
753782 );
754783
755784 // Direct debit: DE
@@ -757,7 +786,7 @@
758787 'label' => 'Direct debit: DE',
759788 'group' => 'dd',
760789 'validation' => array(),
761 - 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', 'BANKNAME', 'DIRECTDEBITTEXT', ),
 790+ 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', /*'BANKNAME',*/ 'DIRECTDEBITTEXT', ),
762791 );
763792
764793 // Direct debit: ES
@@ -766,7 +795,7 @@
767796 'label' => 'Direct debit: ES',
768797 'group' => 'dd',
769798 'validation' => array(),
770 - 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', 'BANKNAME', 'BRANCHCODE', 'BANKCHECKDIGIT', 'CUSTOMERBANKCITY', 'CUSTOMERBANKSTREET', 'CUSTOMERBANKZIP', 'DIRECTDEBITTEXT', 'DOMICILIO', 'PROVINCIA', ),
 799+ 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', /*'BANKNAME',*/ 'BRANCHCODE', 'BANKCHECKDIGIT', /*'CUSTOMERBANKCITY', 'CUSTOMERBANKSTREET', 'CUSTOMERBANKZIP',*/ 'DIRECTDEBITTEXT', /*'DOMICILIO', 'PROVINCIA',*/ ),
771800 );
772801
773802 // Direct debit: FR
@@ -775,7 +804,7 @@
776805 'label' => 'Direct debit: FR',
777806 'group' => 'dd',
778807 'validation' => array(),
779 - 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', 'BANKNAME', 'BRANCHCODE', 'BANKCHECKDIGIT', 'DIRECTDEBITTEXT', ),
 808+ 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', /*'BANKNAME',*/ 'BRANCHCODE', 'BANKCHECKDIGIT', 'DIRECTDEBITTEXT', ),
780809 );
781810
782811 // Direct debit: GB
@@ -784,7 +813,7 @@
785814 'label' => 'Direct debit: GB',
786815 'group' => 'dd',
787816 'validation' => array(),
788 - 'keys' => array( 'ACCOUNTNUMBER', 'AUTHORISATIONID', 'BANKCODE', 'BANKNAME', 'DIRECTDEBITTEXT', 'TRANSACTIONTYPE', ),
 817+ 'keys' => array( 'ACCOUNTNUMBER', 'AUTHORISATIONID', 'BANKCODE', /*'BANKNAME',*/ 'DIRECTDEBITTEXT', 'TRANSACTIONTYPE', ),
789818 );
790819
791820 // Direct debit: IT
@@ -793,7 +822,7 @@
794823 'label' => 'Direct debit: IT',
795824 'group' => 'dd',
796825 'validation' => array(),
797 - 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', 'BANKNAME', 'BRANCHCODE', 'BANKAGENZIA', 'BANKCHECKDIGIT', 'BANKFILIALE', 'CUSTOMERBANKCITY', 'CUSTOMERBANKNUMBER', 'CUSTOMERBANKSTREET', 'CUSTOMERBANKZIP', 'DIRECTDEBITTEXT', ),
 826+ 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKCODE', /*'BANKNAME',*/ 'BRANCHCODE', 'BANKAGENZIA', 'BANKCHECKDIGIT', /*'BANKFILIALE',*/ /*'CUSTOMERBANKCITY', 'CUSTOMERBANKNUMBER', 'CUSTOMERBANKSTREET', 'CUSTOMERBANKZIP',*/ 'DIRECTDEBITTEXT', ),
798827 );
799828
800829 // Direct debit: NL
@@ -802,10 +831,23 @@
803832 'label' => 'Direct debit: NL',
804833 'group' => 'dd',
805834 'validation' => array(),
806 - 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'BANKNAME', 'DIRECTDEBITTEXT', 'TRANSACTIONTYPE', ),
 835+ 'keys' => array( 'ACCOUNTNAME', 'ACCOUNTNUMBER', /*'BANKNAME',*/ 'DIRECTDEBITTEXT', 'TRANSACTIONTYPE', ),
807836 );
808837
809838 /*
 839+ * Online bank transfers
 840+ */
 841+
 842+ // Online Bank Transfer Bpay
 843+ $this->payment_submethods['bpay'] = array(
 844+ 'paymentproductid' => 500,
 845+ 'label' => 'Online Bank Transfer: Bpay',
 846+ 'group' => 'obt',
 847+ 'validation' => array(),
 848+ 'keys' => array(),
 849+ );
 850+
 851+ /*
810852 * Real time bank transfers
811853 */
812854
@@ -1399,6 +1441,9 @@
14001442 /**
14011443 * Set the bank validation error messages for the client.
14021444 *
 1445+ * @todo
 1446+ * - Only the first message will be returned. The reason is there are no translations for DO_BANKVALIDATION
 1447+ *
14031448 * The messages have already been generated at this point. The purpose of
14041449 * this method is to pass them to the view.
14051450 */
@@ -1410,7 +1455,15 @@
14111456
14121457 $errors = isset( $checks['errors'] ) ? $checks['errors'] : array();
14131458
1414 - $this->setTransactionResult( $errors, 'errors' );
 1459+ $errorsToBeDisplayed = array();
 1460+ foreach ( $errors as $code => $error ) {
 1461+ $errorsToBeDisplayed[ $code ] = $this->getErrorMapByCodeAndTranslate( $code );
 1462+
 1463+ // This break is temporary. All errors will have the same message. Only display it once.
 1464+ break;
 1465+ }
 1466+
 1467+ $this->setTransactionResult( $errorsToBeDisplayed, 'errors' );
14151468 }
14161469
14171470 /**
@@ -1531,12 +1584,6 @@
15321585 public function defineStagedVars() {
15331586 //OUR field names.
15341587 $this->staged_vars = array(
1535 - 'fname',
1536 - 'lname',
1537 - 'street',
1538 - 'city',
1539 - 'state',
1540 - 'email',
15411588 'amount',
15421589 'card_type',
15431590 //'card_num',
@@ -1549,36 +1596,6 @@
15501597 );
15511598 }
15521599
1553 - protected function stage_fname( $type = 'request' ) {
1554 - // Truncate to 15 characters due to GlobalCollect's field length limit
1555 - $this->staged_data['fname'] = substr( $this->staged_data['fname'], 0, 15 );
1556 - }
1557 -
1558 - protected function stage_lname( $type = 'request' ) {
1559 - // Truncate to 35 characters due to GlobalCollect's field length limit
1560 - $this->staged_data['lname'] = substr( $this->staged_data['lname'], 0, 35 );
1561 - }
1562 -
1563 - protected function stage_street( $type = 'request' ) {
1564 - // Truncate to 50 characters due to GlobalCollect's field length limit
1565 - $this->staged_data['street'] = substr( $this->staged_data['street'], 0, 50 );
1566 - }
1567 -
1568 - protected function stage_city( $type = 'request' ) {
1569 - // Truncate to 40 characters due to GlobalCollect's field length limit
1570 - $this->staged_data['city'] = substr( $this->staged_data['city'], 0, 40 );
1571 - }
1572 -
1573 - protected function stage_state( $type = 'request' ) {
1574 - // Truncate to 35 characters due to GlobalCollect's field length limit
1575 - $this->staged_data['state'] = substr( $this->staged_data['state'], 0, 35 );
1576 - }
1577 -
1578 - protected function stage_email( $type = 'request' ) {
1579 - // Truncate to 70 characters due to GlobalCollect's field length limit
1580 - $this->staged_data['email'] = substr( $this->staged_data['email'], 0, 70 );
1581 - }
1582 -
15831600 protected function stage_language( $type = 'request' ) {
15841601 $language = strtolower( $this->staged_data['language'] );
15851602
@@ -1714,12 +1731,12 @@
17151732 }
17161733
17171734 /**
1718 - * Stage: setup_stage_payment_method_for_direct_debit
 1735+ * Stage: setupStagePaymentMethodForDirectDebit
17191736 *
17201737 * @param string $payment_submethod
17211738 * @param string $type request|response
17221739 */
1723 - protected function setup_stage_payment_method_for_direct_debit( $payment_submethod, $type = 'request' ) {
 1740+ protected function setupStagePaymentMethodForDirectDebit( $payment_submethod, $type = 'request' ) {
17241741
17251742 // DATECOLLECT is required on all Direct Debit
17261743 $this->addKeyToTransaction('DATECOLLECT');
@@ -1728,10 +1745,11 @@
17291746 $this->staged_data['direct_debit_text'] = 'Wikimedia Foundation';
17301747
17311748 $this->staged_data['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
1732 - $this->data_constraints['IBAN']['length'] = 21;
17331749 $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
17341750 $this->var_map['COUNTRYCODEBANK'] = 'country';
17351751
 1752+ $this->dataConstraints['iban']['length'] = 21;
 1753+
17361754 // Direct debit has different required fields for each paymentproductid.
17371755 $this->addKeysToTransactionForSubmethod( $payment_submethod );
17381756 }
@@ -1758,55 +1776,72 @@
17591777
17601778 /* Bank transfer */
17611779 case 'bt':
 1780+
 1781+ // Brazil
 1782+ if ( $this->staged_data['country'] == 'BR' ) {
 1783+ $this->dataConstraints['direct_debit_text']['city'] = 50;
 1784+ }
 1785+
 1786+ // Korea - Manual does not specify North or South
 1787+ if ( $this->staged_data['country'] == 'KR' ) {
 1788+ $this->dataConstraints['direct_debit_text']['city'] = 50;
 1789+ }
17621790 $this->staged_data['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
17631791 $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
17641792 break;
17651793
17661794 /* Direct Debit */
17671795 case 'dd_nl':
1768 - $this->data_constraints['DIRECTDEBITTEXT']['length'] = 32;
 1796+ $this->dataConstraints['direct_debit_text']['length'] = 32;
17691797
1770 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1798+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
17711799 break;
17721800 case 'dd_gb':
17731801 $this->staged_data['transaction_type'] = '01';
17741802
1775 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1803+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
17761804 break;
17771805 case 'dd_at':
1778 - $this->data_constraints['DIRECTDEBITTEXT']['length'] = 28;
 1806+ $this->dataConstraints['direct_debit_text']['length'] = 28;
17791807
1780 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1808+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
17811809 break;
17821810 case 'dd_be':
17831811
1784 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1812+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
17851813 break;
17861814 case 'dd_ch':
17871815
1788 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1816+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
17891817 break;
17901818 case 'dd_de':
17911819
1792 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1820+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
17931821 break;
17941822 case 'dd_es':
1795 - $this->data_constraints['DIRECTDEBITTEXT']['length'] = 40;
 1823+ $this->dataConstraints['direct_debit_text']['length'] = 40;
17961824
1797 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1825+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
17981826 break;
17991827 case 'dd_fr':
1800 - $this->data_constraints['DIRECTDEBITTEXT']['length'] = 18;
 1828+ $this->dataConstraints['direct_debit_text']['length'] = 18;
18011829
1802 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1830+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
18031831 break;
18041832 case 'dd_it':
1805 - $this->data_constraints['BANKCHECKDIGIT']['length'] = 1;
1806 - $this->data_constraints['DIRECTDEBITTEXT']['length'] = 32;
 1833+ $this->dataConstraints['bank_check_digit']['length'] = 1;
 1834+ $this->dataConstraints['direct_debit_text']['length'] = 32;
18071835
1808 - $this->setup_stage_payment_method_for_direct_debit( $payment_submethod, $type);
 1836+ $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type);
18091837 break;
18101838
 1839+ /* Online bank transfer */
 1840+ case 'bpay':
 1841+ $this->staged_data['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid'];
 1842+ $this->var_map['PAYMENTPRODUCTID'] = 'payment_product';
 1843+ break;
 1844+
 1845+
18111846 /* Real time bank transfer */
18121847 case 'rtbt_nordea_sweden':
18131848 case 'rtbt_enets':
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
18141849 Merged /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.i18n.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -59,9 +59,6 @@
6060 return;
6161 }
6262
63 -
64 -
65 -
6663 $wgOut->addExtensionStyle(
6764 $wgExtensionAssetsPath . '/DonationInterface/gateway_forms/css/gateway.css?284' .
6865 $this->adapter->getGlobal( 'CSSVersion' ) );
@@ -104,12 +101,7 @@
105102 } //TODO: There really should be an else here.
106103 }
107104 }
108 - } else {
109 - if ( !$this->adapter->isCaching() ) {
110 - // if we're not caching, there's a token mismatch
111 - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' );
112 - }
113 - }
 105+ }
114106 }
115107
116108 /**
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
117109 Merged /trunk/extensions/DonationInterface/gateway_common/interface.i18n.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -102,6 +102,17 @@
103103 abstract class GatewayAdapter implements GatewayType {
104104
105105 /**
 106+ * $dataConstraints provides information on how to handle variables.
 107+ *
 108+ * <code>
 109+ * 'account_holder' => array( 'type' => 'alphanumeric', 'length' => 50, )
 110+ * </code>
 111+ *
 112+ * @var array $dataConstraints
 113+ */
 114+ protected $dataConstraints = array();
 115+
 116+ /**
106117 * $error_map maps gateway errors to client errors
107118 *
108119 * The index of each error should map to a translation:
@@ -219,6 +230,7 @@
220231 $this->defineTransactions();
221232 $this->defineErrorMap();
222233 $this->defineVarMap();
 234+ $this->defineDataConstraints();
223235 $this->defineAccountInfo();
224236 $this->defineReturnValueMap();
225237
@@ -309,24 +321,20 @@
310322 * @return boolean true if match, else false.
311323 */
312324 public function checkTokens() {
313 - if ( !$this->posted ) {
314 - //we don't care, because we can't possibly have a good one at this
315 - //point.
316 - //Additional: If we try for this before we're posted, the squid log
317 - //caching won't work.
318 - return true;
319 - } else {
320 - $checkResult = $this->dataObj->token_checkTokens();
 325+ $checkResult = $this->dataObj->token_checkTokens();
321326
322 - if ( $checkResult ) {
 327+ if ( $checkResult ) {
 328+ if ($this->dataObj->isCaching()){
 329+ $this->debugarray[] = 'Token Not Checked (Caching Enabled)';
 330+ } else {
323331 $this->debugarray[] = 'Token Match';
324 - } else {
325 - $this->debugarray[] = 'Token MISMATCH';
326332 }
 333+ } else {
 334+ $this->debugarray[] = 'Token MISMATCH';
 335+ }
327336
328 - $this->refreshGatewayValueFromSource( 'token' );
329 - return $checkResult;
330 - }
 337+ $this->refreshGatewayValueFromSource( 'token' );
 338+ return $checkResult;
331339 }
332340
333341 /**
@@ -1512,7 +1520,7 @@
15131521 * @param type $type Whatever types of staging you feel like having in your child class.
15141522 * ...but usually request and response. I think.
15151523 */
1516 - function stageData( $type = 'request' ) {
 1524+ protected function stageData( $type = 'request' ) {
15171525 $this->defineStagedVars();
15181526 $this->smooshVarsForStaging(); //yup, we do need to do this seperately.
15191527 //If we tried to piggyback off the same loop, all the vars wouldn't be ready, and some staging functions will require
@@ -1521,6 +1529,12 @@
15221530 $function_name = 'stage_' . $field;
15231531 $this->executeIfFunctionExists( $function_name, $type );
15241532 }
 1533+
 1534+ // Format the staged data
 1535+ if ($type === 'request'){
 1536+ $this->formatStagedData();
 1537+ }
 1538+
15251539 }
15261540
15271541 /**
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
@@ -87,6 +87,7 @@
8888 'gateway' => $wgRequest->getText( 'gateway' ), //likely to be reset shortly by setGateway();
8989 'owa_session' => $wgRequest->getText( 'owa_session', null ),
9090 'owa_ref' => $wgRequest->getText( 'owa_ref', null ),
 91+ 'descriptor' => $wgRequest->getText( 'descriptor', null ),
9192
9293 'account_name' => $wgRequest->getText( 'account_name', null ),
9394 'account_number' => $wgRequest->getText( 'account_number', null ),
@@ -357,11 +358,16 @@
358359 }
359360 }
360361
361 -
 362+ /**
 363+ * Tells us if we think we're in caching mode or not.
 364+ * @staticvar string $cache Keeps track of the mode so we don't have to
 365+ * calculate it from the data fields more than once.
 366+ * @return boolean true if we are going to be caching, false if we aren't.
 367+ */
362368 function isCaching(){
363 - //I think it's safe to static this here. I don't want to calc this every
364 - //time some outside object asks if we're caching.
 369+
365370 static $cache = null;
 371+
366372 if ( is_null( $cache ) ){
367373 if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.::
368374 if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){
@@ -372,6 +378,13 @@
373379 $cache = false;
374380 }
375381 }
 382+
 383+ //this business could change at any second, and it will prevent us from
 384+ //caching, so we're going to keep asking if it's set.
 385+ if (self::sessionExists()){
 386+ $cache = false;
 387+ }
 388+
376389 return $cache;
377390 }
378391
@@ -654,6 +667,13 @@
655668 static $match = null;
656669
657670 if ( $match === null ) {
 671+ if ( $this->isCaching() ){
 672+ //This makes sense.
 673+ //If all three conditions for caching are currently true, the
 674+ //last thing we want to do is screw it up by setting a session
 675+ //token before the page loads.
 676+ return true;
 677+ }
658678
659679 // establish the edit token to prevent csrf
660680 $token = $this->token_getSaltedSessionToken();
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
___________________________________________________________________
Modified: svn:mergeinfo
661681 Merged /trunk/extensions/DonationInterface/gateway_common/DonationData.php:r102338,102681,102685,102810,102828-102829,102832,102836,103244,103411,103413,103500,103503,103515,103608,103633,103775,103839
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/us-states.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
662682 Merged /trunk/extensions/DonationInterface/gateway_common/us-states.i18n.php:r102338,102342,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
663683 Merged /trunk/extensions/DonationInterface:r102338,102681,102685,102810,102828-102829,102832,102836,103024,103244,103246,103411,103413,103500,103503,103515,103608,103633,103775,103839

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102338Updating required fields for direct debit.jpostlethwaite22:31, 7 November 2011
r102681Implementing BPAY payment method.jpostlethwaite20:22, 10 November 2011
r102685Implemented Online bank transfer BPAY in GlobalCollectGateway.jpostlethwaite20:47, 10 November 2011
r102810Fixed wrong index on data_constraints. Changed method to camel case for codin...jpostlethwaite19:58, 11 November 2011
r102828Implemented defineDataConstraints() for PayFlowPro. At this time, it is merel...jpostlethwaite00:28, 12 November 2011
r102829Reordered methods defineErrorMap() and defineDataConstraints() for code clean...jpostlethwaite00:31, 12 November 2011
r102832Added variable $this->dataConstraints. Added method $this->formatStagedData()...jpostlethwaite00:43, 12 November 2011
r102836Bugfix for the session tokens and caching: The token was being handed out one...khorn01:12, 12 November 2011
r103024Preliminary steps toward a command-line solution for finding donations which ...khorn20:43, 14 November 2011
r103244Commented out optional fields for direct debit transactions. Translating erro...jpostlethwaite22:18, 15 November 2011
r103246Lots more work on the GlobalCollect command-line orphan rectifier....khorn22:23, 15 November 2011
r103411Adding eWallets to GlobalCollectGateway.jpostlethwaite23:31, 16 November 2011
r103413Adding descriptor field for eWallets.jpostlethwaite23:33, 16 November 2011
r103415Added eWallets: cashU, Moneybookers, PayPal and WebMoney.jpostlethwaite23:35, 16 November 2011
r103500Adding BPAY form for AUpgehres20:13, 17 November 2011
r103503GlobalCollect command-line orphan rectifier: Cleaning up some weird-o formatt...khorn20:23, 17 November 2011
r103514Fixing issue with currency JPY. The amount is floored for the last two digits.jpostlethwaite22:15, 17 November 2011
r103515Adding JCB to AU as well as JCB card logopgehres22:16, 17 November 2011
r103608adjustments to bpay result output to add logos and legal language. Add finish...jamesur19:53, 18 November 2011
r103633updating for new systemkaldari02:10, 19 November 2011
r103775Fix missing $wgScript...reedy19:06, 20 November 2011
r103837Localisation updates for core and extension messages from translatewiki.netraymond21:20, 21 November 2011
r103839Changes stageData to a protected function, to help prevent things like double...khorn21:33, 21 November 2011

Status & tagging log