コード例 #1
0
        public static string AddressToForm(Contacts.Address a, string prefix, int tabIndexStart)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<table>");

            // Country
            sb.Append("<tr><td class=\"formfield\">Country:</td><td class=\"forminput\">");
            sb.Append("<select id=\"" + prefix + "countryname\" name=\"" + prefix + "countryname\"");
            sb.Append(" tabindex=\"" + (tabIndexStart + 1).ToString() + "\" >");
            foreach (MerchantTribe.Web.Geography.Country c in RequestContext.GetCurrentRequestContext().CurrentStore.Settings.FindActiveCountries())
            {
                sb.Append("<option value=\"" + c.Bvin + "\"");
                if (c.Bvin == a.CountyBvin)
                {
                    sb.Append(" selected ");
                }
                sb.Append(">" + c.DisplayName + "</option>");
            }
            sb.Append("</select>");
            sb.Append("</td></tr>");

            // First Name
            sb.Append("<tr><td class=\"formfield\">First Name:</td><td class=\"forminput\">");
            sb.Append("<input type=\"text\" id=\"" + prefix + "firstname\" name=\"" + prefix + "firstname\"");
            sb.Append(" value=\"" + a.FirstName + "\" tabindex=\"" + (tabIndexStart + 2).ToString() + "\" />");
            sb.Append("</td></tr>");

            sb.Append("</table>");
            return(sb.ToString());
        }
コード例 #2
0
        protected override void CopyDataToModel(Data.EF.bvc_User data, CustomerAccount model)
        {
            model.Bvin             = data.bvin;
            model.StoreId          = data.StoreId;
            model.LastUpdatedUtc   = data.LastUpdated;
            model.Addresses        = Contacts.AddressList.FromJson(data.AddressBook);
            model.CreationDateUtc  = data.CreationDate;
            model.Email            = data.Email;
            model.FailedLoginCount = data.FailedLoginCount;
            model.FirstName        = data.FirstName;
            model.LastLoginDateUtc = data.LastLoginDate;
            model.LastName         = data.LastName;
            model.Locked           = data.Locked == 1;
            model.LockedUntilUtc   = data.LockedUntil;
            model.Notes            = data.Comment;
            model.Password         = data.Password;
            model.Phones           = Contacts.PhoneNumberList.FromJson(data.Phones);
            model.PricingGroupId   = data.PricingGroup;
            model.Salt             = data.Salt;
            model.TaxExempt        = data.TaxExempt == 1;

            Contacts.Address shipAddr = MerchantTribe.Web.Json.ObjectFromJson <Contacts.Address>(data.ShippingAddress);
            model.ShippingAddress = shipAddr ?? new Contacts.Address();

            Contacts.Address billAddr = MerchantTribe.Web.Json.ObjectFromJson <Contacts.Address>(data.BillingAddress);
            model.BillingAddress = billAddr ?? new Contacts.Address();
        }
コード例 #3
0
        public void FromDto(CustomerAccountDTO dto)
        {
            this.Bvin      = dto.Bvin;
            this.Email     = dto.Email;
            this.FirstName = dto.FirstName;
            this.LastName  = dto.LastName;
            this.Password  = dto.Password;
            this.Salt      = dto.Salt;

            this.TaxExempt      = dto.TaxExempt;
            this.Notes          = dto.Notes;
            this.PricingGroupId = dto.PricingGroupId;

            this.FailedLoginCount = dto.FailedLoginCount;

            this.LastUpdatedUtc   = dto.LastUpdatedUtc;
            this.CreationDateUtc  = dto.CreationDateUtc;
            this.LastLoginDateUtc = dto.LastLoginDateUtc;

            foreach (AddressDTO a in dto.Addresses)
            {
                Contacts.Address addr = new Contacts.Address();
                addr.FromDto(a);
                this.Addresses.Add(addr);
            }

            this.ShippingAddress.FromDto(dto.ShippingAddress);
            this.BillingAddress.FromDto(dto.BillingAddress);
        }
