Exemple #1
0
        /// <summary>
        /// Tries to validate the tax status given the tax information.
        /// Returns whether the information was sufficent to determine
        /// the final status.
        /// </summary>
        public void UpdateTaxStatus(TaxId taxId)
        {
            if (taxId == TaxId.Unknown)
            {
                return;
            }

            if (taxId == TaxId.None || taxId.Kind == TaxIdKind.CUIL)
            {
                // We just accept CUIL-based registrations, we can't know whether
                // they pay earnings or not :(
                Raise(new TaxStatusValidated(taxId));
                return;
            }

            if (taxId.HasIncomeTax == true)
            {
                Raise(new TaxStatusRejected(taxId, TaxStatusRejectedReason.HasIncomeTax));
                return;
            }

            if (taxId.Category == TaxCategory.NotApplicable)
            {
                Raise(new TaxStatusRejected(taxId, TaxStatusRejectedReason.NotApplicable));
                return;
            }

            if (taxId.Category != TaxCategory.Unknown &&
                taxId.Category != TaxCategory.A)
            {
                Raise(new TaxStatusRejected(taxId, TaxStatusRejectedReason.HighCategory));
                return;
            }

            if (taxId.Category == TaxCategory.A)
            {
                Raise(new TaxStatusValidated(taxId));
                return;
            }

            // Other combinations might not be approved
        }
Exemple #2
0
 protected TaxStatusEvent(TaxId taxId) => TaxId = taxId;
Exemple #3
0
 public void CalculateTaxId(string personalId, Sex sex, string taxId)
 => Assert.Equal(taxId, TaxId.FromNationalId(personalId, sex));
Exemple #4
0
 public bool CanUpdateTaxStatus(TaxId taxId)
 => taxId != TaxId.Unknown &&
 (taxId.Kind == TaxIdKind.CUIL ||
  taxId.HasIncomeTax == true ||
  (taxId.Category != TaxCategory.Unknown && taxId.Category != TaxCategory.A));