Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -295,7 +295,7 @@ |
296 | 296 | 'city' => wfMsg( 'payflowpro_gateway-error-msg-city' ), |
297 | 297 | 'state' => wfMsg( 'payflowpro_gateway-error-msg-state' ), |
298 | 298 | 'zip' => wfMsg( 'payflowpro_gateway-error-msg-zip' ), |
299 | | - 'card_num' => wfMsg( 'payflowpro_gateway-error-msg-card_num' ), |
| 299 | + 'card_num' => wfMsg( 'payflowpro_gateway-error-msg-card-num' ), |
300 | 300 | 'expiration' => wfMsg( 'payflowpro_gateway-error-msg-expiration' ), |
301 | 301 | 'cvv' => wfMsg( 'payflowpro_gateway-error-msg-cvv' ), |
302 | 302 | ); |
— | — | @@ -329,32 +329,17 @@ |
330 | 330 | } |
331 | 331 | |
332 | 332 | // validate that credit card number entered is correct and set the card type |
333 | | - switch( $data[ 'card_num' ] ) { |
334 | | - // american express |
335 | | - case preg_match( '/^3[47][0-9]{13}$/', $data[ 'card_num' ] ): |
336 | | - $data[ 'card' ] = 'american'; |
337 | | - break; |
338 | | - |
339 | | - // mastercard |
340 | | - case preg_match( '/^5[1-5][0-9]{14}$/', $data[ 'card_num' ] ): |
341 | | - $data[ 'card' ] = 'mastercard'; |
342 | | - break; |
343 | | - |
344 | | - // visa |
345 | | - case preg_match( '/^4[0-9]{12}(?:[0-9]{3})?$/', $data[ 'card_num' ] ): |
346 | | - $data[ 'card' ] = 'visa'; |
347 | | - break; |
348 | | - |
349 | | - // discover |
350 | | - case preg_match( '/^6(?:011|5[0-9]{2})[0-9]{12}$/', $data[ 'card_num' ] ): |
351 | | - $data[ 'card' ] = 'discover'; |
352 | | - break; |
353 | | - |
354 | | - // an invalid credit card number was entered |
355 | | - default: |
356 | | - $error_result = '1'; |
357 | | - $error[ 'card_num' ] = wfMsg( 'payflowpro_gateway-error-msg-card-num' ); |
358 | | - break; |
| 333 | + if ( preg_match( '/^3[47][0-9]{13}$/', $data[ 'card_num' ] ) ) { // american express |
| 334 | + $data[ 'card' ] = 'american'; |
| 335 | + } elseif ( preg_match( '/^5[1-5][0-9]{14}$/', $data[ 'card_num' ] ) ) { // mastercard |
| 336 | + $data[ 'card' ] = 'mastercard'; |
| 337 | + } elseif ( preg_match( '/^4[0-9]{12}(?:[0-9]{3})?$/', $data[ 'card_num' ] ) ) {// visa |
| 338 | + $data[ 'card' ] = 'visa'; |
| 339 | + } elseif ( preg_match( '/^6(?:011|5[0-9]{2})[0-9]{12}$/', $data[ 'card_num' ] ) ) { // discover |
| 340 | + $data[ 'card' ] = 'discover'; |
| 341 | + } else { // an invalid credit card number was entered |
| 342 | + $error_result = '1'; |
| 343 | + $error[ 'card_num' ] = wfMsg( 'payflowpro_gateway-error-msg-card-num' ); |
359 | 344 | } |
360 | 345 | |
361 | 346 | return $error_result; |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php |
— | — | @@ -60,7 +60,6 @@ |
61 | 61 | 'payflowpro_gateway-error-msg-state' => 'state', |
62 | 62 | 'payflowpro_gateway-error-msg-zip' => 'postal code', |
63 | 63 | 'payflowpro_gateway-error-msg-country' => 'country', |
64 | | - 'payflowpro_gateway-error-msg-card_num' => 'credit card number', |
65 | 64 | 'payflowpro_gateway-error-msg-expiration' => "card's expiration date", |
66 | 65 | 'payflowpro_gateway-error-msg-cvv' => 'CVV from the back of your card', |
67 | 66 | 'payflowpro_gateway-error-msg-captcha' => "The Captcha value you entered is incorrect. Please try again.", |