コード例 #1
0
        public virtual ViewResult PayVerify(PayRedirectModel model)
        {
            ViewBag.PaymentGateway = BankNames.Pay;
            if (model.IsNotNull())
            {
                var transaction = _transactionBusiness.Find(model.factorNumber);
                if (transaction.IsNull())
                {
                    ViewBag.ErrorMessage = LocalMessage.PaymentException;
                    return(View(viewName: MVC.Transaction.Views.Failed, model: transaction));
                }

                var gateWay = _paymentGatewayBusiness.Find(transaction.PaymentGatewayId);
                if (gateWay.IsNull())
                {
                    return(View(viewName: MVC.Transaction.Views.Failed, model: LocalMessage.PaymentException));
                }
                var result = PaymentFactory.GetInstance(gateWay.BankName).Verify(gateWay, transaction, model);
                if (result.IsSuccessful)
                {
                    return(View(viewName: MVC.Transaction.Views.Success, model: transaction));
                }

                transaction.TrackingId = "0";
                ViewBag.ErrorMessage   = result.Message;
                return(View(viewName: MVC.Transaction.Views.Failed, model: transaction));
            }
            ViewBag.ErrorMessage = LocalMessage.RedirectException;
            return(View(viewName: MVC.Transaction.Views.Failed, model: LocalMessage.RedirectException));
        }