예제 #1
0
        public JsonResult CheckAndValidatePaypalPayments(FormCollection formsCollection)
        {
            decimal amountPaid = Decimal.Parse(formsCollection["amount"]);
            int     clientId   = Int32.Parse(formsCollection["clientId"]);

            try
            {
                _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
                var client = _serviceEndPoint.GetTourClientById(clientId);

                client.CurrentPayment    = amountPaid;
                client.PaidInstallments += amountPaid;
                client.HasFullyPaid      = client.GrossTotalCosts <= client.PaidInstallments;

                _serviceEndPoint.UpdateClientPayments(client);
                return(Json(new { Result = "Success" }));
            }
            catch (Exception e)
            {
                //email exception to admin email
                return(Json(new { Result = "Failed" }));
            }
        }