Nop 4.3 Remove Credit Card Options

1 month ago
We are using Payments.Manual and need to remove American Express and Discover from the list of accepted cards.
1 month 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)
1 month 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" },
                }
1 month 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.
1 month 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.
1 month 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.
1 month ago
Thank you, I'll have to have the IT guys take a look as this is beyond me.
1 month 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.
1 month 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.