I’m trying to perform a return through the ERP Connect API (not using the demo application), but the SRO state is still “Init” even after payment and delivery is “Returned”.
My steps, via ERP Connect v2:
Create RMA from return slip
Set RMA to packageReceived
Set RMA to processing
Set RMA to completed, which automatically creates the SRO
Get SRO from RMA
Confirm return for SRO
Refund SRO
What am I doing wrong? I want to complete the RMA right away and then refund, basically all in one step.
The RMA now has state = Completed and ApprovalCode = Approved, using the erp connect endpoint “rmas/{systemId}/notify/approve”. However, the SRO is still in “Init” state?
When inspecting the RMA for the SRO, the “Approved by” and “Received by” are also filled in correctly.
Do I have to set ApprovalCode on each order row as well? I saw that the SRO rows have “None” as Approval code.
I’m trying to do everything with ERP connect, but maybe that’s not possible? I’d rather not write any Litium code if possible.
And this is the condition for SRO to change from Init to ReturnConfirmed:
stateMachine.AddStateTransition(new State<OrderCarrier>((short)OrderState.Init, OrderState.Init.ToString()), returnConfirmed,
(orderCarrier, startState, endState, token) =>
{
//Conditions for SRO from init to ReturnConfirmed.
//Precodition:
//+RMA in Completed state and it should be Approved
//+Order is of type SalesReturnOrder
if (orderCarrier.Type != OrderType.SalesReturnOrder || orderCarrier.RmaSystemId is null || orderCarrier.RmaSystemId == Guid.Empty)
{
return false;
}
var rma = _rmaService.Get(orderCarrier.RmaSystemId.Value);
//RmaState.Completed denote that the Rma process is completed, the ApprovateCode.Approved denote that it actually is approved.
return rma?.State == RmaState.Completed && rma?.ApprovalCode == ApprovalCode.Approved;
},
false);
Alright. So basically I did everything correct after your first answer, but I called “confirmReturned” instead of just “confirmReturn”, without checking if it was successful or not