Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4029432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:20:40+00:00 2026-05-20T11:20:40+00:00

So I have my View Model validation down using Fluent Validation and my Service

  • 0

So I have my View Model validation down using Fluent Validation and my Service Layer validation down as far as field validation goes, but my question is how do you deal with errors like, “Your credit card was declined”, errors that have to do with logic other then input validation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:20:41+00:00Added an answer on May 20, 2026 at 11:20 am

    A credit card being declined is not a validation error, instead it is a result of a payment processing attempt. For example, suppose you have a payment gateway service which returns a PaymentProcessingResult class, which can either have a status of approved or declined, with a possible reason for the decline:

    class PaymentProcessingResult {
        bool IsApproved { get; set; }
        string DeclineReason { get; set; }
    }
    
    interface IPaymentGateway {
      PaymentProcessingResult ProcessPayment(PaymentInfo p);
    }
    

    Then in the controller which invokes this payment gateway service you can provide a proper response:

    class CheckoutController : Controller {
    
      IPaymentGayeway paymentGateway;
    
      [HttpPost]
      public ActionResult ProcessPayment() {
         var paymentInfo = /* get payment info, from a shopping cart or the like */;
    
         var paymentResponse = this.paymentGateway.ProcessPayment(paymentInfo);
    
         if (paymentResponse.IsApproved) return View("PaymentReceipt");
         else return View("PaymentDeclined", paymentRespone);
    
      }
    }
    

    For security reasons, be sure not to expose too much information about the reason for a decline. A payment being declined can be conveyed in many ways. Instead of displaying a payment decline view, you can redirect back to a page where payment information is entered and highlight and display a message there, perhaps using the TempData dictionary to store the message for the next request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using javascript unobtrusive validation. I have a view model that I am
Working in ASP.NET MVC, I have a view model with an Amount field. The
I have a view model with a property Fields which is an ObservableCollection<FieldVM> .
I have a view model that contains a Product class type and an IEnumerable<
I have a view model that is displayed in a view that uses uploadify.
I have the following view: @model MyModel1 @{ ViewBag.Title = Index; Layout = ~/Views/Shared/_Layout.cshtml;
if i have created a view model and have a partial form that is
In my view model if have a: List<Car> where car has an Id and
I have a painfully simple view model public class TellAFriendViewModel { public string Email1
I have a parent-child view model object structure set up and need to update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.