Payment method problem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 13 años
Hell everyone. I have a big problem concerning custom made payment method. I've tried to create my own, but no metter what i do, something goes wrong. I really need some help.

Here is what i did so far.
In folder Payment i've created a new Nop.Payment.MyPayment project. In it i've created MyPaymentProcessor that looks like this:


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings;
using NopSolutions.NopCommerce.BusinessLogic.CustomerManagement;
using NopSolutions.NopCommerce.BusinessLogic.Directory;
using NopSolutions.NopCommerce.BusinessLogic.Orders;
using NopSolutions.NopCommerce.BusinessLogic.Payment;
using NopSolutions.NopCommerce.BusinessLogic.Products;
using NopSolutions.NopCommerce.BusinessLogic.Utils;
using NopSolutions.NopCommerce.Common;
using NopSolutions.NopCommerce.Common.Utils;
using e24PaymentPipeLib;

namespace NopSolutions.NopCommerce.Payment.Methods.MyPayment
{
    class MyPaymentProcessor : IPaymentMethod
    {
        #region Fields
            private bool useSandBox = true;
            private string vendorID;
           private string serverURL = "http://test4.constriv.com/cg301/Merchant";
        #endregion

        #region Ctor
            public MyPaymentProcessor()
            {
                useSandBox = SettingManager.GetSettingValueBoolean("PaymentMethod.Intesa.UseSandbox");
                vendorID = SettingManager.GetSettingValue("PaymentMethod.Intesa.vendorID");

                if (string.IsNullOrEmpty(vendorID))
                    throw new NopException("MyPayment ID merchent is empty");
            }
        #endregion
        #region Methods
            public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid OrderGuid, ref ProcessPaymentResult processPaymentResult)
            {
                processPaymentResult.PaymentStatus = PaymentStatusEnum.Pending;
              
            }
            public string PostProcessPayment(Order order)
            {
                e24PaymentPipeCtl mojObjekat;
                //e24PaymentPipeCtl mojObjekat;
                mojObjekat = new e24PaymentPipeCtl();
                mojObjekat.WebAddress = "http://test4.constriv.com";
                mojObjekat.PortStr = "80";
                mojObjekat.Context = "/cg301";
                mojObjekat.ID = "2345";
                mojObjekat.Password = "234
                mojObjekat.Language = "SRB";
                mojObjekat.ResponseUrl = "www.merchant.com/response";
                mojObjekat.ErrorUrl = "www.merchant.com/error";
                mojObjekat.Amt = "10.00";
                mojObjekat.Currency = "978";
                mojObjekat.TrackId = "1234";
                mojObjekat.Udf1 = "AA";
                mojObjekat.Udf2 = "BB";
                mojObjekat.Udf3 = "CC";
                mojObjekat.Udf4 = "DD";
                mojObjekat.Udf5 = "EE";
                return string.Empty;
            }
            public decimal GetAdditionalHandlingFee()
            {
                //override if payment method requires additional handling fee
                return decimal.Zero;
            }
            public void Capture(Order order, ref ProcessPaymentResult processPaymentResult)
            {
                throw new NopException("Capture method not supported");
            }
        #endregion

            //public void Capture(Order order, ref ProcessPaymentResult processPaymentResult)
            //{
            //    throw new NopException("Capture method not supported");
            //}
            #region Properies

            /// <summary>
            /// Gets a value indicating whether capture is allowed from admin panel
            /// </summary>
            public bool CanCapture
            {
                get
                {
                    return false;
                }
            }
            #endregion

    }
}

I've also created template folder MyPayment with its PaymentModule.ascx. Here is how it looks:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using NopSolutions.NopCommerce.BusinessLogic.Payment;


namespace NopSolutions.NopCommerce.Web.Templates.Payment.MyPayment
{
    public partial class PaymentModule : BaseNopUserControl, IPaymentMethodModule
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public bool ValidateForm()
        {
            return true;
        }

        public PaymentInfo GetPaymentInfo()
        {
            PaymentInfo paymentInfo = new PaymentInfo();
            paymentInfo.CreditCardType = string.Empty;
            paymentInfo.CreditCardName = string.Empty;
            paymentInfo.CreditCardNumber = string.Empty;
            paymentInfo.CreditCardExpireYear = 0;
            paymentInfo.CreditCardExpireMonth = 0;
            paymentInfo.CreditCardCVV2 = string.Empty;
            return paymentInfo;
        }

    }
}

I got a DLL from bank and "instructions" how to implement it... right... didn't really help much. Its e24PaymentPipe. I've read some of the previous treads on this forum and couldn't find the solution. What system is returning to me is this:

  OrderError  
  11  
  Error while placing order. Value cannot be null. Parameter name: type  
  System.Exception: System.ArgumentNullException: Value cannot 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.ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid OrderGuid, ProcessPaymentResult& processPaymentResult) in C:\Users\zika.lujic\Desktop\NopCommerceTest\Libraries\Nop.BusinessLogic\Payment\PaymentManager.cs:line 53 at NopSolutions.NopCommerce.BusinessLogic.Orders.OrderManager.PlaceOrder(PaymentInfo paymentInfo, Customer customer, Guid OrderGuid, Int32& OrderID) in C:\Users\zika.lujic\Desktop\NopCommerceTest\Libraries\Nop.BusinessLogic\Orders\OrderManager.cs:line 1175  
:  127.0.0.1  
:  [email protected]  
:  http://localhost:50882/CheckoutConfirm.aspx  
:  14/06/2010 12:48:09  


Please guys help, i am pretty new to .NET programming and i would really appreciate ANY help... thanks guys

p.s. sorry for the length of the post.... :(
Hace 12 años
Hi! I am facing the same issue, did you get if sorted??
Please could you explain how?

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