public transactionMessage deposit(transactionInput value)
        {
            transactionMessage ob = new transactionMessage();

            ob.Message = "Success";
            return(ob);
        }
 public IActionResult withdraw([FromBody] transactionInput value)
 {
     try
     {
         var ob = transactionRepository.withdraw(value);
         if (ob == null)
         {
             return(NotFound());
         }
         return(Ok(ob));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Exemple #3
0
 public IActionResult evaluateMinBal([FromBody] transactionInput value)
 {
     //dwacc ob = new dwacc { AccountId = id, Balance = bid };
     try
     {
         var obj = rulesRepository.evaluateMinBal(value);
         if (obj == null)
         {
             return(NotFound());
         }
         return(Ok(obj));
     }
     catch
     {
         return(BadRequest());
     }
 }
Exemple #4
0
 public IActionResult withdraw([FromBody] transactionInput value)
 {
     _log4net.Info("Amount Withdrawn");
     try
     {
         var ob = accountRepository.withdraw(value);
         if (ob == null)
         {
             return(NotFound());
         }
         return(Ok(ob));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Exemple #5
0
 public IActionResult withdraw([FromBody] transactionInput value)
 {
     _log4net.Info("Withdrawing checking initiated");
     try
     {
         var ob = transactionRepository.withdraw(value);
         if (ob == null)
         {
             _log4net.Info("Withdrawn deny response from Rules Microservice");
             return(NotFound());
         }
         _log4net.Info("Withdrawn Success response from Rules Microservice");
         return(Ok(ob));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Exemple #6
0
 public IActionResult deposit([FromBody] transactionInput value)
 {
     _log4net.Info("Deposition checking initiated");
     try
     {
         var ob = transactionRepository.deposit(value);
         if (ob == null)
         {
             _log4net.Info("Deposition Failure");
             return(NotFound());
         }
         _log4net.Info("Deposition success");
         return(Ok(ob));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
 public IActionResult evaluateMinBal([FromBody] transactionInput value)
 {
     //dwacc ob = new dwacc { AccountId = id, Balance = bid };
     _log4net.Info("Minimum Balance checking initiated");
     try
     {
         var obj = rulesRepository.evaluateMinBal(value);
         _log4net.Info("Minimum balance response generated");
         if (obj == null)
         {
             return(NotFound());
         }
         return(Ok(obj));
     }
     catch
     {
         return(BadRequest());
     }
 }
        public transactionMessage withdraw(transactionInput value)
        {
            transactionMessage  ob       = new transactionMessage();
            string              data     = JsonConvert.SerializeObject(value);
            StringContent       content  = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Rules/evaluateMinBal/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string     data1 = response.Content.ReadAsStringAsync().Result;
                ruleStatus s1    = JsonConvert.DeserializeObject <ruleStatus>(data1);
                if (s1.message == "Warning")
                {
                    ob.Message = "Warning";
                    return(ob);
                }
                ob.Message = "No Warning";
                return(ob);
            }
            return(null);
        }
        public IActionResult Deposit(transactionInput accountBalance)
        {
            string              data     = JsonConvert.SerializeObject(accountBalance);
            StringContent       content  = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Account/deposit/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string         data1 = response.Content.ReadAsStringAsync().Result;
                accountDetails ob4   = JsonConvert.DeserializeObject <accountDetails>(data1);
                if (ob4 != null)
                {
                    return(RedirectToAction("DepositStatus", "Customer", ob4));
                }
                else
                {
                    return(RedirectToAction("Error"));
                }
            }
            return(BadRequest("Link Failure"));
        }
Exemple #10
0
        public ruleStatus evaluateMinBal(transactionInput value)
        {
            accountDetails      ob       = new accountDetails();
            ruleStatus          ob1      = new ruleStatus();
            HttpResponseMessage response = client.GetAsync(client.BaseAddress + "/Account/getAccount/" + value.accountId).Result;

            if (response.IsSuccessStatusCode)
            {
                string data = response.Content.ReadAsStringAsync().Result;
                ob = JsonConvert.DeserializeObject <accountDetails>(data);
                ob.accountBalance = ob.accountBalance - value.balance;
                if (ob.accountBalance < 500)
                {
                    ob1.message = "Warning";
                }
                else
                {
                    ob1.message = "No Warning";
                }
            }
            return(ob1);
        }
Exemple #11
0
        public accountDetails deposit(transactionInput value)
        {
            string              data     = JsonConvert.SerializeObject(value);
            StringContent       content  = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Transaction/deposit/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string data1 = response.Content.ReadAsStringAsync().Result;
                Ts     s1    = JsonConvert.DeserializeObject <Ts>(data1);
                if (s1.Message == "Success")
                {
                    if (value.accountId % 2 == 0)
                    {
                        var sa = savingsAccounts.Find(a => a.savingsAccountId == value.accountId);
                        sa.savingsAccountbalance = sa.savingsAccountbalance + value.balance;
                        accountDetails sob = new accountDetails
                        {
                            accountId      = value.accountId,
                            accountType    = "Deposited Correctly",
                            accountBalance = sa.savingsAccountbalance
                        };
                        return(sob);
                    }
                    var ca = currentAccounts.Find(a => a.currentAccountId == value.accountId);
                    ca.currentAccountBalance = ca.currentAccountBalance + value.balance;
                    accountDetails cob = new accountDetails
                    {
                        accountId      = value.accountId,
                        accountType    = "Deposited Correctly",
                        accountBalance = ca.currentAccountBalance
                    };
                    return(cob);
                }
            }
            return(null);
        }
Exemple #12
0
        public accountDetails withdraw(transactionInput value)
        {
            string              data     = JsonConvert.SerializeObject(value);
            StringContent       content  = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Transaction/withdraw/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string         data1 = response.Content.ReadAsStringAsync().Result;
                Ts             s1    = JsonConvert.DeserializeObject <Ts>(data1);
                accountDetails amsg  = new accountDetails();
                if (s1.Message == "No Warning")
                {
                    if (value.accountId % 2 == 0)
                    {
                        var sa = savingsAccounts.Find(a => a.savingsAccountId == value.accountId);
                        sa.savingsAccountbalance = sa.savingsAccountbalance - value.balance;
                        if (sa.savingsAccountbalance >= 0)
                        {
                            amsg.accountId      = value.accountId;
                            amsg.accountType    = "Withdrawn Successfully";
                            amsg.accountBalance = sa.savingsAccountbalance;
                            return(amsg);
                        }
                        else
                        {
                            sa.savingsAccountbalance = sa.savingsAccountbalance + value.balance;
                            amsg.accountId           = value.accountId;
                            amsg.accountType         = "Insufficient Fund";
                            amsg.accountBalance      = sa.savingsAccountbalance;
                            return(amsg);
                        }
                    }
                    var car = currentAccounts.Find(a => a.currentAccountId == value.accountId);
                    car.currentAccountBalance = car.currentAccountBalance - value.balance;
                    if (car.currentAccountBalance >= 0)
                    {
                        amsg.accountId      = value.accountId;
                        amsg.accountType    = "Withdrawn Successfully";
                        amsg.accountBalance = car.currentAccountBalance;
                        return(amsg);
                    }
                    else
                    {
                        car.currentAccountBalance = car.currentAccountBalance + value.balance;
                        amsg.accountId            = value.accountId;
                        amsg.accountType          = "Insufficient Fund";
                        amsg.accountBalance       = car.currentAccountBalance;
                        return(amsg);
                    }
                }
                if (value.accountId % 2 == 0)
                {
                    var sa = savingsAccounts.Find(a => a.savingsAccountId == value.accountId);
                    sa.savingsAccountbalance = sa.savingsAccountbalance - value.balance;
                    if (sa.savingsAccountbalance >= 0)
                    {
                        amsg.accountId      = value.accountId;
                        amsg.accountType    = "Withdrawn Successfully.Service charge applicable at the end of month";
                        amsg.accountBalance = sa.savingsAccountbalance;
                        return(amsg);
                    }
                    else
                    {
                        sa.savingsAccountbalance = sa.savingsAccountbalance + value.balance;
                        amsg.accountId           = value.accountId;
                        amsg.accountType         = "Insufficient Fund";
                        amsg.accountBalance      = sa.savingsAccountbalance;
                        return(amsg);
                    }
                }
                var ca = currentAccounts.Find(a => a.currentAccountId == value.accountId);
                ca.currentAccountBalance = ca.currentAccountBalance - value.balance;
                if (ca.currentAccountBalance >= 0)
                {
                    amsg.accountId      = value.accountId;
                    amsg.accountType    = "Withdrawn Successfully.Service Charge Applicable at the end of month";
                    amsg.accountBalance = ca.currentAccountBalance;
                    return(amsg);
                }
                else
                {
                    ca.currentAccountBalance = ca.currentAccountBalance + value.balance;
                    amsg.accountId           = value.accountId;
                    amsg.accountType         = "Insufficient Fund";
                    amsg.accountBalance      = ca.currentAccountBalance;
                    return(amsg);
                }
            }
            return(null);
        }