November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Sounds like a bug to me. How do you fill the properties? Do you use the .Properties property?
No, I am just setting properties on the ICreditCartPayment:
payment.CardType = CardType; payment.PaymentMethodId = PaymentMethodId; payment.PaymentMethodName = SystemKeyword; payment.Amount = amount; payment.CreditCardNumber = CreditCardNumber; payment.CreditCardSecurityCode = CreditCardSecurityCode; payment.ExpirationMonth = ExpirationMonth; payment.ExpirationYear = ExpirationYear; payment.Status = PaymentStatus.Pending.ToString(); payment.CustomerName = CreditCardName; payment.TransactionType = TransactionType.Sale.ToString();
That's bad. I'll file a bug for this and we will look into it ASAP. Thanks for bringing it into our attention.
I checked the database and it looks like that the data is stored properly.
"Payments": [{ "__MetaClass": "CreditCardPayment", "CreatorId": null, "ModifierId": null, "Created": "2017-10-03T14:48:51.6390544Z", "Modified": "2017-10-03T14:48:51.6390544Z", "CardType": "Generic", "CreditCardNumber": "4007000000027", "CreditCardSecurityCode": "123", "ExpirationMonth": "10", "ExpirationYear": "2017", "PaymentStatus": null, "ProviderPaymentId": null, "ProviderProfileId": null, "ImplementationClass": "Mediachase.Commerce.Orders.CreditCardPayment,Mediachase.Commerce", "AuthorizationCode": null, "OrderGroupId": "0", "PaymentMethodId": "4b6e692f-d6fb-4552-9439-3a39d2251316", "Status": "Pending", "BillingAddressId": "Billing", "OrderFormId": "0", "PaymentMethodName": "Authorize", "ValidationCode": null, "PaymentId": "-3", "TransactionID": null, "Amount": "96.5000000000", "PaymentType": "CreditCard", "TransactionType": "Sale", "ProviderTransactionID": null, "CustomerName": "Asda" }],
It seems that loading the cart does not restore the state properly.
@Maris: After investigation and tests, Save cart with added payment seems ok to me.
Could you give me more details about how to reproduce your bug ( which methods/API did you use to load the cart, where/when do you use it... ) ?
To be clear, just CreditCard data is missing when loading SerializableCart because SerializablePayment doesn't have any property related to CreditCard data like CreditCardNumber, CreditCardSecurityCode, ExpirationMonth, ExpirationYear ...
Other payment info like Amount, PaymentMethodName... still loaded correctly.
And the BillingAddressId was stored in DB instead of entire BillingAddress so when load data from SerializableCart the BillingAddress will be null.
It should be able to deserialize Payment info to CreditCartPayment base on ImplementationClass property. I'm working on it right now .
You can do a workaround to get the CreditCard info by using Hashtable Properties of SerializablePayment to store CreditCard info if you can't wait for the change .
For example :
payment.Properties["CreditCardNumber"] = "4007000000027";
SerializableCart always return SerializablePayment in OrderForm and we also want to have Credit Card info from ICreditCardPayment.
So I use SerializableCreditCardPayment which inherited from SerializablePayment and ICreditCardPayment to make sure we can load all data about Credit Card payment.
After load Cart, you will have SerializableCreditCardPayment instead of SerializablePayment and you can cast it to ICreditCartPayment if you want.
I hope this can fix your issue .
Thank you for reporting it.
As usual - it's done when it's done :) . The current version under testing is 11.3 so the bug will be fixed in a later version, probably 11.3.1 or 11.4 - we don't know yet
There were some issues with the bug fix, and we had to push back. It will probably be in Commerce 11.5 which is CMS-11 compatible. Is that something you can afford?
Yes, it is fine. We are not using Serialized carts yet because of this issue. But once it will be available, will move forward.
@Khiem Nguyen Duy: Regarding this comment, is this something that has been implemented yet?
"It should be able to deserialize Payment info to CreditCartPayment base on ImplementationClass property. I'm working on it right now ."
The reason I'm asking is that we have our own custom payment method implementations that I'd like to deserialize into from Serializable Payments.
@Martin : Yes, we did some changes in PaymentConverter of Commerce 11.4.1 release.
Make sure YourCustomPayment inherit SerializablePayment and specify the converter for it : [JsonConverter(typeof(PaymentConverter))].
When create payment :
public IPayment CreatePayment()
{
return new YourCustomPayment { ImplementationClass = typeof(YourCustomPayment).AssemblyQualifiedName };
}
Based on ImplementationClass of YourCustomPayment, PaymentConverter can deserialize SerializablePayment into YourCustomPayment.
@Khiem: 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 your last comment, I understand that I should get a CustomPayment object back. Is there a something I need to do in ProcessPayment method to convert?
[Serializable]
[JsonConverter(typeof(PaymentConverter))]
public class BarclaysFusePayment : SerializablePayment
{
/// <summary>
/// Initializes a new instance of the <see cref="BarclaysFusePayment"/> class.
/// </summary>
public BarclaysFusePayment()
{
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
var cardPayment = payment as BarclaysFusePayment;
Admittedly, we've not upgraded in a few years we are upgrading from Mediachase.Commerce 11.8.3.0 to Mediachase.Commerce 13.32.0.0
The thread is very old so it's best to create a new thread (And link to this if necessary).
You should not inherit from SerializablePayment. It is an internal implementation. Should extend IPayment instead.
What do you return in your ProcessPayment exactly?
Thanks Quan, I've created a new thread. I've also added a bit more of the payment gateway class to give context.
I'll try using IPayment in the meantime and report back if that works
I am trying to enable serializable carts in our project and after some testing found that it doesn't work with Authorize.NET.
I am adding ICreditCardPayment correctly with new APIs:
But when I load the card next time it doesn't have my payment, but instead it has SerializablePayment which doesn't have any of my filled up properties. It also does not have billing address anymore.
Is there a way to configure serializable carts to work with ICreditCardPayment?
I have Commerce 11.2.1.