Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js |
— | — | @@ -16,6 +16,15 @@ |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
| 20 | + //disable states if country is not US |
| 21 | + if ( document.payment.country.value != '840' ) { |
| 22 | + document.payment.state.disabled = true; |
| 23 | + document.payment.state.value = 'XX'; |
| 24 | + } else { |
| 25 | + document.payment.state.disabled = false; |
| 26 | + document.payment.state.value = document.payment.state.value; |
| 27 | + } |
| 28 | + |
20 | 29 | // validate email address |
21 | 30 | var apos = form.emailAdd.value.indexOf("@"); |
22 | 31 | var dotpos = form.emailAdd.value.lastIndexOf("."); |
— | — | @@ -32,4 +41,17 @@ |
33 | 42 | return true; |
34 | 43 | } |
35 | 44 | |
| 45 | +function disableStates( form ) { |
| 46 | + |
| 47 | + if ( document.payment.country.value != '840' ) { |
| 48 | + document.payment.state.disabled = true; |
| 49 | + document.payment.state.value = 'XX'; |
| 50 | + } else { |
| 51 | + document.payment.state.disabled = false; |
| 52 | + document.payment.state.value = ''; |
| 53 | + } |
| 54 | + |
| 55 | + return true; |
| 56 | +} |
| 57 | + |
36 | 58 | //]]> |
\ No newline at end of file |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | |
22 | 22 | $this->setHeaders(); |
23 | 23 | |
24 | | - //$wgOut->addHeadItem( 'validatescript', '<script type="text/javascript" language="javascript" src="' . $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/validate_input.js"></script>' ); |
| 24 | + $wgOut->addHeadItem( 'validatescript', '<script type="text/javascript" language="javascript" src="' . $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/validate_input.js"></script>' ); |
25 | 25 | |
26 | 26 | $scriptVars = array( |
27 | 27 | 'payflowproGatewayErrorMsgJs' => wfMsg( 'payflowpro_gateway-error-msg-js' ), |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | ); |
41 | 41 | |
42 | 42 | |
43 | | - //$wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
| 43 | + $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
44 | 44 | |
45 | 45 | // create token if one doesn't already exist |
46 | 46 | $token = $wgUser->editToken( 'mrxc877668DwQQ' ); |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | $amount = $wgRequest->getText( 'amount' ); |
83 | 83 | } elseif( isset( $_REQUEST['amount2'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount2' ) ) ) { |
84 | 84 | $amount = number_format( $wgRequest->getText( 'amount2' ), 2, '.', '' ); |
85 | | - } elseif( isset( $_REQUEST['amount'] ) ) { |
| 85 | + } elseif( isset( $_REQUEST['amount'] ) ) { |
86 | 86 | $amount = '0.00'; |
87 | 87 | } else { |
88 | 88 | $wgOut->addHTML( wfMsg( 'payflowpro_gateway-accessible' ) ); |
— | — | @@ -166,136 +166,187 @@ |
167 | 167 | private function fnPayflowDisplayForm( $data, &$error ) { |
168 | 168 | require_once( 'includes/stateAbbreviations.inc' ); |
169 | 169 | require_once( 'includes/countryCodes.inc' ); |
170 | | - |
| 170 | + |
171 | 171 | global $wgOut, $wgLang; |
172 | | - |
173 | | - $form = Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ) . |
174 | | - Xml::openElement( 'div', array( 'id' => 'mw-creditcard-intro' ) ) . |
175 | | - Xml::tags( 'p', array( 'class' => 'mw-creditcard-intro-msg' ), wfMsg( 'payflowpro_gateway-form-message' ) ) . |
176 | | - Xml::tags( 'p', array( 'class' => 'mw-creditcard-intro-msg' ), wfMsg( 'payflowpro_gateway-form-message-2' ) ) . |
177 | | - Xml::closeElement( 'div' ); |
178 | 172 | |
179 | | - // create drop down of countries |
| 173 | + // create drop down of countries |
180 | 174 | $countries = countryCodes(); |
181 | 175 | |
182 | 176 | foreach( $countries as $value => $fullName ) { |
183 | | - $countryMenu .= Xml::option( $fullName, $value ); |
| 177 | + if ( $value == $data['country'] ) { |
| 178 | + $countryMenu .= Xml::option( $fullName, $value, true ); |
| 179 | + } else { |
| 180 | + $countryMenu .= Xml::option( $fullName, $value, false ); } |
184 | 181 | } |
185 | | - |
186 | | - // Form |
187 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard-form' ) ) . |
188 | | - Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => '', 'onsubmit' => 'return validate_form(this)' ) ); |
189 | 182 | |
190 | | - // add hidden fields |
191 | | - $form .= Xml::hidden( 'utm_source', $data['utm_source'] ) . |
192 | | - Xml::hidden( 'utm_medium', $data['utm_medium'] ) . |
193 | | - Xml::hidden( 'utm_campaign', $data['utm_campaign'] ) . |
194 | | - Xml::hidden( 'language', $data['language'] ) . |
195 | | - Xml::hidden( 'referrer', $data['referrer'] ) . |
196 | | - Xml::hidden( 'comment', $data['comment'] ) . |
197 | | - Xml::hidden( 'comment-option', $data['anonymous'] ) . |
198 | | - Xml::hidden( 'email', $data['optout'] ); |
199 | | - |
200 | | - $donorInput = array( |
201 | | - Xml::inputLabel(wfMsg( 'payflowpro_gateway-amount-legend' ), 'amount', 'input_amount_other', '7', $data['amount'] ) . '<span class="creditcard_error_msg">' . ' ' . $error['invalidamount'] . '</span>', |
202 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-email' ), 'emailAdd', 'emailAdd', '30', $data['email'], array( 'maxlength' => '64' ) ) . '<span class="creditcard_error_msg">' . ' ' . $error['emailAdd'] . '</span>', |
203 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-fname' ), 'fname', 'fname', '20', $data['fname'], array( 'maxlength' => '15', 'class' => 'required' ) ) . '<span class="creditcard_error_msg">' . ' ' . $error['fname'] . '</span>', |
204 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-mname' ), 'mname', 'mname', '20', $data['mname'], array( 'maxlength' => '15' ) ), |
205 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-lname' ), 'lname', 'lname', '20', $data['lname'], array( 'maxlength' => '15' ) ) . '<span class="creditcard_error_msg">' . ' ' . $error['lname'] . '</span>', |
206 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-street' ), 'street', 'street', '30', $data['street'], array( 'maxlength' => '30' ) ) . '<span class="creditcard_error_msg">' . ' ' . $error['street'] . '</span>', |
207 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-city' ), 'city', 'city', '20', $data['city'], array( 'maxlength' => '20' ) ) . '<span class="creditcard_error_msg">' . ' ' . $error['city'] . '</span>', |
208 | | - Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) . |
209 | | - Xml::openElement( 'select', array( 'name' => 'state', 'id' => 'state', 'value' => $data['state'] ) ) . |
210 | | - statesMenuXML() . |
211 | | - Xml::closeElement( 'select' ) . '<span class="creditcard_error_msg">' . ' ' . $error['state'] . '</span>', |
212 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-postal' ), 'zip', 'zip', '15', $data['zip'], array( 'maxlength' => '9' ) ) . '<span class="creditcard_error_msg">' . ' ' . $error['zip'] . '</span>', |
213 | | - Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . |
214 | | - Xml::openElement( 'select', array( 'name' => 'country', 'id' => 'country', 'value' => $data['country'] ) ) . |
215 | | - $countryMenu . |
216 | | - Xml::closeElement( 'select' ) . '<span class="creditcard_error_msg">' . ' ' . $error['country'] . '</span>' |
217 | | - ); |
218 | | - |
219 | | - $donorField = ''; |
220 | | - |
221 | | - foreach( $donorInput as $value ) { |
222 | | - $donorField .= '<p>' . $value . '</p>'; |
223 | | - } |
224 | | - |
225 | | - $form .= Xml::fieldset( wfMsg( 'payflowpro_gateway-donor-legend' ), $donorField, array( 'class' => 'mw-creditcard-donor' ) ); |
226 | | - |
| 183 | + //common HTML tags for table |
| 184 | + $endCell = '</td><td>'; |
| 185 | + $endRow = '</td></tr> <tr><td style="text-align:right;">'; |
| 186 | + |
| 187 | + //create drop down of credit card types |
227 | 188 | $cardOptions = array( |
228 | | - 'visa' => 'Visa', |
229 | | - 'mastercard' => 'Mastercard', |
230 | | - 'american' => 'American Express', |
| 189 | + 'visa' => wfMsg( 'payflow_gateway-card-name-visa' ), |
| 190 | + 'mastercard' => wfMsg( 'payflow_gateway-card-name-mc' ), |
| 191 | + 'american' => wfMsg( 'payflow_gateway-card-name-amex' ), |
| 192 | + 'discover' => wfMsg( 'payflow_gateway-card-name-discover' ), |
231 | 193 | ); |
232 | 194 | |
233 | 195 | foreach( $cardOptions as $value => $fullName ) { |
234 | 196 | $cardOptionsMenu .= Xml::option( $fullName, $value ); |
235 | 197 | } |
236 | | - |
237 | | - $cardInput = |
238 | | - Xml::label( wfMsg( 'payflowpro_gateway-donor-card' ), 'card' ) . |
239 | | - Xml::openElement( 'select', array( 'name' => 'card', 'id' => 'card' ) ) . |
240 | | - $cardOptionsMenu . |
241 | | - Xml::closeElement( 'select' ); |
242 | | - |
| 198 | + |
| 199 | + //create expiration month menu |
243 | 200 | $expMos = ''; |
244 | 201 | |
245 | 202 | for( $i = 1; $i < 13; $i++ ) { |
246 | 203 | $expMos .= Xml::option( $wgLang->getMonthName( $i ), str_pad( $i, 2, '0', STR_PAD_LEFT ) ); |
247 | 204 | } |
248 | | - |
249 | | - $expMosMenu = |
250 | | - Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . |
251 | | - Xml::openElement( 'select', array( 'name' => 'mos', 'id' => 'mos' ) ) . |
252 | | - $expMos . |
253 | | - Xml::closeElement( 'select' ); |
254 | | - |
| 205 | + |
| 206 | + //create expiration year menu |
255 | 207 | $expYr = ''; |
256 | 208 | |
257 | 209 | for( $i = 0; $i < 11; $i++ ) { |
258 | 210 | $expYr .= Xml::option( date( 'Y' ) + $i, date( 'Y' ) + $i ); |
259 | 211 | } |
| 212 | + |
| 213 | + $states = statesMenuXML(); |
| 214 | + |
| 215 | + $stateMenu = ''; |
260 | 216 | |
261 | | - $expYrMenu = |
262 | | - Xml::openElement( 'select', array( 'name' => 'year', 'id' => 'year' ) ) . |
263 | | - $expYr . |
264 | | - Xml::closeElement( 'select' ); |
| 217 | + foreach( $states as $value => $fullName ) { |
| 218 | + if ( $value == $data['state'] ) { |
| 219 | + $stateMenu .= Xml::option( $fullName, $value, true ); |
| 220 | + } else $stateMenu .= Xml::option( $fullName, $value, false ); |
| 221 | + } |
265 | 222 | |
266 | | - $cardInput = array( |
267 | | - Xml::label( wfMsg( 'payflowpro_gateway-donor-card' ), 'card' ) . |
| 223 | + |
| 224 | + // intro text |
| 225 | + $form = Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ) . |
| 226 | + Xml::openElement( 'div', array( 'id' => 'mw-creditcard-intro' ) ) . |
| 227 | + Xml::tags( 'p', array( 'class' => 'mw-creditcard-intro-msg' ), wfMsg( 'payflowpro_gateway-form-message' ) ) . |
| 228 | + Xml::tags( 'p', array( 'class' => 'mw-creditcard-intro-msg' ), wfMsg( 'payflowpro_gateway-form-message-2' ) ) . |
| 229 | + Xml::closeElement( 'div' ); |
| 230 | + |
| 231 | + // open form |
| 232 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard-form' ) ) . |
| 233 | + Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => '', 'onsubmit' => 'return validate_form(this)' ) ); |
| 234 | + |
| 235 | + // donor amount and name |
| 236 | + $form .= Xml::openElement( 'table', array( 'id' => 'payflow_table' ) ). |
| 237 | + '<tr><td style="text-align:right;">' . |
| 238 | + Xml::label(wfMsg( 'payflowpro_gateway-amount-legend' ), 'amount', array( 'maxlength' => '10' ) ) . |
| 239 | + $endCell . |
| 240 | + Xml::input( 'amount', '7', $data['amount'], array( 'id' => 'amount' ) ) . |
| 241 | + '<span class="creditcard_error_msg">' . ' ' . $error['invalidamount'] . '</span>' . |
| 242 | + $endRow . |
| 243 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-email' ), 'emailAdd' ) . |
| 244 | + $endCell . |
| 245 | + Xml::input( 'emailAdd', '30', $data['email'], array( 'maxlength' => '64', 'id' => 'emailAdd' ) ) . |
| 246 | + '<span class="creditcard_error_msg">' . ' ' . $error['emailAdd'] . '</span>' . |
| 247 | + $endRow . |
| 248 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-fname' ), 'fname' ) . |
| 249 | + $endCell . |
| 250 | + Xml::input( 'fname', '20', $data['fname'], array( 'maxlength' => '15', 'class' => 'required', 'id' => 'fname' ) ) . |
| 251 | + '<span class="creditcard_error_msg">' . ' ' . $error['fname'] . '</span>' . |
| 252 | + $endRow . |
| 253 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-mname' ), 'mname' ) . |
| 254 | + $endCell . |
| 255 | + Xml::input( 'mname', '20', $data['mname'], array( 'maxlength' => '15', 'id' => 'mname' ) ) . |
| 256 | + $endRow . |
| 257 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-lname' ), 'lname' ) . |
| 258 | + $endCell . |
| 259 | + Xml::input( 'lname', '20', $data['lname'], array( 'maxlength' => '15', 'id' => 'lname' ) ) . |
| 260 | + '<span class="creditcard_error_msg">' . ' ' . $error['lname'] . '</span>' . |
| 261 | + $endRow; |
| 262 | + |
| 263 | + //donor address |
| 264 | + $form .= Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . |
| 265 | + $endCell . |
| 266 | + Xml::openElement( 'select', array( 'name' => 'country', 'id' => 'country', 'onchange' => 'return disableStates( this )' ) ) . |
| 267 | + $countryMenu . |
| 268 | + Xml::closeElement( 'select' ) . |
| 269 | + '<span class="creditcard_error_msg">' . ' ' . $error['country'] . '</span>' . |
| 270 | + $endRow . |
| 271 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-street' ), 'street' ) . |
| 272 | + $endCell . |
| 273 | + Xml::input( 'street', '30', $data['street'], array( 'maxlength' => '30', 'id' => 'street' ) ) . |
| 274 | + '<span class="creditcard_error_msg">' . ' ' . $error['street'] . '</span>' . |
| 275 | + $endRow . |
| 276 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-city' ), 'city' ) . |
| 277 | + $endCell . |
| 278 | + Xml::input( 'city', '20', $data['city'], array( 'maxlength' => '20', 'id' => 'city' ) ) . |
| 279 | + '<span class="creditcard_error_msg">' . ' ' . $error['city'] . '</span>' . |
| 280 | + $endRow . |
| 281 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) . |
| 282 | + $endCell . |
| 283 | + Xml::openElement( 'select', array( 'name' => 'state', 'id' => 'state' ) ) . |
| 284 | + $stateMenu . |
| 285 | + Xml::closeElement( 'select' ) . |
| 286 | + '<span class="creditcard_error_msg">' . ' ' . $error['state'] . '</span>' . |
| 287 | + $endRow . |
| 288 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-postal' ), 'zip' ) . |
| 289 | + $endCell . |
| 290 | + Xml::input( 'zip', '15', $data['zip'], array( 'maxlength' => '9', 'id' => 'zip' ) ) . |
| 291 | + '<span class="creditcard_error_msg">' . ' ' . $error['zip'] . '</span>' . |
| 292 | + $endRow; |
| 293 | + |
| 294 | + // credit card info |
| 295 | + $form .= Xml::label( wfMsg( 'payflowpro_gateway-donor-card' ), 'card' ) . |
| 296 | + $endCell . |
268 | 297 | Xml::openElement( 'select', array( 'name' => 'card', 'id' => 'card' ) ) . |
269 | 298 | $cardOptionsMenu . |
270 | | - Xml::closeElement( 'select'), |
271 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-card-num' ), 'card_num', 'card_num', '30', '', array( 'maxlength' => '100' ) ) . |
| 299 | + Xml::closeElement( 'select') . |
| 300 | + $endRow . |
| 301 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-card-num' ), 'card_num' ) . |
| 302 | + $endCell . |
| 303 | + Xml::input( 'card_num', '30', '', array( 'maxlength' => '100', 'id' => 'card_num' ) ) . |
272 | 304 | '<span class="creditcard_error_msg">' . ' ' . $error['card_num'] . '</span>' . |
273 | | - '<span class="creditcard_error_msg">' . ' ' . $error['card'] . '</span>', |
274 | | - $expMosMenu . $expYrMenu, |
275 | | - Xml::inputLabel( wfMsg( 'payflowpro_gateway-donor-security' ), 'cvv', 'cvv', '5', '', array( 'maxlength' => '10' ) ) . |
276 | | - '<span class="creditcard_error_msg">' . ' ' . $error['cvv'] . '</span>', |
277 | | - ); |
| 305 | + '</tr><tr><td></td><td>' . |
| 306 | + '<span class="creditcard_error_msg">' . ' ' . $error['card'] . '</span>' . |
| 307 | + $endRow . |
| 308 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . |
| 309 | + $endCell . |
| 310 | + Xml::openElement( 'select', array( 'name' => 'mos', 'id' => 'expiration' ) ) . |
| 311 | + $expMos . |
| 312 | + Xml::closeElement( 'select' ) . |
| 313 | + Xml::openElement( 'select', array( 'name' => 'year', 'id' => 'year' ) ) . |
| 314 | + $expYr . |
| 315 | + Xml::closeElement( 'select' ) . |
| 316 | + $endRow . |
| 317 | + Xml::label( wfMsg( 'payflowpro_gateway-donor-security' ), 'cvv' ) . |
| 318 | + $endCell . |
| 319 | + Xml::input( 'cvv', '5', '', array( 'maxlength' => '10', 'id' => 'cvv' ) ) . |
| 320 | + '<span class="creditcard_error_msg">' . ' ' . $error['cvv'] . '</span>' . |
| 321 | + '</td></tr>' . |
| 322 | + Xml::closeElement( 'table' ); |
| 323 | + |
| 324 | + // add hidden fields |
| 325 | + $form .= Xml::hidden( 'utm_source', $data['utm_source'] ) . |
| 326 | + Xml::hidden( 'utm_medium', $data['utm_medium'] ) . |
| 327 | + Xml::hidden( 'utm_campaign', $data['utm_campaign'] ) . |
| 328 | + Xml::hidden( 'language', $data['language'] ) . |
| 329 | + Xml::hidden( 'referrer', $data['referrer'] ) . |
| 330 | + Xml::hidden( 'comment', $data['comment'] ) . |
| 331 | + Xml::hidden( 'comment-option', $data['anonymous'] ) . |
| 332 | + Xml::hidden( 'email', $data['optout'] ) . |
| 333 | + Xml::hidden( 'process', 'CreditCard' ) . |
| 334 | + Xml::hidden( 'payment_method', 'processed' ) . |
| 335 | + Xml::hidden( 'token', $data['token'] ) . |
| 336 | + Xml::hidden( 'currency_code', $data['currency'] ) . |
| 337 | + Xml::hidden( 'orderid', $data['order_id'] ) . |
| 338 | + Xml::hidden( 'numAttempt', $data['numAttempt'] ); |
| 339 | + |
| 340 | + // submit button and close form |
| 341 | + $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' ) ) . |
| 342 | + Xml::closeElement( 'form' ) . |
| 343 | + Xml::closeElement( 'div' ); |
278 | 344 | |
279 | | - foreach( $cardInput as $value ) { |
280 | | - $cardField .= '<p>' . $value . '</p>'; |
281 | | - } |
282 | | - |
283 | | - $form .= Xml::fieldset( wfMsg( 'payflowpro_gateway-card-legend' ), $cardField, array( 'class' => 'mw-creditcard-card' ) ) . |
284 | | - Xml::hidden( 'process', 'CreditCard' ) . |
285 | | - Xml::hidden( 'payment_method', 'processed' ) . |
286 | | - Xml::hidden( 'token', $data['token'] ) . |
287 | | - Xml::hidden( 'currency_code', $data['currency'] ) . |
288 | | - Xml::hidden( 'orderid', $data['order_id'] ) . |
289 | | - Xml::hidden( 'numAttempt', $data['numAttempt'] ) . |
290 | | - Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' ) ) . |
291 | | - Xml::closeElement( 'form' ) . |
292 | | - Xml::closeElement( 'div' ); |
293 | | - |
294 | 345 | $form .= Xml::closeElement( 'div' ) . |
295 | | - Xml::Element( 'p', array( 'class' => 'mw-creditcard-submessage' ), |
296 | | - wfMsg( 'payflowpro_gateway-donor-currency-msg', $data['currency'] ) |
297 | | - ); |
| 346 | + Xml::Element( 'p', array( 'class' => 'mw-creditcard-submessage' ), |
| 347 | + wfMsg( 'payflowpro_gateway-donor-currency-msg', $data['currency'] ) ); |
| 348 | + |
298 | 349 | // Theming |
299 | | - /*global $wgDonationInterfaceTomasSkin; |
| 350 | + global $wgDonationInterfaceTomasSkin; |
300 | 351 | |
301 | 352 | if ( $wgDonationInterfaceTomasSkin ) { |
302 | 353 | $language = 'en'; |
— | — | @@ -314,14 +365,12 @@ |
315 | 366 | XML::closeElement( 'div' ) . |
316 | 367 | XML::closeElement( 'div' ) . |
317 | 368 | XML::closeElement( 'div' ) . |
318 | | - XML::closeElement( 'div' ); |
| 369 | + XML::closeElement( 'div' ); |
319 | 370 | $wgOut->addHTML( $form ); |
320 | 371 | $wgOut->addWikiText( '{{Template:2008/Donate-footer/' . $language . '}}' ); |
321 | 372 | } else { |
322 | 373 | $wgOut->addHTML( $form ); |
323 | | - } |
324 | | - */ |
325 | | - $wgOut->addHTML( $form ); |
| 374 | + } |
326 | 375 | } |
327 | 376 | |
328 | 377 | /** |
— | — | @@ -415,6 +464,20 @@ |
416 | 465 | |
417 | 466 | break; |
418 | 467 | |
| 468 | + case 'discover': |
| 469 | + // pattern for Visa |
| 470 | + $pattern = '/^6(?:011|5[0-9]{2})[0-9]{12}$/'; |
| 471 | + |
| 472 | + // if pattern doesn't match |
| 473 | + if( !preg_match( $pattern, $data['card_num'] ) ) { |
| 474 | + $error_result = '1'; |
| 475 | + $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-discover' ); |
| 476 | + } |
| 477 | + |
| 478 | + break; |
| 479 | + |
| 480 | + |
| 481 | + |
419 | 482 | } // end switch |
420 | 483 | |
421 | 484 | return $error_result; |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/includes/stateAbbreviations.inc |
— | — | @@ -60,12 +60,6 @@ |
61 | 61 | 'WV' => 'West Virginia', |
62 | 62 | 'WY' => 'Wyoming' |
63 | 63 | ); |
64 | | - |
65 | | - $stateMenu = ''; |
66 | | - |
67 | | - foreach( $states as $value => $fullName ) { |
68 | | - $stateMenu .= Xml::option( $fullName, $value ); |
69 | | - } |
70 | | - |
71 | | - return $stateMenu; |
| 64 | + |
| 65 | + return $states; |
72 | 66 | } |
\ No newline at end of file |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php |
— | — | @@ -37,6 +37,10 @@ |
38 | 38 | 'payflowpro_gateway-donor-security' => 'Security code:', |
39 | 39 | 'payflowpro_gateway-donor-submit' => 'Donate', |
40 | 40 | 'payflowpro_gateway-donor-currency-msg' => 'This donation is being made in $1', |
| 41 | + 'payflow_gateway-card-name-amex' => 'American Express', |
| 42 | + 'payflow_gateway-card-name-visa' => 'Visa', |
| 43 | + 'payflow_gateway-card-name-mc' => 'Mastercard', |
| 44 | + 'payflow_gateway-card-name-discover' => 'Discover', |
41 | 45 | 'payflowpro_gateway-error-msg' => 'Please enter your $1', |
42 | 46 | 'payflowpro_gateway-error-msg-js' => 'Please enter your', |
43 | 47 | 'payflowpro_gateway-error-msg-invalid-amount' => '**Please enter a valid amount**', |
— | — | @@ -44,6 +48,7 @@ |
45 | 49 | 'payflowpro_gateway-error-msg-amex' => '**Please enter a correct card number for American Express.**', |
46 | 50 | 'payflowpro_gateway-error-msg-mc' => '**Please enter a correct card number for MasterCard.**', |
47 | 51 | 'payflowpro_gateway-error-msg-visa' => '**Please enter a correct card number for Visa.**', |
| 52 | + 'payflowpro_gateway-error-msg-discover' => '**Please enter a correct card number for Discover.**', |
48 | 53 | 'payflowpro_gateway-error-msg-amount' => 'donation amount', |
49 | 54 | 'payflowpro_gateway-error-msg-emailAdd' => 'e-mail address', |
50 | 55 | 'payflowpro_gateway-error-msg-fname' => 'first name', |