Access customer billing information during validate?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
How would I go about accessing the customer information during Validation of the credit card?

[NonAction]
        public override IList<string> ValidatePaymentForm(FormCollection form)
        {
            var warnings = new List<string>();

            //validate
            var validator = new PaymentInfoValidator(_localizationService);
            var model = new PaymentInfoModel()
            {
                CardholderName = form["CardholderName"],
                CardNumber = form["CardNumber"],
                CardCode = form["CardCode"],
            };
            var validationResult = validator.Validate(model);
            if (!validationResult.IsValid)
                foreach (var error in validationResult.Errors)
                    warnings.Add(error.ErrorMessage);
            return warnings;
        }


What I'm trying to accomplish during this process is run it through our CC verification / encryption server to make sure the card if valid.

I know how to access it during the ProcessPaymentRequest() routine but not sure how to access it outside of there but in the controller.
12 years ago
Inject IWorkContext via constructor and use it: _workContext.CurrentCustomer
12 years ago
a.m. wrote:
Inject IWorkContext via constructor and use it: _workContext.CurrentCustomer


What reference class does IWorkContext come from?
12 years ago
I don't understand your question.
P.S. To get an idea on how to inject this interface via constructor have a look at BlogController.cs file (Nop.Web project)
12 years ago
a.m. wrote:
I don't understand your question.
P.S. To get an idea on how to inject this interface via constructor have a look at BlogController.cs file (Nop.Web project)


I found that it exist within the Nop.Core project.  Sorry if I didn't word that correctly.

Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.