コード例 #1
0
    private void BindItemImageGallery(AspxCommonInfo aspxCommonObj)
    {
        SageFrameRoute     parentPage      = (SageFrameRoute)this.Page;
        string             itemSKU         = parentPage.Key;
        string             costCombination = string.Empty;
        AspxCoreController obj             = new AspxCoreController();
        ItemCommonInfo     objItemInfo     = obj.GetItemInfoFromSKU(itemSKU, aspxCommonObj);

        if (objItemInfo != null)
        {
            ItemID     = objItemInfo.ItemID;
            ItemTypeID = objItemInfo.ItemTypeID;
        }
        if (ItemTypeID == 3)
        {
            List <GiftCardInfo> lstItemGallery = obj.GetGiftCardThemeImagesByItem(ItemID, aspxCommonObj);
            BindGiftGallery(lstItemGallery, aspxCommonObj);
        }
        else
        {
            List <VariantCombination> lstItemCombination = obj.GetCostVariantCombinationbyItemSku(itemSKU, aspxCommonObj);
            if (lstItemCombination != null && lstItemCombination.Count > 0)
            {
                costCombination = lstItemCombination[0].CombinationID.ToString();
            }
            else
            {
                costCombination = "0";
            }
            List <ItemsInfoSettings> lstItemGallery = obj.GetItemsImageGalleryInfoBySKU(itemSKU, aspxCommonObj, costCombination);
            BindGallery(lstItemGallery, aspxCommonObj);
        }
    }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
         aspxCommonObj.StoreID     = GetStoreID;
         aspxCommonObj.PortalID    = GetPortalID;
         aspxCommonObj.UserName    = GetUsername;
         aspxCommonObj.CultureName = GetCurrentCultureName;
         if (!IsPostBack)
         {
             StoreSettingConfig ssc = new StoreSettingConfig();
             if (Session["CurrencyCode"] != null && Session["CurrencyCode"] != "")
             {
                 SelectedCurrency = Session["CurrencyCode"].ToString();
             }
             else
             {
                 SelectedCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, GetStoreID, GetPortalID, GetCurrentCultureName);
             }
             IncludeJs("Currencyconversion", "/js/FancyDropDown/fancyDropDown.js");//
             IncludeCss("Currencyconversion", "/Templates/" + TemplateName + "/css/FancyDropDown/fancy.css", "/Modules/AspxCommerce/AspxCurrencyConverter/css/module.css");
             StoreID      = GetStoreID;
             PortalID     = GetPortalID;
             CultureName  = GetCurrentCultureName;
             MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, StoreID, PortalID, CultureName);
             if (Session["Region"] != null && Session["Region"] != "")
             {
                 Region = Session["Region"].ToString();
             }
             else
             {
                 Region = StoreSetting.GetRegionFromCurrencyCode(SelectedCurrency, StoreID, PortalID);
             }
             AspxCoreController acc = new AspxCoreController();
             acc.GetCurrencyRateOnChange(aspxCommonObj, MainCurrency, SelectedCurrency, Region);
             if (Session["CurrencyRate"] != null && Session["CurrencyRate"] != "")
             {
                 currencyRate = Math.Round(double.Parse(Session["CurrencyRate"].ToString()), 4);
             }
         }
         IncludeLanguageJS();
         BindCurrencyList();
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
コード例 #3
0
    private void BindItemImageGallery()
    {
        SageFrameRoute parentPage = (SageFrameRoute)this.Page;
        string         itemSKU    = parentPage.Key;

        if (HttpContext.Current.Session.SessionID != null)
        {
            SessionCode = HttpContext.Current.Session.SessionID.ToString();
        }
        string costCombination = "";

        aspxCommonObj.UserName    = GetUsername;
        aspxCommonObj.PortalID    = GetPortalID;
        aspxCommonObj.StoreID     = GetStoreID;
        aspxCommonObj.CustomerID  = GetCustomerID;
        aspxCommonObj.CultureName = GetCurrentCultureName;
        aspxCommonObj.SessionCode = SessionCode;
        AspxCoreController obj         = new AspxCoreController();
        ItemCommonInfo     objItemInfo = obj.GetItemInfoFromSKU(itemSKU, aspxCommonObj);

        if (objItemInfo != null)
        {
            ItemID     = objItemInfo.ItemID;
            ItemTypeID = objItemInfo.ItemTypeID;
        }
        if (ItemTypeID == 3)
        {
            List <GiftCardInfo> lstItemGallery = obj.GetGiftCardThemeImagesByItem(ItemID, aspxCommonObj);
            BindGiftGallery(lstItemGallery);
        }
        else
        {
            List <VariantCombination> lstItemCombination = obj.GetCostVariantCombinationbyItemSku(itemSKU, aspxCommonObj);
            if (lstItemCombination != null && lstItemCombination.Count > 0)
            {
                costCombination = lstItemCombination[0].CombinationID.ToString();
            }
            else
            {
                costCombination = "0";
            }
            List <ItemsInfoSettings> lstItemGallery = obj.GetItemsImageGalleryInfoBySKU(itemSKU, aspxCommonObj, costCombination);
            BindGallery(lstItemGallery);
        }
    }
