I encounter a problem when creating a new Payment Plugin.
I tried to "decouple" my dependencies and decided to create an interface for all my concrete classes. I then use autofac in Nop in order to resolve the correct service/implementation to use.
A problem occurs in the paymentsettings model.
I created following Interface for my paymentsettings model:
using Nop.Core.Configuration;
namespace Nop.Plugin.Payments.Mollie.BankContact
{
public interface IMollieBankContactPaymentSettings : ISettings
{
decimal AdditionalHandlingFeeFixed { get; set; }
decimal AdditionalHandlingFeePercentage { get; set; }
string ApiProduction { get; set; }
string ApiTest { get; set; }
......
My concrete class is as followed:
namespace Nop.Plugin.Payments.Mollie.BankContact
{
public class MollieBankContactPaymentSettings : IMollieBankContactPaymentSettings
{
public bool UseSandbox { get; set; }
public string ApiTest { get; set; }
public string ApiProduction { get; set; }
//
// RedirectURL : URL which is used access the mollie API
//
Because my interface IMollieBankContactPaymentSettings extends ISettings, I expected all to go fine, but I get following error:
Method Nop.Web.Framework.SettingsSource.BuildRegistration: type argument 'Nop.Plugin.Payments.Mollie.BankContact.IMollieBankContactPaymentSettings' violates the constraint of type parameter 'TSettings'.
Exception Details: System.Security.VerificationException: Method Nop.Web.Framework.SettingsSource.BuildRegistration: type argument 'Nop.Plugin.Payments.Mollie.BankContact.IMollieBankContactPaymentSettings' violates the constraint of type parameter 'TSettings'.
Source Error:
Line 385: if (ts != null && typeof(ISettings).IsAssignableFrom(ts.ServiceType))
Line 386: {
Line 387: var buildMethod = BuildMethod.MakeGenericMethod(ts.ServiceType);
Line 388: yield return (IComponentRegistration)buildMethod.Invoke(null, null);
Line 389: }
Source File: C:\Data\Ecommerce\nop390\Presentation\Nop.Web.Framework\DependencyRegistrar.cs Line: 387
Any thought on this ?
Thanks in advance.