Closed mindcross closed 3 years ago
I experienced the same issue. I think I found the cause. What I found was that in the ReceiveCreditCards.ProcessTransaction method the order number that was supposed to be supplied to the Transaction object being created, was always an empty string. This was the case for my custom payment provider and also the providers that come out of the box. If the OrderNumber is blank, the Order Repository will return the first item it finds or it'll return null. I think that's why the items list is coming back null. I believe I have a fix for this bug.
Describe the bug
When processing a purchase via a custom gateway class (a class inheriting from PaymentGateway), the overridden method ProcessTransaction will receive a parameter of type Transaction, which has a property called Items. For the very first purchase the Items property is null, which of course means the purchase is unable to complete successfully since no item information is available. Subsequent purchase attempts succeed (the Transaction.Items is populated correctly).
Software Versions
To Reproduce
Example code:
public override void ProcessTransaction(Transaction t) { //t.Items is null (FIRST purchase attempt only)
foreach(var item in t.Items) //blows up here when t.Items is null { //do something } }
Expected behavior
The Items list should always contain the items being purchased by the user.