diff --git a/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.FulfilmentService/Services/FulfilmentCallBackService.cs b/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.FulfilmentService/Services/FulfilmentCallBackService.cs index 557f86df7..0c82a9e2b 100644 --- a/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.FulfilmentService/Services/FulfilmentCallBackService.cs +++ b/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.FulfilmentService/Services/FulfilmentCallBackService.cs @@ -140,7 +140,7 @@ public async Task SendResponseToCallBackApi(bool errorStatus, string paylo await callBackClient.CallBackApi(HttpMethod.Post, payloadJson, scsResponseQueueMessage.CallbackUri); if (!errorStatus) - logger.LogInformation(EventIds.ExchangeSetCreatedPostCallbackUriCalled.ToEventId(), "Post Callback uri is called after exchange set is created for BatchId:{BatchId} and _X-Correlation-ID:{CorrelationId}", scsResponseQueueMessage.BatchId, scsResponseQueueMessage.CorrelationId); + logger.LogInformation(EventIds.ExchangeSetCreatedPostCallbackUriCalled.ToEventId(), "Post Callback uri - {CallbackUri} is called with pay load {payloadJson} after exchange set is created for BatchId:{BatchId} and _X-Correlation-ID:{CorrelationId}", scsResponseQueueMessage.CallbackUri, payloadJson, scsResponseQueueMessage.BatchId, scsResponseQueueMessage.CorrelationId); else logger.LogInformation(EventIds.ExchangeSetCreatedWithErrorPostCallbackUriCalled.ToEventId(), "Post Callback uri is called after exchange set is created with error for BatchId:{BatchId} and _X-Correlation-ID:{CorrelationId}", scsResponseQueueMessage.BatchId, scsResponseQueueMessage.CorrelationId); @@ -161,7 +161,8 @@ public ExchangeSetResponse SetExchangeSetResponse(SalesCatalogueProductResponse RequestedProductCount = salesCatalogueProductResponse.ProductCounts.RequestedProductCount.Value, ExchangeSetCellCount = salesCatalogueProductResponse.ProductCounts.ReturnedProductCount.Value, RequestedProductsAlreadyUpToDateCount = salesCatalogueProductResponse.ProductCounts.RequestedProductsAlreadyUpToDateCount.Value, - RequestedProductsNotInExchangeSet = GetRequestedProductsNotInExchangeSet(salesCatalogueProductResponse) + RequestedProductsNotInExchangeSet = GetRequestedProductsNotInExchangeSet(salesCatalogueProductResponse), + BatchId = scsResponseQueueMessage.BatchId }; } diff --git a/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.Webjob.UnitTests/Services/FulfilmentCallBackServiceTest.cs b/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.Webjob.UnitTests/Services/FulfilmentCallBackServiceTest.cs index d734ae164..e9ef38f8e 100644 --- a/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.Webjob.UnitTests/Services/FulfilmentCallBackServiceTest.cs +++ b/UKHO.ExchangeSetService.API/UKHO.ExchangeSetService.Webjob.UnitTests/Services/FulfilmentCallBackServiceTest.cs @@ -14,6 +14,7 @@ using UKHO.ExchangeSetService.Common.Models.SalesCatalogue; using UKHO.ExchangeSetService.FulfilmentService.Configuration; using UKHO.ExchangeSetService.FulfilmentService.Services; +using Newtonsoft.Json; namespace UKHO.ExchangeSetService.Webjob.UnitTests.Services { @@ -157,6 +158,9 @@ public async Task WhenCallBackUriInRequest_ThenSendCallBackResponseReturnsTrue() uriParam = uri; httpMethodParam = method; postBodyParam = postBody; + var callBackResponse = JsonConvert.DeserializeObject(postBody); + Assert.IsNotNull(callBackResponse, "PostBody can not be null"); + Assert.AreEqual(scsResponseQueueMessage.BatchId, callBackResponse.Data.BatchId); }); var response = await fulfilmentCallBackService.SendCallBackResponse(salesCatalogueProductResponse, scsResponseQueueMessage);