Guest User

Untitled

a guest
Mar 9th, 2017
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. add_filter('woocommerce_stripe_woocommerce_addon_error','woocommerce_stripe_woocommerce_addon_error_overide',10,1) ;
  2.  
  3. function woocommerce_stripe_woocommerce_addon_error_overide($body){
  4.  
  5.     if($body['error']['type'] == 'invalid_request_error' ){
  6.  
  7.         $error = 'Please make sure you have entered the credit card number.';
  8.     }
  9.  
  10.     if($body['error']['type'] == 'incorrect_number' ){
  11.  
  12.         $error = 'The card number is incorrect.';
  13.     }
  14.     if($body['error']['code'] == 'card_declined' ){
  15.  
  16.         $error = 'The card has been declined.';
  17.     }
  18.     if($body['error']['type'] == 'invalid_number' ){
  19.  
  20.         $error = 'The card number is not a valid credit card number.';
  21.     }
  22.     if($body['error']['type'] == 'invalid_expiry_month' ){
  23.  
  24.         $error = 'The card\'s expiration month is invalid.';
  25.     }
  26.     if($body['error']['type'] == 'invalid_expiry_year' ){
  27.  
  28.         $error = 'The card\'s expiration year is invalid.';
  29.     }
  30.     if($body['error']['type'] == 'invalid_cvc' ){
  31.  
  32.         $error = 'The card\'s security code is invalid.';
  33.     }
  34.     if($body['error']['type'] == 'expired_card' ){
  35.  
  36.         $error = 'The card has expired.';
  37.     }
  38.     if($body['error']['type'] == 'incorrect_cvc' ){
  39.  
  40.         $error = 'The card\'s security code is incorrect.';
  41.     }
  42.     if($body['error']['type'] == 'incorrect_zip' ){
  43.  
  44.         $error = 'The card\'s zip code failed validation.';
  45.     }
  46.     if($body['error']['type'] == 'card_error' ){
  47.  
  48.         $error = 'The card was declined from gateway.';
  49.     }
  50.     if($body['error']['type'] == 'missing' ){
  51.  
  52.         $error = 'There is no card on a customer that is being charged.';
  53.     }
  54.     if($body['error']['type'] == 'processing_error' ){
  55.  
  56.         $error = 'An error occurred while processing the card.';
  57.     }
  58.     if($body['error']['type'] == 'rate_limit' ){
  59.  
  60.         $error = 'An error occurred due to requests hitting the API too quickly. Please let us know if you\'re consistently running into this error.';
  61.     }
  62.    
  63.     return $error  ;
  64.  
  65. }
Add Comment
Please, Sign In to add comment