Example #1
0
        public bool CanPurchase(string distributorID, string countryCode)
        {
            bool canPurchase = false;
            var  codes       = new List <string>(CountryType.PE.HmsCountryCodes);

            codes.Add(CountryType.PE.Key);

            if (codes.Contains(DistributorProfileModel.ProcessingCountryCode))
            {
                var tins = DistributorOrderingProfileProvider.GetTinList(distributorID, true);
                //Must have PEID TinCode to purchase
                //CR-GDO-PE-64 - Must have either PEID or PETX to purchase
                if (tins.Count > 0)
                {
                    var requiredTins = new List <string>(new[] { "PEID", "PETX" });
                    var tin          = (from t in tins from r in requiredTins where t.IDType.Key == r select t).ToList();
                    if (tin != null && tin.Count > 0)
                    {
                        canPurchase = true;
                    }
                }
            }
            else
            {
                canPurchase = true;
            }
            return(canPurchase);
        }
Example #2
0
        public bool CanPurchase(string distributorID, string countryCode)
        {
            /// Foreign DS is not allowed to place orders in Croatia
            var tins = DistributorOrderingProfileProvider.GetTinList(distributorID, true);

            if (!(new List <string>(CountryType.HR.HmsCountryCodes)).Union(new List <string>()
            {
                CountryType.HR.Key
            }).Contains(DistributorProfileModel.ProcessingCountryCode))
            {
                return(false);
            }

            if (tins != null && tins.Select(c => c.IDType.Key).Intersect(new[] { "HROI", "HRNA", "HRBL" }).Count() == 3)
            {
                return(true);
            }

            else if (tins != null
                     &&
                     (tins.Select(c => c.IDType.Key).Intersect(new[] { "HROI", "HRNA", "HRRP" }).Count() == 3 ||
                      tins.Select(c => c.IDType.Key).Intersect(new[] { "HROI", "HRNA", "HRPI" }).Count() == 3)
                     )
            {
                return(true);
            }
            return(false);
        }
        public override Dictionary <int, PurchasingLimits_V01> GetPurchasingLimits(string distributorId, string TIN)
        {
            var currentLimits = base.GetPurchasingLimits(distributorId, TIN);
            var limitsType    = PurchaseLimitType.ProductCategory;

            if (!DistributorIsExemptFromPurchasingLimits(distributorId))
            {
                List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);
                if ((tins != null && tins.Select(c => c.IDType.Key).Intersect(new[] { "HROI", "HRNA", "HRRP" }).Count() == 3) ||
                    (tins != null && tins.Select(c => c.IDType.Key).Intersect(new[] { "HROI", "HRNA", "HRPI" }).Count() == 3)
                    )
                {
                    limitsType = PurchaseLimitType.None;
                }
                else
                {
                    limitsType = PurchaseLimitType.Volume;
                }
            }
            else
            {
                limitsType = PurchaseLimitType.None;
            }

            currentLimits.Values.AsQueryable().ToList().ForEach(pl => pl.PurchaseLimitType = limitsType);
            return(currentLimits);
        }
