Skip to content

Commit

Permalink
Feature/abzu 71144 fss batch id callback (#190)
Browse files Browse the repository at this point in the history
* ABZU-71144-set batch id in call back response
  • Loading branch information
JiviteshT authored Mar 2, 2023
1 parent 92ed16d commit 63fc19f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public async Task<bool> 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);

Expand All @@ -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
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -157,6 +158,9 @@ public async Task WhenCallBackUriInRequest_ThenSendCallBackResponseReturnsTrue()
uriParam = uri;
httpMethodParam = method;
postBodyParam = postBody;
var callBackResponse = JsonConvert.DeserializeObject<CallBackResponse>(postBody);
Assert.IsNotNull(callBackResponse, "PostBody can not be null");
Assert.AreEqual(scsResponseQueueMessage.BatchId, callBackResponse.Data.BatchId);
});

var response = await fulfilmentCallBackService.SendCallBackResponse(salesCatalogueProductResponse, scsResponseQueueMessage);
Expand Down

0 comments on commit 63fc19f

Please sign in to comment.