예제 #1
0
        private OrderResult SubmitHostingOrder(string contractId)
        {
            //
            List <OrderItem> itemsOrdered = new List <OrderItem>();
            // assemble hosting plan
            OrderItem hostingPlan = OrderItem.GetHostingPlanItem(ctlQuickPlans.SelectedPlan,
                                                                 ctlQuickPlans.SelectedPlanName, ctlPlanCycles.SelectedCycle);

            // put hosting plan into order
            itemsOrdered.Add(hostingPlan);
            //
            if (ctlPlanDomain.DomainChecked)
            {
                OrderItem domainItem = ctlPlanDomain.DomainOrderItem;
                domainItem.ParentIndex = itemsOrdered.IndexOf(hostingPlan);
                itemsOrdered.Add(domainItem);
            }
            //
            //
            KeyValueBunch args = new KeyValueBunch();

            args[Keys.INVOICE_DIRECT_URL] = ecUtils.GetNavigateUrl(PagesKeys.ORDER_CHECKOUT, true,
                                                                   String.Format("{0}={1}", RequestKeys.CONTRACT_ID, ctlUserAccount.ContractId),
                                                                   String.Format("{0}={1}", RequestKeys.PAYMENT_METHOD, ctlPaymentMethod.SelectedMethod));
            //
            return(StorefrontHelper.SubmitCustomerOrder(ctlUserAccount.ContractId, itemsOrdered.ToArray(), args));
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Step #1: Disable "On Behalf Of" feature if that the case
            if (PanelSecurity.LoggedUserId != PanelSecurity.SelectedUserId)
            {
                DisablePageFunctionality();
                ShowWarningMessage("WORK_ON_BEHALF_DISABLED");
                return;
            }

            // Step #2: Create customer contract if necessary
            if (!StorehouseHelper.CheckCustomerContractExists())
            {
                ContractAccount accountSettings = ecUtils.GetContractAccountFromUserInfo(PanelSecurity.SelectedUser);
                GenericResult   result          = StorefrontHelper.AddContract(PanelSecurity.SelectedUser.OwnerId, accountSettings);
                // Show error message
                if (!result.Succeed)
                {
                    DisablePageFunctionality();
                    ShowResultMessage(result.GetProperty <int>("ResultCode"));
                    return;
                }
            }

            // Step #3: Load customer contract
            myContract = StorehouseHelper.GetCustomerContract(PanelSecurity.SelectedUserId);

            // Step #4: Bind payment profile
            if (!IsPostBack)
            {
                BindPaymentProfile();
            }
        }
예제 #3
0
        private void PopulateUpLevelItem()
        {
            Category category = StorefrontHelper.GetStorefrontCategory(ecPanelRequest.CategoryId);

            if (category != null)
            {
                catTopMenu.Items.Add(CreateNodeFromCategory(category, true));
            }
        }
예제 #4
0
        private void PopulateTopLevelItems()
        {
            Category[] items = StorefrontHelper.GetStorefrontCategories(ecPanelRequest.CategoryId);

            foreach (Category item in items)
            {
                catTopMenu.Items.Add(CreateNodeFromCategory(item, false));
            }
        }
예제 #5
0
 protected void ctlQuickPlans_OnPlanSelected(object sender, EventArgs e)
 {
     if (ctlQuickPlans.SelectedPlan > -1)
     {
         //
         ctlPlanCycles.Visible = true;
         //
         ctlPlanCycles.LoadHostingPlanCycles(ctlQuickPlans.SelectedPlan);
         // load plan
         HostingPlan s_plan = StorefrontHelper.GetHostingPlan(ecPanelRequest.ResellerId, ctlQuickPlans.SelectedPlan);
         // domain visibility
         ctlPlanDomain.DomainOption = s_plan.DomainOption;
     }
 }
예제 #6
0
 protected virtual void ProcessCheckout(string methodName, CheckoutDetails details)
 {
     try
     {
         PreProcessCheckout(details);
         // perform order payment
         CheckoutResult result = StorefrontHelper.CompleteCheckout(details[contractKey], invoiceId, methodName, details);
         // post process order result
         PostProcessCheckout(result);
     }
     catch (Exception ex)
     {
         // Output error message into the trace
         Trace.Write("ECOMMERCE", "COMPLETE_CHECKOUT_ERROR", ex);
         // display raw stack trace in case of error
         Response.Write(PortalUtils.GetSharedLocalizedString("Ecommerce", "Error.CHECKOUT_GENERAL_FAILURE"));
     }
 }
예제 #7
0
        private void BindPaymentProfile()
        {
            // load cc payment method
            PaymentMethod ccMethod = StorefrontHelper.GetContractPaymentMethod(myContract.ContractId,
                                                                               PaymentMethod.CREDIT_CARD);

            //
            if (ccMethod == null)
            {
                ShowWarningMessage("PAYMENT_METHOD_NOT_SUPPORTED");
                // hide controls
                ecUtils.ToggleControls(false, ctlPaymentProfile, btnCreateProfile,
                                       btnDeleteProfile, btnUpdateProfile);
                //
                return;
            }
            //
            ctlPaymentProfile.CheckSupportedItems(ccMethod.SupportedItems);
            //
            bool exists = StorehouseHelper.PaymentProfileExists(myContract.ContractId);

            // toggle buttons
            ecUtils.ToggleControls(!exists, btnCreateProfile);
            ecUtils.ToggleControls(exists, btnUpdateProfile, btnDeleteProfile);
            //
            if (exists)
            {
                //
                ctlPaymentProfile.SetCheckoutDetails(StorehouseHelper.GetPaymentProfile(myContract.ContractId));
            }
            else
            {
                ShowWarningMessage("EMPTY_PAYMENT_PROFILE");
                ctlPaymentProfile.SetCheckoutDetails(null);
            }
        }