/// <summary> /// Test case for bills: #2.2 with various order item types(product order, service charge, cancellation fee, deposit, space order /// </summary> /// <returns></returns> private static InvoiceDocument InvoiceWithVariousOrderItemTypes() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.RetailSalesReceipt, new CurrencyCode("EUR")), revenueItems: new List <PositiveRevenue> { //Night 9/16/2020 new PositiveRevenue(new PositiveAmount(88.50m), TaxType.Vat13, new PositiveAmount(11.50m), ClassificationType.RetailSalesOfGoodsAndServicesPrivateClientele, ClassificationCategory.ProvisionOfServicesIncome, new PositiveInt(1)), //Service / Product new PositiveRevenue(new PositiveAmount(5.00m), TaxType.Vat0, new PositiveAmount(0.00m), ClassificationType.RetailSalesOfGoodsAndServicesPrivateClientele, ClassificationCategory.ProductSaleIncome, new PositiveInt(2), VatExemptionType.VatIncludedArticle43), //Garage new PositiveRevenue(new PositiveAmount(16.13m), TaxType.Vat24, new PositiveAmount(3.87m), ClassificationType.RetailSalesOfGoodsAndServicesPrivateClientele, ClassificationCategory.ProductSaleIncome, new PositiveInt(3)), //CancellationFee new PositiveRevenue(new PositiveAmount(100.00m), TaxType.Vat0, new PositiveAmount(0.00m), ClassificationType.OtherSalesOfGoodsAndServices, ClassificationCategory.OtherIncomeAndProfits, new PositiveInt(4), VatExemptionType.VatIncludedArticle44), //Deposit new PositiveRevenue(new PositiveAmount(100.00m), TaxType.Vat0, new PositiveAmount(0.00m), ClassificationType.OtherSalesOfGoodsAndServices, ClassificationCategory.OtherIncomeAndProfits, new PositiveInt(5), VatExemptionType.VatIncludedArticle46), //Deposit new PositiveRevenue(new PositiveAmount(100.00m), TaxType.Vat0, new PositiveAmount(0.00m), ClassificationType.OtherSalesOfGoodsAndServices, ClassificationCategory.OtherIncomeAndProfits, new PositiveInt(6), VatExemptionType.WithoutVatArticle13) }, payments: new List <PositivePayment> { new PositivePayment(new PositiveAmount(425.00m), PaymentType.Cash), } ) }, 0))); }
internal SendInvoicesResult(ResponseDoc responseDoc) { SendInvoiceResults = new SequentialEnumerable <SendInvoiceResult>(responseDoc.Responses.Select(response => new IndexedItem <SendInvoiceResult>(response.Index, new SendInvoiceResult( invoiceIdentifier: response.InvoiceUid, invoiceRegistrationNumber: response.InvoiceMark, invoiceRegistrationNumberSpecified: response.InvoiceMarkSpecified, errors: response.Errors?.Select(error => new ResultError(MapErrorCode(error.Code, response.StatusCode), error.Message)))))); }
/// <summary> /// Test case for bills: #1.7 /// </summary> private static InvoiceDocument InvoiceWithRebateOfItems() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.OtherIncomeAdjustmentRegularisationEntriesAccountingBase, new CurrencyCode("EUR"), null), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(10m), TaxType.WithoutVat, new PositiveAmount(0m), ClassificationType.CreditExchangeDifferences, ClassificationCategory.OtherIncomeAdjustmentAndRegularisationEntries) } ) }, 0))); }
public async Task SendCorrectionInvoiceSucceeds() { var navClient = TestFixture.GetNavClient(); var exchangeToken = await navClient.GetExchangeTokenAsync(); var response = await navClient.SendModificationDocumentsAsync( token : exchangeToken.SuccessResult, invoices : SequentialEnumerable.FromPreordered(new[] { GetModificationInvoice() }, startIndex: 1) ); Thread.Sleep(3000); var transactionStatus = await navClient.GetTransactionStatusAsync(response.SuccessResult); Assert.IsNotNull(transactionStatus.SuccessResult); AssertError(transactionStatus); }
/// <summary> /// Test case for bills: #1.2, #1.8, #1.16, #2.4 /// </summary> private static InvoiceDocument InvoiceWithEmptyCounterpart(PaymentType paymentType) { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.RetailSalesReceipt, new CurrencyCode("EUR")), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(88.50m), TaxType.Vat13, new PositiveAmount(11.50m), ClassificationType.RetailSalesOfGoodsAndServicesPrivateClientele, ClassificationCategory.ProvisionOfServicesIncome) }, payments: new List <PositivePayment> { new PositivePayment(new PositiveAmount(100m), paymentType) } ) }, 0))); }
/// <summary> /// Simple invoice with city tax /// </summary> /// <returns></returns> private static InvoiceDocument SimpleValidInvoiceWithCityTax() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.RetailSalesReceipt, new CurrencyCode("EUR")), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(53.65m), TaxType.Vat24, new PositiveAmount(12.88m), ClassificationType.RetailSalesOfGoodsAndServicesPrivateClientele, ClassificationCategory.ProductSaleIncome, cityTax: new CityTax(CityTaxType.Hotels5Stars, new PositiveAmount(4.00m))) }, payments: new List <PositivePayment> { new PositivePayment(new PositiveAmount(70.53m), PaymentType.Cash) } ) }, 0))); }
/// <summary> /// Test case for bills: #2.5 /// </summary> private static InvoiceDocument InvoiceForCompanyWithoutDetails() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.SimplifiedInvoice, new CurrencyCode("EUR")), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(88.50m), TaxType.Vat13, new PositiveAmount(11.50m), ClassificationType.OtherSalesOfGoodsAndServices, ClassificationCategory.OtherIncomeAndProfits) }, payments: new List <PositivePayment> { new PositivePayment(new PositiveAmount(100m), PaymentType.Cash) } ) }, 0))); }
private static InvoiceDocument InvoiceWithVariousPaymentMethods() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.RetailSalesReceipt, new CurrencyCode("EUR")), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(23.00m), TaxType.Vat0, new PositiveAmount(0.00m), ClassificationType.RetailSalesOfGoodsAndServicesPrivateClientele, ClassificationCategory.ProductSaleIncome, vatExemption: VatExemptionType.VatIncludedArticle44) }, payments: new List <PositivePayment> { //ToDo - validate mapping for external payments new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Bacs) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Bad debts) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Bancontact) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Bank charges) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Barter) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Cash) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Cheque) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Chèque vacances) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Comission) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Complimentary) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Credit card) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Cross settlement) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Exchange rate difference) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Exchange rounding difference) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Gift card) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (iDeal) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Invoice) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Loyalty points) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (PayPal) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Prepayment) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Reseller) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit), //External payment (Unspecified) new PositivePayment(new PositiveAmount(1m), PaymentType.OnCredit) //External payment (Wife transfer) } ) }, 0))); }
private static InvoiceDocument CreditInvoiceWithNegativeAmounts() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <Invoice>() { new NegativeInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new NegativeInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, currencyCode: new CurrencyCode("EUR")), revenueItems: new List <NegativeRevenue> { new NegativeRevenue(new NegativeAmount(-53.65m), TaxType.Vat6, new NegativeAmount(-12.88m), ClassificationType.OtherSalesOfGoodsAndServices, ClassificationCategory.ProductSaleIncome) }, payments: new List <NegativePayment> { new NegativePayment(new NegativeAmount(-66.53m), PaymentType.Cash) }, counterpart: new ForeignCompany(new NotEmptyString("090701900"), new CountryCode("GR"), new NonNegativeInt(0), address: new Address(postalCode: new NotEmptyString("12"), city: new NotEmptyString("City"))) ) }, 0))); }
/// <summary> /// Test case for bills: #1.4 with foreign counterpart(payment type: cash) and #1.4 with foreign counterpart(with payment type: onCredit) /// </summary> private static InvoiceDocument InvoiceWithForeignCompanyCounterpart(string countryCode, BillType billType, ClassificationType classificationType, PaymentType paymentType) { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, billType, new CurrencyCode("EUR"), null), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(100m), TaxType.WithoutVat, new PositiveAmount(0m), classificationType, ClassificationCategory.ProvisionOfServicesIncome) }, payments: new List <PositivePayment> { new PositivePayment(new PositiveAmount(100m), paymentType) }, counterpart: new ForeignCompany(new NotEmptyString("12348765"), new CountryCode(countryCode), new NonNegativeInt(0), new StringIdentifier("Name"), new Address(postalCode: new NotEmptyString("12"), city: new NotEmptyString("City"))) ) }, 0))); }
/// <summary> /// Test case for bill: #1.14 /// </summary> private static InvoiceDocument InvoiceForDepositCashPayment() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.RetailSalesReceipt, new CurrencyCode("EUR")), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(200.00m), TaxType.Vat0, new PositiveAmount(0.00m), ClassificationType.OtherSalesOfGoodsAndServices, ClassificationCategory.OtherIncomeAndProfits, null, VatExemptionType.VatIncludedArticle46) }, payments: new List <PositivePayment> { new PositivePayment(new PositiveAmount(200m), PaymentType.Cash) } ) }, 0))); }
/// <summary> /// Test case for bills: #1.3 /// </summary> private static InvoiceDocument SimpleInvoiceForCompany() { return(new InvoiceDocument( SequentialEnumerable.FromPreordered(new List <PositiveInvoice>() { new PositiveInvoice( issuer: new LocalCompany(new TaxIdentifier(UserVatNumber)), header: new PositiveInvoiceHeader(new LimitedString1to50("0"), new LimitedString1to50("50020"), DateTime.Now, BillType.SalesInvoice, new CurrencyCode("EUR")), revenueItems: new List <PositiveRevenue> { new PositiveRevenue(new PositiveAmount(88.50m), TaxType.Vat13, new PositiveAmount(11.50m), ClassificationType.OtherOrdinaryIncome, ClassificationCategory.OtherIncomeAndProfits) }, payments: new List <PositivePayment> { new PositivePayment(new PositiveAmount(100m), PaymentType.Cash) }, counterpart: new ForeignCompany(new NotEmptyString("090701900"), new CountryCode("GR")) ) }, 0))); }
private ModificationInvoice GetModificationInvoice() { var amounts = GetItemAmounts(amount: 100, exchangeRate: 300); var unitAmounts = GetItemAmounts(amount: 100, exchangeRate: 300); var item = new InvoiceItem( consumptionDate: new DateTime(2020, 08, 30), totalAmounts: amounts, description: new Description("NIGHT 8/30/2020"), measurementUnit: MeasurementUnit.Night, quantity: -1, unitAmounts: unitAmounts, exchangeRate: new ExchangeRate(300) ); var amounts1 = GetItemAmounts(amount: 100, exchangeRate: 300); var unitAmounts1 = GetItemAmounts(amount: 100, exchangeRate: 300); var item1 = new InvoiceItem( consumptionDate: new DateTime(2020, 08, 31), totalAmounts: amounts1, description: new Description("NIGHT2 8/31/2020"), measurementUnit: MeasurementUnit.Night, quantity: 1, unitAmounts: unitAmounts1, exchangeRate: new ExchangeRate(300) ); return(new ModificationInvoice( number: new InvoiceNumber("ABC-18abfcefsaa"), supplierInfo: GetSupplierInfo(), customerInfo: GetCustomerInfo(), items: SequentialEnumerable.FromPreordered(new[] { item, item1 }, startIndex: 1), currencyCode: new CurrencyCode("USD"), issueDate: new DateTime(2020, 08, 31), paymentDate: new DateTime(2020, 08, 31), itemIndexOffset: 4, modificationIndex: 4, modifyWithoutMaster: true, originalDocumentNumber: new InvoiceNumber("ABC-18afasadafa") )); }
private Invoice GetInvoice() { var item1Amount = new Amount(new AmountValue(1), new AmountValue(1), new AmountValue(0)); var item2Amount = new Amount(new AmountValue(20m), new AmountValue(16.81m), new AmountValue(3.19m)); var unitAmount1 = new ItemAmounts(item1Amount, item2Amount, 0.05m); var items = new[] { new InvoiceItem( consumptionDate: new DateTime(2020, 06, 30), totalAmounts: new ItemAmounts(item1Amount, item1Amount, 0.05m), description: new Description("Httt hzi serts (fl)"), measurementUnit: MeasurementUnit.Night, quantity: 15, unitAmounts: unitAmount1, exchangeRate: new ExchangeRate(1) ), new InvoiceItem( consumptionDate: new DateTime(2020, 06, 30), totalAmounts: new ItemAmounts(item2Amount, item2Amount, 0.05m), description: new Description("Httt hzi serts (fl)"), measurementUnit: MeasurementUnit.Night, quantity: -15, unitAmounts: unitAmount1, exchangeRate: new ExchangeRate(1) ), }; var address = GetAddress(); return(new Invoice( number: new InvoiceNumber("ABC-18a"), issueDate: new DateTime(2020, 06, 30), supplierInfo: GetSupplierInfo(), customerInfo: GetCustomerInfo(), items: SequentialEnumerable.FromPreordered(items, startIndex: 1), paymentDate: new DateTime(2020, 06, 14), currencyCode: new CurrencyCode("EUR") )); }
public async Task SendInvoiceSucceeds() { var navClient = TestFixture.GetNavClient(); var exchangeToken = await navClient.GetExchangeTokenAsync(); var invoiceTransactionId = await navClient.SendInvoicesAsync(exchangeToken.SuccessResult, SequentialEnumerable.FromPreordered(new[] { GetInvoice() }, startIndex: 1)); Thread.Sleep(3000); var transactionStatus = await navClient.GetTransactionStatusAsync(invoiceTransactionId.SuccessResult); Assert.IsNotNull(transactionStatus.SuccessResult); Assert.IsNotNull(exchangeToken.SuccessResult); Assert.IsNotNull(invoiceTransactionId.SuccessResult); AssertError(transactionStatus); AssertError(exchangeToken); AssertError(invoiceTransactionId); }