Example #4
0
        public override Dictionary <int, PurchasingLimits_V01> GetPurchasingLimits(string distributorId, string TIN)
        {
            Dictionary <int, PurchasingLimits_V01> currentLimits = base.GetPurchasingLimits(distributorId, TIN);
            PurchasingLimits_V01 theLimits  = currentLimits[PurchasingLimitProvider.GetOrderMonth()];
            PurchaseLimitType    limitsType = PurchaseLimitType.ProductCategory;

            var  tins     = DistributorOrderingProfileProvider.GetTinList(distributorId, true);
            bool bHasMYID = tins.Find(t => t.IDType.Key == "MYID") != null;

            if (!DistributorIsExemptFromPurchasingLimits(distributorId))
            {
                limitsType = PurchaseLimitType.Volume;
                if (!bHasMYID)
                {
                    limitsType = PurchaseLimitType.ProductCategory;
                }
            }
            else
            {
                if (bHasMYID)
                {
                    limitsType = PurchaseLimitType.None;
                }
            }
            currentLimits.Values.AsQueryable().ToList().ForEach(pl => pl.PurchaseLimitType = limitsType);

            return(currentLimits);
        }
 private ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason,
                                             ShoppingCartRuleResult Result)
 {
     //45479, SG:Foreign ds with SNID and foreign DS with dummy tinid are both able to add more than 12 p type products to cart.
     if (reason == ShoppingCartRuleReason.CartItemsBeingAdded)
     {
         List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(cart.DistributorID, true);
         TaxIdentification        tid  = null;
         if (tins != null && (tid = tins.Find(t => t.IDType.Key == "SNID")) != null)  // have national ID
         {
             if (tid.ID == "S0000000S" || !DistributorProfileModel.ProcessingCountryCode.Equals(CountryType.SG.Key))
             // dummy TIN and foreign DS
             {
                 if (getPTypeSKUCount(cart.CartItems, cart.CurrentItems[0]) > ForeingDSLines)
                 {
                     Result.Result = RulesResult.Failure;
                     Result.AddMessage(
                         string.Format(
                             HttpContext.GetGlobalResourceObject(
                                 string.Format("{0}_Rules", HLConfigManager.Platform), "AnySKUQuantityExceeds")
                             .ToString(), ForeingDSLines.ToString()));
                     cart.RuleResults.Add(Result);
                     return(Result);
                 }
             }
         }
     }
     return(Result);
 }
Example #6
0
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            var tins =
                (from t in DistributorOrderingProfileProvider.GetTinList(distributorId, true) select t.IDType.Key);

            return(IndiaRestrictedPurchaseTINs.Intersect(tins).ToList().Count == 0);
        }
