예제 #1
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ZNode.Libraries.Shipping.FedEx fdx = new ZNode.Libraries.Shipping.FedEx();
        ZNodeEncryption decrypt = new ZNodeEncryption ();

        fdx.ClientProductId = ZNodeConfigManager.SiteConfig.FedExClientProductId;
        fdx.ClientProductVersion = ZNodeConfigManager.SiteConfig.FedExClientProductVersion;
        fdx.CSPAccessKey = ZNodeConfigManager.SiteConfig.FedExCSPKey;
        fdx.CSPPassword = ZNodeConfigManager.SiteConfig.FedExCSPPassword;
        fdx.CurrencyCode = ZNode.Libraries.ECommerce.Catalog.ZNodeCurrencyManager.CurrencyCode();
        fdx.FedExAccountNumber = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExAccountNumber);

        ZNode.Libraries.Shipping.FedExRegisterCspUserService.Address BillingAddress = new ZNode.Libraries.Shipping.FedExRegisterCspUserService.Address();

        BillingAddress.StreetLines =  new string[]{txtBillingStreet1.Text.Trim(),txtBillingStreet2.Text.Trim()};
        BillingAddress.City = txtBillingCity.Text.Trim();
        BillingAddress.StateOrProvinceCode = txtBillingState.Text.Trim();
        BillingAddress.PostalCode = txtBillingPostalCode.Text.Trim();
        BillingAddress.CountryCode = lstBillingCountryCode.SelectedValue;

        ZNode.Libraries.Shipping.FedExRegisterCspUserService.WebAuthenticationCredential userCredential = fdx.RegisterCPCUser(FirstName.Text.Trim(), LastName.Text.Trim(), PhoneNumber.Text.Trim(), "", "", EmailId.Text.Trim(), BillingAddress);

        if (fdx.ErrorCode == "0")
        {
            //User Credential
            string userKey = userCredential.Key;
            string password = userCredential.Password;

            PortalService portalService = new PortalService();
            Portal _portal = portalService.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID);

            _portal.FedExProductionKey = decrypt.EncryptData(userKey);
            _portal.FedExSecurityCode = decrypt.EncryptData(password);

            portalService.Update(_portal);

            //remove the siteconfig from session
            ZNodeConfigManager.SiteConfig = null;

            Response.Redirect("~/admin/secure/settings/default.aspx?mode=fedex");
        }
        else
        {
            lblErrorMsg.Text = fdx.ErrorDescription;
        }
    }
예제 #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ZNode.Libraries.Shipping.FedEx fdx = new ZNode.Libraries.Shipping.FedEx();
        ZNodeEncryption decrypt = new ZNodeEncryption();

        if (ZNodeConfigManager.SiteConfig.FedExProductionKey.Length == 0 || ZNodeConfigManager.SiteConfig.FedExSecurityCode.Length == 0)
        {
            lblErrorMsg.Text = "Please obtain user account first using RegisterCSPUSer.";
            return;
        }

        fdx.ClientProductId = ZNodeConfigManager.SiteConfig.FedExClientProductId;
        fdx.ClientProductVersion = ZNodeConfigManager.SiteConfig.FedExClientProductVersion;
        fdx.CSPAccessKey = ZNodeConfigManager.SiteConfig.FedExCSPKey;
        fdx.CSPPassword = ZNodeConfigManager.SiteConfig.FedExCSPPassword;
        fdx.FedExAccountNumber = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExAccountNumber);
        fdx.CurrencyCode = ZNode.Libraries.ECommerce.Catalog.ZNodeCurrencyManager.CurrencyCode();
        fdx.FedExAccessKey = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExProductionKey);
        fdx.FedExSecurityCode = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExSecurityCode);

        ZNode.Libraries.Shipping.FedExSubscribeService.Address BillingAddress = new ZNode.Libraries.Shipping.FedExSubscribeService.Address();
        BillingAddress.StreetLines = new string[] { txtBillingStreet1.Text.Trim(), txtBillingStreet2.Text.Trim() };
        BillingAddress.PostalCode = txtBillingPostalCode.Text.Trim();
        BillingAddress.City = txtBillingCity.Text.Trim();
        BillingAddress.StateOrProvinceCode = txtBillingState.Text.Trim();
        BillingAddress.CountryCode = lstBillingCountryCode.SelectedValue;

        string meterNumber = fdx.SubscribeUser(FirstName.Text.Trim() + " " + LastName.Text.Trim(), PhoneNumber.Text.Trim(), "", "", EmailID.Text, BillingAddress);

        if (fdx.ErrorCode == "0")//Check for success
        {
            PortalService portalService = new PortalService();
            Portal _portal = portalService.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID);

            _portal.FedExMeterNumber = decrypt.EncryptData(meterNumber);

            portalService.Update(_portal);

            Response.Redirect("~/admin/secure/settings/default.aspx?mode=fedex");
        }
        else
        {
            lblErrorMsg.Text = fdx.ErrorDescription;
        }
    }