コード例 #4
0
        public bool CopyTo(Contacts.Address destinationAddress)
        {
            bool result = true;

            try {
                destinationAddress.NickName      = this.NickName;
                destinationAddress.FirstName     = this.FirstName;
                destinationAddress.MiddleInitial = this.MiddleInitial;
                destinationAddress.LastName      = this.LastName;
                destinationAddress.Company       = this.Company;
                destinationAddress.Line1         = this.Line1;
                destinationAddress.Line2         = this.Line2;
                destinationAddress.Line3         = this.Line3;
                destinationAddress.City          = this.City;
                destinationAddress.RegionBvin    = this.RegionBvin;
                destinationAddress.RegionName    = this.RegionName;
                destinationAddress.PostalCode    = this.PostalCode;
                destinationAddress.CountryBvin   = this.CountryBvin;
                destinationAddress.CountryName   = this.CountryName;
                destinationAddress.Phone         = this.Phone;
                destinationAddress.Fax           = this.Fax;
                destinationAddress.WebSiteUrl    = this.WebSiteUrl;
                destinationAddress.CountyBvin    = this.CountyBvin;
                destinationAddress.CountyName    = this.CountyName;
                //destinationAddress.Residential = this.Residential;
            }
            catch  {
                result = false;
            }

            return(result);
        }
コード例 #5
0
        public bool CheckIfNewAddressAndAddWithUpdate(CustomerAccount a, Contacts.Address address)
        {
            bool addressWasAdded = a.CheckIfNewAddressAndAddNoUpdate(address);

            if (addressWasAdded)
            {
                UpdateCustomer(a);
            }
            return(addressWasAdded);
        }
コード例 #6
0
 public ShippableItem()
 {
     IsNonShipping         = false;
     ExtraShipFee          = 0m;
     Weight                = 0m;
     Length                = 0m;
     Width                 = 0m;
     Height                = 0m;
     ShippingScheduleId    = 0;
     ShippingSource        = ShippingMode.ShipFromSite;
     ShippingSourceId      = string.Empty;
     ShipSeparately        = false;
     ShippingSourceAddress = new Contacts.Address();
 }
コード例 #7
0
        public bool Calculate(Order o)
        {
            // reset values
            o.TotalShippingBeforeDiscounts = 0;
            o.TotalTax      = 0;
            o.TotalTax2     = 0;
            o.TotalHandling = 0;

            o.ClearDiscounts();

            if (!SkipRepricing)
            {
                // Price items for current user
                RepriceItemsForUser(o);
            }

            // Discount prices for volume ordered
            ApplyVolumeDiscounts(o);

            //Apply Offers to Line Items and Sub Total
            ApplyOffersToOrder(o, PromotionActionMode.ForLineItems);
            ApplyOffersToOrder(o, PromotionActionMode.ForSubTotal);

            // Calculate Handling, Merge with Shipping For Display
            o.TotalHandling = CalculateHandlingAmount(o);

            OrdersCalculateShipping(o);

            // Calculate Per Item shipping and handling portion
            //CalculateShippingPortion(o);

            // Apply shipping offers
            ApplyOffersToOrder(o, PromotionActionMode.ForShipping);

            // Calcaulte Taxes
            o.ClearTaxes();
            List <Taxes.ITaxSchedule> schedules = _app.OrderServices.TaxSchedules.FindAllAndCreateDefaultAsInterface(o.StoreId);

            Contacts.Address destination = o.ShippingAddress;
            ApplyTaxes(schedules, o.ItemsAsITaxable(), destination);

            // Calculate Sub Total of Items
            foreach (LineItem li in o.Items)
            {
                o.TotalTax += li.TaxPortion;
            }


            return(true);
        }
コード例 #8
0
 public ShippableItem()
 {
     IsNonShipping = false;
     ExtraShipFee = 0m;
     Weight = 0m;
     Length = 0m;
     Width = 0m;
     Height = 0m;
     ShippingScheduleId = 0;
     ShippingSource = ShippingMode.ShipFromSite;
     ShippingSourceId = string.Empty;
     ShipSeparately = false;
     ShippingSourceAddress = new Contacts.Address();
 }
