示例#1
0
        public BankCard CreateBankCard(Client client, string pin, int expireYears)
        {
            if (String.IsNullOrWhiteSpace(pin))
            {
                throw new ArgumentNullException(nameof(pin), "PIN can not be null");
            }

            if (!BankCardValidation.PinValidate(pin))
            {
                throw new BankCardException("PIN must be numeric value!");
            }


            var bankCard = new BankCard
            {
                BankName   = Name,
                Fullname   = BankHelper.GetFullName(client.Name, client.Surname),
                CardNumber = BankHelper.GetRandomPan(),
                PIN        = pin,
                CVC        = BankHelper.GetRandomCvc(),
                ExpireDate = BankHelper.GetExpireDate(expireYears),
                Balance    = BankHelper.GetRandomBalance()
            };

            return(bankCard);
        }
示例#2
0
        static void GetClientPan(out string PAN)
        {
            while (true)
            {
                Console.Write("Enter PAN: ");

                Console.ForegroundColor = ConsoleColor.DarkGreen;
                PAN = Console.ReadLine();
                Console.ResetColor();
                if (BankCardValidation.PanValidate(PAN))
                {
                    break;
                }

                Console.WriteLine("Your PAN format is wrong! Try again!");
                ClearScreen();
            }
        }