Hello every one,
i need to update serial number in cart line , so i used below
public class SavecartVersionDataTrigger : IRequestTriggerAsync
{
public IEnumerable<Type> SupportedRequestTypes =>
new[] { typeof(SaveCartVersionedDataRequest) };
public async Task OnExecuting(Request request)
{
await Task.CompletedTask;
}
public async Task OnExecuted(Request request, Response response)
{
var SaveCart = request as SaveCartVersionedDataRequest;
var cartLines = SaveCart.SalesTransaction;
if (cartLines != null)
{
foreach (var cartLine in cartLines.SalesLines)
{
var BarcodInfoReqest = new GetBarcodeInfoRequest(request.RequestContext.GetDeviceConfiguration().TerminalId, cartLine.ItemId);
var BarcodeInfo = request.RequestContext.ExecuteAsync<GetBarcodeInfoResponse>(BarcodInfoReqest);
var updateInforequest = new UpdateItemBarcodeInfoRequest(BarcodeInfo.Result.BarcodeInfo.FirstOrDefault().IDString, cartLine.LineNumber, cartLines.Id);
var updateInfoResponse = request.RequestContext.ExecuteAsync<GetBarcodeInfoResponse>(updateInforequest);
if (cartLine.GetProperty("Updated") != null)
continue;
if (string.IsNullOrEmpty(cartLine.SerialNumber))
{
cartLine.SerialNumber = BarcodeInfo.Result.BarcodeInfo.FirstOrDefault().SerialIDString;
cartLine.BatchId = BarcodeInfo.Result.BarcodeInfo.FirstOrDefault().BatchIDString;
cartLine.Comment = BarcodeInfo.Result.BarcodeInfo.FirstOrDefault().BatchIDString;
}
cartLine.SetProperty("Updated", Convert.ToInt32(true));
}
}
await Task.CompletedTask;
}
}
}
it's successfully add the serial number to the cart but with the below error
so any idea how can solve this .