コード例 #9
0
        public bool UpdateAddress(Contacts.Address a)
        {
            bool result = false;

            int index = -1;

            for (int i = 0; i < _Addresses.Count; i++)
            {
                if (_Addresses[i].Bvin == a.Bvin)
                {
                    index = i;
                    break;
                }
            }
            if (index >= 0)
            {
                _Addresses[index] = a;
                return(true);
            }

            return(result);
        }
コード例 #10
0
        public bool CheckIfNewAddressAndAddNoUpdate(Contacts.Address address)
        {
            bool addressFound = false;

            foreach (Contacts.Address currAddress in this.Addresses)
            {
                if (currAddress.IsEqualTo(address))
                {
                    addressFound = true;
                    break;
                }
            }

            bool createdAddress = false;

            if (!addressFound)
            {
                address.Bvin = System.Guid.NewGuid().ToString();
                this._Addresses.Add(address);
                createdAddress = true;
            }

            return(createdAddress);
        }
コード例 #11
0
        public void FromDto(CustomerAccountDTO dto)
        {
            this.Bvin = dto.Bvin;
            this.Email = dto.Email;
            this.FirstName = dto.FirstName;
            this.LastName = dto.LastName;
            this.Password = dto.Password;
            this.Salt = dto.Salt;

            this.TaxExempt = dto.TaxExempt;
            this.Notes = dto.Notes;
            this.PricingGroupId = dto.PricingGroupId;

            this.FailedLoginCount = dto.FailedLoginCount;

            this.LastUpdatedUtc = dto.LastUpdatedUtc;
            this.CreationDateUtc = dto.CreationDateUtc;
            this.LastLoginDateUtc = dto.LastLoginDateUtc;

            foreach (AddressDTO a in dto.Addresses)
            {
                Contacts.Address addr = new Contacts.Address();
                addr.FromDto(a);
                this.Addresses.Add(addr);
            }

            this.ShippingAddress.FromDto(dto.ShippingAddress);
            this.BillingAddress.FromDto(dto.BillingAddress);
        }
