feat(withdrawal): normalize IBAN format in withdrawal requests
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m38s

- Added IbanNormalizer to validate and normalize IBAN numbers in RequestWithdrawalCommandHandler and UserWalletService.
- Implemented error handling for invalid IBAN formats, ensuring compliance with expected standards.
- Updated relevant methods to handle normalized IBANs for cash withdrawal requests.
This commit is contained in:
masoodafar-web
2026-08-23 23:01:17 +03:30
parent 8ec0910cdf
commit 2d23dbc798
3 changed files with 53 additions and 2 deletions
@@ -1,3 +1,5 @@
using CMSMicroservice.Application.Common;
namespace CMSMicroservice.Application.CommissionCQ.Commands.RequestWithdrawal;
public class RequestWithdrawalCommandHandler : IRequestHandler<RequestWithdrawalCommand, Unit>
@@ -37,7 +39,10 @@ public class RequestWithdrawalCommandHandler : IRequestHandler<RequestWithdrawal
if (request.Method == WithdrawalMethod.Cash)
{
payout.IbanNumber = request.IbanNumber;
var normalizedIban = IbanNormalizer.TryNormalize(request.IbanNumber);
if (normalizedIban is null)
throw new InvalidOperationException("فرمت شماره شبا معتبر نیست. باید IR و ۲۴ رقم باشد.");
payout.IbanNumber = normalizedIban;
}
_context.UserCommissionPayouts.Update(payout);