예제 #3
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        IPCommerce ipc = new IPCommerce();
        IPCommerceService ipcserv = new IPCommerceService();
        ZNodeEncryption encrypt = new ZNodeEncryption();

        ipc = ipcserv.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID);

        bool recordExists = false;

        if (ipc == null)
        {
            recordExists = false;
            ipc = new IPCommerce();

            //delete config files
            string uc = Server.MapPath("~/data/default/config/ipcommerce_users.config");
            string zc = Server.MapPath("~/data/default/config/ipcommerce_znode.config");

            File.Delete(uc);
            File.Delete(zc);
        }
        else
        {
            recordExists = true;
        }

        ipc.PortalID = ZNodeConfigManager.SiteConfig.PortalID;
        ipc.IPPFSocketId = encrypt.EncryptData(SocketID.Text);
        ipc.MerchantLogin = encrypt.EncryptData(UserID.Text);
        ipc.MerchantPassword = encrypt.EncryptData(Password.Text);
        ipc.MerchantCity = txtBillingCity.Text;
        ipc.MerchantCountryCode = lstBillingCountryCode.SelectedItem.Text;
        ipc.MerchantCustServicePhone = PhoneNumber.Text;
        ipc.MerchantName = MerchantName.Text;
        ipc.MerchantPostalCode = txtBillingPostalCode.Text;
        ipc.MerchantSocketNum = SocketNumber.Text;
        ipc.MerchantStateProv = txtBillingState.Text;
        ipc.MerchantStoreId = StoreID.Text;
        ipc.MerchantStreet1 = txtBillingStreet1.Text;
        ipc.MerchantStreet2 = txtBillingStreet2.Text;
        ipc.Custom1 = SIC.Text.Trim(); // SIC Code
        ipc.Custom5 = SerialNumber.Text.Trim(); //Serial number
        ipc.Custom2 = chkCVVData.Checked.ToString();
        ipc.Custom3 = chkAVSData.Checked.ToString();

        //validate these settings with IP Commerce
        ZNode.Libraries.Payment.GatewayIPCommerce gwipc = new ZNode.Libraries.Payment.GatewayIPCommerce(ipc);

        //save to database
        if (gwipc.PaymentSolutionStatus == SecurePayments.Framework.PaymentSolutionStatus.ReadyToTransact)
        {
            Hashtable elementMapping = new Hashtable();
            // Add elements to the hash table. There are no
            // duplicate keys, which contains xpath to retrieve value from provisioned data
            elementMapping.Add("/ppbcp:MerchId", "");
            elementMapping.Add("/ppbcp:SIC", "");
            elementMapping.Add("/ppbcp:SocketNum", "");
            elementMapping.Add("/ppbcp:StoreId", "");

            //retrieve data
            gwipc.GetMerchantInfo("CREDIT", elementMapping);

            ipc.MerchantSocketNum = elementMapping["/ppbcp:SocketNum"].ToString();
            ipc.MerchantStoreId = elementMapping["/ppbcp:StoreId"].ToString();
            ipc.Custom4 = elementMapping["/ppbcp:MerchId"].ToString(); // Merchant ID

            if (recordExists)
            {
                ipcserv.Save(ipc);
            }
            else
            {
                ipcserv.Insert(ipc);
            }

            Response.Redirect("~/admin/secure/settings/default.aspx?mode=ipcommerce");
        }
        else
        {
            lblErrorMsg.Text = "Unable to configure IP Commerce Settings. Please verify the settings and try again. " + gwipc.ResponseText;
        }
    }