コード例 #4
0
    private void GetAdvanceSearchSetting(AspxCommonInfo aspxCommonObj, int categoryID, bool isGiftCard)
    {
        AspxCoreController aspxController = new AspxCoreController();
        DataSet            adDataSet      = asc.GetAdvanceSearchDataSet("---", true, aspxCommonObj, categoryID, isGiftCard);

        DataTable advSettings = adDataSet.Tables[0];

        adSettingInfo.AdvanceSearchPageName = advSettings.Rows[0]["AdvanceSearchPageName"].ToString();
        adSettingInfo.IsEnableAdvanceSearch = true;
        adSettingInfo.IsEnableBrandSearch   = Convert.ToBoolean(advSettings.Rows[0]["IsEnableBrandSearch"]);
        adSettingInfo.NoOfItemsInARow       = Convert.ToInt32(advSettings.Rows[0]["NoOfItemsInARow"]);

        DataTable dtCatList = adDataSet.Tables[1];

        LoadAllCategoryForSearch(aspxCommonObj, AspxCommerce.Core.CommonHelper.ConvertTo <CategoryInfo>(dtCatList));

        DataTable dtBrandItem = adDataSet.Tables[2];

        GetAllBrandForItem(0, false, aspxCommonObj, AspxCommerce.Core.CommonHelper.ConvertTo <BrandItemsInfo>(dtBrandItem));
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SetCustomerID();
        GetStoreSettings();
        CheckStoreAccessible();
        CreateGlobalVariables();
        LoadGlobalVariables();
        IncludeCoreLanguageJS();
        IncludeTemplateLanguageJS();
        IncludeRssFeedLanguageJS();
        if (HttpContext.Current.Session["IsLoginClick" + GetUsername] != null)
        {
            if (bool.Parse(HttpContext.Current.Session["IsLoginClick" + GetUsername].ToString()))
            {
                UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, GetCustomerID,
                                                    HttpContext.Current.Session.SessionID.ToString());
                HttpContext.Current.Session["IsLoginClick" + GetUsername] = false;
            }
        }
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = GetStoreID;
        aspxCommonObj.PortalID    = GetPortalID;
        aspxCommonObj.UserName    = GetUsername;
        aspxCommonObj.CustomerID  = GetCustomerID;
        aspxCommonObj.SessionCode = HttpContext.Current.Session.SessionID.ToString();
        List <CustomerOnlineInfo> customerIsExistInfo = AspxCoreController.CheckIfCustomerExists(aspxCommonObj);

        if ((GetUsername != "AnonymousUser") && (customerIsExistInfo[0].UserExists == false) && (customerIsExistInfo[0].IsUserOnline == true))
        {
            LoggOutUser();
        }
        List <CurrrencyRateInfo> ratelist        = GetCountryCodeRates();
        JavaScriptSerializer     json_serializer = new JavaScriptSerializer();
        string jsonRates = json_serializer.Serialize(ratelist);

        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ratelist", " var currencyRate='" + jsonRates + "';", true);
    }
コード例 #6
0
    private void StartProccess()
    {
        try
        {
            var ssc = new StoreSettingConfig();
            Currency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, OrderDetail.StoreId, OrderDetail.PortalId, OrderDetail.CultureName);
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID  = OrderDetail.StoreId;
            aspxCommonObj.PortalID = OrderDetail.PortalId;
            if (PaypalSupportedCurrency.paypalSupportedCurrency.Split(',').Where(s => string.Compare(Currency, s, true) == 0).Count() > 0)
            {
                Rate             = 1;
                SelectedCurrency = Currency;
            }
            else
            {
                AspxCoreController acc = new AspxCoreController();
                Rate             = acc.GetCurrencyRateOnChange(aspxCommonObj, Currency, "USD", "en-US");
                Currency         = "USD";
                SelectedCurrency = Currency;

                if (Rate == 1)
                {
                    Rate = 0;
                }
            }
            if (Rate != 0)
            {
                Session["SelectedCurrency"] = SelectedCurrency;
                LoadSetting();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID     = GetStoreID;
            aspxCommonObj.PortalID    = GetPortalID;
            aspxCommonObj.UserName    = GetUsername;
            aspxCommonObj.CultureName = GetCurrentCultureName;

            if (!IsPostBack)
            {
                if (Session["OrderID"] != null)
                {
                    orderID = int.Parse(Session["OrderID"].ToString());
                }

                StoreSettingConfig ssc = new StoreSettingConfig();
                AspxCoreController acc = new AspxCoreController();
                MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, GetPortalID, GetPortalID, GetCurrentCultureName);

                if (Session["CurrencyCode"] != null && Session["CurrencyCode"] != "")
                {
                    SelectedCurrency = Session["CurrencyCode"].ToString();
                }
                else
                {
                    SelectedCurrency = MainCurrency;
                }
                if (Session["Region"] != null && Session["Region"] != "")
                {
                    Region = Session["Region"].ToString();
                }
                else
                {
                    Region = StoreSetting.GetRegionFromCurrencyCode(SelectedCurrency, GetStoreID, GetPortalID);
                }

                currencyRate = Convert.ToDecimal(acc.GetCurrencyRateOnChange(aspxCommonObj, MainCurrency, SelectedCurrency, Region));



                var sfConfig = new SageFrameConfig();
                _isUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                PageExtension      = SageFrameSettingKeys.PageExtension;
                if (_isUseFriendlyUrls)
                {
                    if (!IsParent)
                    {
                        _sageRedirectPath = ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + PageExtension);
                        _addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/portal/" + GetPortalSEOName + "/";
                    }
                    else
                    {
                        _sageRedirectPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + PageExtension);
                        _addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/";
                    }
                }
                else
                {
                    _sageRedirectPath = ResolveUrl("{~/Default" + PageExtension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                }

                var imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                }
                hlnkHomePage.NavigateUrl = _sageRedirectPath;
                SendEmailFrom            = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, GetStoreID, GetPortalID, GetCurrentCultureName);
                SendOrderNotice          = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, GetStoreID, GetPortalID, GetCurrentCultureName);

                if (Session["mb_IsCheckoutFromMobile"] != null)
                {
                    MobileSuccess(_sageRedirectPath);
                }
                else
                {
                    SendConfrimMessage(_sageRedirectPath);
                }
            }
            IncludeLanguageJS();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (CheckOutSessions.Get("MoneybookersData", "") != "")
            {
                string[] data = CheckOutSessions.Get("MoneybookersData", "").Split('#');
                storeID     = int.Parse(data[0].ToString());
                portalID    = int.Parse(data[1].ToString());
                userName    = data[2];
                customerID  = int.Parse(data[3].ToString());
                sessionCode = data[4].ToString();
                cultureName = data[5];
                itemIds     = data[6];
                couponCode  = data[7];
                Spath       = ResolveUrl("~/Modules/AspxCommerce/AspxCommerceServices/");
                StoreSettingConfig ssc = new StoreSettingConfig();
                MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, storeID, portalID, cultureName);
                AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.StoreID  = storeID;
                aspxCommonObj.PortalID = portalID;
                if (MoneybookersSupportedCurrency.moneybookersSupportedCurrency.Split(',').Where(s => string.Compare(MainCurrency, s, true) == 0).Count() > 0)
                {
                    rate             = 1;
                    SelectedCurrency = MainCurrency;
                }
                else
                {
                    AspxCoreController acc = new AspxCoreController();
                    rate             = acc.GetCurrencyRateOnChange(aspxCommonObj, MainCurrency, "USD", "en-US");
                    MainCurrency     = "USD";
                    SelectedCurrency = MainCurrency;

                    /* Some time if selected currency does not exist in currency table then it returns 1,
                     *    if we take 1 as rate then it will convert same as previous amount
                     *     So avoid Transaction by making it 0 */

                    if (rate == 1)
                    {
                        rate = 0;
                    }
                }
                if (rate != 0)
                {
                    Session["SelectedCurrency"] = SelectedCurrency;
                    LoadSetting();
                }
                else
                {
                    lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
                    clickhere.Visible = false;
                }
            }
            else
            {
                lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
                clickhere.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
            clickhere.Visible = false;
            ProcessException(ex);
        }
    }
