Nop 4.3 Remove Credit Card Options

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
We are using Payments.Manual and need to remove American Express and Discover from the list of accepted cards.
3 years ago
There have been several posts about this in the past.  It requires custom changes to the plugin source code.  (I think someone did contribute a modified version a long time ago, but I don't see it in the marketplace anymore)
3 years ago
at a glance it looks like you can simply comment out / remove them from the view component, then rebuild the plugin:
https://github.com/nopSolutions/nopCommerce/blob/develop/src/Plugins/Nop.Plugin.Payments.Manual/Components/PaymentManualViewComponent.cs


                CreditCardTypes = new List<SelectListItem>
                {
                    new SelectListItem { Text = "Visa", Value = "visa" },
                    new SelectListItem { Text = "Master card", Value = "MasterCard" },
                    //new SelectListItem { Text = "Discover", Value = "Discover" },
                    //new SelectListItem { Text = "Amex", Value = "Amex" },
                }
3 years ago
a quick follow up:

the above will only stop those options from showing in the dropdown menu, a customer could still enter an Amex or Disco cc# and I did not see any validation to prevent it.  

You could validate against Amex / Disco with javascript in the view (still possible to bypass) or regex in the controller (another round trip to the server).

Typically a DIsco card begins with '6' and Amex with '3', but there is probably a more definitive regex out there to be found.
3 years ago
I looked in the Plugins\Payments.Manual\Views and the file you indicated to edit does not exist.

The only files in the directory are:
ViewImports.cshtml
Configure.cshtml
PaymentInfo.cshtml

And they don't appear to contain the code you provided.
3 years ago
you need the source code:
https://www.nopcommerce.com/download-nopcommerce-link?type=sourcepackage

The code for the manual payment plugin is included.  You would change the code in Visual Studio then build the plugin's solution to compile the changes.  Then upload the new DLLs to your server and restart the application.
3 years ago
Thank you, I'll have to have the IT guys take a look as this is beyond me.
3 years ago
you could also filter them out in the cshtml files, but you would still have the same concern of no real validation to prevent them from being used.
3 years ago
af1racing wrote:
...  no real validation to prevent them from being used.

It's always been that way in the plugin.  There actually is validator code that does a CRC check, but nothing that matches the first digit to the card type.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.