We are updating the payment method on an Order with this code:
using (var uow = _uowProvider.Create())
{
var order = _sessionManager.GetOrCreateCurrentOrder(store.Id).AsWritable(uow);
var store = GetStore();
// other code remove for brevity
var paymentId = _paymentMethodService.GetPaymentMethods(storeId).FirstOrDefault(x => x.PaymentProviderAlias == "total-processing").Id;
order.SetPaymentMethod(paymentId);
_orderService.SaveOrder(order);
uow.Complete();
}
On the _orderService.SaveOrder line, when we look at the order.PaymentInfo.PaymentMethodId property, I can see the Guid of the payment provider.
If I then step past this line and the order is saved, when I then look at the order.PaymentInfo.PaymentMethodId property it is null again.
This is causing us issues when we then retrieve the Order in another controller as the payment provider hasn't been saved.
I saw the other forum post about Vendr Checkout and no we're not using it.
We are in the process of setting up another language site, which is running off a 2nd Vendr shop all within the same Umbraco instance.
The 1st site has been up and running for months without issue, so I'm a little nervous to start changing what was a working checkout process, but the new site is currently not working because of this payment issue.
Ok, then if you aren’t running Vendr Checkout on either store, I’d double check what event handlers you have configured and whether any of them are resetting it.
Also, make sure all units of work have their Complete(); method called otherwise things will just be reset.
There are some OrderEventHandlers hidden in the codebase that are clearing out the shipping and payment details if the order isn't finalised. We do need them, but just not firing on the last page of the checkout.
Inherited project so didn't even know they were there.....
Order missing PaymentMethod
We are updating the payment method on an Order with this code:
On the _orderService.SaveOrder line, when we look at the order.PaymentInfo.PaymentMethodId property, I can see the Guid of the payment provider.
If I then step past this line and the order is saved, when I then look at the order.PaymentInfo.PaymentMethodId property it is null again.
This is causing us issues when we then retrieve the Order in another controller as the payment provider hasn't been saved.
Any ideas what we're doing wrong?
Are you using Vendr Checkout?
I saw the other forum post about Vendr Checkout and no we're not using it.
We are in the process of setting up another language site, which is running off a 2nd Vendr shop all within the same Umbraco instance.
The 1st site has been up and running for months without issue, so I'm a little nervous to start changing what was a working checkout process, but the new site is currently not working because of this payment issue.
Ok, then if you aren’t running Vendr Checkout on either store, I’d double check what event handlers you have configured and whether any of them are resetting it.
Also, make sure all units of work have their Complete(); method called otherwise things will just be reset.
Thanks Matt, that was it!!
There are some OrderEventHandlers hidden in the codebase that are clearing out the shipping and payment details if the order isn't finalised. We do need them, but just not firing on the last page of the checkout.
Inherited project so didn't even know they were there.....
is working on a reply...