コード例 #9
0
    private List <CartInfo> LoadCartItems()
    {
        List <CartInfo> cartInfos = AspxCoreController.GetCartDetails(aspxCommonObj);

        return(cartInfos);
    }
コード例 #10
0
    public string SendPaymentInfoAIM(OrderDetailsCollection OrderDetail, string TemplateName, string addressPath)
    {
        WebClient objRequest = new WebClient();

        System.Collections.Specialized.NameValueCollection objInf = new System.Collections.Specialized.NameValueCollection(30);

        string strError;

        //OrderDetail.ObjOrderDetails.CustomerID = int.Parse(Crypto.GenerateCustomerID());
        OrderDetail.ObjOrderDetails.InvoiceNumber       = Crypto.GenerateInvoiceNumber();
        OrderDetail.ObjOrderDetails.PurchaseOrderNumber = Crypto.GeneratePurchaseOrderNumber();

        //merchant generated field
        objInf.Add("x_version", OrderDetail.ObjOrderDetails.Version);
        objInf.Add("x_delim_data", OrderDetail.ObjOrderDetails.DelimData);
        objInf.Add("x_login", OrderDetail.ObjOrderDetails.APILogin);
        objInf.Add("x_tran_key", OrderDetail.ObjOrderDetails.TransactionKey);
        objInf.Add("x_relay_response", OrderDetail.ObjOrderDetails.RelayResponse);
        objInf.Add("x_delim_char", OrderDetail.ObjOrderDetails.DelimChar);
        objInf.Add("x_encap_char", OrderDetail.ObjOrderDetails.EncapeChar);
        objInf.Add("x_invoice_num", OrderDetail.ObjOrderDetails.InvoiceNumber);
        objInf.Add("x_cust_id", OrderDetail.ObjOrderDetails.CustomerID.ToString());
        objInf.Add("x_po_num", OrderDetail.ObjOrderDetails.PurchaseOrderNumber);
        //for (int i = 0; i < arr; i++)
        //{

        //}

        // Billing Address
        objInf.Add("x_first_name", OrderDetail.ObjBillingAddressInfo.FirstName);
        objInf.Add("x_last_name", OrderDetail.ObjBillingAddressInfo.LastName);
        objInf.Add("x_company", OrderDetail.ObjBillingAddressInfo.CompanyName);
        objInf.Add("x_email", OrderDetail.ObjBillingAddressInfo.EmailAddress);
        objInf.Add("x_address", OrderDetail.ObjBillingAddressInfo.Address);
        objInf.Add("x_city", OrderDetail.ObjBillingAddressInfo.City);
        objInf.Add("x_state", OrderDetail.ObjBillingAddressInfo.State);
        objInf.Add("x_zip", OrderDetail.ObjBillingAddressInfo.Zip);
        objInf.Add("x_country", OrderDetail.ObjBillingAddressInfo.Country);
        objInf.Add("x_phone", OrderDetail.ObjBillingAddressInfo.Phone);
        objInf.Add("x_fax", OrderDetail.ObjBillingAddressInfo.Fax);
        objInf.Add("x_email_customer", OrderDetail.ObjOrderDetails.IsEmailCustomer);

        if (OrderDetail.ObjOrderDetails.IsMultipleCheckOut == false)
        {
            //shipping address
            objInf.Add("x_ship_to_first_name", OrderDetail.ObjShippingAddressInfo.FirstName);
            objInf.Add("x_ship_to_last_name", OrderDetail.ObjShippingAddressInfo.LastName);
            objInf.Add("x_ship_to_company", OrderDetail.ObjShippingAddressInfo.CompanyName);
            objInf.Add("x_ship_to_address", OrderDetail.ObjShippingAddressInfo.Address);
            objInf.Add("x_ship_to_city", OrderDetail.ObjShippingAddressInfo.City);
            objInf.Add("x_ship_to_state", OrderDetail.ObjShippingAddressInfo.State);
            objInf.Add("x_ship_to_zip", OrderDetail.ObjShippingAddressInfo.Zip);
            objInf.Add("x_ship_to_country", OrderDetail.ObjShippingAddressInfo.Country);
        }
        // Card Details
        objInf.Add("x_card_num", OrderDetail.ObjPaymentInfo.CardNumber);
        objInf.Add("x_card_type", OrderDetail.ObjPaymentInfo.CardType);
        objInf.Add("x_exp_date", OrderDetail.ObjPaymentInfo.ExpireDate);
        if (OrderDetail.ObjPaymentInfo.PaymentMethodCode == "CC")
        {
            // Authorization code of the card (CCV)
            objInf.Add("x_card_code", OrderDetail.ObjPaymentInfo.CardCode.ToString());
            objInf.Add("x_method", OrderDetail.ObjPaymentInfo.PaymentMethodCode);
            objInf.Add("x_type", OrderDetail.ObjPaymentInfo.TransactionType);
            string amount = Regex.Replace(OrderDetail.ObjOrderDetails.GrandTotal.ToString("0.00"), @"[A-Z]", String.Empty);
            objInf.Add("x_amount", amount);
            objInf.Add("x_description", OrderDetail.ObjOrderDetails.Remarks);
            objInf.Add("x_test_request", OrderDetail.ObjOrderDetails.IsTest);
        }
        else
        {
            //bank
            objInf.Add("x_bank_aba_code", OrderDetail.ObjPaymentInfo.RoutingNumber);
            objInf.Add("x_bank_acct_num", OrderDetail.ObjPaymentInfo.AccountNumber);
            objInf.Add("x_bank_acct_type", OrderDetail.ObjPaymentInfo.AccountType);
            objInf.Add("x_bank_name", OrderDetail.ObjPaymentInfo.BankName);
            objInf.Add("x_bank_acct_name", OrderDetail.ObjPaymentInfo.AccountHolderName);
            objInf.Add("x_echeck_type", OrderDetail.ObjPaymentInfo.ChequeType);
            objInf.Add("x_bank_check_number", OrderDetail.ObjPaymentInfo.ChequeNumber);
        }

        // Currency setting. Check the guide for other supported currencies
        objInf.Add("x_currency_code", OrderDetail.ObjOrderDetails.CurrencyCode);
        objRequest.BaseAddress = "https://test.authorize.net/gateway/transact.dll";

        try
        {
            // POST request
            byte[]   objRetBytes;
            string[] objRetVals;

            objRetBytes =
                objRequest.UploadValues(objRequest.BaseAddress, "POST", objInf);
            objRetVals =
                System.Text.Encoding.ASCII.GetString(objRetBytes).Split(",".ToCharArray());

            // Process Return Values
            OrderDetail.ObjOrderDetails.ResponseCode       = int.Parse(objRetVals[0].Trim(char.Parse("|")));
            OrderDetail.ObjOrderDetails.ResponseReasonCode = int.Parse(objRetVals[2].Trim(char.Parse("|")));
            if (objRetVals[0].Trim(char.Parse("|")) == "1")
            {
                // Returned Authorisation Code
                //response.AuthorizationCode = objRetVals[4].Trim(char.Parse("|"));
                // Returned Transaction ID
                OrderDetail.ObjOrderDetails.TransactionID = Convert.ToString(objRetVals[6].Trim(char.Parse("|")));
                strError = "Transaction completed successfully.";
                // AspxCommerceWebService asws = new AspxCommerceWebService();
                AspxCoreController asws = new AspxCoreController();
                OrderDetail.ObjOrderDetails.OrderStatusID = 8;
                OrderDetail.ObjOrderDetails.TransactionID = Convert.ToString(objRetVals[6].Trim(char.Parse("|")));
                asws.AddOrderDetails(OrderDetail);
                CartManageSQLProvider cms           = new CartManageSQLProvider();
                AspxCommonInfo        aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.CustomerID  = OrderDetail.ObjOrderDetails.CustomerID;
                aspxCommonObj.SessionCode = OrderDetail.ObjOrderDetails.SessionCode;
                aspxCommonObj.StoreID     = OrderDetail.ObjCommonInfo.StoreID;
                aspxCommonObj.PortalID    = OrderDetail.ObjCommonInfo.PortalID;
                cms.ClearCartAfterPayment(aspxCommonObj);
            }
            else
            {
                // Error!
                strError = objRetVals[3].Trim(char.Parse("|")) + " (" +
                           objRetVals[2].Trim(char.Parse("|")) + ")";

                if (objRetVals[2].Trim(char.Parse("|")) == "44")
                {
                    // CCV transaction decline
                    strError += "Our Card Code Verification (CCV) returned " +
                                "the following error: ";

                    switch (objRetVals[38].Trim(char.Parse("|")))
                    {
                    case "N":
                        strError += "Card Code does not match.";
                        break;

                    case "P":
                        strError += "Card Code was not processed.";
                        break;

                    case "S":
                        strError += "Card Code should be on card but was not indicated.";
                        break;

                    case "U":
                        strError += "Issuer was not certified for Card Code.";
                        break;
                    }
                }

                if (objRetVals[2].Trim(char.Parse("|")) == "45")
                {
                    if (strError.Length > 1)
                    {
                        strError += "<br />n";
                    }

                    // AVS transaction decline
                    strError += "Our Address Verification System (AVS) " +
                                "returned the following error: ";

                    switch (objRetVals[5].Trim(char.Parse("|")))
                    {
                    case "A":
                        strError += " the zip code entered does not match " +
                                    "the billing address.";
                        break;

                    case "B":
                        strError += " no information was provided for the AVS check.";
                        break;

                    case "E":
                        strError += " a general error occurred in the AVS system.";
                        break;

                    case "G":
                        strError += " the credit card was issued by a non-US bank.";
                        break;

                    case "N":
                        strError += " neither the entered street address nor zip " +
                                    "code matches the billing address.";
                        break;

                    case "P":
                        strError += " AVS is not applicable for this transaction.";
                        break;

                    case "R":
                        strError += " please retry the transaction; the AVS system " +
                                    "was unavailable or timed out.";
                        break;

                    case "S":
                        strError += " the AVS service is not supported by your " +
                                    "credit card issuer.";
                        break;

                    case "U":
                        strError += " address information is unavailable for the " +
                                    "credit card.";
                        break;

                    case "W":
                        strError += " the 9 digit zip code matches, but the " +
                                    "street address does not.";
                        break;

                    case "Z":
                        strError += " the zip code matches, but the address does not.";
                        break;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            strError = ex.Message;
        }
        OrderDetail.ObjOrderDetails.ResponseReasonText = strError;
        return(OrderDetail.ObjOrderDetails.ResponseReasonText);
    }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (CheckOutSessions.Get("PaypalData", "") != "")
            {
                string[] data = CheckOutSessions.Get("PaypalData", "").Split('#');
                storeID     = int.Parse(data[0]);
                portalID    = int.Parse(data[1]);
                UserName    = data[2];
                customerID  = int.Parse(data[3]);
                SessionCode = data[4];
                CultureName = data[5];
                AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.StoreID  = storeID;
                aspxCommonObj.PortalID = portalID;
                var ssc = new StoreSettingConfig();
                MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, storeID, portalID, CultureName);
                if (PaypalSupportedCurrency.paypalSupportedCurrency.Split(',').Where(s => string.Compare(MainCurrency, s, true) == 0).Count() > 0)
                {
                    Rate             = 1;
                    SelectedCurrency = MainCurrency;
                }
                else
                {
                    AspxCoreController acc = new AspxCoreController();
                    Rate             = acc.GetCurrencyRateOnChange(aspxCommonObj, MainCurrency, "USD", "en-US");
                    MainCurrency     = "USD";
                    SelectedCurrency = MainCurrency;

                    /* Some time if selected currency does not exist in currency table then it returns 1,
                     * if we take 1 as rate then it will convert same as previous amount
                     * So avoid Transaction by making it 0 */
                    if (Rate == 1)
                    {
                        Rate = 0;
                    }
                }
                if (Rate != 0)
                {
                    HttpContext.Current.Session["SelectedCurrency"] = SelectedCurrency;
                    LoadSetting();
                }
                else
                {
                    lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
                    clickhere.Visible = false;
                }
            }
            else
            {
                lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
                clickhere.Visible = false;
            }
        }
        catch
        {
            lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
            clickhere.Visible = false;
            // ProcessException(ex);
        }
    }
