public IActionResult Index()
        {
            ErrorViewModel         errorModel = new ErrorViewModel();
            TransactionsIndexModel model      = new TransactionsIndexModel();
            GetUnsettledTransactionsRequestBody transactionsRequestBody = BuildGetUnsettledTransactionsRequestBody();
            ResponseDetails response = _apiHelper.SendPaymentApiRequest(transactionsRequestBody);

            if (response.Success)
            {
                GetUnsettledTransactionsResponseBody ResponseBody = JsonConvert.DeserializeObject <GetUnsettledTransactionsResponseBody> (response.Data.ToString());

                if (ResponseBody.Messages.ResultCode.ToLower() == "ok")
                {
                    if (ResponseBody.Transactions != null)
                    {
                        model.Transactions = ResponseBody.Transactions;
                        model.Transactions = ProtectTransactionId(model.Transactions);
                    }

                    return(View(model));
                }
                else
                {
                    errorModel.Message = ResponseBody.Messages.Message.First().Text;
                }
            }
            else
            {
                errorModel.Message = response.Data.ToString();
            }

            return(View("Error", errorModel));
        }
        public IActionResult Index(TransactionsIndexModel model)
        {
            if (!Validate(model))
            {
                return(View(model));
            }

            ErrorViewModel      errorModel  = new ErrorViewModel();
            GetBatchRequestBody requestBody = BuildGetSattledBatchRequestBody(model);

            // Get Batches
            ResponseDetails response = _apiHelper.SendPaymentApiRequest(requestBody);

            if (response.Success)
            {
                GetBatchResponseBody responseBody = JsonConvert.DeserializeObject <GetBatchResponseBody> (response.Data.ToString());

                if (responseBody.Messages.ResultCode.ToLower() == "ok")
                {
                    model.BatchItems = responseBody.BatchList;

                    if (model.BatchItems != null)
                    {
                        model.BatchItems = ProtectBatchId(model.BatchItems);
                    }
                }
                else
                {
                    errorModel.Message = responseBody.Messages.Message.First().Text;
                }
            }
            else
            {
                errorModel.Message = response.Data.ToString();
            }

            // Get Unsettled transaction
            GetUnsettledTransactionsRequestBody transactionsRequestBody = BuildGetUnsettledTransactionsRequestBody();

            response = _apiHelper.SendPaymentApiRequest(transactionsRequestBody);

            if (response.Success)
            {
                GetUnsettledTransactionsResponseBody transactionsResponseBody = JsonConvert.DeserializeObject <GetUnsettledTransactionsResponseBody> (response.Data.ToString());

                if (transactionsResponseBody.Messages.ResultCode.ToLower() == "ok")
                {
                    if (transactionsResponseBody.Transactions != null)
                    {
                        model.Transactions = transactionsResponseBody.Transactions;
                        model.Transactions = ProtectTransactionId(model.Transactions);
                    }

                    // got all data now return view
                    return(View(model));
                }
                else
                {
                    errorModel.Message = transactionsResponseBody.Messages.Message.First().Text;
                }
            }
            else
            {
                errorModel.Message = response.Data.ToString();
            }

            return(View("Error", errorModel));
        }