예제 #4
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin();
        Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID);

        portal.AdminEmail = txtAdminEmail.Text;
        portal.CompanyName = txtCompanyName.Text;
        portal.CustomerServiceEmail = txtCustomerServiceEmail.Text;
        portal.CustomerServicePhoneNumber = txtCustomerServicePhoneNumber.Text;
        portal.DomainName = txtDomainName.Text;
        portal.MaxCatalogDisplayColumns = byte.Parse(txtMaxCatalogDisplayColumns.Text);
        portal.MaxCatalogDisplayItems = int.Parse(txtMaxCatalogDisplayItems.Text);
        portal.InclusiveTax = chkInclusiveTax.Checked;

        portal.MaxCatalogItemThumbnailWidth = int.Parse(txtMaxCatalogItemThumbnailWidth.Text);
        portal.MaxCatalogCategoryDisplayThumbnails = int.Parse(txtMaxSmallThumbnailsDisplay.Text);

        portal.SiteWideBottomJavascript = txtSiteWideBottomJavaScript.Text;
        portal.SiteWideTopJavascript = txtSiteWideTopJavaScript.Text;
        portal.SiteWideAnalyticsJavascript = txtSiteWideAnalyticsJavascript.Text;
        portal.OrderReceiptAffiliateJavascript = txtOrderReceiptJavaScript.Text;

        portal.MaxCatalogItemLargeWidth = int.Parse(txtMaxCatalogItemLargeWidth.Text);
        portal.MaxCatalogItemMediumWidth = int.Parse(txtMaxCatalogItemMediumWidth.Text);
        portal.MaxCatalogItemSmallWidth = int.Parse(txtMaxCatalogItemSmallWidth.Text);
        portal.MaxCatalogItemCrossSellWidth = int.Parse(txtMaxCatalogCrossSellWidth.Text);
        portal.MaxCatalogItemThumbnailWidth = int.Parse(txtMaxCatalogItemThumbnailWidth.Text);
        portal.MaxCatalogItemSwatchWidth = int.Parse(txtMaxCatalogItemSwatchesWidth.Text);

        portal.ShopByPriceMin = int.Parse(txtShopByPriceMin.Text);
        portal.ShopByPriceMax = int.Parse(txtShopByPriceMax.Text);
        portal.ShopByPriceIncrement = int.Parse(txtShopByPriceIncrement.Text);

        portal.SalesEmail = txtSalesEmail.Text;
        portal.SalesPhoneNumber = txtSalesPhoneNumber.Text;
        portal.StoreName = txtStoreName.Text;
        portal.UseSSL = chkEnableSSL.Checked;
        portal.DefaultReviewStatus = ListReviewStatus.SelectedValue;

        //Currency Settings
        portal.CurrencyTypeID = int.Parse(ddlCurrencyTypes.SelectedValue);

        ZNodeEncryption encrypt = new ZNodeEncryption();

        //SMTP Server Settings
        portal.SMTPServer = txtSMTPServer.Text;
        portal.SMTPUserName = encrypt.EncryptData(txtSMTPUserName.Text);
        portal.SMTPPassword = encrypt.EncryptData(txtSMTPPassword.Text);

        //UPS Shipping Settings
        portal.UPSUserName = encrypt.EncryptData(txtUPSUserName.Text.Trim());
        portal.UPSPassword = encrypt.EncryptData(txtUPSPassword.Text.Trim());
        portal.UPSKey = encrypt.EncryptData(txtUPSKey.Text.Trim());

        //FedEx Shipping Settings
        portal.FedExAccountNumber = encrypt.EncryptData(txtAccountNum.Text.Trim());
        portal.FedExMeterNumber = encrypt.EncryptData(txtMeterNum.Text.Trim());
        portal.FedExProductionKey = encrypt.EncryptData(txtProductionAccessKey.Text.Trim());
        portal.FedExSecurityCode = encrypt.EncryptData(txtSecurityCode.Text.Trim());

        //Units
        portal.WeightUnit = ddlWeightUnits.SelectedItem.Text;
        portal.DimensionUnit = ddlDimensions.SelectedItem.Text;

        //default order status setting
        portal.DefaultOrderStateID = int.Parse(ddlOrderStateList.SelectedValue);

        //Shipping Settings
        portal.ShippingOriginAddress1 = txtShippingAddress1.Text.Trim();
        portal.ShippingOriginAddress2 = txtShippingAddress2.Text.Trim();
        portal.ShippingOriginCity = txtShippingCity.Text.Trim();
        portal.ShippingOriginPhone = txtShippingPhone.Text.Trim();

        portal.ShippingOriginZipCode = txtShippingZipCode.Text.Trim();
        portal.ShippingOriginStateCode = txtShippingStateCode.Text.Trim();
        portal.ShippingOriginCountryCode = txtShippingCountryCode.Text.Trim();

        portal.FedExDropoffType = ddldropOffTypes.SelectedItem.Value;
        portal.FedExPackagingType = ddlPackageTypeCodes.SelectedItem.Value;
        portal.FedExUseDiscountRate = chkFedExDiscountRate.Checked;
        portal.FedExAddInsurance = chkAddInsurance.Checked;

        // set logo path
        System.IO.FileInfo _FileInfo = null;

        if (radNewImage.Checked == true)
        {
            //Check for Product Image
            _FileInfo = new System.IO.FileInfo(UploadImage.PostedFile.FileName);

            if (_FileInfo != null)
            {
                if ((_FileInfo.Extension == ".jpeg") || (_FileInfo.Extension.Equals(".jpg")) || (_FileInfo.Extension.Equals(".png")) || (_FileInfo.Extension.Equals(".gif")))
                {
                    portal.LogoPath = ZNodeConfigManager.EnvironmentConfig.ContentPath + _FileInfo.Name;
                    UploadImage.SaveAs(Server.MapPath(ZNodeConfigManager.EnvironmentConfig.ContentPath + _FileInfo.Name));
                }
                else
                {
                    lblImageError.Text = "Select a valid jpg, gif or png image.";
                    return;
                }
            }
        }

        bool ret = storeAdmin.Update(portal);

        //Set currency
        CurrencyType currencyType  = storeAdmin.GetByCurrencyTypeID(int.Parse(ddlCurrencyTypes.SelectedValue));
        if(currencyType !=null)
        {
            currencyType.CurrencySuffix = txtCurrencySuffix.Text.Trim();
            storeAdmin.UpdateCurrencyType(currencyType);
        }

        //remove the siteconfig from session
        ZNodeConfigManager.SiteConfig = null;

        if (!ret)
        {
            lblMsg.Text = "An error ocurred while updating the store settings. Please try again.";

            //Log Activity
            ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9002, HttpContext.Current.User.Identity.Name);

        }
        else
        {
            HttpContext.Current.Application["CurrencyTypeCache"] = currencyType;
            Response.Redirect("~/admin/secure/default.aspx");

            //Log Activity
            ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9001, HttpContext.Current.User.Identity.Name);

        }
    }