コード例 #12
0
        public string SendPaymentInfoAIM(OrderDetailsCollection OrderDetail, string TemplateName, string addressPath)
        {
            var objRequest = new WebClient();
            var objInf     = new System.Collections.Specialized.NameValueCollection(30);

            string strError;

            //OrderDetail.ObjOrderDetails.CustomerID = int.Parse(Crypto.GenerateCustomerID());
            OrderDetail.ObjOrderDetails.InvoiceNumber       = Crypto.GenerateInvoiceNumber();
            OrderDetail.ObjOrderDetails.PurchaseOrderNumber = Crypto.GeneratePurchaseOrderNumber();

            //merchant generated field
            objInf.Add("x_version", OrderDetail.ObjOrderDetails.Version);
            objInf.Add("x_delim_data", "True");
            objInf.Add("x_login", OrderDetail.ObjOrderDetails.APILogin);
            objInf.Add("x_tran_key", OrderDetail.ObjOrderDetails.TransactionKey);
            objInf.Add("x_relay_response", "False");
            objInf.Add("x_delim_char", ",");
            objInf.Add("x_encap_char", "|");
            objInf.Add("x_invoice_num", OrderDetail.ObjOrderDetails.InvoiceNumber);
            objInf.Add("x_cust_id", OrderDetail.ObjOrderDetails.CustomerID.ToString(CultureInfo.InvariantCulture));
            objInf.Add("x_po_num", OrderDetail.ObjOrderDetails.PurchaseOrderNumber);

            // Billing Address
            objInf.Add("x_first_name", OrderDetail.ObjBillingAddressInfo.FirstName);
            objInf.Add("x_last_name", OrderDetail.ObjBillingAddressInfo.LastName);
            objInf.Add("x_company", OrderDetail.ObjBillingAddressInfo.CompanyName);
            objInf.Add("x_email", OrderDetail.ObjBillingAddressInfo.EmailAddress);
            objInf.Add("x_address", OrderDetail.ObjBillingAddressInfo.Address);
            objInf.Add("x_city", OrderDetail.ObjBillingAddressInfo.City);
            objInf.Add("x_state", OrderDetail.ObjBillingAddressInfo.State);
            objInf.Add("x_zip", OrderDetail.ObjBillingAddressInfo.Zip);
            objInf.Add("x_country", OrderDetail.ObjBillingAddressInfo.Country);
            objInf.Add("x_phone", OrderDetail.ObjBillingAddressInfo.Phone);
            objInf.Add("x_fax", OrderDetail.ObjBillingAddressInfo.Fax);
            objInf.Add("x_email_customer", OrderDetail.ObjOrderDetails.IsEmailCustomer);

            if (OrderDetail.ObjOrderDetails.IsMultipleCheckOut == false)
            {
                //shipping address
                objInf.Add("x_ship_to_first_name", OrderDetail.ObjShippingAddressInfo.FirstName);
                objInf.Add("x_ship_to_last_name", OrderDetail.ObjShippingAddressInfo.LastName);
                objInf.Add("x_ship_to_company", OrderDetail.ObjShippingAddressInfo.CompanyName);
                objInf.Add("x_ship_to_address", OrderDetail.ObjShippingAddressInfo.Address);
                objInf.Add("x_ship_to_city", OrderDetail.ObjShippingAddressInfo.City);
                objInf.Add("x_ship_to_state", OrderDetail.ObjShippingAddressInfo.State);
                objInf.Add("x_ship_to_zip", OrderDetail.ObjShippingAddressInfo.Zip);
                objInf.Add("x_ship_to_country", OrderDetail.ObjShippingAddressInfo.Country);
            }
            // Card Details
            objInf.Add("x_card_num", OrderDetail.ObjPaymentInfo.CardNumber);
            objInf.Add("x_card_type", OrderDetail.ObjPaymentInfo.CardType);
            objInf.Add("x_exp_date", OrderDetail.ObjPaymentInfo.ExpireDate);

            var            ssc = new StoreSettingConfig();
            double         rate;
            string         mainCurrency    = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, OrderDetail.ObjCommonInfo.StoreID, OrderDetail.ObjCommonInfo.PortalID, OrderDetail.ObjCommonInfo.CultureName);
            const string   gateWayCurrency = "USD";
            AspxCommonInfo aspxCommonObj   = new AspxCommonInfo();

            aspxCommonObj.CustomerID  = OrderDetail.ObjOrderDetails.CustomerID;
            aspxCommonObj.SessionCode = OrderDetail.ObjOrderDetails.SessionCode;
            aspxCommonObj.StoreID     = OrderDetail.ObjCommonInfo.StoreID;
            aspxCommonObj.PortalID    = OrderDetail.ObjCommonInfo.PortalID;

            if (gateWayCurrency.ToLower().Trim() == mainCurrency.ToLower().Trim())
            {
                rate = 1;
            }
            else
            {
                AspxCoreController acc = new AspxCoreController();
                rate = acc.GetCurrencyRateOnChange(aspxCommonObj, mainCurrency, gateWayCurrency.Trim(), "en-US");
            }
            //double amountTotal = double.Parse(HttpContext.Current.Session["GrandTotalAll"].ToString()) * rate;
            double  amountTotal = double.Parse(CheckOutSessions.Get <Double>("GrandTotalAll", 0).ToString()) * rate;
            decimal amount      = decimal.Parse(amountTotal.ToString(CultureInfo.InvariantCulture));

            //string amount = Regex.Replace(OrderDetail.ObjOrderDetails.GrandTotal.ToString("0.00"), @"[A-Z]", String.Empty);
            objInf.Add("x_amount", Math.Round(amount, 2).ToString(CultureInfo.InvariantCulture));
            objInf.Add("x_test_request", "False");
            if (OrderDetail.ObjPaymentInfo.PaymentMethodCode == "CC")
            {
                // Authorization code of the card (CCV)
                objInf.Add("x_card_code", OrderDetail.ObjPaymentInfo.CardCode.Trim());
                objInf.Add("x_method", OrderDetail.ObjPaymentInfo.PaymentMethodCode.Trim());
                objInf.Add("x_type", OrderDetail.ObjPaymentInfo.TransactionType.Trim());
                // string amount = Regex.Replace(OrderDetail.ObjOrderDetails.GrandTotal.ToString("0.00"), @"[A-Z]", String.Empty);
                // objInf.Add("x_amount", amount);
                objInf.Add("x_description", OrderDetail.ObjOrderDetails.Remarks.Trim());
            }
            else
            {
                //bank
                objInf.Add("x_bank_aba_code", OrderDetail.ObjPaymentInfo.RoutingNumber.Trim());
                objInf.Add("x_bank_acct_num", OrderDetail.ObjPaymentInfo.AccountNumber.Trim());
                objInf.Add("x_bank_acct_type", OrderDetail.ObjPaymentInfo.AccountType.Trim());
                objInf.Add("x_bank_name", OrderDetail.ObjPaymentInfo.BankName.Trim());
                objInf.Add("x_bank_acct_name", OrderDetail.ObjPaymentInfo.AccountHolderName.Trim());
                objInf.Add("x_echeck_type", OrderDetail.ObjPaymentInfo.ChequeType.Trim());
                objInf.Add("x_bank_check_number", OrderDetail.ObjPaymentInfo.ChequeNumber.Trim());
            }

            // Currency setting. Check the guide for other supported currencies
            objInf.Add("x_currency_code", OrderDetail.ObjOrderDetails.CurrencyCode.Trim());

            if (OrderDetail.ObjOrderDetails.IsTest.ToLower().Trim() == "true" || OrderDetail.ObjOrderDetails.IsTest.ToLower() == "1")
            {
                objRequest.BaseAddress = "https://test.authorize.net/gateway/transact.dll";
            }
            else
            {
                objRequest.BaseAddress = "https://secure.authorize.net/gateway/transact.dll";
            }

            try
            {
                // POST request

                byte[]   objRetBytes = objRequest.UploadValues(objRequest.BaseAddress, "POST", objInf);
                string[] objRetVals  = System.Text.Encoding.ASCII.GetString(objRetBytes).Split(",".ToCharArray());

                // Process Return Values
                OrderDetail.ObjOrderDetails.ResponseCode       = int.Parse(objRetVals[0].Trim(char.Parse("|")));
                OrderDetail.ObjOrderDetails.ResponseReasonCode = int.Parse(objRetVals[2].Trim(char.Parse("|")));

                if (objRetVals[0].Trim(char.Parse("|")) == "1")
                {
                    // Returned Authorisation Code
                    //response.AuthorizationCode = objRetVals[4].Trim(char.Parse("|"));
                    // Returned Transaction ID
                    OrderDetail.ObjOrderDetails.TransactionID = Convert.ToString(objRetVals[6].Trim(char.Parse("|")));
                    strError = "Transaction completed successfully.";

                    AspxCoreController acc = new AspxCoreController();
                    OrderDetail.ObjOrderDetails.OrderStatusID = 8;
                    OrderDetail.ObjOrderDetails.TransactionID = Convert.ToString(objRetVals[6].Trim(char.Parse("|")));
                    acc.AddOrderDetails(OrderDetail);
                    HttpContext.Current.Session["TransDetailsAIM"] = OrderDetail.ObjOrderDetails.InvoiceNumber + "#" + OrderDetail.ObjOrderDetails.TransactionID + "#" + "AIM Authorize.Net";
                    if (HttpContext.Current.Session["OrderCollection"] != null)
                    {
                        OrderDetailsCollection orderdata2 = new OrderDetailsCollection();
                        if (HttpContext.Current.Session["OrderCollection"] != null)
                        {
                            orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                        }

                        AspxOrderController.UpdateItemQuantity(orderdata2);
                        AspxGiftCardController.IssueGiftCard(orderdata2.LstOrderItemsInfo, orderdata2.ObjOrderDetails.OrderID, true, aspxCommonObj);
                        if (orderdata2.GiftCardDetail != null && HttpContext.Current.Session["UsedGiftCard"] != null)
                        {   //updating giftcard used in chekout
                            AspxGiftCardController.UpdateGiftCardUsage(orderdata2.GiftCardDetail, orderdata2.ObjCommonInfo.StoreID,
                                                                       orderdata2.ObjCommonInfo.PortalID, orderdata2.ObjOrderDetails.OrderID, orderdata2.ObjCommonInfo.AddedBy,
                                                                       orderdata2.ObjCommonInfo.CultureName);
                            HttpContext.Current.Session.Remove("UsedGiftCard");
                        }


                        var tinfo = new TransactionLogInfo();
                        var tlog  = new TransactionLog();

                        tinfo.TransactionID      = OrderDetail.ObjOrderDetails.TransactionID;
                        tinfo.AuthCode           = objRetVals[4].Trim(char.Parse("|"));//auth Code
                        tinfo.TotalAmount        = OrderDetail.ObjOrderDetails.GrandTotal;
                        tinfo.ResponseCode       = "1";
                        tinfo.ResponseReasonText = strError;
                        tinfo.OrderID            = orderdata2.ObjOrderDetails.OrderID;
                        tinfo.StoreID            = OrderDetail.ObjCommonInfo.StoreID;
                        tinfo.PortalID           = OrderDetail.ObjCommonInfo.PortalID;
                        tinfo.AddedBy            = OrderDetail.ObjCommonInfo.AddedBy;
                        tinfo.CustomerID         = OrderDetail.ObjOrderDetails.CustomerID;
                        tinfo.SessionCode        = OrderDetail.ObjOrderDetails.SessionCode;
                        tinfo.PaymentGatewayID   = OrderDetail.ObjOrderDetails.PaymentGatewayTypeID;
                        tinfo.PaymentStatus      = "Processed";
                        tinfo.PayerEmail         = OrderDetail.ObjBillingAddressInfo.EmailAddress;
                        tinfo.CreditCard         = OrderDetail.ObjPaymentInfo.CardNumber;
                        tinfo.CurrencyCode       = gateWayCurrency.Trim();
                        tlog.SaveTransactionLog(tinfo);
                    }

                    var cms = new AspxCommerce.Core.CartManageSQLProvider();
                    cms.ClearCartAfterPayment(aspxCommonObj);

                    // StoreSettingConfig ssc = new StoreSettingConfig();
                    string sendEmailFrom   = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, OrderDetail.ObjCommonInfo.StoreID, OrderDetail.ObjCommonInfo.PortalID, OrderDetail.ObjCommonInfo.CultureName);
                    string sendOrderNotice = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, OrderDetail.ObjCommonInfo.StoreID, OrderDetail.ObjCommonInfo.PortalID, OrderDetail.ObjCommonInfo.CultureName);



                    if (sendOrderNotice.ToLower() == "true")
                    {
                        try
                        {
                            EmailTemplate.SendEmailForOrder(OrderDetail.ObjCommonInfo.PortalID, OrderDetail, addressPath,
                                                            TemplateName, OrderDetail.ObjOrderDetails.TransactionID);
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }
                    acc.ClearSessionVariable("OrderCollection");
                    CheckOutHelper cHelper = new CheckOutHelper();
                    cHelper.ClearSessions();
                }
                else
                {
                    // Error!
                    strError = objRetVals[3].Trim(char.Parse("|")) + " (" +
                               objRetVals[2].Trim(char.Parse("|")) + ")";

                    if (objRetVals[2].Trim(char.Parse("|")) == "44")
                    {
                        // CCV transaction decline
                        strError += "Our Card Code Verification (CCV) returned " +
                                    "the following error: ";

                        switch (objRetVals[38].Trim(char.Parse("|")))
                        {
                        case "N":
                            strError += "Card Code does not match.";
                            break;

                        case "P":
                            strError += "Card Code was not processed.";
                            break;

                        case "S":
                            strError += "Card Code should be on card but was not indicated.";
                            break;

                        case "U":
                            strError += "Issuer was not certified for Card Code.";
                            break;
                        }
                    }

                    if (objRetVals[2].Trim(char.Parse("|")) == "45")
                    {
                        if (strError.Length > 1)
                        {
                            strError += "<br />n";
                        }

                        // AVS transaction decline
                        strError += "Our Address Verification System (AVS) " +
                                    "returned the following error: ";

                        switch (objRetVals[5].Trim(char.Parse("|")))
                        {
                        case "A":
                            strError += " the zip code entered does not match " +
                                        "the billing address.";
                            break;

                        case "B":
                            strError += " no information was provided for the AVS check.";
                            break;

                        case "E":
                            strError += " a general error occurred in the AVS system.";
                            break;

                        case "G":
                            strError += " the credit card was issued by a non-US bank.";
                            break;

                        case "N":
                            strError += " neither the entered street address nor zip " +
                                        "code matches the billing address.";
                            break;

                        case "P":
                            strError += " AVS is not applicable for this transaction.";
                            break;

                        case "R":
                            strError += " please retry the transaction; the AVS system " +
                                        "was unavailable or timed out.";
                            break;

                        case "S":
                            strError += " the AVS service is not supported by your " +
                                        "credit card issuer.";
                            break;

                        case "U":
                            strError += " address information is unavailable for the " +
                                        "credit card.";
                            break;

                        case "W":
                            strError += " the 9 digit zip code matches, but the " +
                                        "street address does not.";
                            break;

                        case "Z":
                            strError += " the zip code matches, but the address does not.";
                            break;
                        }
                    }
                    var tinfo = new TransactionLogInfo();
                    var tlog  = new TransactionLog();

                    tinfo.TransactionID      = "";
                    tinfo.AuthCode           = objRetVals[4].Trim(char.Parse("|"));//auth Code
                    tinfo.TotalAmount        = amount;
                    tinfo.ResponseCode       = objRetVals[2].Trim(char.Parse("|"));
                    tinfo.ResponseReasonText = strError;
                    tinfo.OrderID            = OrderDetail.ObjOrderDetails.OrderID;
                    tinfo.StoreID            = OrderDetail.ObjCommonInfo.StoreID;
                    tinfo.PortalID           = OrderDetail.ObjCommonInfo.PortalID;
                    tinfo.AddedBy            = OrderDetail.ObjCommonInfo.AddedBy;
                    tinfo.CustomerID         = OrderDetail.ObjOrderDetails.CustomerID;
                    tinfo.SessionCode        = OrderDetail.ObjOrderDetails.SessionCode;
                    tinfo.PaymentGatewayID   = OrderDetail.ObjOrderDetails.PaymentGatewayTypeID;
                    tinfo.PaymentStatus      = "Failed";
                    tinfo.PayerEmail         = OrderDetail.ObjBillingAddressInfo.EmailAddress;
                    tinfo.CreditCard         = OrderDetail.ObjPaymentInfo.CardNumber;
                    tinfo.CurrencyCode       = gateWayCurrency.Trim();
                    tlog.SaveTransactionLog(tinfo);
                }
            }
            catch (Exception ex)
            {
                strError = ex.Message;
            }
            OrderDetail.ObjOrderDetails.ResponseReasonText = strError;
            return(OrderDetail.ObjOrderDetails.ResponseReasonText);
        }