public JsonResultDTO MakePayment(CardDetailDTO cardDetail)
        {
            var isExpiryDateValid = CardValidation.ValidateExpiryDate(cardDetail.ExpiryDate);
            var isCvvValid        = CardValidation.ValidateCvvNumber(cardDetail.Cvv);

            if (isExpiryDateValid && isCvvValid)
            {
                var bankResponse = IBankRepo.MakePayment(cardDetail);
                if (bankResponse.Status == "Success")
                {
                    jsonResult.IsSuccess     = true;
                    jsonResult.TransactionId = bankResponse.Identifier;
                }
                else
                {
                    jsonResult.IsSuccess = false;
                    jsonResult.Errors.Add("Bank responded payment unsuccessful");
                }
            }
            else
            {
                jsonResult.IsSuccess = false;
                jsonResult.Errors.Add("The credit card is expired");
            }
            return(jsonResult);
        }
 public IBankRepo GetBankRepo()
 {
     if (theBankRepo == null)
     {
         theBankRepo = new BankRepo(LoggingFactory);
     }
     return(theBankRepo);
 }
        public BankPreviousPaymentDetailDTO RetrievePreviousPayment(Guid identifier)
        {
            var paymentInfo = IBankRepo.RetrievePreviousPayment(identifier);

            if (paymentInfo.CardNumber != "")
            {
                paymentInfo.CardNumber = MaskingNumber.MaskingCreditCardNumber(paymentInfo.CardNumber);
            }

            return(paymentInfo);
        }
 public BankController(IBankRepo bankRepo)
 {
     this.bankRepo = bankRepo;
 }
 public BankController()
 {
     this.bankRepo = new BankRepository(new KasaTakipDbContext());
 }
 public BankController(IBankRepo bankenRepo)
 {
     BankenRepo = bankenRepo;
 }
Example #7
0
 public BankService(IBankRepo repo)
 {
     this.repo = repo;
 }
Example #8
0
 public CustomerService(IBankRepo repo)
 {
     _repo = repo;
 }
Example #9
0
 public BankService(IBankRepo repo)
 {
     this.repo = repo;
 }