I am new to NopCommerce and have been trying to create a new payment gateway.
I simply replicated PayInStore payment method and renamed it to NewPayment to have a baseline which I will edit later on. However doing so, I still received a null Exception:
Value cannot be null.
Parameter name: type
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: type
Source Error:
Line 533: if (paymentMethod == null)
Line 534: return decimal.Zero;
Line 535: var iPaymentMethod = Activator.CreateInstance(Type.GetType(paymentMethod.ClassName)) as IPaymentMethod;
Line 536:
Line 537: decimal result = iPaymentMethod.GetAdditionalHandlingFee();
Source File: C:\Users\ritchieanxa\Documents\Visual Studio 2010\Projects\nopCommerce_1.90_Source\Libraries\Nop.BusinessLogic\Payment\PaymentService.cs Line: 535
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: type]
System.Activator.CreateInstance(Type type, Boolean nonPublic) +9643414
System.Activator.CreateInstance(Type type) +6
NopSolutions.NopCommerce.BusinessLogic.Payment.PaymentService.GetAdditionalHandlingFee(Int32 paymentMethodId) in C:\Users\ritchieanxa\Documents\Visual Studio 2010\Projects\nopCommerce_1.90_Source\Libraries\Nop.BusinessLogic\Payment\PaymentService.cs:535
NopSolutions.NopCommerce.Web.Modules.CheckoutPaymentMethodControl.FormatPaymentMethodInfo(PaymentMethod paymentMethod) in C:\Users\ritchieanxa\Documents\Visual Studio 2010\Projects\nopCommerce_1.90_Source\NopCommerceStore\Modules\CheckoutPaymentMethod.ascx.cs:50
ASP.modules_checkoutpaymentmethod_ascx.__DataBind__control4(Object sender, EventArgs e) in c:\Users\ritchieanxa\Documents\Visual Studio 2010\Projects\nopCommerce_1.90_Source\NopCommerceStore\Modules\CheckoutPaymentMethod.ascx:20
System.Web.UI.Control.OnDataBinding(EventArgs e) +91
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +201
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
System.Web.UI.Control.DataBind() +15
System.Web.UI.WebControls.DataList.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +137
System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +488
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +64
System.Web.UI.WebControls.BaseDataList.DataBind() +55
NopSolutions.NopCommerce.Web.Modules.CheckoutPaymentMethodControl.BindData() in C:\Users\ritchieanxa\Documents\Visual Studio 2010\Projects\nopCommerce_1.90_Source\NopCommerceStore\Modules\CheckoutPaymentMethod.ascx.cs:309
NopSolutions.NopCommerce.Web.CheckoutPaymentMethodPage.Page_Load(Object sender, EventArgs e) in C:\Users\ritchieanxa\Documents\Visual Studio 2010\Projects\nopCommerce_1.90_Source\NopCommerceStore\CheckoutPaymentMethod.aspx.cs:60
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
NopSolutions.NopCommerce.Web.BaseNopFrontendPage.OnLoad(EventArgs e) in C:\Users\ritchieanxa\Documents\Visual Studio 2010\Projects\nopCommerce_1.90_Source\NopCommerceStore\Controls\BaseNopFrontendPage.cs:147
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Here is what I did:
1) Created NewPayment template, PaymentModule.ascx, PaymentModule.ascx.cs
2) Under Administration > Payment, I created NewPayment folder with ConfigurePaymentMethod.ascx and ConfigurePaymentMethod.ascx.cs
3) Under Payment class folder I created Nop.Payment.NewPayment with NewPaymentProcessor.cs and AssemblyInfo.cs
Would appreciate any help you can give me.
Thank you in advance!