예제 #5
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin();
        PaymentSetting paymentSetting = new PaymentSetting();

        //If edit mode then retrieve data first
        if (ItemId > 0)
        {
            paymentSetting = settingsAdmin.GetPaymentSettingByID(ItemId);

            if (paymentSetting.ProfileID.HasValue)
            {
                if ((paymentSetting.ProfileID != int.Parse(lstProfile.SelectedValue)) || (paymentSetting.PaymentTypeID != int.Parse(lstPaymentType.SelectedValue)))
                {
                    //check if this setting already exists for this profile
                    bool settingExists = PaymentSettingExists();

                    if (settingExists)
                    {
                        lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option.";
                        return;
                    }
                }
            }
            else
            {
                if (lstProfile.SelectedValue != "-1")
                {
                    //check if this setting already exists for this profile
                    bool settingExists = PaymentSettingExists();

                    if (settingExists)
                    {
                        lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option.";
                        return;
                    }
                }
            }
        }

        //set values based on user input
        paymentSetting.ActiveInd = chkActiveInd.Checked;
        paymentSetting.PaymentTypeID = int.Parse(lstPaymentType.SelectedValue);
        if (lstProfile.SelectedValue == "-1")
        {
            paymentSetting.ProfileID = null;//If All profiles is selected
        }
        else
        {
            paymentSetting.ProfileID = int.Parse(lstProfile.SelectedValue);
        }
        paymentSetting.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text);
        //paymentSetting.OfflineMode = false;

        //if credit card
        if (paymentSetting.PaymentTypeID == 0)
        {
            paymentSetting.GatewayTypeID = int.Parse(lstGateway.SelectedValue);

            paymentSetting.EnableAmex = chkEnableAmex.Checked;
            paymentSetting.EnableDiscover = chkEnableDiscover.Checked;
            paymentSetting.EnableMasterCard = chkEnableMasterCard.Checked;
            paymentSetting.EnableVisa = chkEnableVisa.Checked;
            paymentSetting.TestMode = chkTestMode.Checked;
            paymentSetting.PreAuthorize = chkPreAuthorize.Checked;
            paymentSetting.GatewayPassword = string.Empty;
            paymentSetting.TransactionKey = string.Empty;

            ZNodeEncryption encrypt = new ZNodeEncryption();

            paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text);

            //if authorize.net
            if (paymentSetting.GatewayTypeID == 1)
            {
                paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text);
            }
            //If Verisign PayFlow pro gateway is selected
            else if (paymentSetting.GatewayTypeID == 2)
            {
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                paymentSetting.Partner = txtPartner.Text.Trim();
                paymentSetting.Vendor = txtVendor.Text.Trim();
            }
            //If Nova gateway is selected
            else if (paymentSetting.GatewayTypeID == 5)
            {
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text);
            }
            //If Paypal direct payment gateway is selected
            else if (paymentSetting.GatewayTypeID == 6)
            {
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                paymentSetting.TransactionKey = txtTransactionKey.Text;
            }
            // If World Pay gateway is selected
            else if (paymentSetting.GatewayTypeID == 10)
            {
                // Authorization password
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                // Installation Id
                paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text);
            }
            else
            {
                paymentSetting.TransactionKey = "";
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
            }
        }
        // if Paypal
        else if (paymentSetting.PaymentTypeID == 2)
        {
            paymentSetting.GatewayTypeID = null;
            ZNodeEncryption encrypt = new ZNodeEncryption();

            paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text);
            paymentSetting.TransactionKey = txtTransactionKey.Text;
            paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
            paymentSetting.TestMode = chkTestMode.Checked;

        }
            //if Google Checkout
        else if (paymentSetting.PaymentTypeID == 3)
        {
            paymentSetting.GatewayTypeID = null; //Set null value to Google
            ZNodeEncryption encrypt = new ZNodeEncryption();

            paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text);
            paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
            paymentSetting.TestMode = chkTestMode.Checked;
        }
        else // Purchase Order
        {
            paymentSetting.GatewayTypeID = null;
        }

        bool retval = false;

        //Update Payment setting into database
        if (ItemId > 0)
        {
            retval = settingsAdmin.UpdatePaymentSetting(paymentSetting);
        }
        else
        {
            bool settingExists = settingsAdmin.PaymentSettingExists(int.Parse(lstProfile.SelectedValue), int.Parse(lstPaymentType.SelectedValue));

            if (settingExists)
            {
                lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option.";
                return;
            }

            retval = settingsAdmin.AddPaymentSetting(paymentSetting);
        }

        if (retval)
        {
            //redirect to main page
            Response.Redirect("~/admin/secure/settings/payment/");
        }
        else
        {
            //display error message
            lblMsg.Text = "An error occurred while updating. Please try again.";
        }
    }