I have two strange thing happening when using the Litium Adyen payment app.
I subscribe to the SalesOrderConfirmed event and when that happens I create a shipment and push it to processing state.
_eventBroker.Subscribe<SalesOrderConfirmed>(async x =>
{
var shipment = await _shipmentManager.Create(x.Item.SystemId, new CreateShipmentArgs
{
Rows = x.Item.Rows.Where(salesOrderRow => salesOrderRow.OrderRowType == OrderRowType.Product)
.Select(salesOrderRow => new ProductToShipRow
{
Quantity = salesOrderRow.Quantity,
ArticleNumber = salesOrderRow.ArticleNumber
}).ToList(),
ShippingMethod = x.Item.ShippingInfo.First().ShippingOption.OptionId,
Address = shippingAddress
});
using (_securityContextService.ActAsSystem())
{
_shipmentService.Create(shipment);
}
var stateTransitionResult = _stateTransitionsService.SetState<Sales.Shipment>(shipment.SystemId, ShipmentState.Processing);
});
- Everything looks fine but this can be seen in the logs
2023-09-15 15:47:33.4371 [App:01] [0153291ab07650b962e98e425b93cb37] [DEBUG] [.NET ThreadPool Worker] Litium.StateTransitions.StateTransitionsService - Changing state to Processing on Litium.Sales.SalesReturnOrder (38402101-b076-48af-bd71-fd5116cfeb83) for state machine SalesReturnOrder result in failure for Litium.Sales.Shipment (843ccf9f-241d-4c0e-9f6a-7166e4d8062d) at Litium.Application.StateTransitions.State`1[Litium.Sales.Shipment], Invalid transition, there is no transition from Init to Processing Litium.Application.StateTransitions.InvalidStateTransitionException: Invalid transition, there is no transition from Init to Processing
at Litium.Application.StateTransitions.FiniteStateMachine`1.TransitionAction(String nextStateId, Guid entitySystemId)
at Litium.Application.StateTransitions.StateTransitionsServiceImpl.StateTransitionEngine`1.SetState(Guid entitySystemId, String nextStateId)
I don’t get why it thinks it’s a Litium.Sales.SalesReturnOrder??? Everything seems to be fine. Both the order and the shipment is in Processing. Payment has Attention though but everything good in the logs from what I can see (except for the strange message above).
- This is the real issue. A few minutes later this shows up in the logs. Seems to be at the same time as the payment gets SentForSettle state in Adyen.
2023-09-15 15:49:06.2301 [App:01] [] [ERROR] [.NET ThreadPool Worker] Litium.Application.Events.EventBrokerImpl - Value cannot be null. (Parameter 'shipment') System.ArgumentNullException: Value cannot be null. (Parameter 'shipment')
at Litium.Connect.Application.Erp.OrderFulfilmentServiceImpl.PaymentCapturedForShipment(OrderOverview orderOverview, Shipment shipment)
at Litium.Connect.Application.Erp.LitiumConnectEventsListener.OnCaptured(PaymentCaptured paymentCaptured)
at Litium.Connect.Application.Erp.LitiumConnectEventsListener.<Litium.Runtime.IAsyncAutostart.StartAsync>b__6_0(PaymentCaptured x)
at Litium.Events.EventBroker.<>c__DisplayClass4_0`1.<Subscribe>g__execution|0(T x)
at Litium.Application.Events.EventBrokerImpl.<>c__DisplayClass11_1`1.<PublishAsync>b__4()
at Litium.Application.Common.FifoExecution.WorkItem.Execute()
at Litium.Application.Common.FifoExecution.ProcessQueuedItems(Object ignored)
Payment is Completed.
Litium version: 8.10.0