New Payment method headache - help

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Thought i would tackle the Myvirtualmerchant/Elavon/Usbank xml realtime processing.  I already have it working on a a live site using asp with out a problem.

SO.....

I used the Authorize.net as a template and made some changes.
I added a new project property and code under the Nopcommerce -> payment area.

I added the code for the Admin setup and the web side data entry.

But somehow something is now broken.  I get the following error on any of the payment methods i try and it is always with my new (myvirtualmerchant class even when not active).

The error is occurring at:
var iPaymentMethod = Activator.CreateInstance(Type.GetType(paymentMethod.ClassName)) as IPaymentMethod;
the class name is: NopSolutions.NopCommerce.Payment.Methods.myvirtualmerchant.myvirtualmerchantPaymentProcessor, Nop.Payment.myvirtualmerchant

all exist.  All appear to be referenced correctly.  No build errors.  I can select my payment type, update the options on the configurations tab.

But when I click the "shopping cart" link to go to the cart I get the error:
ArgumentNullException was unhandled by user code

do I need to make sure all the functions return something?  Not sure why it is calling any of this at the cart level.  And it was not doing this prior.  No if I select manual payment it does the same error.  some reference appears to be lost.

Value can not be null
parameter name: type

   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at NopSolutions.NopCommerce.BusinessLogic.Payment.PaymentManager.GetAdditionalHandlingFee(Int32 paymentMethodId) in C:\Documents and Settings\Administrator\Desktop\shop_cart open source\Libraries\Nop.BusinessLogic\Payment\PaymentManager.cs:line 87
   at NopSolutions.NopCommerce.Web.Modules.OrderTotalsControl.BindData(Boolean isShoppingCart) in C:\Documents and Settings\Administrator\Desktop\shop_cart open source\NopCommerceStore\Modules\OrderTotals.ascx.cs:line 121
   at NopSolutions.NopCommerce.Web.Modules.OrderSummaryControl.BindData() in C:\Documents and Settings\Administrator\Desktop\shop_cart open source\NopCommerceStore\Modules\OrderSummary.ascx.cs:line 89
   at NopSolutions.NopCommerce.Web.Modules.OrderSummaryControl.OnInit(EventArgs e) in C:\Documents and Settings\Administrator\Desktop\shop_cart open source\NopCommerceStore\Modules\OrderSummary.ascx.cs:line 52
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


I was so close.  Thought I had this.  

as you can probably tell I am not a C# coder but do know the .net side of VB.  So it is a little different for us VB coders.

Please let me know if you can help.  Will keep chipping away.

I did have to rename a function in the region Ctor under the paymentprocessor.cs code.  It then asked to change all occurances and I said yes.  I have a bad feeling this is where it happened.  but the named function was not something in use by nocommerce anywhere else.
13 years ago
I am going to try a clean version and insert just the code just in case I blew something up internally.
That would probably be the simplest since I have not modded anything else yet.

But if someone knows what I may have done or what to check that would surely be appreciated.

Mike
13 years ago
clean install made no difference
13 years ago
ok its something to do with the class references but I really can't see why.  if I delete the item from the edit payments (i.e. delete the new template from the database via the admin web tool) then everything works.   It has to do with my class references.  Not sure why yet.
13 years ago
GOT IT !!!

ok - so some of the forum postings did lead me to looking into areas I would not thought of but none of them really gave me what I was looking for.

So for anyone getting the error with the below line:

var iPaymentMethod = Activator.CreateInstance(Type.GetType(paymentMethod.ClassName)) as IPaymentMethod;
where the returned ipaymethod is NULL and is the basis for the error read on.

it came down for me that the assembly name was not the same as the class name.  I think that is what the other postings might have been saying but man they were pages and pages of text.

the assembly was a lowercase version of the name.  Perhaps I renamed I don't know.
anyway if you go to (from solution explorer) Nopcommerce/payment/Nop.Payment.YourPaymentProcessor project
right click and go to properties.  Under Application tab you will see a "Assembly Information" Button.  Click it.
There you will see Title and Product.  Both of those are very important, as I have found.
this info should also be available under properties then assemblyinfo.cs of the project explorer.

So when adding the class name to the ascx file for admin this is what appears to matter.

Anyway all my uppercase letter were lower case.  This caused it to not work.

Again i am a vb programmer so case sensitive vars always seem to be the last thing I check.
not to mention arrays with () and [] but that is another story.

Hopefully this might lead someone to a solution of there own on something else.
12 years ago
Care to share your gateway ??

Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.