SaaS CMS has officially launched! Learn more now.

Updating TransactionId after Purchase Order Creation

Vote:
 

Is there a way to update any meta field on a payment record for an order that has already created a purchase order object?

Thanks

#217369
Feb 21, 2020 18:19
Vote:
 

Hi Todd

See code sample below, I hope it helps. 

// Get Order reference 

var orderReference = _orderRepository.SaveAsPurchaseOrder(cart);

// Load purchase order 

IPurchaseOrder purchaseOrder = _orderRepository.Load<IPurchaseOrder>(orderReference.OrderGroupId);





// loop through all payments in the PurchaseOrder, find payment with id equal guidPaymentMethodId, set TransactionId
foreach (var payment in purchaseOrder.Forms.SelectMany(form => form.Payments).Where(payment => payment.PaymentMethodId.Equals(paymentMethodId)))
{
    payment.TransactionID = token;
    payment.ProviderTransactionID = token;
}
#217429
Feb 24, 2020 4:14
* 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.