コード例 #1
0
 public override System.Web.Mvc.ActionResult BankGateway(Models.PayOnline payonline)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BankGateway);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "payonline", payonline);
     BankGatewayOverride(callInfo, payonline);
     return callInfo;
 }
コード例 #2
0
        public virtual System.Web.Mvc.ActionResult BankGateway(float totalPrice, int totalCount)
        {
            System.Guid userId    = Infrastructure.Sessions.AuthenticatedUser.Id;
            var         varOrders = UnitOfWork.OrdersRepository.Get()
                                    .Include(p => p.Products)
                                    .Where(current => current.userId == userId)
                                    .Where(current => current.IsActive == true)
                                    .Where(current => current.Products.IsActive == true).ToList();



            System.Random oRandom = new System.Random();
            oRandom.Next(1093250, 10000000); // minimum = 0, maximum = 1000


            Models.PayOnline oPayOnline = new Models.PayOnline
            {
                Id        = new System.Guid(),
                userId    = Infrastructure.Sessions.AuthenticatedUser.Id,
                OrderNo   = totalCount.ToString(),
                ReceiptNo = oRandom.ToString(),
                Payment   = totalPrice
            };

            //var varCustomersProfile = UnitOfWork.CustomersProfileRepository.Get()
            //    .Include(u => u.User)
            //    .Where(current => current.UserId == userId).ToList();

            if (varOrders.Count > 0)
            {
                RSACryptoServiceProvider.UseMachineKeyStore = true;
                string merchantCode = "321008";              //کد پذيرنده  //
                string terminalCode = "325160";              //کد ترمينال //
                string amount       = totalPrice.ToString(); // مبلغ فاکتور //
                //BankGatewayRedirect();
                // :  آدرس سايتی که مشتری پس از انجام تراکنش بايد به آن فرستاده شود //
                string redirectAddress = "http://amad-co.ir/BankGateway.cshtml";
                string timeStamp       = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                string invoiceNumber   = "515";                                               // شماره فاکتور //
                string invoiceDate     = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); //تاريخ فاکتور //
                string action          = "1003";                                              // براي درخوايت خريد : 1003
                // براي درخواست برگشت خريد : 1004
                System.Security.Cryptography.RSACryptoServiceProvider rsa = new System.Security.Cryptography.RSACryptoServiceProvider();
                string primarykey = "<RSAKeyValue><Modulus>vGNaMAZxRvUPDHqPLkqteTxwRBuc19PceD6W21IB4pSSmck4t32gwTJvudZJsEWiRIAw+rVYmxBQNJaloVPwf60SBpp3seCfopV0B+Lnmsm6wZLcuNNLEmRFKE0Zp5HH7jomLUgtAy53xZnqfXz6aLx0YsVbaWalHj8cJ6TH/0k=</Modulus><Exponent>AQAB</Exponent><P>7tthrumhDGrGINXlyW/bIPUWZFKZcrzbB1geLT9TlslizvuZll29CH6HuAPO8mDGdM4CKut/pmM2G7DnUJAnRQ==</P><Q>yeivbHYSb8tRcR2QCfa9gc98Gi/iB8KcuFb4O5y6kF/X3S3tDU5aSr1l2TUKWZMoRQs9GHoZcmeYpWbWwRdGNQ==</Q><DP>Pnu1OgRz1MO5wK0zx1YzhJOYn/XbnmA5C9rJShzeyPs1ld/LdcJfyPEQn9qfMFiQkc2yU3f3lJcveF72o+SR4Q==</DP><DQ>cE/dnOCE2ujnEZvXLqOwwI+QweRWv+hSUvwVsts4r+yQX/kW/qrR8Pcvu0YUzsTbxqQ8xOvOUeQsdf0hgmEW7Q==</DQ><InverseQ>pnrwkhSLvarhfGxTkqr2pkLJr6usPDVsu5qXw2imQqao87iEPalEJndnNqQ50uNY5bPJPBzDi96U6FwUsbmEuQ==</InverseQ><D>B0NrxlvZOwhW+WVlGj6ccm1kHrW51fbZknR6hVMKHSq0fePTB5Z7MwSEAXRDokPTcWfhe498yEdYVrUgObIhnMzLwxVdXw+PPWIRlcNHRBMtSe9mjOSP8d+hCzUmzHPeuCmKfjPr5iwTu8z9NfycTupezn9D2cr51p35nMbX0KE=</D></RSAKeyValue>";  //کليد خصوصي فروشنده//
                rsa.FromXmlString(primarykey);
                string data = "#" + merchantCode + "#" + terminalCode + "#"
                              + invoiceNumber + "#" + invoiceDate + "#" + amount + "#" + redirectAddress
                              + "#" + action + "#" + timeStamp + "#";
                byte[] signMain = rsa.SignData(System.Text.Encoding.UTF8.GetBytes(data), new
                                               System.Security.Cryptography.SHA1CryptoServiceProvider());
                string sign = System.Convert.ToBase64String(signMain);


                Models.Gateway getway = UnitOfWork.PayOnlineRepository.Gateway(invoiceNumber, invoiceDate, amount, terminalCode, merchantCode,
                                                                               redirectAddress, timeStamp, action, sign);
                return(View(getway));
            }
            return(View());
        }
コード例 #3
0
        public virtual System.Web.Mvc.ActionResult Create(Models.PayOnline payOnline)
        {
            if (ModelState.IsValid)
            {
                UnitOfWork.PayOnlineRepository.Insert(payOnline);

                UnitOfWork.Save();

                return(RedirectToAction(MVC.PayOnline.Index()));
            }

            return(View(payOnline));
        }
コード例 #4
0
        public virtual System.Web.Mvc.ActionResult DeleteConfirmed(System.Guid id)
        {
            Models.PayOnline oPayOnline =
                UnitOfWork.PayOnlineRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            UnitOfWork.PayOnlineRepository.Delete(oPayOnline);

            UnitOfWork.Save();

            return(RedirectToAction(MVC.PayOnline.Index()));
        }
コード例 #5
0
        public virtual System.Web.Mvc.ActionResult Delete(System.Guid id)
        {
            Models.PayOnline oPayOnline =
                UnitOfWork.PayOnlineRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            if (oPayOnline == null)
            {
                return(HttpNotFound());
            }

            return(View(oPayOnline));
        }
コード例 #6
0
        public virtual System.Web.Mvc.ActionResult Edit(Models.PayOnline payOnline)
        {
            payOnline.UpdateDateTime = Infrastructure.Utility.Now;

            if (ModelState.IsValid)
            {
                UnitOfWork.PayOnlineRepository.Update(payOnline);

                UnitOfWork.Save();

                return(RedirectToAction(MVC.PayOnline.Index()));
            }

            return(View(payOnline));
        }
コード例 #7
0
 partial void BankGatewayOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.PayOnline payonline);
コード例 #8
0
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.PayOnline payOnline);