I am using a custom payment and passing in the ImplementationClass when adding the payment to the cart. Using cart.AddPayment method. However, when ProcessPayment is called in my custom payment gateway I get the IPayment Object which is iternally a 'SerializablePayment' object.
Following last comment from Khiem, I understand that I should get a CustomPayment object back. Is there a something I need to do in ProcessPayment method to convert?
public class BarclaysFusePayment : SerializablePayment
/// Initializes a new instance of the <see cref="BarclaysFusePayment"/> class.
this.Properties = new Hashtable();
this.BillingAddress = (IOrderAddress)new SerializableOrderAddress();
this.PaymentType = PaymentType.Other;
this.ImplementationClass = typeof(BarclaysFusePayment).AssemblyQualifiedName;
The following code use to work with Mediachase version but now thows an exception as it cant cast
public class BarclaysFusePaymentGateway : AbstractWexPaymentGateway, IPaymentPlugin
public PaymentProcessingResult ProcessPayment(IOrderGroup orderGroup, IPayment payment)
var cardPayment = payment as BarclaysFusePayment;
var paymentSuccessful = false;
//payment processing logic
return PaymentProcessingResult.CreateUnsuccessfulResult("Error processing payment");
Admittedly, we've not upgraded in a few years we are upgrading from Mediachase.Commerce 126.96.36.199 to Mediachase.Commerce 188.8.131.52
Can you show us how you are creating the IPayment object before you call ProcessPayment on your custom gateway?
Also I don't think you should be inheriting from SerializablePayment. Ideally you should be using the CreatePayment method() from the PaymentOption (payment method) or directly from OrderGroupFactory. You've mentioned the ImplementationClass so I assume your doing the latter correctly.