Example #7
0
        public void PerformTaxationRules(Order_V01 order, string locale)
        {
            try
            {
                if (order != null)
                {
                    Message message = new Message();
                    message.MessageType = "Perception";
                    order.Messages      = order.Messages == null ? new MessageCollection() : order.Messages;

                    List <TaxIdentification> tinList = DistributorOrderingProfileProvider.GetTinList(order.DistributorID, true);
                    var CIID = (tinList.Find(t => t.IDType.Key == "CIID") != null);
                    var CIEW = (tinList.Find(t => t.IDType.Key == "CIWE") != null);
                    if (CIID && !CIEW)
                    {
                        message.MessageValue = "Perception";
                        order.Messages.Add(message);
                    }
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(
                    string.Format("CL Taxation Rules failed for Distributor {0}. Exception details \r\n{1}",
                                  order.DistributorID, ex.Message));
            }
        }
        /// <summary>
        ///     used to determine if a distributor can purshase or not.
        /// </summary>
        /// <param name="distributor">Distributor to evaluate.</param>
        /// <returns>True if can purshase.</returns>
        public bool CanPurchase(string distributorID, string countryCode)
        {
            bool canPurchase = false;
            var  codes       = new List <string>(CountryType.EC.HmsCountryCodes);

            codes.Add(CountryType.EC.Key);

            if (codes.Contains(DistributorProfileModel.ProcessingCountryCode))
            {
                var tins = DistributorOrderingProfileProvider.GetTinList(distributorID, true);

                //Must have ECID or ECTX TinCode to purchase
                if (tins.Count > 0)
                {
                    var requiredTins = new List <string>(new[] { "ECID", "ECTX " });
                    var tin          = (from t in tins from r in requiredTins where t.IDType.Key == r select t).ToList();
                    if (tin != null && tin.Count > 0)
                    {
                        canPurchase = true;
                    }
                }
            }
            else
            {
                //No restriction for EC or foreign DS.(Orders without Tin code will error out and business will have to rekey these orders
                canPurchase = true;
            }

            return(canPurchase);
        }
        protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason,
                                                               ShoppingCartRuleResult Result)
        {
            if (reason == ShoppingCartRuleReason.CartItemsAdded)
            {
                var myhlCart = cart as MyHLShoppingCart;

                if (null == myhlCart)
                {
                    LoggerHelper.Error(
                        string.Format("{0} myhlCart is null {1}", Locale, cart.DistributorID));
                    Result.Result = RulesResult.Failure;
                    return(Result);
                }
                List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(cart.DistributorID, true);
                if (tins != null && tins.Find(t => t.IDType.Key == "OBRT") != null)
                {
                    ///Poštovani - ukoliko imate registriran OBRT, možete platisa sa vašom Business karticom ili vašom osobnom kreditnom karticom ukoliko kupnja ne prelazi 5000 HRK. U slučaju da plaćate bankovnim transferom možete platiti sa vašeg Business transakcijskog računa vezanog uz vaš Obrt ili sa vašeg osobnog računa ukoliko kupnja ne prelazi 5000 HRK
                    Result.Result = RulesResult.Failure;
                    Result.AddMessage(
                        string.Format(
                            HttpContext.GetGlobalResourceObject(
                                string.Format("{0}_Rules", HLConfigManager.Platform),
                                "Croatia_SpecialMessage").ToString()));
                    cart.RuleResults.Add(Result);
                }
            }
            return(base.PerformRules(cart, reason, Result));
        }
        private bool CanPurchase(string distributorID)
        {
            bool canPurchase = true;

            var  tins       = DistributorOrderingProfileProvider.GetTinList(distributorID, false, true);
            var  now        = DateUtils.GetCurrentLocalTime(COUNTRY_TIME);
            var  idTIN      = RetrieveIDTinCode(tins);
            bool isDummyTIN = IsDummyTin(idTIN);
            bool isIDCOP    = IsIDCountryOfProcessing();

            if (idTIN != null)
            {
                if (!isDummyTIN)
                {
                    if (isIDCOP && idTIN.IDType.ExpirationDate < now) //ID Member with expired TIN
                    {
                        canPurchase = false;
                    }
                }
            }
            else //no TINs found
            {
                if (isIDCOP)  //ID members can't purchase without TINs
                {
                    canPurchase = false;
                }
            }

            return(canPurchase);
        }
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            bool isExempt = base.DistributorIsExemptFromPurchasingLimits(distributorId);

            if (!isExempt)
            {
                return(false);
            }

            //Must have PETX TinCode to don't have volume limited
            //CR-GDO-PE-64 - Must have either PEID or PETX to purchase

            List <string> codes = new List <string>(CountryType.PE.HmsCountryCodes);

            codes.Add(CountryType.PE.Key);
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);

            if (codes.Contains(DistributorProfileModel.ProcessingCountryCode))
            {
                return(tins.Find(p => p.IDType.Key == "PETX") != null);
            }
            else
            {
                var required =
                    (from t in tins
                     from r in new List <string>(new string[] { "PEID", "PETX" })
                     where t.IDType.Key == r
                     select t).ToList();
                return(null != required && required.Count == 2);
            }
        }
        private string getShippingInfoForInvoiceToFirm(MyHLShoppingCart shoppingCart)
        {
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(shoppingCart.DistributorID, true);
            TaxIdentification        tid  = null;

            if ((tid = tins.Find(t => t.IDType.Key == "MKTX")) != null && shoppingCart.InvoiceOption == InvoiceHandlingType.RecycleInvoice.ToString())
            {
                var entries = GlobalResourceHelper.GetGlobalEnumeratorElements("InvoiceOptions");

                foreach (var entry in entries)
                {
                    var key = entry.Key;
                    if (key == shoppingCart.InvoiceOption)
                    {
                        var parts = key.Split('_');
                        if (parts.Length > 1)
                        {
                            key = parts[0];
                        }
                        shoppingCart.InvoiceOption = InvoiceHandlingType.WithPackage.ToString();
                        return(" " + entry.Value);
                    }
                }
            }
            return(string.Empty);
        }
