Help on new Payment Method - nullException

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Thanks for the quick response Andrei. Here is my solution:

nopCommerce_1.90_Solution.rar - 64.6 MB
13 years ago
I followed the next steps:

1. Opened your solution
2. Cleared connection string and installed it
3. Executed the following SQL command over my database:
IF NOT EXISTS (
    SELECT 1
    FROM [dbo].[Nop_PaymentMethod]
    WHERE [ClassName] = N'NopSolutions.NopCommerce.Payment.Methods.NBePay.NBePayPaymentProcessor, Nop.Payment.NBePay')
BEGIN
  INSERT [dbo].[Nop_PaymentMethod] ([Name], [VisibleName], [Description], [ConfigureTemplatePath], [UserTemplatePath], [ClassName], [SystemKeyword], [IsActive], [DisplayOrder])
  VALUES (N'NBePay', N'NBePay', N'', N'Payment\NBePay\ConfigurePaymentMethod.ascx', N'~\Templates\Payment\NBePay\PaymentModule.ascx', N'NopSolutions.NopCommerce.Payment.Methods.NBePay.NBePayPaymentProcessor, Nop.Payment.NBePay', N'NBePay', 0, 290)
END
GO

4. Added 'Nop.Payment.NBePay' assembly a reference to 'NopCommerceStore' project (it was missed!!!)
5. Now everything should work fine. But there're a couple of issues in NBePay payment module. Find them below:

6) Open Payment\Nop.Payment.NBePay\NBePayPaymentProcessor.cs and remove the following code from contructor:
if (string.IsNullOrEmpty(this.vendorID))
{
   throw new NopException("NBePay Vendor Id is empty");
}
. I think that this validation should be placed into another place
7) Open \NopCommerceStore\Administration\Payment\NBePay\ConfigurePaymentMethod.ascx file and replace 'CurrencyManager.PrimaryStoreCurrency.CurrencyCode' with 'CurrencyService.PrimaryStoreCurrency.CurrencyCode' (CurrencyManager was renamed to  CurrencyService in 1.90)
13 years ago
What do you exactly mean when you say:
4. Added 'Nop.Payment.NBePay' assembly a reference to 'NopCommerceStore' project (it was missed!!!)

Can you tell me what file to edit and what to put? What I did in the Administration CMS was to simply add the following:
Configuration template path: Payment\NBePay\ConfigurePaymentMethod.ascx
User template path: ~\Templates\Payment\NBePay\PaymentModule.ascx
Class name: NopSolutions.NopCommerce.Payment.Methods.NBePay.NBePayPaymentProcessor, Nop.Payment.NBePay

What did I miss?
13 years ago
greenapple wrote:
- Are you sure that you added 'Nop.Payment.NBePay' assembly as a reference to 'NopCommerceStore' project?
- Yes to both.
- What do you exactly mean when you say: Added 'Nop.Payment.NBePay' assembly a reference to 'NopCommerceStore' project (it was missed!!!)

=)))


1. Open your solution
2. In Solution Explorer, right-click the 'NopCommerceStore' project node and click Add Reference.
3. In the Add Reference dialog box, select the 'Projects' tab.
4. Select the 'Nop.Payment.NBePay' assembly, and then click OK.
5. Recompile the solution
13 years ago
So that's what you meant! I got it working now Andrei! Thank you very much for all the help :)
12 years ago
Hi there,
I found out that I need to create a new class for the MPAY24 payment method. The payment procedure works via a http request. As I have seen I should implement the iPaymentMethod and create a new class for mpay24 and implement it there. Do you have any hint or doku how I can easily do that. Any help would be appreciated as I am quite stuck at this point.

Here is the documentation of mpay24:

http://naturerlebnis.co.at.iis2001.shared-servers.com/AGBs/mpay24-Specification.pdf


Thanks in advance.
AL
12 years ago
Hi there, I managed to add the new class, got all necessary references and added the interface. How should I continue is there anyone who can help me how to continue.

Documentation for Mpay24:
-------------------------------

http://naturerlebnis.co.at.iis2001.shared-servers.com/AGBs/mpay24-Specification.pdf

my Mpay24PaymentProcessor.cs class:
-------------------------------------------
using System;
using System.Globalization;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings;
using NopSolutions.NopCommerce.BusinessLogic.CustomerManagement;
using NopSolutions.NopCommerce.BusinessLogic.Directory;
using NopSolutions.NopCommerce.BusinessLogic.Infrastructure;
using NopSolutions.NopCommerce.BusinessLogic.Orders;
using NopSolutions.NopCommerce.BusinessLogic.Payment;
using NopSolutions.NopCommerce.BusinessLogic.Products;

namespace NopSolutions.NopCommerce.Payment.Methods.Mpay24
{
  public class Mpay24PaymentProcessor : IPaymentMethod
  {
    #region IPaymentMethod Members

    public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
    {
      throw new NotImplementedException();
    }

    public string PostProcessPayment(Order order)
    {
      throw new NotImplementedException();
    }

    public decimal GetAdditionalHandlingFee()
    {
      throw new NotImplementedException();
    }

    public void Capture(Order order, ref ProcessPaymentResult processPaymentResult)
    {
      throw new NotImplementedException();
    }

    public void Refund(Order order, ref CancelPaymentResult cancelPaymentResult)
    {
      throw new NotImplementedException();
    }

    public void Void(Order order, ref CancelPaymentResult cancelPaymentResult)
    {
      throw new NotImplementedException();
    }

    public void ProcessRecurringPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
    {
      throw new NotImplementedException();
    }

    public void CancelRecurringPayment(Order order, ref CancelPaymentResult cancelPaymentResult)
    {
      throw new NotImplementedException();
    }

    public bool CanCapture
    {
      get { throw new NotImplementedException(); }
    }

    public bool CanPartiallyRefund
    {
      get { throw new NotImplementedException(); }
    }

    public bool CanRefund
    {
      get { throw new NotImplementedException(); }
    }

    public bool CanVoid
    {
      get { throw new NotImplementedException(); }
    }

    public RecurringPaymentTypeEnum SupportRecurringPayments
    {
      get { throw new NotImplementedException(); }
    }

    public PaymentMethodTypeEnum PaymentMethodType
    {
      get { throw new NotImplementedException(); }
    }

    #endregion
  }
}
12 years ago
Hi,
I managed to integrate the mpay24 class (Nop.Payment.Mpay24/Mpay24PaymentProcessor.cs and TransactMode.cs), added all references, implemented the interface for iPaymentMethod.cs into my mpay24 class.
I added a new Template for Mpay24 to Templates/Payment/Mpay24 (PaymentModule.ascx + cs) and added a Administration/Payment/Mpay24 ConfigurePaymentMethod.cs. This is what I get when adding the new Payment method to the Payment section in the Administration:


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 18:                             GroupName="paymentMethodGroup" />
Line 19:                         <%#Server.HtmlEncode(Eval("VisibleName").ToString()) %>
Line 20:                         <%#Server.HtmlEncode(FormatPaymentMethodInfo(((PaymentMethod)Container.DataItem)))%>
Line 21:                     </div>
Line 22:                 </ItemTemplate>


Where is the problem??

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