Exemplo n.º 1
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                if (Country != default(string))
                {
                    hash = hash * 23 + Country.GetHashCode();
                }
                if (City != default(string))
                {
                    hash = hash * 23 + City.GetHashCode();
                }
                if (Bank != default(string))
                {
                    hash = hash * 23 + Bank.GetHashCode();
                }
                if (PostalCode != default(string))
                {
                    hash = hash * 23 + PostalCode.GetHashCode();
                }
                if (Financing != default(string))
                {
                    hash = hash * 23 + Financing.GetHashCode();
                }
                if (LastDigits != default(string))
                {
                    hash = hash * 23 + LastDigits.GetHashCode();
                }
                if (Brand != default(string))
                {
                    hash = hash * 23 + Brand.GetHashCode();
                }
                if (ExpirationMonth != default(int))
                {
                    hash = hash * 23 + ExpirationMonth.GetHashCode();
                }
                if (ExpirationYear != default(int))
                {
                    hash = hash * 23 + ExpirationYear.GetHashCode();
                }
                if (Fingerprint != default(string))
                {
                    hash = hash * 23 + Fingerprint.GetHashCode();
                }
                if (Name != default(string))
                {
                    hash = hash * 23 + Name.GetHashCode();
                }
                if (SecurityCodeCheck != default(bool))
                {
                    hash = hash * 23 + SecurityCodeCheck.GetHashCode();
                }

                return(hash);
            }
        }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                hash = hash * 23 + Brand.GetHashCode();
                hash = hash * 23 + Number.GetHashCode();
                hash = hash * 23 + LastDigits.GetHashCode();
                hash = hash * 23 + Name.GetHashCode();

                return(hash);
            }
        }
Exemplo n.º 3
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                hash = hash * 23 + Country.GetHashCode();
                hash = hash * 23 + City.GetHashCode();
                hash = hash * 23 + Bank.GetHashCode();
                hash = hash * 23 + PostalCode.GetHashCode();
                hash = hash * 23 + Financing.GetHashCode();
                hash = hash * 23 + LastDigits.GetHashCode();
                hash = hash * 23 + Brand.GetHashCode();
                hash = hash * 23 + ExpirationMonth.GetHashCode();
                hash = hash * 23 + ExpirationYear.GetHashCode();
                hash = hash * 23 + Fingerprint.GetHashCode();
                hash = hash * 23 + Name.GetHashCode();
                hash = hash * 23 + SecurityCodeCheck.GetHashCode();

                return(hash);
            }
        }
Exemplo n.º 4
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                if (Brand != default(string))
                {
                    hash = hash * 23 + Brand.GetHashCode();
                }
                if (Number != default(string))
                {
                    hash = hash * 23 + Number.GetHashCode();
                }
                if (LastDigits != default(string))
                {
                    hash = hash * 23 + LastDigits.GetHashCode();
                }
                if (Name != default(string))
                {
                    hash = hash * 23 + Name.GetHashCode();
                }

                return(hash);
            }
        }
Exemplo n.º 5
0
        public bool IsValid()
        {
            HolderDocument.ClearStrings();

            if (Brand.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Bandeira do cartão de crédito não informada");
            }

            if (ExpirationMonth.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Mês de expiração do cartão de crédito não informado");
            }

            int monthAsInt;

            int.TryParse(ExpirationMonth, out monthAsInt);

            if (monthAsInt < 1 || monthAsInt > 12)
            {
                throw new ArgumentException("Mês de expiração do cartão de crédito inválido");
            }

            if (ExpirationYear.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Ano de expiração do cartão de crédito não informado");
            }

            int yearAsInt;

            int.TryParse(ExpirationYear, out yearAsInt);

            if (yearAsInt < DateTime.Now.Year)
            {
                throw new ArgumentException("Ano de expiração do cartão de crédito inválido");
            }

            if (monthAsInt < DateTime.Now.Month && yearAsInt == DateTime.Now.Year)
            {
                throw new ArgumentException("Mês de expiração do cartão de crédito inválido");
            }

            if (HolderName.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Nome do titular do cartão de crédito não informado");
            }

            if (HolderDocument.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Documento do titular do cartão de crédito não informado");
            }

            if (!HolderDocument.IsValidCPF() && !HolderDocument.IsValidCNPJ())
            {
                throw new ArgumentException("Documento do titular do cartão de crédito inválido");
            }

            if (Bin.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Bin do cartão de crédito não informado");
            }

            if (LastDigits.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Últimos 4 dígitos do cartão de crédito não informados");
            }

            if (Signature.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Assinatura do cartão de crédito não informada");
            }

            if (Timestamp.IsNull() || Timestamp == DateTime.MinValue)
            {
                throw new ArgumentException("Timestamp do cartão de crédito não informados");
            }

            if (Token.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Token do cartão de crédito não informado");
            }

            return(true);
        }