I have a thiry party payment gateway. When payment fails, i delete order reference from orderrepository. But purchnase order is still there in orderrepository. How to remove purchaseorder from orderrepository? My code is as shown below. purchnase order is showing line items.
if (paymentResponse.ResultCode != PaymentsResponse.ResultCodeEnum.Authorised)
{
_orderRepository.Delete(orderReference);
}
var purchaseOrders = _orderRepository.Load<IPurchaseOrder>(_customerContext.CurrentContactId)
.OrderByDescending(x => x.Created)
.ToList();
after you've deleted your order? Right now you're loading the customer's purchase orders, so if the customer had previous orders, you'll see them and not the one you deleted.
_orderRepository.Delete(orderReference); is the correct code to delete the order, but only if you pass the correct orderReference. Where does your orderReference point to?
I have a thiry party payment gateway. When payment fails, i delete order reference from orderrepository. But purchnase order is still there in orderrepository. How to remove purchaseorder from orderrepository? My code is as shown below. purchnase order is showing line items.