Index: trunk/extensions/DonationInterface/tests/Adapter/GlobalCollect/BankTransferTestCase.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | require_once dirname( dirname( dirname( __FILE__ ) ) ) . DIRECTORY_SEPARATOR . 'DonationInterfaceTestCase.php'; |
26 | 26 | |
27 | 27 | /** |
28 | | - * |
| 28 | + * |
29 | 29 | * @group Fundraising |
30 | 30 | * @group Gateways |
31 | 31 | * @group DonationInterface |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | IBAN |
64 | 64 | CountryDescription |
65 | 65 | Notes |
66 | | - We do not need to have donor information stored on our side yet as long as it is sent to Global Collect |
| 66 | + We do not need to have donor information stored on our side yet as long as it is sent to Global Collect |
67 | 67 | */ |
68 | 68 | |
69 | 69 | /** |
— | — | @@ -80,12 +80,11 @@ |
81 | 81 | public function testbuildRequestXML() { |
82 | 82 | |
83 | 83 | global $wgGlobalCollectGatewayTest; |
84 | | - global $wgRequest; |
85 | | - |
| 84 | + |
86 | 85 | $wgGlobalCollectGatewayTest = true; |
87 | 86 | |
88 | 87 | $_SERVER = array(); |
89 | | - |
| 88 | + |
90 | 89 | $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; |
91 | 90 | $_SERVER['HTTP_HOST'] = TESTS_HOSTNAME; |
92 | 91 | $_SERVER['SERVER_NAME'] = TESTS_HOSTNAME; |
— | — | @@ -93,17 +92,17 @@ |
94 | 93 | |
95 | 94 | |
96 | 95 | $options = array(); |
97 | | - |
| 96 | + |
98 | 97 | $options['test'] = true; |
99 | 98 | $transactionType = 'BANK_TRANSFER'; |
100 | | - |
| 99 | + |
101 | 100 | $amount = 350; |
102 | | - |
| 101 | + |
103 | 102 | $options['postDefaults'] = array( |
104 | 103 | 'returnTitle' => true, |
105 | 104 | 'returnTo' => 'http://' . TESTS_HOSTNAME . '/index.php/Special:GlobalCollectGatewayResult', |
106 | 105 | ); |
107 | | - |
| 106 | + |
108 | 107 | $options['testData'] = array( |
109 | 108 | 'amount' => $amount, |
110 | 109 | 'transaction_type' => $transactionType, |
— | — | @@ -139,15 +138,15 @@ |
140 | 139 | 'owa_ref' => 'http://localhost/defaultTestData', |
141 | 140 | 'transaction_type' => '', // Used by GlobalCollect for payment types |
142 | 141 | ); |
143 | | - |
| 142 | + |
144 | 143 | $gateway = new GlobalCollectAdapter( $options ); |
145 | 144 | |
146 | 145 | $result = $gateway->do_transaction( $transactionType ); |
147 | | - |
| 146 | + |
148 | 147 | $request = trim( $gateway->buildRequestXML() ); |
149 | | - |
| 148 | + |
150 | 149 | $orderId = $gateway->getData( 'order_id' ); |
151 | | - |
| 150 | + |
152 | 151 | $expected = '<?xml version="1.0"?>' . "\n"; |
153 | 152 | $expected .= '<XML><REQUEST><ACTION>INSERT_ORDERWITHPAYMENT</ACTION><META><MERCHANTID>6570</MERCHANTID><VERSION>1.0</VERSION></META><PARAMS><ORDER><ORDERID>' . $orderId . '</ORDERID><AMOUNT>' . $amount * 100 . '</AMOUNT><CURRENCYCODE>EUR</CURRENCYCODE><LANGUAGECODE>en</LANGUAGECODE><COUNTRYCODE>ES</COUNTRYCODE><MERCHANTREFERENCE>' . $orderId . '</MERCHANTREFERENCE></ORDER><PAYMENT><PAYMENTPRODUCTID>11</PAYMENTPRODUCTID><AMOUNT>35000</AMOUNT><CURRENCYCODE>EUR</CURRENCYCODE><LANGUAGECODE>en</LANGUAGECODE><COUNTRYCODE>ES</COUNTRYCODE><HOSTEDINDICATOR>1</HOSTEDINDICATOR><RETURNURL>http://wikimedia-fundraising-1.17.localhost.wikimedia.org/index.php/Special:GlobalCollectGatewayResult?order_id=' . $orderId . '</RETURNURL><FIRSTNAME>Testy</FIRSTNAME><SURNAME>Testerton</SURNAME><STREET>123 Happy Street</STREET><CITY>Barcelona</CITY><STATE>XX</STATE><EMAIL>jpostlethwaite@wikimedia.org</EMAIL></PAYMENT></PARAMS></REQUEST></XML>'; |
154 | 153 | //$expected .= '<XML><REQUEST><ACTION>Donate</ACTION><ACCOUNT><MERCHANTID>128</MERCHANTID><PASSWORD>k4ftw</PASSWORD><VERSION>3.2</VERSION><RETURNURL>http://' . TESTS_HOSTNAME . '/index.php/Donate-thanks/en</RETURNURL></ACCOUNT><DONATION><DONOR>Tester Testington</DONOR><AMOUNT>35000</AMOUNT><CURRENCYCODE>USD</CURRENCYCODE><LANGUAGECODE>en</LANGUAGECODE><COUNTRYCODE>US</COUNTRYCODE></DONATION></REQUEST></XML>' . "\n"; |
— | — | @@ -181,29 +180,28 @@ |
182 | 181 | $this->markTestIncomplete( TESTS_MESSAGE_NOT_IMPLEMENTED ); |
183 | 182 | |
184 | 183 | global $wgGlobalCollectGatewayTest; |
185 | | - global $wgRequest; |
186 | | - |
| 184 | + |
187 | 185 | $wgGlobalCollectGatewayTest = true; |
188 | 186 | |
189 | 187 | $_SERVER = array(); |
190 | | - |
| 188 | + |
191 | 189 | $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; |
192 | 190 | $_SERVER['HTTP_HOST'] = TESTS_HOSTNAME; |
193 | 191 | $_SERVER['SERVER_NAME'] = TESTS_HOSTNAME; |
194 | 192 | $_SERVER['REQUEST_URI'] = '/index.php/Special:GlobalCollectGateway?form_name=TwoStepAmount'; |
195 | 193 | |
196 | 194 | $options = array(); |
197 | | - |
| 195 | + |
198 | 196 | $options['test'] = true; |
199 | 197 | $transactionType = 'BANK_TRANSFER'; |
200 | | - |
| 198 | + |
201 | 199 | $options['postDefaults'] = array( |
202 | 200 | 'returnTitle' => true, |
203 | 201 | 'returnTo' => 'http://' . TESTS_HOSTNAME . '/index.php/Special:GlobalCollectGatewayResult', |
204 | 202 | ); |
205 | 203 | |
206 | 204 | $amount = 350; |
207 | | - |
| 205 | + |
208 | 206 | $options['testData'] = array( |
209 | 207 | 'amount' => $amount, |
210 | 208 | 'transaction_type' => $transactionType, |
— | — | @@ -239,10 +237,10 @@ |
240 | 238 | 'owa_ref' => 'http://localhost/defaultTestData', |
241 | 239 | 'transaction_type' => '', // Used by GlobalCollect for payment types |
242 | 240 | ); |
243 | | - |
| 241 | + |
244 | 242 | $gateway = new GlobalCollectAdapter( $options ); |
245 | 243 | $result = $gateway->do_transaction( $transactionType ); |
246 | | - |
| 244 | + |
247 | 245 | $this->assertTrue( $result ); |
248 | 246 | } |
249 | 247 | } |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | */ |
9 | 9 | public function __construct() { |
10 | 10 | $this->adapter = new PayflowProAdapter(); |
11 | | - parent::__construct(); //the next layer up will know who we are. |
| 11 | + parent::__construct(); //the next layer up will know who we are. |
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
— | — | @@ -16,8 +16,7 @@ |
17 | 17 | * @param $par Mixed: parameter passed to the page or null |
18 | 18 | */ |
19 | 19 | public function execute( $par ) { |
20 | | - global $wgRequest, $wgOut, $wgExtensionAssetsPath; |
21 | | - $CSSVersion = $this->adapter->getGlobal( 'CSSVersion' ); |
| 20 | + global $wgRequest, $wgOut; |
22 | 21 | |
23 | 22 | // Hide unneeded interface elements |
24 | 23 | $wgOut->addModules( 'donationInterface.skinOverride' ); |
— | — | @@ -25,7 +24,7 @@ |
26 | 25 | $gateway_id = $this->adapter->getIdentifier(); |
27 | 26 | |
28 | 27 | $this->addErrorMessageScript(); |
29 | | - |
| 28 | + |
30 | 29 | $this->setHeaders(); |
31 | 30 | |
32 | 31 | /** |
— | — | @@ -38,8 +37,8 @@ |
39 | 38 | $this->paypalRedirect(); |
40 | 39 | return; |
41 | 40 | } |
42 | | - //TODO: This is short-circuiting what I really want to do here. |
43 | | - //so stop it. |
| 41 | + //TODO: This is short-circuiting what I really want to do here. |
| 42 | + //so stop it. |
44 | 43 | $data = $this->adapter->getDisplayData(); |
45 | 44 | |
46 | 45 | // dispatch forms/handling |
— | — | @@ -179,8 +178,8 @@ |
180 | 179 | * @param $responseMsg String: message supplied by getResults function |
181 | 180 | */ |
182 | 181 | function fnPayflowDisplayOtherResults( $responseMsg ) { |
183 | | - //I have collapsed it like this because the contents were identical. |
184 | | - //TODO: Determine if we need to be switching on anything else in the display here. |
| 182 | + //I have collapsed it like this because the contents were identical. |
| 183 | + //TODO: Determine if we need to be switching on anything else in the display here. |
185 | 184 | $this->fnPayflowDisplayDeclinedResults( $responseMsg ); |
186 | 185 | } |
187 | 186 | |
— | — | @@ -195,8 +194,8 @@ |
196 | 195 | } |
197 | 196 | |
198 | 197 | //TODO: Remember why the heck I decided to leave this here... |
199 | | - //arguably, it's because it's slightly more "view" related, but... still, shouldn't you get stashed |
200 | | - //in the new GatewayForm class so we can override in children if we feel like it? Odd. |
| 198 | + //arguably, it's because it's slightly more "view" related, but... still, shouldn't you get stashed |
| 199 | + //in the new GatewayForm class so we can override in children if we feel like it? Odd. |
201 | 200 | function addErrorMessageScript() { |
202 | 201 | global $wgOut; |
203 | 202 | $gateway_id = $this->adapter->getIdentifier(); |
Index: trunk/extensions/DonationInterface/extras/recaptcha/recaptcha.body.php |
— | — | @@ -19,8 +19,8 @@ |
20 | 20 | public function __construct( &$gateway_adapter ) { |
21 | 21 | parent::__construct( $gateway_adapter ); |
22 | 22 | |
23 | | - //stash all the vars that reCaptcha is going to need in a global just for it. |
24 | | - //I know this is vaguely unpleasant, but it's the quickest way back to zero. |
| 23 | + //stash all the vars that reCaptcha is going to need in a global just for it. |
| 24 | + //I know this is vaguely unpleasant, but it's the quickest way back to zero. |
25 | 25 | global $wgReCaptchaConfData; |
26 | 26 | $wgReCaptchaConfData['UseHTTPProxy'] = $this->gateway_adapter->getGlobal( 'RecaptchaUseHTTPProxy' ); |
27 | 27 | $wgReCaptchaConfData['HTTPProxy'] = $this->gateway_adapter->getGlobal( 'RecaptchaHTTPProxy' ); |
— | — | @@ -74,12 +74,12 @@ |
75 | 75 | // load up the form class |
76 | 76 | $form_class = $this->gateway_adapter->getFormClass(); |
77 | 77 | |
78 | | - //hmm. Looking at this now, makes me want to say |
| 78 | + //hmm. Looking at this now, makes me want to say |
79 | 79 | //TODO: Refactor the Form Class constructors. Again. Because the next three lines of code anger me deeply. |
80 | | - //#1 - all three things are clearly in the gateway adapter, and we're passing that already. |
81 | | - //#2 - I have to stuff them in variables because Form wants parameters by reference. |
| 80 | + //#1 - all three things are clearly in the gateway adapter, and we're passing that already. |
| 81 | + //#2 - I have to stuff them in variables because Form wants parameters by reference. |
82 | 82 | $data = $this->gateway_adapter->getData(); |
83 | | - $erros = $this->gateway_adapter->getValidationErrors(); |
| 83 | + $errors = $this->gateway_adapter->getValidationErrors(); |
84 | 84 | $form_obj = new $form_class( $data, $errors, $this->gateway_adapter ); |
85 | 85 | |
86 | 86 | // set the captcha HTML to use in the form |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepAmount.php |
— | — | @@ -24,19 +24,17 @@ |
25 | 25 | class Gateway_Form_TwoStepAmount extends Gateway_Form { |
26 | 26 | |
27 | 27 | public function __construct( &$form_data, &$form_errors, &$gateway ) { |
28 | | - global $wgOut; |
29 | | - |
30 | 28 | $form_data['payment_method'] = 'bt'; |
31 | 29 | $form_data['payment_submethod'] = 'bt'; |
32 | | - |
| 30 | + |
33 | 31 | //$form_data['payment_method'] = 'rtbt'; |
34 | 32 | //$form_data['payment_submethod'] = 'rtbt_nordea_sweeden'; |
35 | | - |
| 33 | + |
36 | 34 | //$form_data['payment_method'] = 'rtbt'; |
37 | 35 | //$form_data['payment_submethod'] = 'rtbt_ideal'; |
38 | 36 | //$form_data['issuerids'] = array(); |
39 | | - |
40 | | - |
| 37 | + |
| 38 | + |
41 | 39 | $form_data['process'] = 'other'; |
42 | 40 | parent::__construct( $form_data, $form_errors, $gateway ); |
43 | 41 | |
— | — | @@ -83,7 +81,7 @@ |
84 | 82 | output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n'; |
85 | 83 | } |
86 | 84 | } |
87 | | - |
| 85 | + |
88 | 86 | if (document.getElementById('fname').value == '$first') { |
89 | 87 | output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n'; |
90 | 88 | } |
— | — | @@ -102,7 +100,7 @@ |
103 | 101 | if( apos < 1 || dotpos-apos < 2 ) { |
104 | 102 | output += payflowproGatewayErrorMsgEmail; |
105 | 103 | } |
106 | | - |
| 104 | + |
107 | 105 | if( output ) { |
108 | 106 | alert( output ); |
109 | 107 | return false; |
— | — | @@ -114,7 +112,7 @@ |
115 | 113 | EOT; |
116 | 114 | $wgOut->addHeadItem( 'placeholders', $js ); |
117 | 115 | } |
118 | | - |
| 116 | + |
119 | 117 | /** |
120 | 118 | * Required method for constructing the entire form |
121 | 119 | * |
— | — | @@ -255,8 +253,6 @@ |
256 | 254 | } |
257 | 255 | |
258 | 256 | protected function generatePaymentFields() { |
259 | | - global $wgScriptPath; |
260 | | - |
261 | 257 | // amount |
262 | 258 | $form = '<tr>'; |
263 | 259 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter7.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class Gateway_Form_TwoColumnLetter7 extends Gateway_Form_OneStepTwoColumn { |
5 | | - |
| 5 | + |
6 | 6 | public function __construct( &$form_data, &$form_errors, &$gateway ) { |
7 | 7 | global $wgScriptPath; |
8 | 8 | |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | |
14 | 14 | parent::__construct( $form_data, $form_errors, $gateway ); |
15 | 15 | } |
16 | | - |
| 16 | + |
17 | 17 | public function loadPlaceholders() { |
18 | 18 | global $wgOut; |
19 | 19 | // form placeholder values |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | i, |
75 | 75 | output = '', |
76 | 76 | currField = ''; |
77 | | - |
| 77 | + |
78 | 78 | var doCheck = true; |
79 | 79 | if( typeof( document.payment.PaypalRedirect.value ) !== 'undefined' ) { |
80 | 80 | if( document.payment.PaypalRedirect.value == 1 ) { |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n'; |
90 | 90 | } |
91 | 91 | } |
92 | | - |
| 92 | + |
93 | 93 | if (document.getElementById('fname').value == '$first') { |
94 | 94 | output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n'; |
95 | 95 | } |
— | — | @@ -104,16 +104,16 @@ |
105 | 105 | if (document.getElementById('zip').value == '$zip') { |
106 | 106 | output += payflowproGatewayErrorMsgJs + ' zip code.\\r\\n'; |
107 | 107 | } |
108 | | - |
| 108 | + |
109 | 109 | // validate email address |
110 | 110 | var apos = document.payment.emailAdd.value.indexOf("@"); |
111 | 111 | var dotpos = document.payment.emailAdd.value.lastIndexOf("."); |
112 | | - |
| 112 | + |
113 | 113 | if( apos < 1 || dotpos-apos < 2 ) { |
114 | 114 | output += payflowproGatewayErrorMsgEmail; |
115 | 115 | } |
116 | 116 | } |
117 | | - |
| 117 | + |
118 | 118 | if( output ) { |
119 | 119 | alert( output ); |
120 | 120 | return false; |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | } |
194 | 194 | |
195 | 195 | protected function generateBillingFields() { |
196 | | - global $wgScriptPath, $wgRequest; |
| 196 | + global $wgScriptPath; |
197 | 197 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/gateway_forms/includes"; |
198 | 198 | |
199 | 199 | $form = ''; |
— | — | @@ -202,7 +202,7 @@ |
203 | 203 | $form .= '<td style="text-align:center;" colspan="2"><big><b>' . wfMsg( 'payflowpro_gateway-paypal-button' ) . '</b></big><br/><a href="#" onclick="document.payment.PaypalRedirect.value=1;document.payment.submit();"><img src="' . $scriptPath . '/paypal.png"/></a></td>'; |
204 | 204 | $form .= '</tr>'; |
205 | 205 | */ |
206 | | - |
| 206 | + |
207 | 207 | // amount |
208 | 208 | $otherChecked = false; |
209 | 209 | $amount = -1; |
— | — | @@ -215,7 +215,7 @@ |
216 | 216 | $form .= '</tr>'; |
217 | 217 | $form .= '<tr>'; |
218 | 218 | $form .= '<td class="label"><div style="padding-top:4px;">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</div></td>'; |
219 | | - $form .= '<td>' . |
| 219 | + $form .= '<td>' . |
220 | 220 | '<table cellspacing="3" cellpadding="0" border="0" style="margin-bottom:0.2em;"><tr>' . |
221 | 221 | '<td>'.Xml::radio( 'amount', 20, $this->form_data['amount'] == 20, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$20 '.'</td>'. |
222 | 222 | '<td>'.Xml::radio( 'amount', 35, $this->form_data['amount'] == 35, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$35 '.'</td>'. |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | '</tr></table>' . |
231 | 231 | '</td>'; |
232 | 232 | $form .= '</tr>'; |
233 | | - |
| 233 | + |
234 | 234 | // email opt-in |
235 | 235 | /* |
236 | 236 | $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'email-opt' ] : true; |
— | — | @@ -247,32 +247,32 @@ |
248 | 248 | // Payment type |
249 | 249 | $form .= '<tr>'; |
250 | 250 | $form .= '<td class="label""><div style="padding-top:9px;">' . wfMsg( 'payflowpro_gateway-payment-type' ) . '</div></td>'; |
251 | | - $form .= '<td>' . |
| 251 | + $form .= '<td>' . |
252 | 252 | '<p style="border: 1px solid rgb(187, 187, 187); float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0 8px 0 0; padding: 5px 5px 5px 3px; white-space: nowrap;">'. |
253 | 253 | Xml::radio( 'card_type', 'cc1', $this->form_data['card_type'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png" ) ). '</label>' . |
254 | 254 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" ) ). '</label>' . |
255 | 255 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-amex.png" ) ). '</label>' . |
256 | | - ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png" ) ). '</label>' . |
| 256 | + ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png" ) ). '</label>' . |
257 | 257 | '</p>'. |
258 | 258 | '<p style="border: 1px solid transparent; float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0; padding: 5px 5px 5px 3px; white-space: nowrap;">'. |
259 | 259 | Xml::radio( 'card_type', 'pp', $this->form_data['card_type'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png" ) ) . '</label>' . |
260 | 260 | '</p>'. |
261 | 261 | '</td>'; |
262 | 262 | $form .= '</tr>'; |
263 | | - |
| 263 | + |
264 | 264 | $form .= '</table>'; |
265 | | - |
| 265 | + |
266 | 266 | if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
267 | 267 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
268 | 268 | } else { |
269 | 269 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc', 'style' => 'display: none;' ) ); |
270 | 270 | } |
271 | | - |
| 271 | + |
272 | 272 | $form .= '<tr>'; |
273 | | - $form .= '<td colspan="2"><h3 class="cc_header">' . wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) . |
| 273 | + $form .= '<td colspan="2"><h3 class="cc_header">' . wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) . |
274 | 274 | Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-left:8px;' ) ) . '</h3></td>'; |
275 | 275 | $form .= '</tr>'; |
276 | | - |
| 276 | + |
277 | 277 | // card number |
278 | 278 | $form .= $this->getCardNumberField(); |
279 | 279 | |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>'; |
283 | 283 | $form .= '<td>' . $this->generateExpiryMonthDropdown() . ' / ' . $this->generateExpiryYearDropdown() . '</td>'; |
284 | 284 | $form .= '</tr>'; |
285 | | - |
| 285 | + |
286 | 286 | // cvv |
287 | 287 | $form .= $this->getCvvField(); |
288 | 288 | |
— | — | @@ -331,7 +331,7 @@ |
332 | 332 | $form .= '<td>' . $this->generateCountryDropdown() . '</td>'; |
333 | 333 | $form .= '</tr>'; |
334 | 334 | */ |
335 | | - |
| 335 | + |
336 | 336 | // email |
337 | 337 | $form .= '<tr>'; |
338 | 338 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['emailAdd'] . '</span></td>'; |
— | — | @@ -358,7 +358,7 @@ |
359 | 359 | |
360 | 360 | public function generateFormSubmit() { |
361 | 361 | global $wgScriptPath; |
362 | | - |
| 362 | + |
363 | 363 | // cc submit button |
364 | 364 | if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
365 | 365 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-right:4px;' ) ) . 'Your donation will be securely processed.'; |
374 | 374 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-submessage |
375 | 375 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
376 | | - |
| 376 | + |
377 | 377 | // paypal submit button |
378 | 378 | if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
379 | 379 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal', 'style' => 'display: none;' ) ); |
— | — | @@ -410,9 +410,7 @@ |
411 | 411 | } |
412 | 412 | |
413 | 413 | public function generateDonationFooter() { |
414 | | - global $wgScriptPath; |
415 | | - $form = ''; |
416 | | - $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
| 414 | + $form = Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
417 | 415 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) ); |
418 | 416 | $form .= Xml::tags( 'div', array( 'style' => 'text-align:center;' ), '* * *' ); |
419 | 417 | $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ); |
— | — | @@ -422,7 +420,7 @@ |
423 | 421 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info |
424 | 422 | return $form; |
425 | 423 | } |
426 | | - |
| 424 | + |
427 | 425 | public function generateStateDropdown() { |
428 | 426 | require_once( dirname( __FILE__ ) . '/../includes/stateAbbreviations.inc' ); |
429 | 427 | |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremium.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function generateFormStart() { |
17 | | - global $wgOut, $wgRequest, $wgScriptPath; |
| 17 | + global $wgRequest, $wgScriptPath; |
18 | 18 | |
19 | 19 | $form = parent::generateBannerHeader(); |
20 | 20 | |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | |
145 | 145 | // country |
146 | 146 | $form .= $this->getCountryField( $this->form_data[ 'country2' ] ); |
147 | | - |
| 147 | + |
148 | 148 | /* |
149 | 149 | $form .= '<tr>'; |
150 | 150 | $form .= '<td colspan="2"><span class="creditcard-error-msg"></span></td>'; |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | $form .= '<tr>'; |
153 | 153 | $form .= '<td colspan="2"><label for="shipping"><input id="shipping" name="shipping" type="checkbox" checked="checked"/> '.wfMsg( 'payflowpro_gateway-shipping-address-same' ).'</label></td>'; |
154 | 154 | $form .= '</tr>'; |
155 | | - |
| 155 | + |
156 | 156 | $form .= '<tr>'; |
157 | 157 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['country2'] . '</span></td>'; |
158 | 158 | $form .= '</tr>'; |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | foreach ( $hidden_fields as $field => $value ) { |
176 | 176 | $form .= Html::hidden( $field, $value ); |
177 | 177 | } |
178 | | - |
| 178 | + |
179 | 179 | // Temporary |
180 | 180 | $form .= Html::hidden( 'country2', $this->form_data[ 'country2' ] ); |
181 | 181 | |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumn.php |
— | — | @@ -3,8 +3,6 @@ |
4 | 4 | class Gateway_Form_TwoStepTwoColumn extends Gateway_Form { |
5 | 5 | |
6 | 6 | public function __construct( &$form_data, &$form_errors, &$gateway ) { |
7 | | - global $wgOut; |
8 | | - |
9 | 7 | parent::__construct( $form_data, $form_errors, $gateway ); |
10 | 8 | // load validation and placeholder JS |
11 | 9 | $this->loadValidateJs(); |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | $this->loadvalidateJs(); |
13 | 13 | parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | | - |
| 15 | + |
16 | 16 | public function loadPlaceholders() { |
17 | 17 | global $wgOut; |
18 | 18 | // form placeholder values |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n'; |
70 | 70 | } |
71 | 71 | } |
72 | | - |
| 72 | + |
73 | 73 | if (document.getElementById('fname').value == '$first') { |
74 | 74 | output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n'; |
75 | 75 | } |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | if (document.getElementById('zip').value == '$zip') { |
86 | 86 | output += payflowproGatewayErrorMsgJs + ' zip code.\\r\\n'; |
87 | 87 | } |
88 | | - |
| 88 | + |
89 | 89 | var stateField = document.getElementById( 'state' ); |
90 | 90 | if( stateField.options[stateField.selectedIndex].value == '' ) { |
91 | 91 | output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgState'] + '.\\r\\n'; |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | if( apos < 1 || dotpos-apos < 2 ) { |
99 | 99 | output += payflowproGatewayErrorMsgEmail; |
100 | 100 | } |
101 | | - |
| 101 | + |
102 | 102 | if( output ) { |
103 | 103 | alert( output ); |
104 | 104 | return false; |
— | — | @@ -155,17 +155,17 @@ |
156 | 156 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
157 | 157 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
158 | 158 | $form .= $this->generateBillingFields(); |
159 | | - |
| 159 | + |
160 | 160 | return $form; |
161 | 161 | } |
162 | | - |
| 162 | + |
163 | 163 | public function generateFormSubmit() { |
164 | 164 | global $wgScriptPath; |
165 | | - |
| 165 | + |
166 | 166 | $form = '<tr>'; |
167 | 167 | $form .= '<td class="label"> </td>'; |
168 | 168 | $form .= '<td>'; |
169 | | - |
| 169 | + |
170 | 170 | // submit button |
171 | 171 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
172 | 172 | // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
176 | 176 | Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-right:4px;' ) ) . 'Your credit / debit card will be securely processed.'; |
177 | 177 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-submessage |
178 | | - |
| 178 | + |
179 | 179 | $form .= '</td>'; |
180 | 180 | $form .= '</tr>'; |
181 | 181 | return $form; |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | global $wgScriptPath; |
194 | 194 | |
195 | 195 | $form = ''; |
196 | | - |
| 196 | + |
197 | 197 | // amount |
198 | 198 | $form .= '<tr>'; |
199 | 199 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
— | — | @@ -207,19 +207,19 @@ |
208 | 208 | $form .= '</tr>'; |
209 | 209 | $form .= '<tr>'; |
210 | 210 | $form .= '<td class="amount_data">'.wfMsg( 'payflowpro_gateway-donation' ).'</td>'; |
211 | | - $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data['amount'] . |
212 | | - Html::hidden( 'amount', $this->form_data['amount'] ) . |
| 211 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data['amount'] . |
| 212 | + Html::hidden( 'amount', $this->form_data['amount'] ) . |
213 | 213 | '</td>'; |
214 | 214 | $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data[ 'currency' ] . |
215 | | - Html::hidden( 'currency_code', $this->form_data['currency'] ) . |
| 215 | + Html::hidden( 'currency_code', $this->form_data['currency'] ) . |
216 | 216 | '</td>'; |
217 | 217 | $form .= '</tr>'; |
218 | 218 | $form .= '</table>'; |
219 | 219 | $form .= '</td>'; |
220 | 220 | $form .= '</tr>'; |
221 | | - |
| 221 | + |
222 | 222 | $form .= '<tr>'; |
223 | | - $form .= '<td colspan="2"><h3 class="cc_header">' . wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) . |
| 223 | + $form .= '<td colspan="2"><h3 class="cc_header">' . wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) . |
224 | 224 | Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-left:8px;' ) ) . '</h3></td>'; |
225 | 225 | $form .= '</tr>'; |
226 | 226 | |
— | — | @@ -232,7 +232,7 @@ |
233 | 233 | $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos3.gif" ) ) . '</td>'; |
234 | 234 | } |
235 | 235 | $form .= '</tr>'; |
236 | | - |
| 236 | + |
237 | 237 | // card number |
238 | 238 | $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data[ 'card_num' ] : ''; |
239 | 239 | $form .= ''; |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>'; |
259 | 259 | $form .= '<td>' . $this->generateExpiryMonthDropdown() . ' / ' . $this->generateExpiryYearDropdown() . '</td>'; |
260 | 260 | $form .= '</tr>'; |
261 | | - |
| 261 | + |
262 | 262 | // cvv |
263 | 263 | $form .= $this->getCvvField(); |
264 | 264 | |
— | — | @@ -307,7 +307,7 @@ |
308 | 308 | $form .= '<td>' . $this->generateCountryDropdown() . '</td>'; |
309 | 309 | $form .= '</tr>'; |
310 | 310 | */ |
311 | | - |
| 311 | + |
312 | 312 | // email |
313 | 313 | $form .= '<tr>'; |
314 | 314 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['emailAdd'] . '</span></td>'; |
— | — | @@ -339,11 +339,9 @@ |
340 | 340 | $form .= Xml::closeElement( 'table' ); |
341 | 341 | return $form; |
342 | 342 | } |
343 | | - |
| 343 | + |
344 | 344 | public function generateDonationFooter() { |
345 | | - global $wgScriptPath; |
346 | | - $form = ''; |
347 | | - $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
| 345 | + $form = Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
348 | 346 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) ); |
349 | 347 | $form .= Xml::tags( 'div', array( 'style' => 'text-align:center;' ), '* * *' ); |
350 | 348 | $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ); |
— | — | @@ -353,7 +351,7 @@ |
354 | 352 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info |
355 | 353 | return $form; |
356 | 354 | } |
357 | | - |
| 355 | + |
358 | 356 | public function generateStateDropdown() { |
359 | 357 | require_once( dirname( __FILE__ ) . '/includes/stateAbbreviations.inc' ); |
360 | 358 | |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremiumUS.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | |
13 | 13 | parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | | - |
| 15 | + |
16 | 16 | public function loadPlaceholders() { |
17 | 17 | global $wgOut; |
18 | 18 | // form placeholder values |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n'; |
74 | 74 | } |
75 | 75 | } |
76 | | - |
| 76 | + |
77 | 77 | if (document.getElementById('fname').value == '$first') { |
78 | 78 | output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n'; |
79 | 79 | } |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | if (document.getElementById('zip').value == '$zip') { |
90 | 90 | output += payflowproGatewayErrorMsgJs + ' zip code.\\r\\n'; |
91 | 91 | } |
92 | | - |
| 92 | + |
93 | 93 | var stateField = document.getElementById( 'state' ); |
94 | 94 | if( stateField.options[stateField.selectedIndex].value == '' ) { |
95 | 95 | output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgState'] + '.\\r\\n'; |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | if( apos < 1 || dotpos-apos < 2 ) { |
103 | 103 | output += payflowproGatewayErrorMsgEmail; |
104 | 104 | } |
105 | | - |
| 105 | + |
106 | 106 | if( output ) { |
107 | 107 | alert( output ); |
108 | 108 | return false; |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | } |
115 | 115 | |
116 | 116 | public function generateFormStart() { |
117 | | - global $wgOut, $wgRequest, $wgScriptPath; |
| 117 | + global $wgRequest, $wgScriptPath; |
118 | 118 | |
119 | 119 | $form = parent::generateBannerHeader(); |
120 | 120 | |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | global $wgScriptPath; |
179 | 179 | |
180 | 180 | $form = ''; |
181 | | - |
| 181 | + |
182 | 182 | // amount |
183 | 183 | $form .= '<tr>'; |
184 | 184 | $form .= '<td colspan="2">'; |
— | — | @@ -189,19 +189,19 @@ |
190 | 190 | $form .= '</tr>'; |
191 | 191 | $form .= '<tr>'; |
192 | 192 | $form .= '<td class="amount_data">'.wfMsg( 'payflowpro_gateway-donation' ).'</td>'; |
193 | | - $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data['amount'] . |
194 | | - Html::hidden( 'amount', $this->form_data['amount'] ) . |
| 193 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data['amount'] . |
| 194 | + Html::hidden( 'amount', $this->form_data['amount'] ) . |
195 | 195 | '</td>'; |
196 | 196 | $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data[ 'currency' ] . |
197 | | - Html::hidden( 'currency_code', $this->form_data['currency'] ) . |
| 197 | + Html::hidden( 'currency_code', $this->form_data['currency'] ) . |
198 | 198 | '</td>'; |
199 | 199 | $form .= '</tr>'; |
200 | 200 | $form .= '</table>'; |
201 | 201 | $form .= '</td>'; |
202 | 202 | $form .= '</tr>'; |
203 | | - |
| 203 | + |
204 | 204 | $form .= '<tr>'; |
205 | | - $form .= '<td colspan="2"><h3 class="cc_header">' . wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) . |
| 205 | + $form .= '<td colspan="2"><h3 class="cc_header">' . wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) . |
206 | 206 | Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-left:8px;' ) ) . '</h3></td>'; |
207 | 207 | $form .= '</tr>'; |
208 | 208 | |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos3.gif" ) ) . '</td>'; |
216 | 216 | } |
217 | 217 | $form .= '</tr>'; |
218 | | - |
| 218 | + |
219 | 219 | // card number |
220 | 220 | $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data[ 'card_num' ] : ''; |
221 | 221 | $form .= ''; |
— | — | @@ -239,7 +239,7 @@ |
240 | 240 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>'; |
241 | 241 | $form .= '<td>' . $this->generateExpiryMonthDropdown() . ' / ' . $this->generateExpiryYearDropdown() . '</td>'; |
242 | 242 | $form .= '</tr>'; |
243 | | - |
| 243 | + |
244 | 244 | // cvv |
245 | 245 | $form .= $this->getCvvField(); |
246 | 246 | |
— | — | @@ -287,7 +287,7 @@ |
288 | 288 | $form .= '<td class="label"> </td>'; |
289 | 289 | $form .= '<td>' . $this->generateCountryDropdown( $this->form_data['country2'] ) . '</td>'; |
290 | 290 | $form .= '</tr>'; |
291 | | - |
| 291 | + |
292 | 292 | // email |
293 | 293 | $form .= '<tr>'; |
294 | 294 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['emailAdd'] . '</span></td>'; |
— | — | @@ -319,11 +319,9 @@ |
320 | 320 | $form .= Xml::closeElement( 'table' ); |
321 | 321 | return $form; |
322 | 322 | } |
323 | | - |
| 323 | + |
324 | 324 | public function generateDonationFooter() { |
325 | | - global $wgScriptPath; |
326 | | - $form = ''; |
327 | | - $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
| 325 | + $form = Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
328 | 326 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) ); |
329 | 327 | $form .= Xml::tags( 'div', array( 'style' => 'text-align:center;' ), '* * *' ); |
330 | 328 | $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ); |
— | — | @@ -333,7 +331,7 @@ |
334 | 332 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info |
335 | 333 | return $form; |
336 | 334 | } |
337 | | - |
| 335 | + |
338 | 336 | public function generateStateDropdown() { |
339 | 337 | require_once( dirname( __FILE__ ) . '/../includes/stateAbbreviations.inc' ); |
340 | 338 | |
Index: trunk/extensions/DonationInterface/gateway_forms/OneStepTwoColumn.php |
— | — | @@ -4,8 +4,6 @@ |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | 7 | public function __construct( &$form_data, &$form_errors, &$gateway ) { |
8 | | - global $wgOut; |
9 | | - |
10 | 8 | parent::__construct( $form_data, $form_errors, $gateway ); |
11 | 9 | |
12 | 10 | // update the list of hidden fields we need to use in this form. |
— | — | @@ -18,7 +16,7 @@ |
19 | 17 | |
20 | 18 | $this->loadPlaceholders(); |
21 | 19 | } |
22 | | - |
| 20 | + |
23 | 21 | public function loadPlaceholders() { |
24 | 22 | global $wgOut; |
25 | 23 | // form placeholder values |
— | — | @@ -55,14 +53,14 @@ |
56 | 54 | i, |
57 | 55 | output = '', |
58 | 56 | currField = ''; |
59 | | - |
| 57 | + |
60 | 58 | var doCheck = true; |
61 | 59 | if( typeof( document.payment.PaypalRedirect.value ) !== 'undefined' ) { |
62 | 60 | if( document.payment.PaypalRedirect.value == 1 ) { |
63 | 61 | doCheck = false; |
64 | 62 | } |
65 | 63 | } |
66 | | - |
| 64 | + |
67 | 65 | if( doCheck ) { |
68 | 66 | for( i = 0; i < numFields; i++ ) { |
69 | 67 | if( document.getElementById( fields[i] ).value == '' ) { |
— | — | @@ -70,23 +68,23 @@ |
71 | 69 | output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n'; |
72 | 70 | } |
73 | 71 | } |
74 | | - |
| 72 | + |
75 | 73 | if (document.getElementById('fname').value == '$first') { |
76 | 74 | output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n'; |
77 | 75 | } |
78 | 76 | if (document.getElementById('lname').value == '$last') { |
79 | 77 | output += payflowproGatewayErrorMsgJs + ' last name.\\r\\n'; |
80 | 78 | } |
81 | | - |
| 79 | + |
82 | 80 | // validate email address |
83 | 81 | var apos = document.payment.emailAdd.value.indexOf("@"); |
84 | 82 | var dotpos = document.payment.emailAdd.value.lastIndexOf("."); |
85 | | - |
| 83 | + |
86 | 84 | if( apos < 1 || dotpos-apos < 2 ) { |
87 | 85 | output += payflowproGatewayErrorMsgEmail; |
88 | 86 | } |
89 | 87 | } |
90 | | - |
| 88 | + |
91 | 89 | if( output ) { |
92 | 90 | alert( output ); |
93 | 91 | return false; |
Index: trunk/extensions/DonationInterface/gateway_common/donation.api.php |
— | — | @@ -7,12 +7,10 @@ |
8 | 8 | class DonationApi extends ApiBase { |
9 | 9 | var $donationData, $gateway; |
10 | 10 | public function execute() { |
11 | | - global $wgRequest, $wgParser; |
12 | | - |
13 | 11 | $this->donationData = $this->extractRequestParams(); |
14 | | - |
| 12 | + |
15 | 13 | $this->gateway = $this->donationData['gateway']; |
16 | | - |
| 14 | + |
17 | 15 | // If you want to test with fake data, pass a 'test' param set to true. |
18 | 16 | // You still have to set the gateway you are testing though. |
19 | 17 | // It looks like this only works if the Test global variable for that gateway is true. |
— | — | @@ -21,9 +19,9 @@ |
22 | 20 | } else { |
23 | 21 | // If we need to do any local data munging do it here. |
24 | 22 | } |
25 | | - |
| 23 | + |
26 | 24 | $method = $this->donationData['payment_method']; |
27 | | - |
| 25 | + |
28 | 26 | if ( $this->gateway == 'payflowpro' ) { |
29 | 27 | $gatewayObj = new PayflowProAdapter(); |
30 | 28 | switch ( $method ) { |
— | — | @@ -44,12 +42,12 @@ |
45 | 43 | } else { |
46 | 44 | $this->dieUsage( "Invalid gateway <<<$gateway>>> passed to Donation API.", 'unknown_gateway' ); |
47 | 45 | } |
48 | | - |
| 46 | + |
49 | 47 | //$normalizedData = $gatewayObj->getData(); |
50 | 48 | $outputResult = array(); |
51 | 49 | $outputResult['message'] = $result['message']; |
52 | 50 | $outputResult['status'] = $result['status']; |
53 | | - |
| 51 | + |
54 | 52 | if ( array_key_exists( 'data', $result ) ) { |
55 | 53 | if ( array_key_exists( 'PAYMENT', $result['data'] ) |
56 | 54 | && array_key_exists( 'RETURNURL', $result['data']['PAYMENT'] ) ) |
— | — | @@ -66,12 +64,12 @@ |
67 | 65 | if ( $result['errors'] ) { |
68 | 66 | $outputResult['errors'] = $result['errors']; |
69 | 67 | } |
70 | | - |
| 68 | + |
71 | 69 | if ( $this->donationData ) { |
72 | 70 | $this->getResult()->addValue( null, 'request', $this->donationData ); |
73 | 71 | } |
74 | 72 | $this->getResult()->addValue( null, 'result', $outputResult ); |
75 | | - |
| 73 | + |
76 | 74 | /* |
77 | 75 | $this->getResult()->setIndexedTagName( $result, 'response' ); |
78 | 76 | $this->getResult()->addValue( 'data', 'result', $result ); |
— | — | @@ -101,7 +99,7 @@ |
102 | 100 | 'language' => $this->defineParam( false ), |
103 | 101 | ); |
104 | 102 | } |
105 | | - |
| 103 | + |
106 | 104 | private function defineParam( $required = false, $type = 'string' ) { |
107 | 105 | if ( $required ) { |
108 | 106 | $param = array( ApiBase::PARAM_TYPE => $type, ApiBase::PARAM_REQUIRED => true ); |
— | — | @@ -110,7 +108,7 @@ |
111 | 109 | } |
112 | 110 | return $param; |
113 | 111 | } |
114 | | - |
| 112 | + |
115 | 113 | private function populateTestData() { |
116 | 114 | $this->donationData = array( |
117 | 115 | 'gateway' => $this->gateway, |
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | $this->populateData_Test( $testdata ); |
27 | 27 | } else { |
28 | 28 | $this->normalized = array( |
29 | | - 'posted' => 'true', //moderately sneaky. |
| 29 | + 'posted' => 'true', //moderately sneaky. |
30 | 30 | 'amount' => $wgRequest->getText( 'amount', null ), |
31 | 31 | 'amountGiven' => $wgRequest->getText( 'amountGiven', null ), |
32 | 32 | 'amountOther' => $wgRequest->getText( 'amountOther', null ), |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | 'comment-option' => $wgRequest->getText( 'comment-option' ), |
73 | 73 | 'comment' => $wgRequest->getText( 'comment' ), |
74 | 74 | 'email-opt' => $wgRequest->getText( 'email-opt' ), |
75 | | - // test_string has been disabled - may no longer be needed. |
| 75 | + // test_string has been disabled - may no longer be needed. |
76 | 76 | //'test_string' => $wgRequest->getText( 'process' ), // for showing payflow string during testing |
77 | 77 | '_cache_' => $wgRequest->getText( '_cache_', null ), |
78 | 78 | 'token' => $wgRequest->getText( 'token', null ), |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | 'comment-option' => $wgRequest->getText( 'comment-option' ), |
165 | 165 | 'comment' => $wgRequest->getText( 'comment' ), |
166 | 166 | 'email-opt' => $wgRequest->getText( 'email-opt' ), |
167 | | - // test_string has been disabled - may no longer be needed. |
| 167 | + // test_string has been disabled - may no longer be needed. |
168 | 168 | //'test_string' => $wgRequest->getText( 'process' ), |
169 | 169 | 'token' => '', |
170 | 170 | 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ), |
— | — | @@ -228,17 +228,17 @@ |
229 | 229 | } |
230 | 230 | |
231 | 231 | function setOwaRefId() { |
232 | | - //Our data should already be pulled and whatever. |
| 232 | + //Our data should already be pulled and whatever. |
233 | 233 | if ( $this->isSomething( 'owa_ref' ) && !is_numeric( $this->normalized['owa_ref'] ) ) { |
234 | 234 | $owa_ref = $this->get_owa_ref_id( $owa_ref ); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
238 | 238 | function setNormalizedOrderIDs() { |
239 | | - //basically, we need a new order_id every time we come through here, but if there's an internal already there, |
240 | | - //we want to use that one internally. So. |
241 | | - //Exception: If we pass in an order ID in the querystring: Don't mess with it. |
242 | | - //TODO: I'm pretty sure I'm not supposed to do this directly. |
| 239 | + //basically, we need a new order_id every time we come through here, but if there's an internal already there, |
| 240 | + //we want to use that one internally. So. |
| 241 | + //Exception: If we pass in an order ID in the querystring: Don't mess with it. |
| 242 | + //TODO: I'm pretty sure I'm not supposed to do this directly. |
243 | 243 | if ( array_key_exists( 'order_id', $_GET ) ) { |
244 | 244 | $this->setVal( 'order_id', $_GET['order_id'] ); |
245 | 245 | $this->setVal( 'i_order_id', $_GET['order_id'] ); |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
256 | | - * Generate an order id exactly once for this go-round. |
| 256 | + * Generate an order id exactly once for this go-round. |
257 | 257 | */ |
258 | 258 | function generateOrderId() { |
259 | 259 | static $order_id = null; |
— | — | @@ -264,9 +264,9 @@ |
265 | 265 | |
266 | 266 | /** |
267 | 267 | * Sanitize user input |
268 | | - * |
| 268 | + * |
269 | 269 | * Intended to be used with something like array_walk |
270 | | - * |
| 270 | + * |
271 | 271 | * @param $value The value of the array |
272 | 272 | * @param $key The key of the array |
273 | 273 | * @param $flags The flag constant for htmlspecialchars |
— | — | @@ -282,7 +282,7 @@ |
283 | 283 | $c::log( $message, $log_level ); |
284 | 284 | } |
285 | 285 | } |
286 | | - |
| 286 | + |
287 | 287 | function getGatewayIdentifier() { |
288 | 288 | $c = $this->getAdapterClass(); |
289 | 289 | if ( $c && is_callable( array( $c, 'getIdentifier' ) ) ){ |
— | — | @@ -291,7 +291,7 @@ |
292 | 292 | return 'DonationData'; |
293 | 293 | } |
294 | 294 | } |
295 | | - |
| 295 | + |
296 | 296 | function getGatewayGlobal( $varname ) { |
297 | 297 | $c = $this->getAdapterClass(); |
298 | 298 | if ( $c && is_callable( array( $c, 'getGlobal' ) ) ){ |
— | — | @@ -308,13 +308,11 @@ |
309 | 309 | } |
310 | 310 | |
311 | 311 | function doCacheStuff() { |
312 | | - //TODO: Wow, name. |
313 | | - global $wgRequest; |
314 | | - |
| 312 | + //TODO: Wow, name. |
315 | 313 | // if _cache_ is requested by the user, do not set a session/token; dynamic data will be loaded via ajax |
316 | 314 | if ( $this->isSomething( '_cache_' ) ) { |
317 | 315 | self::log( $this->getAnnoyingOrderIDLogLinePrefix() . ' Cache requested', LOG_DEBUG ); |
318 | | - $this->cache = true; //TODO: If we don't need this, kill it in the face. |
| 316 | + $this->cache = true; //TODO: If we don't need this, kill it in the face. |
319 | 317 | $this->setVal( 'token', 'cache' ); |
320 | 318 | |
321 | 319 | // if we have squid caching enabled, set the maxage |
— | — | @@ -326,12 +324,12 @@ |
327 | 325 | $wgOut->setSquidMaxage( $maxAge ); |
328 | 326 | } |
329 | 327 | } else { |
330 | | - $this->cache = false; //TODO: Kill this one in the face, too. (see above) |
| 328 | + $this->cache = false; //TODO: Kill this one in the face, too. (see above) |
331 | 329 | } |
332 | 330 | } |
333 | 331 | |
334 | 332 | function getAnnoyingOrderIDLogLinePrefix() { |
335 | | - //TODO: ...aww. But it's so descriptive. |
| 333 | + //TODO: ...aww. But it's so descriptive. |
336 | 334 | return $this->getVal( 'order_id' ) . ' ' . $this->getVal( 'i_order_id' ) . ': '; |
337 | 335 | } |
338 | 336 | |
— | — | @@ -403,7 +401,7 @@ |
404 | 402 | */ |
405 | 403 | function unsetEditToken() { |
406 | 404 | $gateway_ident = $this->gatewayID; |
407 | | - |
| 405 | + |
408 | 406 | if ( isset( $_SESSION ) && isset( $_SESSION[$gateway_ident . 'EditToken'] ) ){ |
409 | 407 | unset( $_SESSION[$gateway_ident . 'EditToken'] ); |
410 | 408 | } |
— | — | @@ -440,7 +438,7 @@ |
441 | 439 | $this->log( $this->getAnnoyingOrderIDLogLinePrefix() . ' editToken: ' . $token, LOG_DEBUG ); |
442 | 440 | |
443 | 441 | // match token |
444 | | - $token_check = ( $this->isSomething( 'token' ) ) ? $this->getVal( 'token' ) : $token; //TODO: does this suck as much as it looks like it does? |
| 442 | + $token_check = ( $this->isSomething( 'token' ) ) ? $this->getVal( 'token' ) : $token; //TODO: does this suck as much as it looks like it does? |
445 | 443 | $match = $this->matchEditToken( $token_check, $salt ); |
446 | 444 | if ( $wgRequest->wasPosted() ) { |
447 | 445 | $this->log( $this->getAnnoyingOrderIDLogLinePrefix() . ' Submitted edit token: ' . $this->getVal( 'token' ), LOG_DEBUG ); |
— | — | @@ -522,8 +520,8 @@ |
523 | 521 | * because the form elements for comment anonymization and email opt-out |
524 | 522 | * are backwards (they are really opt-in) relative to contribution_tracking |
525 | 523 | * (which is opt-out), we need to reverse the values. |
526 | | - * NOTE: If you prune here, and there is a paypal redirect, you will have |
527 | | - * problems with the email-opt/optout and comment-option/anonymous. |
| 524 | + * NOTE: If you prune here, and there is a paypal redirect, you will have |
| 525 | + * problems with the email-opt/optout and comment-option/anonymous. |
528 | 526 | */ |
529 | 527 | function setNormalizedOptOuts( $prune = false ) { |
530 | 528 | $optout['optout'] = ( $this->isSomething( 'email-opt' ) && $this->getVal( 'email-opt' ) == "1" ) ? '0' : '1'; |
— | — | @@ -543,7 +541,7 @@ |
544 | 542 | * Compares tracking data array to list of valid tracking fields and |
545 | 543 | * removes any extra tracking fields/data. Also sets empty values to |
546 | 544 | * 'null' values. |
547 | | - * @param bool $clean_opouts |
| 545 | + * @param bool $clean_opouts |
548 | 546 | */ |
549 | 547 | public function getCleanTrackingData() { |
550 | 548 | |
— | — | @@ -572,7 +570,7 @@ |
573 | 571 | } |
574 | 572 | |
575 | 573 | //if ( !empty($data) && ( $data[ 'numAttempt' ] == '0' && ( !$wgRequest->getText( 'utm_source_id', false ) || $wgRequest->getText( '_nocache_' ) == 'true' ) ) ) { |
576 | | - //so, basically, if this is the first attempt. This seems to get called nowhere else. |
| 574 | + //so, basically, if this is the first attempt. This seems to get called nowhere else. |
577 | 575 | function saveContributionTracking() { |
578 | 576 | |
579 | 577 | $tracked_contribution = $this->getCleanTrackingData(); |
— | — | @@ -620,9 +618,9 @@ |
621 | 619 | * @param array $data Form data |
622 | 620 | * @param bool $force If set to true, will ensure that contribution tracking is updated |
623 | 621 | */ |
624 | | - //Looks like two places: Either right before a paypal redirect (if that's still a thing) or |
625 | | - //just prior to curling something up to some server somewhere. |
626 | | - //I took care of the one just prior to curling. |
| 622 | + //Looks like two places: Either right before a paypal redirect (if that's still a thing) or |
| 623 | + //just prior to curling something up to some server somewhere. |
| 624 | + //I took care of the one just prior to curling. |
627 | 625 | public function updateContributionTracking( $force = false ) { |
628 | 626 | // ony update contrib tracking if we're coming from a single-step landing page |
629 | 627 | // which we know with cc# in utm_source or if force=true or if contribution_tracking_id is not set |
— | — | @@ -678,9 +676,9 @@ |
679 | 677 | } |
680 | 678 | |
681 | 679 | /** |
682 | | - * TODO: Consider putting all the session data for a gateway under something like |
| 680 | + * TODO: Consider putting all the session data for a gateway under something like |
683 | 681 | * $_SESSION[$gateway_identifier] |
684 | | - * so we can kill it all with one stroke. |
| 682 | + * so we can kill it all with one stroke. |
685 | 683 | */ |
686 | 684 | public function unsetAllDDSessionData() { |
687 | 685 | unset( $_SESSION['Donor'] ); |
— | — | @@ -709,7 +707,7 @@ |
710 | 708 | } |
711 | 709 | } |
712 | 710 | } |
713 | | - |
| 711 | + |
714 | 712 | function getAdapterClass(){ |
715 | 713 | if ( class_exists( $this->boss ) ) { |
716 | 714 | return $this->boss; |
Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | $me = get_called_class(); |
74 | 74 | parent::__construct( $me ); |
75 | 75 | $this->errors = $this->getPossibleErrors(); |
76 | | - $this->setFormClass(); |
| 76 | + $this->setFormClass(); |
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | * @param array $error Reference to the error messages of the form |
86 | 86 | * @param array $options |
87 | 87 | * OPTIONAL - You may require certain field groups to be validated |
88 | | - * - address - Validates: street, city, state, zip |
| 88 | + * - address - Validates: street, city, state, zip |
89 | 89 | * - amount - Validates: amount |
90 | 90 | * - creditCard - Validates: card_num, cvv, expiration and sets the card |
91 | 91 | * - email - Validates: email |
— | — | @@ -313,7 +313,7 @@ |
314 | 314 | * The message at the top of the form can be edited in the payflow_gateway.i18n.php file |
315 | 315 | */ |
316 | 316 | public function displayForm( &$data, &$error ) { |
317 | | - global $wgOut, $wgRequest; |
| 317 | + global $wgOut; |
318 | 318 | |
319 | 319 | $form_class = $this->getFormClass(); |
320 | 320 | $form_obj = new $form_class( $data, $error, $this->adapter ); |
— | — | @@ -344,7 +344,7 @@ |
345 | 345 | } |
346 | 346 | $this->form_class = $class_name; |
347 | 347 | |
348 | | - //this should... maybe replace the other thing? I need it in the adapter so reCaptcha can get to it. |
| 348 | + //this should... maybe replace the other thing? I need it in the adapter so reCaptcha can get to it. |
349 | 349 | $this->adapter->setFormClass( $class_name ); |
350 | 350 | } |
351 | 351 | |
— | — | @@ -436,17 +436,17 @@ |
437 | 437 | |
438 | 438 | /** |
439 | 439 | * Convert an amount for a particular currency to an amount in USD |
440 | | - * |
| 440 | + * |
441 | 441 | * This is grosley rudimentary and likely wildly inaccurate. |
442 | 442 | * This mimicks the hard-coded values used by the WMF to convert currencies |
443 | 443 | * for validatoin on the front-end on the first step landing pages of their |
444 | 444 | * donation process - the idea being that we can get a close approximation |
445 | 445 | * of converted currencies to ensure that contributors are not going above |
446 | 446 | * or below the price ceiling/floor, even if they are using a non-US currency. |
447 | | - * |
| 447 | + * |
448 | 448 | * In reality, this probably ought to use some sort of webservice to get real-time |
449 | 449 | * conversion rates. |
450 | | - * |
| 450 | + * |
451 | 451 | * @param $currency_code |
452 | 452 | * @param $amount |
453 | 453 | * @return unknown_type |