Exemple #1
0
        public async Task CreateVat(Guid subscriptionId, string country, decimal rate, string description)
        {
            if (subscriptionId == Guid.Empty)
            {
                throw new ArgumentException("value cannot be empty", nameof(subscriptionId));
            }

            if (string.IsNullOrWhiteSpace(country))
            {
                throw new ArgumentException("value cannot be empty", nameof(country));
            }

            if (rate < 0)
            {
                throw new ArgumentException("value cannot be less than zero", nameof(rate));
            }

            if (string.IsNullOrWhiteSpace(description))
            {
                throw new ArgumentException("value cannot be empty", nameof(description));
            }

            var vat = new Vat
            {
                Id             = Guid.NewGuid(),
                SubscriptionId = subscriptionId,
                Country        = country,
                Description    = description,
                Rate           = rate,
                Unlisted       = false
            };

            _context.Add(vat);
            await _context.SaveChangesAsync();
        }
        private void CreateSettingsDefaults(Guid subscriptionId, bool minimumTaxPayerRegime, bool electronicInvoiceEnabled, bool splitPaymentApplied, Vat vat, ProvidenceFund providenceFund, WithholdingTax withholdingTax)
        {
            var defaults = new SettingsDefaults
            {
                Id                       = Guid.NewGuid(),
                SubscriptionId           = subscriptionId,
                ElectronicInvoiceEnabled = electronicInvoiceEnabled,
                MinimumTaxPayerRegime    = minimumTaxPayerRegime,
                SplitPaymentApplied      = splitPaymentApplied,
                ProvidenceFund           = providenceFund,
                Vat                      = vat,
                WithholdingTax           = withholdingTax
            };

            _context.Add(defaults);
        }