You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
DNN: 09.08.01
Hotcakes: 3.5.0
To Reproduce
Perform an iisreset
Purchase a product
Purchase fails (if your code relies on the Items list not being null).
Try to purchase the product again, with the same user and type in the exact same payment information.
This time the Items list is present and populated and the purchase succeeds.
Perform another iisreset and you can reproduce the problem again.
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: