public async Task <APIResponse> ProcessPayment(CardInfoDTO request)
        {
            var response = new APIResponse();

            try
            {
                var amount = request.Amount;
                if (amount < 20)
                {
                    response = await _cheapPaymentGateway.ProcessCheapPayment(request);
                }
                else if (amount >= 21 && amount <= 500)
                {
                    if (_expensivePaymentGateway != null)
                    {
                        response = await _expensivePaymentGateway.ProcessExpensivePayment(request);
                    }
                    else
                    {
                        response = await _cheapPaymentGateway.ProcessCheapPayment(request);
                    }
                }
                else if (amount > 500)
                {
                    int count = 0;
                    response = await _premiumPayment.ProcessPremiumPayment(request);

                    if (response.Code == "99")
                    {
                        while (response.Code == "99" && count <= 3)
                        {
                            response = await _premiumPayment.ProcessPremiumPayment(request);

                            count++;
                        }
                    }
                }
                else
                {
                    response = new APIResponse {
                        Code = "99", Description = "Your payment cannot be processed", Data = ""
                    };
                }

                var paymentState = new PaymentState();
                paymentState.CorrelationId  = Guid.NewGuid().ToString();
                paymentState.PayDate        = DateTime.Now;
                paymentState.RequestString  = JsonTranformer.SerializeObject(request);
                paymentState.ResponseString = JsonTranformer.SerializeObject(response);
                if (response.Code == "00")
                {
                    paymentState.State = State.processed;
                }
                if (response.Code == "99")
                {
                    paymentState.State = State.failed;
                }
                else
                {
                    paymentState.State = State.pending;
                }

                _repositoryWrapper.PaymentStateRepository.Create(paymentState);
                await _repositoryWrapper.SaveAsync();
            }
            catch (Exception)
            {
                response = new APIResponse {
                    Code = "99", Description = "Internal Server Error", Data = ""
                };
                throw;
            }
            return(response);
        }