コード例 #1
0
        // GET: Payment
        public ActionResult Index(bool success, int order)
        {
            string ff = "";

            foreach (string key in Request.Form.AllKeys)
            {
                ff += Request.Form[key];
            }

            using (TempRepository bb = new TempRepository())
            {
                bb.AddUpdate(new DomainModel.TempStatus()
                {
                    DataStr     = ff,
                    CreatedDate = DateTime.Now
                });
            }

            var bodyStream = new StreamReader(Request.InputStream);

            bodyStream.BaseStream.Seek(0, SeekOrigin.Begin);
            var bodyText = bodyStream.ReadToEnd();


            using (TempRepository bb = new TempRepository())
            {
                bb.AddUpdate(new DomainModel.TempStatus()
                {
                    DataStr     = bodyText,
                    CreatedDate = DateTime.Now
                });
            }
            ViewBag.IsSuccess = false;
            if (success)
            {
                using (TripRepository tripRepo = new TripRepository())
                {
                    tripRepo.TripPaymentDone(order);
                }

                ViewBag.IsSuccess = true;
            }
            return(View());
        }
コード例 #2
0
        public IHttpActionResult PeymentGet()
        {
            try
            {
                // logger.Info("start 2 ");

                var bodyStream = new StreamReader(HttpContext.Current.Request.InputStream);
                bodyStream.BaseStream.Seek(0, SeekOrigin.Begin);
                var bodyText = bodyStream.ReadToEnd();
                //   logger.Info("Body 2:" + bodyText);
                if (!string.IsNullOrEmpty(bodyText))
                {
                    using (TempRepository bb = new TempRepository())
                    {
                        bb.AddUpdate(new DomainModel.TempStatus()
                        {
                            DataStr     = "Get " + bodyText,
                            CreatedDate = DateTime.Now
                        });
                    }

                    WeAcceptTockenModelContainer returnObj = JsonConvert.DeserializeObject <WeAcceptTockenModelContainer>(bodyText);

                    if (returnObj.obj != null)
                    {
                        if (!string.IsNullOrEmpty(returnObj.obj.token))
                        {
                            using (SecurityUserRepository secRepo = new SecurityUserRepository())
                            {
                                secRepo.UpdatePaymentTocken(returnObj.obj.token, returnObj.obj.order_id);
                            }
                        }
                    }


                    WeAcceptRootObject returnMainObj = JsonConvert.DeserializeObject <WeAcceptRootObject>(bodyText);
                    if (returnMainObj.obj != null)
                    {
                        if (returnMainObj.obj.order != null)
                        {
                            logger.Info("obj.order.id : " + returnMainObj.obj.order.id.ToString());
                            logger.Info("obj.success : " + returnMainObj.obj.success);
                            logger.Info("obj.id : " + returnMainObj.obj.id.ToString());
                            using (SecurityUserRepository secRepo = new SecurityUserRepository())
                            {
                                if (returnMainObj.obj.success == true)
                                {
                                    secRepo.UpdatePaymentDone(returnMainObj.obj.order.id.ToString());
                                    secRepo.UpdateRefundOrderId(returnMainObj.obj.id.ToString(), returnMainObj.obj.order.id.ToString());
                                }
                            }
                        }
                    }



                    return(Ok("1 EGP has been successfully deducted from your card, please return to rabbit."));
                }
                else
                {
                    return(Ok("1 EGP has been successfully deducted from your card, please return to rabbit."));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message + " > " + ex.InnerException?.Message + " > " + ex.StackTrace);
                return(Ok("Pending payment, Please try again if not success"));
            }
        }