Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How to add Cart Payment to Purchase Order Payment Option

P
P
Vote:
 

Hi all,

please help me to get on from this. I have requirement to add Payment from cart to Purchase order. 

For this I tried as below

 var purchaseOrder = _orderRepository.Load(orderRef);

 var cartPayment = cart.GetFirstForm().Payments.FirstOrDefault();

 var POPayment = purchaseOrder.GetFirstForm().Payments.FirstOrDefault();

  1. purchaseOrder.GetFirstForm().Payments.Add(cartPayment);
  2. purchaseOrder.AddPayment((IOrderForm)purchaseOrder.GetFirstForm(), (IPayment)cartPayment);

In both case its getting exception as " Value cannot be null".  

Help me to achieve the same.

Thank You!!

#217218
Feb 19, 2020 13:26
Vote:
 

If you debug your code, which code is throwing that exception?

#217220
Feb 19, 2020 14:08
P
Vote:
 

In both 1 and 2 cases are throwing an exception as I mentioned

#217281
Feb 20, 2020 8:05
Vote:
 

No, I don't mean which option, but which exactly line is throw exception and with what stacktrace? 

#217282
Feb 20, 2020 8:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.