From 2d8d25691020570c6db65afdb801cd925a19fd3b Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Thu, 11 Jun 2020 12:47:21 +0100 Subject: [PATCH] Minor fix after estate management change --- .../Services/TransactionDomainService.cs | 12 +++++++----- .../Common/DockerHelper.cs | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs b/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs index 0e89c9c7..f776ef24 100644 --- a/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs @@ -529,6 +529,8 @@ private async Task GetToken(CancellationToken cancellationToken) CancellationToken cancellationToken) { EstateResponse estate = null; + MerchantResponse merchant = null; + // Validate the Estate Record is a valid estate try { @@ -540,11 +542,11 @@ private async Task GetToken(CancellationToken cancellationToken) } // get the merchant record and validate the device - // TODO: Token - MerchantResponse merchant = await this.GetMerchant(estateId, merchantId, cancellationToken); - - // TODO: Remove this once GetMerchant returns correct response when merchant not found - if (merchant.MerchantName == null) + try + { + merchant = await this.GetMerchant(estateId, merchantId, cancellationToken); + } + catch (Exception ex) when (ex.InnerException != null && ex.InnerException.GetType() == typeof(KeyNotFoundException)) { throw new TransactionValidationException($"Merchant Id [{merchantId}] is not a valid merchant for estate [{estate.EstateName}]", TransactionResponseCode.InvalidMerchantId); diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 818013bf..28192d31 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -232,7 +232,8 @@ public override async Task StartContainersForScenarioRun(String scenarioName) (Setup.SqlServerContainerName, "sa", "thisisalongpassword123!"), - ("serviceClient", "Secret1")); + ("serviceClient", "Secret1"), + true); IContainerService securityServiceContainer = DockerHelper.SetupSecurityServiceContainer(this.SecurityServiceContainerName, this.Logger,