Custom Payment Gateway from App_Code returning an error

Lukas Filim asked on March 3, 2014 04:15

Hi,

I've been working on creating my own custom payment gateway and I have used code and the video from here - http://devnet.kentico.com/articles/developing-custom-payment-gateway

My custom provider is always returning an error in th event logs sames as World Pay code from above link: Message: Could not load file or assembly 'CMS RealexProvider' or one of its dependencies. The system cannot find the file specified. Stack Trace: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at CMS.SettingsProvider.ClassHelper.GetAssemblyInternal(String assemblyName) at CMS.SettingsProvider.ClassHelper.GetClassInternal(String assemblyName, String className) at CMS.EcommerceProvider.CMSPaymentGatewayProvider.GetPaymentGatewayProvider(Int32 paymentOptionId)

I'm using Kention 7.0 and can't much of a help to get thru this error.

Best Regards, Lukas

Recent Answers


Lukas Filim answered on March 3, 2014 04:17

Hi,

Sorry above error started to occur when I wanted to implement the gatewat not from App_Code folder , proper error that is logged in teh event log for App_Code payment gateway is : Message: [ClasHelper.GetClass]: App_Code class cannot be loaded because the OnGetCustomClass handler is not initialized. Stack Trace: at CMS.SettingsProvider.ClassHelper.GetClassInternal(String assemblyName, String className) at CMS.EcommerceProvider.CMSPaymentGatewayProvider.GetPaymentGatewayProvider(Int32 paymentOptionId)

OnGetCustomClass handler for me is initailized in loader class hacing correct code same as WorldPay in the sample link in first post.

Best Regards, Lukas

0 votesVote for this answer Mark as a Correct answer

Josef Dvorak answered on March 14, 2014 04:14

Hi,

For anyone else who may have the same problem, we were able to resolve Lukas's the issue via email. The cause of the problem was using a WebApplication and not a WebProject. When using WebApplication, the .NET framework does not use App_Code folder, therefore Kentico has to use its own alternative, called Old_App_Code. To fix your issue, do the following:

  1. Move all contents of the App_Code directory to Old_App_Code,
  2. Rremove App_Code
  3. Include the moved folder in the Solution
  4. Clean and build the Solution
  5. Clear browser cache and try the checkout again.
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.