public async Task <ResultDto> CheckDirectDebitDetails(DirectDebitDetailsVm directDebitDetailsVm) { var bankAccountCheckerDetails = new BankAccountCheckerDto() { AccountNumber = directDebitDetailsVm.AccountNumber, SortCode = directDebitDetailsVm.SortCode }; var backAccountDetailsConfirmed = await _bankAccountCheckerProcess.CheckBankAccount(bankAccountCheckerDetails); _resultDto.IsSuccessful = false; if (backAccountDetailsConfirmed.ValidationResult == BankAccountValidationResult.AccountInvalid) { _resultDto.MessageForUser = BankAccountCheckerConstants.AccountInvalid; return(_resultDto); } if (backAccountDetailsConfirmed.ValidationResult == BankAccountValidationResult.ModulusCheckFailed) { _resultDto.MessageForUser = BankAccountCheckerConstants.ModulusCheckFailed; return(_resultDto); } if (backAccountDetailsConfirmed.ValidationResult == BankAccountValidationResult.SortCodeInvalid) { _resultDto.MessageForUser = BankAccountCheckerConstants.SortCodeInvalid; return(_resultDto); } _resultDto.IsSuccessful = true; return(_resultDto); }
public async Task <GetBankAccountValidationResultDto> CheckBankAccount( BankAccountCheckerDto bankAccountCheckerDto) { var innerUrl = $"{_baseUrl}api/BankAccountChecker/CheckBankAccount/"; return(await _restClient.PostAsync <BankAccountCheckerDto, GetBankAccountValidationResultDto>( innerUrl, bankAccountCheckerDto)); }
public void CheckApiGatewayHeartbeat_CallsProxy() { _loggerMock = new Mock <ILogger <BankAccountCheckerProcess> >(); _proxyMock = new Mock <IApiGatewayProxy>(); BankAccountCheckerDto dtoPassedToProxy = new BankAccountCheckerDto(); GetBankAccountValidationResultDto dtoReturnedFromProxy = new GetBankAccountValidationResultDto(); _proxyMock.Setup(x => x.CheckBankAccount(dtoPassedToProxy)).ReturnsAsync(dtoReturnedFromProxy); IBankAccountCheckerProcess process = new BankAccountCheckerProcess(_loggerMock.Object, _proxyMock.Object); GetBankAccountValidationResultDto dtoReturnedFromProcess = process.CheckBankAccount(dtoPassedToProxy).Result; _proxyMock.Verify(x => x.CheckBankAccount(It.IsAny <BankAccountCheckerDto>()), Times.Once); Assert.AreEqual(dtoReturnedFromProcess, dtoReturnedFromProxy); }
public async Task <GetBankAccountValidationResultDto> CheckBankAccount(BankAccountCheckerDto bankAccountCheckerDto) { return(await _apiGatewayProxy.CheckBankAccount(bankAccountCheckerDto)); }