/**
  * Returns a message appropriate for a frontend user.  This should be used
  * to provide enough information to a user to allow them to resolve an
  * issue on their own, but not enough to help nefarious folks fishing for
  * info. Adds a few custom authorize.net-specific user error messages.
  *
  * @since 2.0.0
  * @see SV_WC_Payment_Gateway_API_Response_Message_Helper::get_user_message()
  * @param string $message_id identifies the message to return
  * @return string a user message
  */
 public function get_user_message($message_id)
 {
     switch ($message_id) {
         case 'authorize_net_error_try_later':
             $message = __('Oops, sorry! A temporary error occurred. Please try again in 5 minutes.', 'woocommerce-gateway-authorize-net-cim');
             break;
         case 'authorize_net_authorized_but_not_settled':
             $message = __('This transaction was authorized successfully, but could not be settled. Please contact us.', 'woocommerce-gateway-authorize-net-cim');
             break;
         case 'authorize_net_echeck_mismatch':
             $message = __('The name and/or bank account type does not match. Please re-enter and try again.', 'woocommerce-gateway-authorize-net-cim');
             break;
         default:
             $message = parent::get_user_message($message_id);
     }
     return apply_filters('wc_authorize_net_cim_api_response_user_message', $message, $message_id, $this);
 }
 /**
  * Returns a message appropriate for a frontend user.  This should be used
  * to provide enough information to a user to allow them to resolve an
  * issue on their own, but not enough to help nefarious folks fishing for
  * info.
  *
  * @since 1.3.1
  * @see SV_WC_Payment_Gateway_API_Response_Message_Helper
  * @see SV_WC_Payment_Gateway_API_Response::get_user_message()
  * @return string user message, if there is one
  */
 public function get_user_message()
 {
     $message_helper = new SV_WC_Payment_Gateway_API_Response_Message_Helper('woocommerce-gateway-intuit-qbms');
     $user_message = null;
     switch ($this->get_status_code()) {
         case 10101:
             // just get the validation error
             $user_message = preg_replace('/.*error:/', '', $this->get_transaction_status_message());
             if ('Card Verification Code not available.' == $message) {
                 $user_message = $message_helper->get_user_message('csc_missing');
             }
             // otherwise just use the string from Intuit (ie "Incorrect Street Address and Zip Code", and who knows what else)
             break;
         case 10301:
             $user_message = $message_helper->get_user_message('card_number_invalid');
             break;
         case 10303:
             if (strpos($this->get_status_detail(), 'CreditCardNumber') !== false) {
                 $user_message = $message_helper->get_user_message('card_number_missing');
             }
             break;
         case 10302:
             if ('ExpirationMonth/ExpirationYear' == $this->get_status_detail()) {
                 $user_message = $message_helper->get_user_message('card_expired');
             } elseif (('ExpirationMonth' == $this->get_status_detail() || 'ExpirationYear' == $this->get_status_detail()) && strpos($this->get_transaction_status_message(), 'date value null') !== false) {
                 $user_message = $message_helper->get_user_message('card_expiry_missing');
                 break;
             }
             // the remaining status details are processed the same as 10309 below
         // the remaining status details are processed the same as 10309 below
         case 10309:
             if ('CardSecurityCode' == $this->get_status_detail()) {
                 $user_message = $message_helper->get_user_message('csc_invalid');
             } elseif ('CreditCardNumber' == $this->get_status_detail()) {
                 $user_message = $message_helper->get_user_message('card_number_invalid');
             } elseif ('ExpirationMonth' == $this->get_status_detail()) {
                 $user_message = $message_helper->get_user_message('card_expiry_month_invalid');
             } elseif ('ExpirationYear' == $this->get_status_detail()) {
                 $user_message = $message_helper->get_user_message('card_expiry_year_invalid');
             }
             break;
         case 10400:
             $user_message = $message_helper->get_user_message('insufficient_funds');
             break;
         case 10401:
             $user_message = $message_helper->get_user_message('card_declined');
             break;
         case 10409:
             $user_message = $this->get_transaction_status_message();
             break;
         case 10415:
             $user_message = $message_helper->get_user_message('card_expired');
             break;
         case 10420:
             $user_message = $message_helper->get_user_message('card_declined');
             break;
     }
     return apply_filters('wc_payment_gateway_intuit_qbms_customer_checkout_message', $user_message, $this);
 }