Payment Plugin Mapping Issue.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi All,

It has been a while since I've done anything with Nop (v1.8) everything has changed a little :) I've been re-developing an old v1.8 payment provider for SagePay Direct for use with v2.8. - Coming back to Nop after all this time has been very much a School day for me.

I'm taring my hair out the following error and I'd really appreciate any help:

Trying to map Nop.Services.Payments.IPaymentMethod to Nop.Admin.Models.Payments.PaymentMethodModel. Using mapping configuration for Nop.Services.Payments.IPaymentMethod to Nop.Admin.Models.Payments.PaymentMethodModel Exception of type 'AutoMapper.AutoMapperMappingException' was thrown.

AutoMapper.AutoMapperMappingException: Trying to map Nop.Services.Payments.IPaymentMethod to Nop.Admin.Models.Payments.PaymentMethodModel. Using mapping configuration for Nop.Services.Payments.IPaymentMethod to Nop.Admin.Models.Payments.PaymentMethodModel Exception of type 'AutoMapper.AutoMapperMappingException' was thrown. ---> AutoMapper.AutoMapperMappingException: Trying to map Nop.Plugin.Payments.SagePayDirect.SagePayDirectPaymentProcessor to System.Boolean. Using mapping configuration for Nop.Services.Payments.IPaymentMethod to Nop.Admin.Models.Payments.PaymentMethodModel Destination property: SupportCapture Exception of type 'AutoMapper.AutoMapperMappingException' was thrown. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: The method or operation is not implemented. at Nop.Plugin.Payments.SagePayDirect.SagePayDirectPaymentProcessor.get_SupportCapture() --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at AutoMapper.Internal.MemberGetter.Resolve(ResolutionResult source) at AutoMapper.PropertyMap.ResolveValue(ResolutionContext context) at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap) --- End of inner exception stack trace --- at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap) at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.Map(ResolutionContext context, IMappingEngineRunner mapper) at AutoMapper.Mappers.TypeMapMapper.Map(ResolutionContext context, IMappingEngineRunner mapper) at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) --- End of inner exception stack trace --- at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) at AutoMapper.MappingEngine.Map[TSource,TDestination](TSource source) at Nop.Admin.MappingExtensions.ToModel(IPaymentMethod entity) in c:\D-DRIVE\IIS\surfari-nop2.8-source\Presentation\Nop.Web\Administration\MappingExtensions.cs:line 461 at Nop.Admin.Controllers.PaymentController.Methods() in c:\D-DRIVE\IIS\surfari-nop2.8-source\Presentation\Nop.Web\Administration\Controllers\PaymentController.cs:line 56 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I believe I have implemented all of the Interfaces, functions etc... but this keeps coming up. Any general suggestions would be gratefully received.

Maybe a fresh set of eyes tomorrow will see some thing obvious.

Thanks

Jax.
11 years ago
Does your plugin implement AutoMapper?
11 years ago
Nope... I don't think so. Should it?
11 years ago
Are you using ToEntity or ToModel in your plugin?  Those are AutoMapper functions and they won't recognize your new Types.  There might be a way to add those extension methods but it's probably quicker/easier to just drop them and handle the mapping yourself like:


var model = new SomeModel();
model.Prop1 = entity.Prop1;
model.Prop2 = entity.Prop2;


and Vice Versa for model to entity.
11 years ago
I'll look into it... Thanks for the tip.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.