From 9eab1c031f8cee4f022bd92e1d76eec0ef8f661e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Thu, 26 Nov 2020 11:35:12 +0100 Subject: [PATCH] Fix - Correction de l'assignation d'un IBAN via Manage --- Sheaft.Application.Handlers/Commands/PaymentCommandsHandler.cs | 3 +-- Sheaft.Infrastructure.Services/PspService.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Sheaft.Application.Handlers/Commands/PaymentCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/PaymentCommandsHandler.cs index b08d1f16a..c8b103e76 100644 --- a/Sheaft.Application.Handlers/Commands/PaymentCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/PaymentCommandsHandler.cs @@ -79,6 +79,7 @@ public async Task> Handle(UpdateBankAccountCommand request, Cancell return Failed(resetResult.Exception); bankAccount.SetIdentifier(string.Empty); + await _context.SaveChangesAsync(token); } bankAccount.SetAddress(address); @@ -87,8 +88,6 @@ public async Task> Handle(UpdateBankAccountCommand request, Cancell bankAccount.SetIban(request.IBAN); bankAccount.SetBic(request.BIC); - await _context.SaveChangesAsync(token); - var result = await _pspService.CreateBankIbanAsync(bankAccount, token); if (!result.Success) return Failed(result.Exception); diff --git a/Sheaft.Infrastructure.Services/PspService.cs b/Sheaft.Infrastructure.Services/PspService.cs index e6e99ee01..b747e8192 100644 --- a/Sheaft.Infrastructure.Services/PspService.cs +++ b/Sheaft.Infrastructure.Services/PspService.cs @@ -183,7 +183,7 @@ public async Task> CreateBankIbanAsync(BankAccount payment, Cance if (string.IsNullOrWhiteSpace(payment.User.Identifier)) return BadRequest(MessageKind.PsP_CannotCreate_Bank_User_Not_Exists); - if (payment.Identifier.Length > 0) + if (!string.IsNullOrWhiteSpace(payment.Identifier) && payment.Identifier.Length > 0) return BadRequest(MessageKind.PsP_CannotCreate_Bank_Already_Exists); await EnsureAccessTokenIsValidAsync(token);