Example #13
0
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            //bool isExempt = base.DistributorIsExemptFromPurchasingLimits(distributorId);
            //if (!isExempt)
            //{
            //    return false;
            //}

            List <string> codes = new List <string>(CountryType.MN.HmsCountryCodes);

            codes.Add(CountryType.MN.Key);
            bool isCOPMN = codes.Contains(DistributorProfileModel.ProcessingCountryCode);

            if (!isCOPMN)
            {
                return(false);
            }

            bool isExempt = false;
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);

            var now = DateUtils.GetCurrentLocalTime("MN");

            foreach (TaxIdentification taxId in tins)
            {
                if (taxId.IDType != null && (taxId.IDType.Key == "MGTX" && taxId.IDType.ExpirationDate > now))
                {
                    isExempt = true;
                    break;
                }
            }

            return(isExempt);
        }
Example #14
0
        private bool HasMemberVPLimitations()
        {
            bool hasLimitations = true;

            var processingCountryCode = DistributorProfileModel.ProcessingCountryCode;

            if (processingCountryCode == "BG")
            {
                var now   = DateUtils.GetCurrentLocalTime("BG");
                var tins  = DistributorOrderingProfileProvider.GetTinList(DistributorProfileModel.Id, false);
                var bgTin = tins.Find(t => t.IDType.Key == "BGBL");

                if (bgTin != null && bgTin.IDType != null && bgTin.IDType.ExpirationDate > now && string.IsNullOrEmpty(ddl_OrderType.SelectedValue))
                {
                    hasLimitations = false;
                }
                else if (bgTin != null && bgTin.IDType != null && bgTin.IDType.ExpirationDate > now && ddl_OrderType.SelectedValue != "PC")
                {
                    hasLimitations         = false;
                    trRemainingVal.Visible = false;
                }
            }

            return(hasLimitations);
        }
        private bool CanPurchasePType(string distributorID)
        {
            bool canPurchasePType = true;

            var  tins       = DistributorOrderingProfileProvider.GetTinList(distributorID, false, true);
            var  now        = DateUtils.GetCurrentLocalTime(COUNTRY_TIME);
            var  idTIN      = RetrieveIDTinCode(tins);
            bool isDummyTIN = IsDummyTin(idTIN);
            bool isIDCOP    = IsIDCountryOfProcessing();

            if (!isIDCOP)   //restriction only for foreign members only
            {
                if (idTIN == null)
                {
                    canPurchasePType = false;
                }
                else
                {
                    if (!isDummyTIN && idTIN.IDType.ExpirationDate < now)
                    {
                        canPurchasePType = false;
                    }
                }
            }

            return(canPurchasePType);
        }
        public bool CanPurchase(string distributorID, string countryCode)
        {
            bool canPurchase = false;
            var  codes       = new List <string>(CountryType.CL.HmsCountryCodes);

            codes.Add(CountryType.CL.Key);

            if (codes.Contains(DistributorProfileModel.ProcessingCountryCode))
            {
                var tins = DistributorOrderingProfileProvider.GetTinList(distributorID, true); //HMS made up the country code
                //Must have CIID TinCode to purchase
                if (tins.Count > 0)
                {
                    var tin = (from t in tins where t.IDType.Key == "CIID" select t).FirstOrDefault();
                    if (tin != null)
                    {
                        canPurchase = true;
                    }
                }
            }
            else
            {
                canPurchase = true;
            }

            return(canPurchase);
        }
Example #17
0
        public bool CanPurchase(string distributorID, string countryCode)
        {
            bool canPurchase = false;
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorID, true); //HMS made up the country code

            //Must have POTX TinCode to purchase
            foreach (TaxIdentification t in tins)
            {
                if (t.IDType.Key == "POTX")
                {
                    canPurchase = true;
                }
            }

            if (!canPurchase)
            {
                //If they don't have the TinCode, they can only purchase if their mailing address is not in Portugal.
                var mailingAddress = DistributorOrderingProfileProvider.GetAddress(ServiceProvider.OrderSvc.AddressType.Mailing, distributorID, countryCode);
                if (null != mailingAddress)
                {
                    if (!string.IsNullOrEmpty(mailingAddress.Country) && mailingAddress.Country != "PT")
                    {
                        canPurchase = true;
                    }
                }
            }
            return(canPurchase);
        }
