public int?MakePayment(PaymentModel model)
        {
            HttpResponseMessage response = new HttpResponseMessage();
            PaymentBLL          bllobj   = new PaymentBLL(new PaymentDAL());
            int?Result = bllobj.MakePayment(model);

            if (Result > 0)
            {
                response.Content = new StringContent("Payment Success");
            }
            else
            {
                response.Content = new StringContent("Payment FAIL");
            }
            return(Result);
        }
Пример #2
0
        public ActionResult NetBanking(PaymentModel modelobj, ServiceProviderType serviceProviderType, IBill bill)

        {
            try
            {
                PaymentBLL bllobj  = new PaymentBLL();
                var        receipt = bllobj.MakePayment(modelobj, serviceProviderType, bill);

                ViewBag.Result = "Success";
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
                logger.Debug(ex.Message);
            }
            return(View());
        }
Пример #3
0
        public ActionResult NetBanking(PaymentModel modelobj)

        {
            try
            {
                PaymentBLL bllobj = new PaymentBLL();
                int?       Result = bllobj.MakePayment(modelobj);
                if (Result > 0)
                {
                    ViewBag.Result = "Success";
                }
                else
                {
                    ViewBag.Result = "Failed";
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
                logger.Debug(ex.Message);
            }
            return(View());
        }
Пример #4
0
        public ActionResult MakePayment(tDealBuyModel currentCheckoutData)
        {
            currentCheckoutData.Quantity    = CommonUtils.Instance.ShoppingCart.Quantity;
            currentCheckoutData.BuyerNotes  = CommonUtils.Instance.ShoppingCart.BuyerNotes;
            currentCheckoutData.MobilePhone = CommonUtils.Instance.ShoppingCart.MobilePhone;

            PaymentResultModel resModel = new PaymentResultModel();

            resModel.IDDeal = currentCheckoutData.IDDeal;
            int           UserID      = (int)MembershipHelper.GetCurrenUser().ProviderUserKey;
            tOrder        ordData     = _orderRepository.GetOrderByIDDealIDUser(currentCheckoutData.IDDeal, UserID);
            tDeal         currentDeal = _dealRepository.Find(currentCheckoutData.IDDeal);
            tDealBuyModel buyModel    = GetBuyModel(currentDeal);

            if (ordData != null && ordData.tCoupon.ConsumeStatus == (int)Enums.enmCouponConsumeStatus.NotConsumed)
            {
                resModel.PaymentStatus  = false;
                resModel.StatusMessage += "You have already bought this deal, please use it's coupon and try again";
                ModelState.AddModelError("Error", resModel.StatusMessage);

                return(View("Checkout", buyModel));
            }


            ValidateDeal(currentDeal);
            if (!ModelState.IsValid)
            {
                resModel.PaymentStatus  = false;
                resModel.StatusMessage += "Deal Error";
                ModelState.AddModelError("Error", resModel.StatusMessage);

                return(View("Checkout", buyModel));
            }
            if (currentCheckoutData.Quantity < currentDeal.QuantityMinimum)
            {
                resModel.PaymentStatus  = false;
                resModel.StatusMessage += "Minimum Quantity allowed :" + currentDeal.QuantityMinimum;
                ModelState.AddModelError("Error", resModel.StatusMessage);
                return(View("Checkout", buyModel));
            }

            List <tCoupon> couponsForThisPartner = _couponRepository.GetListByIDPartnerNotUsedAndNotConsumed(currentDeal.IDPartner);

            if (couponsForThisPartner == null || couponsForThisPartner.Count == 0)
            {
                resModel.PaymentStatus          = false;
                resModel.StatusMessage         += "Coupon info could't be found, please contact web admin";
                currentCheckoutData.currentDeal = currentDeal;
                ModelState.AddModelError("Error", resModel.StatusMessage);
                return(View("Checkout", buyModel));
            }
            tCoupon currCouponToUse = couponsForThisPartner[0];

            resModel.CouponCode          = currCouponToUse.CustomCode;
            currCouponToUse.CouponStatus = (int)Enums.enmCouponStatus.Used;
            IPayment paymentAgent   = new PaymentAgentBeelineKg();
            decimal  AmountToBePaid = CalculateAmountToBePaid(currentDeal, currentCheckoutData.Quantity);

            if (AmountToBePaid <= 0)
            {
                resModel.PaymentStatus  = false;
                resModel.StatusMessage += "Please verify amount to be paid for this deal!";
                ModelState.AddModelError("Error", resModel.StatusMessage);
                return(View("Checkout", buyModel));
            }
            PaymentBLL pBLL          = new PaymentBLL();
            bool       paymentResult = pBLL.MakePayment(AmountToBePaid, paymentAgent);

            resModel.StatusMessage = pBLL.StatusMessage;
            resModel.PaymentStatus = paymentResult;
            resModel.CouponCode    = currCouponToUse.CustomCode;

            if (paymentAgent.GetType() == typeof(PaymentAgentBeelineKg))
            {
                System.Guid     uniqueID = Guid.NewGuid();
                tPaymentMessage msg      = new tPaymentMessage();
                msg.UniqueID  = uniqueID.ToString();
                msg.IDDeal    = currentCheckoutData.IDDeal;
                msg.IDUsed    = UserID;
                msg.SMSCode   = pBLL.PaymentCode;
                msg.DateAdded = DateTime.Now;
                msg.Approved  = false;
                _paymentMessageRepository.InsertOrUpdate(msg);
                resModel.PaymentType = (int)Enums.enmPaymentType.BeelineKG;
                resModel.SMSUniqueID = uniqueID.ToString();
            }
            else
            {
                //Burdan aşağısı sadece kredikartı için çalışır
                _couponRepository.InsertOrUpdate(currCouponToUse);

                tOrder order = new tOrder();
                order.AmountPaid = AmountToBePaid;
                order.BuyerNotes = CommonUtils.Instance.ShoppingCart.BuyerNotes;
                order.IDCoupon   = currCouponToUse.IDCoupon;
                order.IDDeal     = currentDeal.IDDeal;

                order.IDUserBought  = UserID;
                order.MobilePhoneNo = CommonUtils.Instance.ShoppingCart.MobilePhone;
                order.OrderNotes    = currentCheckoutData.OrderNotes;
                CommonUtils.Instance.ShoppingCart.OrderNotes = currentCheckoutData.OrderNotes;
                order.OrderStatus  = (int)Enums.enmOrderStatus.ToBePaid;
                order.PaymentType  = (int)Enums.enmPaymentType.BeelineKG;
                order.Quantity     = currentCheckoutData.Quantity;
                order.RefundStatus = (int)Enums.enmRefundStatus.OrderSuccessful;
                _orderRepository.InsertOrUpdate(order);

                if (paymentResult)
                {
                    _orderRepository.Save();
                    _couponRepository.Save();
                }
            }
            return(View(resModel));
        }