Force credit card expiration date and expiration month?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 yıl önce
Hello:

Currently, the credit card expiration date dropdown options on versions 2.x and 3.x default to 01/2013 for the expiration month and year.

Customers are not bothering to select their true expiration date.   Is there any way within the current nopCommerce system to set it up to require a valid date be inputted (1/2013 is in the past) PLUS default it to "select month" and "select year" in the dropdown so the validation forces the customer to choose an appropriate date?

Thanks.
10 yıl önce
You would need to modify the particular plugin that you are using.
10 yıl önce
It's just the ManualPayment plugin that comes with nopCommerce.   Any suggestions on what specifically I need to add to get this to work as described above?    Was hoping there was a clearer way to get this to work without having to re-write it.

The problem with all these re-writes is that when it comes time to upgrade to a new version (which is about every 3 months), it's just one more thing you have to account for and re-add to the global code.    It'd be a lot cooler and less painful if fixes like this were just rolled into the next version.

Thanks.
7 yıl önce
This Credit Card Expiration Validation non-feature still exists in 3.7.  This is what I did to fix it.  There may be better ways.

If you don't feel comfortable working with the code in visual studio then this isn't for you.

Open the solution in Visual Studio.
Find the Nop.Plugin.Payments.Manual project.
Open the PaymentInfoValidator.cs file in the Validators folder within the project.
Add the following line of code:

RuleFor(x => System.Convert.ToDateTime(x.ExpireMonth + "/1/" + x.ExpireYear).AddMonths(1).AddDays(-1))
                .GreaterThanOrEqualTo(System.DateTime.Now)
                .WithMessage((string.IsNullOrEmpty(localizationService.GetResource("Payment.ExpirationDate.Future")) ? "Expiration Date must be in the future" : localizationService.GetResource("Payment.ExpirationDate.Future")));

Build the project.
Navigate to the folder where the build is dropping the files.  
{some folder structure}\NopCommerce3_7\Presentation\Nop.Web\Plugins
Copy the Payments.Manual folder and drop it into your website plugins folder.
Restart the application.
Your new plugin should be loaded.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.