Example #18
0
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            List <string> codes = new List <string>(CountryType.KZ.HmsCountryCodes);

            codes.Add(CountryType.KZ.Key);
            bool isCOPKZ = codes.Contains(DistributorProfileModel.ProcessingCountryCode);

            if (!isCOPKZ)
            {
                return(true);
            }

            bool isExempt = false;
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);

            var now        = DateUtils.GetCurrentLocalTime("KZ");
            int numberTins = 0;

            foreach (TaxIdentification taxId in tins)
            {
                if (taxId.IDType != null && ((taxId.IDType.Key == "KZTX" || taxId.IDType.Key == "KZBL") && taxId.IDType.ExpirationDate > now))
                {
                    numberTins++;

                    if (numberTins == 2)    //DS should have both tins and active
                    {
                        isExempt = true;
                        break;
                    }
                }
            }

            return(isExempt);
        }
        public void PerformTaxationRules(Order_V01 order, string locale)
        {
            if (null != order)
            {
                var limits = order.PurchasingLimits as PurchasingLimits_V01;
                if (null == limits)
                {
                    limits =
                        PurchasingLimitProvider.GetCurrentPurchasingLimits(order.DistributorID);
                    order.PurchasingLimits = limits;
                }
                if (null == limits)
                {
                    //Log an error here - can't tax this, it is invalid for IT if we don't have Limits created
                }
                else
                {
                    //Add suplemental items for Incaricato VAT and INPS calcs
                    limits.Items = new SupplementalItems();
                    limits.Items.Add("ConsignmentWitholdingRate", new List <decimal>(new[] { 0.1794M }));
                    //Both A1 and B1
                    limits.Items.Add("FlatFreightRate", new List <decimal>(new[] { 0.045M }));
                    if (!string.IsNullOrEmpty(limits.PurchaseSubType) && limits.PurchaseSubType.Equals("A1"))
                    //VAT Registered
                    {
                        DistributorOrderingProfile distributorOrderingProfile = DistributorOrderingProfileProvider.GetProfile(order.DistributorID, Country);
                        //Calcualte the INPS contribution for A1
                        if (distributorOrderingProfile.YTDEarnings > limits.MaxEarningsLimit &&
                            distributorOrderingProfile.YTDEarnings <=
                            HLConfigManager.Configurations.DOConfiguration.MaxTaxableEarnings)
                        {
                            var taxIds = DistributorOrderingProfileProvider.GetTinList(order.DistributorID, true);
                            if (taxIds.Count > 0 &&
                                taxIds.Where(
                                    p =>
                                    p.IDType.Key.Equals("IEVA") & p.IDType.Key.Equals("ITIN") &
                                    p.IDType.Key.Equals("ITSS")).Count() > 0)
                            {
                                limits.Items.Add("INPSContributionRate", new List <decimal>(new[] { 0.0442M }));
                            }
                            else
                            {
                                limits.Items.Add("INPSContributionRate", new List <decimal>(new[] { 0.0695M }));
                            }
                        }
                        else
                        {
                            limits.Items.Add("INPSContributionRate", new List <decimal>(new[] { 0M }));
                        }
                        limits.Items.Add("VATReimbursementRate", new List <decimal>(new[] { 0.20M }));
                    }
                }

                CheckforMultipleDuplicateLinkedSkus(order);
            }
        }
        private bool HasActiveAppTinCode(string distributorID)
        {
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorID, true);
            bool hasActiveAppTinCode      = tins.Count == 2 &&
                                            tins.Any(l => l.IDType != null && l.IDType.Key == "BYTX" & l.IDType.ExpirationDate > DateUtils.GetCurrentLocalTime("BY")) &&
                                            tins.Any(l => l.IDType != null && l.IDType.Key == "BYBL" & l.IDType.ExpirationDate > DateUtils.GetCurrentLocalTime("BY")) &&
                                            tins.Any(l => l.IDType != null && l.IDType.Key == "BYID" & l.IDType.ExpirationDate > DateUtils.GetCurrentLocalTime("BY")) &&
                                            tins.Any(l => l.IDType != null && l.IDType.Key == "BYNA" & l.IDType.ExpirationDate > DateUtils.GetCurrentLocalTime("BY"));

            return(hasActiveAppTinCode);
        }
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            // Must be VAT register to dont have volume limited
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);
            var GRVT = tins.Find(p => p.IDType.Key == "GRVT");
            var GRTN = tins.Find(p => p.IDType.Key == "GRTN");
            var GRSS = tins.Find(p => p.IDType.Key == "GRSS");
            var GRBL = tins.Find(p => p.IDType.Key == "GRBL");

            return(GRVT != null && GRTN != null && GRSS != null && GRBL != null);
        }
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            // Must be VAT register to dont have volume limited
            if (!base.DistributorIsExemptFromPurchasingLimits(distributorId))
            {
                return(false);
            }

            var tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);

            return(tins.Any(p => p.IDType.Key == "PYTX"));
        }
