public void GetGST_GSTRATE_GetByKey()
        {
            // Setup dependency
            var settingsMock = new Mock<ISettings>();
            var repositoryMock = new Mock<IRepository>();
            var uoMock = new Mock<IUnitOfWork>();
            var serviceLocatorMock = new Mock<IServiceLocator>();
            serviceLocatorMock.Setup(x => x.GetInstance<IRepository>())
                .Returns(repositoryMock.Object);
            ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object);

            // Arrange
            Guid id = Guid.NewGuid();
               SystemConfig sys = new SystemConfig()
            {
                Name = "GST_RATE",
                Value ="1234"
            };
              SystemConfig [] systems = new SystemConfig[] {sys};
              repositoryMock.Setup(e => e.Query<SystemConfig>()).Returns(systems.AsQueryable());
               // Act

              var systemConfigService = new SystemConfigService(uoMock.Object, repositoryMock.Object, settingsMock.Object);
            decimal actulvalue =  systemConfigService.GetGST();
            // Assert
            Assert.AreEqual(decimal.Parse(sys.Value, CultureInfo.InvariantCulture), actulvalue);
        }
Exemplo n.º 2
0
        // Subtract GST
        public Decimal SubtractGSTCalculator(decimal price)
        {
            SystemConfigService sysConfig = new SystemConfigService(UnitOfWork, Repository, Settings);
            decimal gst = sysConfig.GetGST();

            decimal gstAmount = price - (price / (gst + 1));

            return decimal.Round(gstAmount, 2, MidpointRounding.AwayFromZero);
        }
Exemplo n.º 3
0
        /// <summary>
        /// (the specialists rate + TeleConsult mark up) + (virtual consultation cost + TeleConsult mark up) + Sales Tax if applicable
        /// </summary>
        /// <param name="specRate"></param>
        /// <param name="gstOnSpecRate"> = 1 if this specialization doesnot apply gst</param>
        /// <param name="platformCost"></param>
        /// <param name="gstOnPlatformCost"></param>
        /// <returns>customer rate - already has money rounding</returns>
        public decimal GetCustomerRate(decimal specRate, bool appliedGST)
        {
            SystemConfigService systemConfig = new SystemConfigService(UnitOfWork, Repository, Settings);

            //default tax = 0.1 (10%)
            decimal tax = systemConfig.GetGST() + 1;
            // commission = 2% = 0.02
            decimal commission = systemConfig.GetValueByKey(ParamatricBusinessRules.COMMISSION_LEVELS.ToString()) / 100;

            decimal basicFee = systemConfig.GetValueByKey(ParamatricBusinessRules.BASIC_FEE.ToString());

            if (!appliedGST)
            {
                tax = 1;
            }

            decimal rate = (specRate * (1 + commission) + basicFee) * tax;

            return Utilities.RoundMoney(rate);
        }