1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "invoices": [
12 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ubl:Invoice xmlns:ubl=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\" xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\"><cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</cbc:CustomizationID><cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID><cbc:ID>1234/78/901</cbc:ID><cbc:IssueDate>2016-06-16</cbc:IssueDate><cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode><cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode><cbc:BuyerReference>04011000-12348-91</cbc:BuyerReference><cac:AccountingSupplierParty><cac:Party><cbc:EndpointID schemeID=\"EM\">seller@email.de</cbc:EndpointID><cac:PartyName><cbc:Name>[Seller trading name]</cbc:Name></cac:PartyName><cac:PostalAddress><cbc:StreetName>[Seller address line 1]</cbc:StreetName><cbc:AdditionalStreetName>[Seller address line 2]</cbc:AdditionalStreetName><cbc:CityName>[Seller city]</cbc:CityName><cbc:PostalZone>12345</cbc:PostalZone><cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country></cac:PostalAddress><cac:PartyTaxScheme><cbc:CompanyID>12/345/67890</cbc:CompanyID><cac:TaxScheme><cbc:ID>???</cbc:ID></cac:TaxScheme></cac:PartyTaxScheme><cac:PartyLegalEntity><cbc:RegistrationName>[Seller name]</cbc:RegistrationName><cbc:CompanyID>VR 12345 Nz</cbc:CompanyID><cbc:CompanyLegalForm>Vorstand: [...] (Vorsitzender), […] (Stellvertreterin), Dr. […] (Schatzmeister); Beirat: […] (Vorsitzender); Geschäftsführung: […], AG […], FA für Körperschaften […]</cbc:CompanyLegalForm></cac:PartyLegalEntity><cac:Contact><cbc:Name>[…]</cbc:Name><cbc:Telephone>+49 (0)12-345678-90</cbc:Telephone><cbc:ElectronicMail>mail@seller.eu</cbc:ElectronicMail></cac:Contact></cac:Party></cac:AccountingSupplierParty><cac:AccountingCustomerParty><cac:Party><cbc:EndpointID schemeID=\"EM\">buyer@info.de</cbc:EndpointID><cac:PostalAddress><cbc:StreetName>[Buyer address line 1]</cbc:StreetName><cbc:AdditionalStreetName>[Buyer address line 2]</cbc:AdditionalStreetName><cbc:CityName>[Buyer city]</cbc:CityName><cbc:PostalZone>12345</cbc:PostalZone><cac:Country><cbc:IdentificationCode>DE</cbc:IdentificationCode></cac:Country></cac:PostalAddress><cac:PartyLegalEntity><cbc:RegistrationName>[Buyer name]</cbc:RegistrationName></cac:PartyLegalEntity><cac:Contact><cbc:Name>[Buyer contact person]</cbc:Name></cac:Contact></cac:Party></cac:AccountingCustomerParty><cac:PaymentMeans><cbc:PaymentMeansCode>58</cbc:PaymentMeansCode><cac:PayeeFinancialAccount><cbc:ID>DE79000000001234567890</cbc:ID></cac:PayeeFinancialAccount></cac:PaymentMeans><cac:PaymentTerms><cbc:Note>Wir möchten Sie bitten, die Teilnahmegebühr iHv. 120,00 € innerhalb von 14 Tagen auf das oben genannte Konto unter Angabe der Rechnungsnummer 1234/78/901 zu überweisen.</cbc:Note></cac:PaymentTerms><cac:TaxTotal><cbc:TaxAmount currencyID=\"EUR\">0</cbc:TaxAmount><cac:TaxSubtotal><cbc:TaxableAmount currencyID=\"EUR\">120</cbc:TaxableAmount><cbc:TaxAmount currencyID=\"EUR\">0</cbc:TaxAmount><cac:TaxCategory><cbc:ID>O</cbc:ID><cbc:Percent>0</cbc:Percent><cbc:TaxExemptionReason>als gemeinnützig anerkannt</cbc:TaxExemptionReason><cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme></cac:TaxCategory></cac:TaxSubtotal></cac:TaxTotal><cac:LegalMonetaryTotal><cbc:LineExtensionAmount currencyID=\"EUR\">120</cbc:LineExtensionAmount><cbc:TaxExclusiveAmount currencyID=\"EUR\">120</cbc:TaxExclusiveAmount><cbc:TaxInclusiveAmount currencyID=\"EUR\">120</cbc:TaxInclusiveAmount><cbc:PayableAmount currencyID=\"EUR\">120</cbc:PayableAmount></cac:LegalMonetaryTotal><cac:InvoiceLine><cbc:ID>Teilnahmegebühr</cbc:ID><cbc:InvoicedQuantity unitCode=\"XPP\">1</cbc:InvoicedQuantity><cbc:LineExtensionAmount currencyID=\"EUR\">120</cbc:LineExtensionAmount><cac:Item><cbc:Description>Anmeldung von […]</cbc:Description><cbc:Name>Teilnahmegebühr</cbc:Name><cac:ClassifiedTaxCategory><cbc:ID>O</cbc:ID><cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme></cac:ClassifiedTaxCategory></cac:Item><cac:Price><cbc:PriceAmount currencyID=\"EUR\">120</cbc:PriceAmount></cac:Price></cac:InvoiceLine></ubl:Invoice>"
13 ]
14};
15
16
17const run = await client.actor("bite-sized-insights/bulk-e-invoice-validator").call(input);
18
19
20console.log('Results from dataset');
21console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
22const { items } = await client.dataset(run.defaultDatasetId).listItems();
23items.forEach((item) => {
24 console.dir(item);
25});
26
27