Example #23
0
        private ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result)
        {
            if (reason == ShoppingCartRuleReason.CartItemsBeingAdded)
            {
                CatalogItem_V01 currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country);

                try
                {
                    List <string> codes = new List <string>(CountryType.TH.HmsCountryCodes);
                    codes.Add(CountryType.TH.Key);
                    bool isCOPThai        = codes.Contains(DistributorProfileModel.ProcessingCountryCode);
                    TaxIdentification tid = null;

                    var tins = DistributorOrderingProfileProvider.GetTinList(cart.DistributorID, true);
                    tid = tins.Find(t => t.IDType.Key == "THID");
                    //Simulate the dummy tin with an foreign DS
                    //TaxIdentification ti = new TaxIdentification() { CountryCode = "TH", ID = "dummy", IDType = new TaxIdentificationType(dummyTin) };
                    //ods.Value.TinList.Add(ti);

                    if (CanPurchase(cart.DistributorID, Country))
                    {
                        //Additional Check to allow DS COP = Thai Tin = No TIN, Can place only L and A items
                        if (IsWithOutTinCode)
                        {
                            if (currentItem.ProductType == ProductType.Product)
                            {
                                Result.Result = RulesResult.Failure;
                                Result.AddMessage(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "CantPurchase").ToString());
                                cart.RuleResults.Add(Result);
                            }
                        }
                    }
                    else
                    {
                        if (IsWithOutTinCode)
                        {
                            if (currentItem.ProductType == ProductType.Product)
                            {
                                Result.Result = RulesResult.Failure;
                                Result.AddMessage(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "CantPurchase").ToString());
                                cart.RuleResults.Add(Result);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LoggerHelper.Error(string.Format("Error while performing Add to Cart Rule for Singapore distributor: {0}, Cart Id:{1}, \r\n{2}", cart.DistributorID, cart.ShoppingCartID, ex.ToString()));
                }
            }
            return(Result);
        }
Example #24
0
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            bool isExempt = base.DistributorIsExemptFromPurchasingLimits(distributorId);

            if (!isExempt)
            {
                return(false);
            }

            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);

            return(tins.Find(p => p.IDType.Key == "MYID" && p.ID == "MY00") == null);
        }
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            // Must be VAT register to dont have volume limited
            bool isExempt = false;
            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);
            var firstCombination          = tins.Find(p => p.IDType.Key == "SRTX");

            if (firstCombination != null)
            {
                isExempt = true;
            }
            return(isExempt);
        }
