PaymentMethod.CalculatePrice() always returns 0 in Vendr Checkout
Hello,
I'm currently experiencing an odd issues when using Vendr Checkout alongside the Stripe Payment provider. Here some info on the versions of things being used
Umbraco - 8.17.2
Vendr - 2.1.0
Vendr.PaymentProviders.Stripe - 2.1.1
Vendr.Checkout - 2.1.0
In the VendrCheckoutPaymentMethodPage.cshtml there is the following code (this is an unchanged copy from the package) from line 44
I'm expecting the item.PaymentMethod.CalculatePrice() to return the total order value, but it always returns 0. I've had a look through the Vendr Checkout source code, and the Stripe source code, and can't find any reference to then CalculatePrice() method, and i couldn't find it in the docs for the main Vendr package either.
I've been able to pop a breakpoint into the compiled code and have found something at Vendr.Extensions.PaymentMethodExtensions, and when trying to debug I can see that the currentOrder value (OrderReadOnly) is being populated, but I can't quite work out where it's going wrong.
Has anyone else experienced this issue? I feel I could probably just change it to use the currentOrder.TotalPrice value, but as this is code directly from the package, i'm assuming it is like it is for a reason.
My first thought is that I wouldn't expect item.PaymentMethod.CalculatePrice() to return the total order price, but instead the price for that item, as item is a payment method.
The price it is trying to show would be the price of using said payment provider (in the CMS you can set a price to charge uplifts for the provider).
That's exactly it! 100% a case of me not understanding it completely. I got blinkered by some other legacy code that had been added by someone else which used the values from that payment method for some analytics stuff, but based on this, it appears it was done incorrectly in the first place.
PaymentMethod.CalculatePrice() always returns 0 in Vendr Checkout
Hello,
I'm currently experiencing an odd issues when using Vendr Checkout alongside the Stripe Payment provider. Here some info on the versions of things being used
In the VendrCheckoutPaymentMethodPage.cshtml there is the following code (this is an unchanged copy from the package) from line 44
I'm expecting the item.PaymentMethod.CalculatePrice() to return the total order value, but it always returns 0. I've had a look through the Vendr Checkout source code, and the Stripe source code, and can't find any reference to then CalculatePrice() method, and i couldn't find it in the docs for the main Vendr package either.
I've been able to pop a breakpoint into the compiled code and have found something at
Vendr.Extensions.PaymentMethodExtensions
, and when trying to debug I can see that the currentOrder value (OrderReadOnly) is being populated, but I can't quite work out where it's going wrong.Has anyone else experienced this issue? I feel I could probably just change it to use the
currentOrder.TotalPrice
value, but as this is code directly from the package, i'm assuming it is like it is for a reason.Thanks in advance.
Hey Mike,
My first thought is that I wouldn't expect
item.PaymentMethod.CalculatePrice()
to return the total order price, but instead the price for that item, as item is a payment method.The price it is trying to show would be the price of using said payment provider (in the CMS you can set a price to charge uplifts for the provider).
So showing 0 seems correct to me.
Thanks
Nik
Thanks Nik,
That's exactly it! 100% a case of me not understanding it completely. I got blinkered by some other legacy code that had been added by someone else which used the values from that payment method for some analytics stuff, but based on this, it appears it was done incorrectly in the first place.
Cheers, Mike
is working on a reply...