clean up remove unused code customer validator

This commit is contained in:
Frede Hundewadt 2023-11-08 16:07:04 +01:00
parent a38504b711
commit a898eeed6f

View file

@ -1,36 +0,0 @@
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using Wonky.Entity.DTO;
namespace Wonky.Client.Helpers;
internal interface IValidator<in T>
{
bool Validate(T t);
}
public class CustomerValidator : IValidator<CompanyDto>
{
public bool Validate(CompanyDto t)
{
if (string.IsNullOrWhiteSpace(t.Name)
|| string.IsNullOrWhiteSpace(t.ZipCode)
|| string.IsNullOrWhiteSpace(t.City)
|| string.IsNullOrWhiteSpace(t.CountryCode)) return false;
return string.IsNullOrWhiteSpace(t.VatNumber) || VatUtils.ValidateFormat(t.CountryCode, t.VatNumber);
}
}