Example #26
0
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            bool isExempt = base.DistributorIsExemptFromPurchasingLimits(distributorId);

            if (!isExempt)
            {
                return(false);
            }

            var tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);

            isExempt = tins.Any(t => t.IDType.Key == "BENO" || t.IDType.Key == "BEVT");
            return(isExempt);
        }
Example #27
0
        public void PerformTaxationRules(Order_V01 order, string locale)
        {
            try
            {
                Message message = new Message();
                message.MessageType  = "OrderType";
                message.MessageValue = "RSO";

                Message messageBoleta = new Message();
                messageBoleta.MessageType  = "TypePerceptions";
                messageBoleta.MessageValue = "Boleta";

                if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.EventTicketOrderType))
                {
                    var sessionInfo = SessionInfo.GetSessionInfo(order.DistributorID, locale);
                    if (null != sessionInfo)
                    {
                        message.MessageValue = sessionInfo.IsEventTicketMode ? "ETO" : "RSO";
                    }
                    if ("RSO" == message.MessageValue)
                    {
                        List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(order.DistributorID, true);
                        TaxIdentification        tid  = null;
                        var isPeid = (tid = tins.Find(t => t.IDType.Key == "PEID")) != null;
                        var isPetx = (tid = tins.Find(t => t.IDType.Key == "PETX")) != null;
                        if ((isPEDs && isPetx && isPeid) || (isPEDs && isPetx))
                        {
                            messageBoleta.MessageValue = "Factura";
                        }
                    }
                }

                if (order.Messages == null)
                {
                    order.Messages = new MessageCollection();
                }
                order.Messages.Add(message);
                bool enable = Settings.GetRequiredAppSetting <bool>("PEperceptionsEnable", true);
                if (enable)
                {
                    order.Messages.Add(messageBoleta);
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(
                    string.Format("PE Taxation Rules failed for Distributor {0}. Exception details \r\n{1}",
                                  order.DistributorID, ex.Message));
            }
        }
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            // Distributors who have ROBL tin code do not have any restriction

            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);

            if (tins.Find(p => p.IDType.Key == "APP") != null)
            {
                return(false);
            }
            var robl = tins.Find(p => p.IDType.Key == "ROBL");

            return(robl != null);
        }
Example #29
0
        private ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart,
                                                    ShoppingCartRuleReason reason,
                                                    ShoppingCartRuleResult Result)
        {
            if (reason == ShoppingCartRuleReason.CartItemsBeingAdded)
            {
                try
                {
                    bool bCheckProductType = false;
                    {
                        var tins = DistributorOrderingProfileProvider.GetTinList(cart.DistributorID, true);

                        if (tins.Count > 0)
                        {
                            if (tins.Find(t => t.IDType.Key == "IDID") == null) // DS has no national ID
                            {
                                bCheckProductType = true;
                            }
                        }
                        else
                        {
                            bCheckProductType = true;
                        }
                        if (bCheckProductType)
                        {
                            var currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU,
                                                                             Country);
                            if (currentItem.ProductType == ServiceProvider.CatalogSvc.ProductType.Product)
                            {
                                Result.Result = RulesResult.Failure;
                                Result.AddMessage(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_Rules", HLConfigManager.Platform), "CantPurchase").ToString());
                                cart.RuleResults.Add(Result);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LoggerHelper.Error(
                        string.Format(
                            "Error while performing Add to Cart Rule for Indonesia distributor: {0}, Cart Id:{1}, \r\n{2}",
                            cart.DistributorID, cart.ShoppingCartID, ex));
                }
            }
            return(Result);
        }
        public override bool DistributorIsExemptFromPurchasingLimits(string distributorId)
        {
            // Must be VAT register to dont have volume limited
            bool isExempt = base.DistributorIsExemptFromPurchasingLimits(distributorId);

            if (!isExempt)
            {
                return(false);
            }

            List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(distributorId, true);
            var uabl = tins.Find(p => p.IDType.Key == "UABL");

            isExempt = (uabl != null);
            return(isExempt);
        }