コード例 #12
0
        public override bool ProcessCheckout(OrderTaskContext context)
        {
            if (context.HccApp.CurrentRequestContext.RoutingContext.HttpContext != null)
            {
                try
                {
                    PayPalAPI ppAPI = Utilities.PaypalExpressUtilities.GetPaypalAPI(context.HccApp.CurrentStore);

                    string cartReturnUrl = HccUrlBuilder.RouteHccUrl(HccRoute.ThirdPartyPayment, null, Uri.UriSchemeHttps);
                    string cartCancelUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Checkout, null, Uri.UriSchemeHttps);

                    EventLog.LogEvent("PayPal Express Checkout", "CartCancelUrl=" + cartCancelUrl, EventLogSeverity.Information);
                    EventLog.LogEvent("PayPal Express Checkout", "CartReturnUrl=" + cartReturnUrl, EventLogSeverity.Information);

                    PaymentActionCodeType mode = PaymentActionCodeType.Authorization;
                    if (!context.HccApp.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
                    {
                        mode = PaymentActionCodeType.Sale;
                    }

                    // Accelerated boarding
                    if (string.IsNullOrWhiteSpace(context.HccApp.CurrentStore.Settings.PayPal.UserName))
                    {
                        mode = PaymentActionCodeType.Sale;
                    }

                    var  solutionType  = context.HccApp.CurrentStore.Settings.PayPal.RequirePayPalAccount ? SolutionTypeType.Mark : SolutionTypeType.Sole;
                    bool isNonShipping = !context.Order.HasShippingItems;

                    bool addressSupplied = false;
                    if (context.Inputs["ViaCheckout"] != null &&
                        context.Inputs["ViaCheckout"].Value == "1")
                    {
                        addressSupplied = true;
                        context.Order.CustomProperties.Add("hcc", "ViaCheckout", "1");
                    }

                    PaymentDetailsItemType[] itemsDetails = GetOrderItemsDetails(context);

                    SetExpressCheckoutResponseType expressResponse;
                    if (addressSupplied)
                    {
                        Contacts.Address address = context.Order.ShippingAddress;

                        // in some cases, this logic will be hit with non-shipping orders, causing an exception
                        if (address == null || string.IsNullOrEmpty(address.Bvin))
                        {
                            // this is a workaround for that use case
                            address = context.Order.BillingAddress;
                        }

                        if (address.CountryData != null)
                        {
                            var itemsTotalWithoutTax = context.Order.TotalOrderAfterDiscounts;
                            if (context.HccApp.CurrentStore.Settings.ApplyVATRules)
                            {
                                itemsTotalWithoutTax -= context.Order.ItemsTax;
                            }
                            string itemsTotal = itemsTotalWithoutTax.ToString("N", CultureInfo.InvariantCulture);
                            string taxTotal   = context.Order.TotalTax.ToString("N", CultureInfo.InvariantCulture);
                            var    shippingTotalWithoutTax = context.Order.TotalShippingAfterDiscounts;
                            if (context.HccApp.CurrentStore.Settings.ApplyVATRules)
                            {
                                shippingTotalWithoutTax -= context.Order.ShippingTax;
                            }
                            string shippingTotal = shippingTotalWithoutTax.ToString("N", CultureInfo.InvariantCulture);

                            string orderTotal = context.Order.TotalGrand.ToString("N", CultureInfo.InvariantCulture);
                            expressResponse = ppAPI.SetExpressCheckout(
                                itemsDetails,
                                itemsTotal,
                                taxTotal,
                                shippingTotal,
                                orderTotal,
                                cartReturnUrl,
                                cartCancelUrl,
                                mode,
                                PayPalAPI.GetCurrencyCodeType(context.HccApp.CurrentStore.Settings.PayPal.Currency),
                                solutionType,
                                address.FirstName + " " + address.LastName,
                                address.CountryData.IsoCode,
                                address.Line1,
                                address.Line2,
                                address.City,
                                address.RegionBvin,
                                address.PostalCode,
                                address.Phone,
                                context.Order.OrderNumber + Guid.NewGuid().ToString(),
                                isNonShipping);
                            if (expressResponse == null)
                            {
                                EventLog.LogEvent("PayPal Express Checkout", "Express Response Was Null!", EventLogSeverity.Error);
                            }
                        }
                        else
                        {
                            EventLog.LogEvent("StartPaypalExpressCheckout", "Country with bvin " + address.CountryBvin + " was not found.", EventLogSeverity.Error);
                            return(false);
                        }
                    }
                    else
                    {
                        decimal includedTax = 0;
                        if (context.HccApp.CurrentStore.Settings.ApplyVATRules)
                        {
                            includedTax = context.Order.ItemsTax;
                        }
                        string taxTotal             = includedTax.ToString("N", CultureInfo.InvariantCulture);
                        var    itemsTotalWithoutTax = context.Order.TotalOrderAfterDiscounts;
                        if (context.HccApp.CurrentStore.Settings.ApplyVATRules)
                        {
                            itemsTotalWithoutTax -= context.Order.ItemsTax;
                        }
                        string itemsTotal = itemsTotalWithoutTax.ToString("N", CultureInfo.InvariantCulture);
                        string orderTotal = context.Order.TotalOrderAfterDiscounts.ToString("N", CultureInfo.InvariantCulture);
                        expressResponse = ppAPI.SetExpressCheckout(itemsDetails,
                                                                   itemsTotal,
                                                                   taxTotal,
                                                                   orderTotal,
                                                                   cartReturnUrl,
                                                                   cartCancelUrl,
                                                                   mode,
                                                                   PayPalAPI.GetCurrencyCodeType(context.HccApp.CurrentStore.Settings.PayPal.Currency),
                                                                   solutionType,
                                                                   context.Order.OrderNumber + Guid.NewGuid().ToString(),
                                                                   isNonShipping);
                        if (expressResponse == null)
                        {
                            EventLog.LogEvent("PayPal Express Checkout", "Express Response2 Was Null!", EventLogSeverity.Error);
                        }
                    }

                    if (expressResponse.Ack == AckCodeType.Success || expressResponse.Ack == AckCodeType.SuccessWithWarning)
                    {
                        context.Order.ThirdPartyOrderId = expressResponse.Token;

                        // Recording of this info is handled on the paypal express
                        // checkout page instead of here.
                        //Orders.OrderPaymentManager payManager = new Orders.OrderPaymentManager(context.Order);
                        //payManager.PayPalExpressAddInfo(context.Order.TotalGrand, expressResponse.Token);

                        EventLog.LogEvent("PayPal Express Checkout", "Response SUCCESS", EventLogSeverity.Information);

                        Orders.OrderNote note = new Orders.OrderNote();
                        note.IsPublic = false;
                        note.Note     = "Paypal Order Accepted With Paypal Order Number: " + expressResponse.Token;
                        context.Order.Notes.Add(note);
                        if (context.HccApp.OrderServices.Orders.Update(context.Order))
                        {
                            string urlTemplate;
                            if (string.Compare(context.HccApp.CurrentStore.Settings.PayPal.Mode, "Live", true) == 0)
                            {
                                urlTemplate = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={0}";
                            }
                            else
                            {
                                urlTemplate = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={0}";
                            }
                            HttpContextBase httpContext = new HccHttpContextWrapper(HttpContext.Current);
                            httpContext.Response.Redirect(string.Format(urlTemplate, expressResponse.Token), true);
                        }
                        return(true);
                    }
                    else
                    {
                        foreach (ErrorType ppError in expressResponse.Errors)
                        {
                            context.Errors.Add(new WorkflowMessage(ppError.ErrorCode, ppError.ShortMessage, true));

                            //create a note to save the paypal error info onto the order
                            Orders.OrderNote note = new Orders.OrderNote();
                            note.IsPublic = false;
                            note.Note     = "Paypal error number: " + ppError.ErrorCode + " Paypal Error: '" + ppError.ShortMessage + "' Message: '" + ppError.LongMessage;
                            context.Order.Notes.Add(note);

                            EventLog.LogEvent("Paypal error number: " + ppError.ErrorCode, "Paypal Error: '" + ppError.ShortMessage + "' Message: '" + ppError.LongMessage + "' " + " Values passed to SetExpressCheckout: Total=" + string.Format("{0:c}", context.Order.TotalOrderBeforeDiscounts) + " Cart Return Url: " + cartReturnUrl + " Cart Cancel Url: " + cartCancelUrl, EventLogSeverity.Error);
                        }
                        context.Errors.Add(new WorkflowMessage("Paypal checkout error", GlobalLocalization.GetString("PaypalCheckoutCustomerError"), true));
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    EventLog.LogEvent("Paypal Express Checkout", "Exception occurred during call to Paypal: " + ex.ToString(), EventLogSeverity.Error);
                    context.Errors.Add(new WorkflowMessage("Paypal checkout error", GlobalLocalization.GetString("PaypalCheckoutCustomerError"), true));
                    return(false);
                }
            }

            return(false);
        }
コード例 #13
0
        public override bool Execute(OrderTaskContext context)
        {
            if (context.Inputs["Mode"] != null)
            {
                if (context.Inputs["Mode"].Value == "PaypalExpress")
                {
                    if (context.MTApp.CurrentRequestContext.RoutingContext.HttpContext != null)
                    {
                        PayPalAPI ppAPI = Utilities.PaypalExpressUtilities.GetPaypalAPI(context.MTApp.CurrentStore);
                        try {
                            string cartReturnUrl = string.Empty;
                            string cartCancelUrl = string.Empty;
                            if (context.MTApp.CurrentRequestContext != null)
                            {
                                cartReturnUrl = context.MTApp.CurrentRequestContext.CurrentStore.RootUrlSecure() + "paypalexpresscheckout";
                                cartCancelUrl = context.MTApp.CurrentRequestContext.CurrentStore.RootUrlSecure() + "checkout";
                            }

                            EventLog.LogEvent("PayPal Express Checkout", "CartCancelUrl=" + cartCancelUrl, EventLogSeverity.Information);
                            EventLog.LogEvent("PayPal Express Checkout", "CartReturnUrl=" + cartReturnUrl, EventLogSeverity.Information);

                            SetExpressCheckoutResponseType expressResponse;
                            PaymentActionCodeType          mode = PaymentActionCodeType.Authorization;

                            if (context.MTApp.CurrentRequestContext.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
                            {
                                mode = PaymentActionCodeType.Order;
                            }
                            else
                            {
                                mode = PaymentActionCodeType.Sale;
                            }

                            // Accelerated boarding
                            if (context.MTApp.CurrentRequestContext.CurrentStore.Settings.PayPal.UserName.Trim().Length < 1)
                            {
                                mode = PaymentActionCodeType.Sale;
                            }


                            bool addressSupplied = false;
                            if (context.Inputs["AddressSupplied"] != null)
                            {
                                if (context.Inputs["AddressSupplied"].Value == "1")
                                {
                                    addressSupplied = true;
                                    context.Order.CustomProperties.Add("bvsoftware", "PaypalAddressOverride", "1");
                                }
                            }

                            string amountToPayPal = context.Order.TotalOrderBeforeDiscounts.ToString("N", System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));

                            if (addressSupplied)
                            {
                                Contacts.Address address = context.Order.ShippingAddress;

                                MerchantTribe.Web.Geography.Country country = MerchantTribe.Web.Geography.Country.FindByBvin(address.CountryBvin);
                                if (country != null)
                                {
                                    expressResponse = ppAPI.SetExpressCheckout(
                                        amountToPayPal,
                                        cartReturnUrl,
                                        cartCancelUrl,
                                        mode,
                                        PayPalAPI.GetCurrencyCodeType(context.MTApp.CurrentRequestContext.CurrentStore.Settings.PayPal.Currency),
                                        address.FirstName + " " + address.LastName,
                                        country.IsoCode,
                                        address.Line1,
                                        address.Line2,
                                        address.City,
                                        address.RegionBvin,
                                        address.PostalCode,
                                        address.Phone,
                                        context.Order.OrderNumber + System.Guid.NewGuid().ToString());
                                    if (expressResponse == null)
                                    {
                                        EventLog.LogEvent("PayPal Express Checkout", "Express Response Was Null!", EventLogSeverity.Error);
                                    }
                                }
                                else
                                {
                                    EventLog.LogEvent("StartPaypalExpressCheckout", "Country with bvin " + address.CountryBvin + " was not found.", EventLogSeverity.Error);
                                    return(false);
                                }
                            }
                            else
                            {
                                expressResponse = ppAPI.SetExpressCheckout(amountToPayPal,
                                                                           cartReturnUrl,
                                                                           cartCancelUrl,
                                                                           mode,
                                                                           PayPalAPI.GetCurrencyCodeType(context.MTApp.CurrentRequestContext.CurrentStore.Settings.PayPal.Currency),
                                                                           context.Order.OrderNumber + System.Guid.NewGuid().ToString());
                                if (expressResponse == null)
                                {
                                    EventLog.LogEvent("PayPal Express Checkout", "Express Response2 Was Null!", EventLogSeverity.Error);
                                }
                            }

                            if (expressResponse.Ack == AckCodeType.Success || expressResponse.Ack == AckCodeType.SuccessWithWarning)
                            {
                                context.Order.ThirdPartyOrderId = expressResponse.Token;

                                // Recording of this info is handled on the paypal express
                                // checkout page instead of here.
                                //Orders.OrderPaymentManager payManager = new Orders.OrderPaymentManager(context.Order);
                                //payManager.PayPalExpressAddInfo(context.Order.TotalGrand, expressResponse.Token);

                                EventLog.LogEvent("PayPal Express Checkout", "Response SUCCESS", EventLogSeverity.Information);

                                Orders.OrderNote note = new Orders.OrderNote();
                                note.IsPublic = false;
                                note.Note     = "Paypal Order Accepted With Paypal Order Number: " + expressResponse.Token;
                                context.Order.Notes.Add(note);
                                if (context.MTApp.OrderServices.Orders.Update(context.Order))
                                {
                                    if (string.Compare(context.MTApp.CurrentRequestContext.CurrentStore.Settings.PayPal.Mode, "Live", true) == 0)
                                    {
                                        context.MTApp.CurrentRequestContext.RoutingContext.HttpContext.Response.Redirect("https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + expressResponse.Token, true);
                                    }
                                    else
                                    {
                                        context.MTApp.CurrentRequestContext.RoutingContext.HttpContext.Response.Redirect("https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + expressResponse.Token, true);
                                    }
                                }
                                return(true);
                            }
                            else
                            {
                                foreach (ErrorType ppError in expressResponse.Errors)
                                {
                                    context.Errors.Add(new WorkflowMessage(ppError.ErrorCode, ppError.ShortMessage, true));

                                    //create a note to save the paypal error info onto the order
                                    Orders.OrderNote note = new Orders.OrderNote();
                                    note.IsPublic = false;
                                    note.Note     = "Paypal error number: " + ppError.ErrorCode + " Paypal Error: '" + ppError.ShortMessage + "' Message: '" + ppError.LongMessage;
                                    context.Order.Notes.Add(note);

                                    EventLog.LogEvent("Paypal error number: " + ppError.ErrorCode, "Paypal Error: '" + ppError.ShortMessage + "' Message: '" + ppError.LongMessage + "' " + " Values passed to SetExpressCheckout: Total=" + string.Format("{0:c}", context.Order.TotalOrderBeforeDiscounts) + " Cart Return Url: " + cartReturnUrl + " Cart Cancel Url: " + cartCancelUrl, EventLogSeverity.Error);
                                }
                                context.Errors.Add(new WorkflowMessage("Paypal checkout error", Content.SiteTerms.GetTerm(Content.SiteTermIds.PaypalCheckoutCustomerError), true));
                                return(false);
                            }
                        }
                        catch (Exception ex) {
                            EventLog.LogEvent("Paypal Express Checkout", "Exception occurred during call to Paypal: " + ex.ToString(), EventLogSeverity.Error);
                            context.Errors.Add(new WorkflowMessage("Paypal checkout error", Content.SiteTerms.GetTerm(Content.SiteTermIds.PaypalCheckoutCustomerError), true));
                            return(false);
                        }
                        finally {
                            ppAPI = null;
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }

            return(false);
        }
コード例 #14
0
        public bool IsEqualTo(Contacts.Address a2)
        {
            if (a2 == null)
            {
                return(false);
            }

            bool result = true;

            if (string.Compare(this.NickName.Trim(), a2.NickName.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.FirstName.Trim(), a2.FirstName.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.MiddleInitial.Trim(), a2.MiddleInitial.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.LastName.Trim(), a2.LastName.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.Company.Trim(), a2.Company.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.Line1.Trim(), a2.Line1.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.Line2.Trim(), a2.Line2.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.Line3.Trim(), a2.Line3.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.RegionName.Trim(), a2.RegionName.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.RegionBvin.Trim(), a2.RegionBvin.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.City.Trim(), a2.City.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.PostalCode.Trim(), a2.PostalCode.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.CountryBvin.Trim(), a2.CountryBvin.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.CountryName.Trim(), a2.CountryName.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.Phone.Trim(), a2.Phone.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.Fax.Trim(), a2.Fax.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.WebSiteUrl.Trim(), a2.WebSiteUrl.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.CountyBvin.Trim(), a2.CountyBvin.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            if (string.Compare(this.CountyName.Trim(), a2.CountyName.Trim(), true, System.Globalization.CultureInfo.InvariantCulture) != 0)
            {
                result = false;
            }
            //if (this.Residential != a2.Residential) {
            //    result = false;
            //}

            return(result);
        }