Exemplo n.º 1
0
        public static bool CancelMandate(string mandateCode, string billerId)
        {
            bool       isSuccessful = false;
            MandateLog resp         = new DAO.MandateLog();

            try
            {
                using (var context = new CentralPayBridgeEntities())
                {
                    resp = context.MandateLogs.FirstOrDefault(g => g.MandateCode.Trim().ToLower().Equals(mandateCode.Trim().ToLower()) && g.BillerId.Equals(billerId));
                    if (resp != null)
                    {
                        resp.DateCancelled = DateTime.Now;
                        resp.IsCancelled   = true;
                        resp.DateUpdated   = DateTime.Now;
                        context.SaveChanges();
                        isSuccessful = true;
                    }
                }
            }
            catch (Exception ext)
            {
                ExceptionLogRepo.SaveExceptionLog(ext);
                Utils.LogError(ext, "Failed to create MandateLog ");
            }
            return(isSuccessful);
        }
Exemplo n.º 2
0
        public static MandateLog QueryMandate(string mandateCode, string billerId)
        {
            MandateLog resp = new DAO.MandateLog();

            try
            {
                using (var context = new CentralPayBridgeEntities())
                {
                    resp = context.MandateLogs.FirstOrDefault(g => g.MandateCode.Trim().ToLower().Equals(mandateCode.Trim().ToLower()) && g.BillerId.Equals(billerId));
                }
            }
            catch (Exception ext)
            {
                ExceptionLogRepo.SaveExceptionLog(ext);
                Utils.LogError(ext, "Failed to create MandateLog ");
            }
            return(resp);
        }
Exemplo n.º 3
0
        public static bool SaveCentralPayOtp(CentralPayOtp otp)
        {
            bool isSuccessful = false;

            try
            {
                using (var context = new CentralPayBridgeEntities())
                {
                    context.CentralPayOtps.Add(otp);
                    context.SaveChanges();
                    isSuccessful = true;
                }
            }
            catch (Exception ext)
            {
                ExceptionLogRepo.SaveExceptionLog(ext);
                Utils.LogError(ext, "Failed to create CentralPayOtp ");
            }
            return(isSuccessful);
        }
Exemplo n.º 4
0
        public static bool SaveMandate(MandateLog mandate)
        {
            bool saved = false;

            try
            {
                using (var context = new CentralPayBridgeEntities())
                {
                    context.MandateLogs.Add(mandate);
                    context.SaveChanges();
                    mandate.MandateCode = "CpayMD" + mandate.Id.ToString().PadLeft(8, '0');
                    context.SaveChanges();
                    saved = true;
                }
            }
            catch (Exception ext)
            {
                ExceptionLogRepo.SaveExceptionLog(ext);
                Utils.LogError(ext, "Failed to create MandateLog ");
            }
            return(saved);
        }
Exemplo n.º 5
0
        public static bool ValidateOtp(string mandateCode, string otp, decimal?amount)
        {
            CentralPayOtp resp    = new DAO.CentralPayOtp();
            bool          isValid = false;

            try
            {
                using (var context = new CentralPayBridgeEntities())
                {
                    resp = context.CentralPayOtps.FirstOrDefault(g => g.MandateLog.MandateCode.Trim().ToLower().Equals(mandateCode.Trim().ToLower()) && g.otp.Equals(otp) && g.Amount == amount);
                    if (resp != null)
                    {
                        isValid = true;
                    }
                }
            }
            catch (Exception ext)
            {
                ExceptionLogRepo.SaveExceptionLog(ext);
                Utils.LogError(ext, "Failed to create MandateLog ");
            }
            return(isValid);
        }