Exemplo n.º 1
0
        public ActionResult PaymentOption(int pageId)
        {
            checkoutShared cs = new checkoutShared(db);
            checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"];
            checkoutItem.clearDataOnStepAndBindCurrentStep(checkoutStep.payment);

            // Validation
            var validation = checkoutItem.validationOnCurrentStep(db);
            if (!validation.Item1)
            {
                return redirectToValidation(validation, checkoutItem);
            }

            helperPaymentOption helperPage = new helperPaymentOption();
            sharedCheckoutItemLoad(pageId, helperPage, checkoutItem);
            helperPage.paymentOptionId = (int)checkoutItem.paymentOptionChoose;

            transferDiscount item = cs.getTransferInfo(langId);
            helperPage.transferDiscountText = cs.getTransferInfoText(item, "TL");

            // Payment Option Visiable From Settings
            var settingItem = db.tbl_settings.Where(a => a.langId == langId).FirstOrDefault();
            if (settingItem.isCrediCardEnable.HasValue && settingItem.isCrediCardEnable.Value)
            {
                helperPage.isCredicardVisiable = true;
            }

            if (settingItem.isTransferEnable.HasValue && settingItem.isTransferEnable.Value)
            {
                helperPage.isTransferVisiable = true;
            }

            // If Is Test Account EveryPayment Actice
            #region Test Account

            if (!string.IsNullOrWhiteSpace(settingItem.testAccountEmail))
            {
                var testAccountList = settingItem.testAccountEmail.Split(',').ToList();

                if (checkoutItem.cartItem.isRegisteredUser)
                {
                    var userItem = db.tbl_user.Where(a => a.userId == checkoutItem.cartItem.userId).First();

                    if (testAccountList.Contains(userItem.email))
                    {
                        helperPage.isCredicardVisiable = true;
                        helperPage.isTransferVisiable = true;
                    }
                }
                else
                {

                    if (testAccountList.Contains(checkoutItem.trackInfo.email))
                    {
                        helperPage.isCredicardVisiable = true;
                        helperPage.isTransferVisiable = true;
                    }
                }
            }

            #endregion

            return View(helperPage);
        }