Ejemplo n.º 1
0
 internal static InvoiceParty CreateInvoiceParty(Country country, string taxNumber, string name = null, Address address = null)
 {
     return(InvoiceParty.Create(
                info: InvoicePartyInfo.Create(NonNegativeInt.Zero(), TaxpayerIdentificationNumber.Create(country, taxNumber).Success.Get(), name, address).Success.Get(),
                country: country
                ).Success.Get());
 }
Ejemplo n.º 2
0
        public async Task GetTaxerpayerDataSucceeds()
        {
            var taxpayer     = TaxpayerIdentificationNumber.Create(Countries.Hungary, "10630433").Success.Get();
            var taxpayerData = await NavClient.GetTaxPayerDataAsync(taxpayer);

            TestFixture.AssertResponse(taxpayerData);
        }
        public void CreatingInvalidEuropeanTaxpayerNumberFails(string countryCode, string taxpayerNumber)
        {
            var country         = countryCode.IsNotNull() ? Country.GetByCode(countryCode).Get() : null;
            var europeanCountry = countryCode.IsNotNull() ? EuropeanUnionCountry.GetByCode(countryCode).Get() : null;

            Assert.IsTrue(EuropeanUnionTaxpayerIdentificationNumber.Create(europeanCountry, taxpayerNumber).IsError);
            Assert.IsTrue(TaxpayerIdentificationNumber.Create(country, taxpayerNumber).IsError);
        }
        public void CreatingValidEuropeanTaxpayerNumberSucceeds(string countryCode, string taxpayerNumber)
        {
            var country         = Country.GetByCode(countryCode).Get();
            var europeanCountry = EuropeanUnionCountry.GetByCode(countryCode).Get();

            Assert.IsTrue(EuropeanUnionTaxpayerIdentificationNumber.Create(europeanCountry, taxpayerNumber).IsSuccess);
            Assert.IsTrue(TaxpayerIdentificationNumber.Create(country, taxpayerNumber).IsSuccess);
        }
Ejemplo n.º 5
0
 private CustomerInfo GetCustomerInfo()
 {
     return(new CustomerInfo(
                taxpayerId: TaxpayerIdentificationNumber.Create(Countries.Hungary, "14750636").Success.Get(),
                name: Name.Create("Vev Kft").Success.Get(),
                address: GetAddress()
                ));
 }
Ejemplo n.º 6
0
 private SupplierInfo GetSupplierInfo()
 {
     return(new SupplierInfo(
                taxpayerId: TaxpayerIdentificationNumber.Create(Countries.Hungary, "14750636").Success.Get(),
                vatCode: VatCode.Create("2").Success.Get(),
                name: Name.Create("BUDAPESTI MSZAKI S GAZDASGTUDOMNYI EGYETEM").Success.Get(),
                address: GetAddress()
                ));
 }
Ejemplo n.º 7
0
        public async Task SendLocalCompanyInvoiceSucceeds()
        {
            var receiver = Receiver.LocalCompany(
                taxpayerId: TaxpayerIdentificationNumber.Create(Countries.Hungary, "10630433").Success.Get(),
                name: Name.Create("Hungarian test company ltd.").Success.Get(),
                address: CreateAddress(Countries.Hungary)
                );
            var sendInvoicesResult = await SendInvoices(receiver.Success.Get());

            await AssertInvoices(sendInvoicesResult);
        }
Ejemplo n.º 8
0
        public async Task SendForeignCompanyInvoiceSucceeds(string countryCode, string taxId)
        {
            var country        = Countries.GetByCode(countryCode).Get();
            var taxpayerNumber = taxId.ToNonEmptyOption().Map(i => TaxpayerIdentificationNumber.Create(country, i).Success.Get());
            var receiver       = Receiver.ForeignCompany(
                name: Name.Create("Foreign test company ltd.").Success.Get(),
                address: CreateAddress(country),
                taxpayerId: taxpayerNumber.GetOrNull()
                );
            var sendInvoicesResult = await SendInvoices(receiver.Success.Get());

            await AssertInvoices(sendInvoicesResult);
        }
