After upgrading from Commerce 11.2.5 to 11.8.5, which should not contain any breaking change, we get the following error in Commerce Manager when trying to create a return. Anyone seen this error? Is this an undocumented breaking change?
[InvalidCastException: Unable to cast object of type 'EPiServer.Commerce.Order.Internal.InMemoryShipment' to type 'Mediachase.Commerce.Orders.Shipment'.]EPiServer.Commerce.Order.Calculator.DefaultShippingCalculator.GetShippingRate(IShipment shipment, ShippingMethodRow row, IMarket market) +282EPiServer.Commerce.Order.Calculator.DefaultShippingCalculator.CalculateShippingCost(IShipment shipment, IMarket market, Currency currency) +575EPiServer.Commerce.Order.Calculator.DefaultShippingCalculator.GetDiscountedShippingAmount(IShipment shipment, IMarket market, Currency currency) +388EPiServer.Commerce.Order.Calculator.DefaultTaxCalculator.CalculateShippingTaxTotal(IShipment shipment, IMarket market, Currency currency, Func`3 getShippingTotalFunc, Func`3 getDiscountedPriceFunc, Boolean isReturn) +311EPiServer.Commerce.Order.Calculator.DefaultTaxCalculator.CalculateShippingTaxTotal(IShipment shipment, IMarket market, Currency currency) +259EPiServer.Commerce.Order.Calculator.DefaultTaxCalculator.GetShippingTaxTotal(IShipment shipment, IMarket market, Currency currency) +367EPiServer.Commerce.Order.Calculator.<>c__DisplayClass7_0.<GetTotalForReturns>b__1(IShipment shipment) +157System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +233System.Linq.Enumerable.Sum(IEnumerable`1 source) +98EPiServer.Commerce.Order.Calculator.DefaultReturnPurchaseOrderCalculator.GetTotalForReturns(IPurchaseOrder order) +788EPiServer.Commerce.Order.Calculator.DefaultReturnPurchaseOrderCalculator.CalculateReturnTotal(IPurchaseOrder purchaseOrder, IReturnOrderForm currentReturnForm, Boolean isCompletingReturnForm) +338Mediachase.Commerce.Manager.Apps.Order.Modules.OrderCreateReturn.CalculateReturnTotal() +147Mediachase.Commerce.Manager.Apps.Order.Modules.OrderCreateReturn.Page_Load(Object sender, EventArgs e) +1241System.Web.UI.Control.OnLoad(EventArgs e) +106System.Web.UI.Control.LoadRecursive() +68System.Web.UI.Control.LoadRecursive() +162System.Web.UI.Control.LoadRecursive() +162System.Web.UI.Control.LoadRecursive() +162System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785
It sounds like your shipment has the wrong shipping gateway/plugin attached. It should have been a class that implements IShippingPlugin, but it only implements IShippingGateway
Hi Quan. When did this change? It seems it stopped working for us when going from 11.2.5 to 11.8.5.
I can't recall any change related to this. Which is the shipping method attached to this shipment. What does the implementation of that shipping method look like?
It is a custom gateway which implements IShippingGateway. The invalid cast occurs in GetRate() since it expects a Shipment but gets an IShipment.
I'll try to change the implementation but one thing occured to me. We rely on data from the orderform and ordergroup which we get from LineItem.Parent and LineItem.Parent.Parent. I don't see any replacement for that in IShipment. How can we resolve which OrderForm an IShipment belongs to?
Hmm, what does your CM Configs\ecf.app.config look like
<?xml version="1.0" encoding="utf-8"?><Application defaultApplicationName="xxxxx.CommerceAdmin"><Roles><add name="AdminRole" value="Admins"/><add name="ManagerUserRole" value="Management Users"/><add name="EveryoneRole" value="Everyone"/><add name="RegisteredRole" value="Registered"/></Roles><Connection connectionStringName="EcfSqlConnection"/><Cache enabled="true" appTimeout="0:0:10"/><Languages><add key="en-us" value="English"/><add key="da-DK" value="Danish"/><add key="sv-SE" value="Svenska"/><add key="fi-FI" value="Suomi"/><add key="nl-NL" value="Netherlands"/><add key="nb-NO" value="Norsk"/><add key="fr-FR" value="French"/></Languages><Features><add feature="WorkflowsVNext" state="Disabled" type="Mediachase.Commerce.Core.Features.WorkflowsVNext, Mediachase.Commerce"/></Features></Application>
Shouldn't it be Enabled for WorkflowsVNext?
We're still on the old promotion system.
Please reach out for developer support service, and we can take it from there
Did you get to the bottom of this. We seem to ebe getting the same error when trying to do a return in commerce manager.
Unfortunately no - or if we did - I forget it now. Please reach out to developer support service