Ejemplo n.º 9
0
        public async Task SendCorrectionLocalCompanyInvoiceSucceeds()
        {
            var receiver = Receiver.LocalCompany(
                taxpayerId: TaxpayerIdentificationNumber.Create(Countries.Hungary, "10630433").Success.Get(),
                name: Name.Create("Hungarian test company ltd.").Success.Get(),
                address: CreateAddress(Countries.Hungary)
                ).Success.Get();
            var invoiceNumber      = InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get();
            var sendInvoicesResult = await SendInvoices(receiver, invoiceNumber);

            await AssertInvoices(sendInvoicesResult);

            var sendModificationInvoiceResponse = await SendModificationInvoices(receiver, originalInvoiceNumber : invoiceNumber);

            await AssertInvoices(sendModificationInvoiceResponse);
        }
Ejemplo n.º 10
0
        public async Task SendCorrectionForeignCompanyInvoiceSucceeds(string countryCode, string taxId)
        {
            var country        = Countries.GetByCode(countryCode).Get();
            var taxpayerNumber = taxId.ToNonEmptyOption().Map(i => TaxpayerIdentificationNumber.Create(country, i).Success.Get());
            var receiver       = Receiver.ForeignCompany(
                name: Name.Create("Foreign test company ltd.").Success.Get(),
                address: CreateAddress(country),
                taxpayerId: taxpayerNumber.GetOrNull()
                ).Success.Get();
            var invoiceNumber      = InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get();
            var sendInvoicesResult = await SendInvoices(receiver, invoiceNumber);

            await AssertInvoices(sendInvoicesResult);

            var sendModificationInvoiceResponse = await SendModificationInvoices(receiver, originalInvoiceNumber : invoiceNumber);

            await AssertInvoices(sendModificationInvoiceResponse);
        }
Ejemplo n.º 11
0
        public async Task CheckNif()
        {
            var goodEntries = NonEmptyEnumerable.Create(
                new NifInfoEntry(IssuingCompany.TaxpayerIdentificationNumber, IssuingCompany.Name.Value),
                new NifInfoEntry(ReceivingCompany.TaxpayerIdentificationNumber, ReceivingCompany.Name.Value),
                new NifInfoEntry(TaxpayerIdentificationNumber.Create(Countries.Spain, "99999999R").Success.Get(), "ESPAÑOL ESPAÑOL JUAN"),
                new NifInfoEntry(IssuingCompany.TaxpayerIdentificationNumber, "Wrong company name") // surprisingly, good company ID with bad company name is found
                );
            var badEntries = NonEmptyEnumerable.Create(
                new NifInfoEntry(TaxpayerIdentificationNumber.Create(Countries.Spain, "111111111").Success.Get(), IssuingCompany.Name.Value),
                new NifInfoEntry(TaxpayerIdentificationNumber.Create(Countries.Spain, "99999999R").Success.Get(), "Not Juan"),
                new NifInfoEntry(TaxpayerIdentificationNumber.Create(Countries.Spain, "12999999R").Success.Get(), "Non existent name for non existent ID."),
                new NifInfoEntry(TaxpayerIdentificationNumber.Create(Countries.Angola, "123456").Success.Get(), "Random tax id")
                );

            await AssertNifLookup(goodEntries, NifSearchResult.Found);
            await AssertNifLookup(badEntries, NifSearchResult.NotFound);

            // Surprisingly, this works for some reason.
            var serverModifiedEntry = new NifInfoEntry(TaxpayerIdentificationNumber.Create(Countries.Spain, "A08433179").Success.Get(), "Microsoft test company");

            await AssertNifLookup(serverModifiedEntry.ToEnumerable(), NifSearchResult.NotFoundBecauseNifModifiedByServer);
        }