1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "xmlText": `<?xml version="1.0" encoding="UTF-8"?>
12<!--
13
14 Licensed under European Union Public Licence (EUPL) version 1.2.
15
16-->
17<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
18 xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
19 xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
20 <cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>
21 <cbc:ProfileID>P1</cbc:ProfileID>
22 <cbc:ID>test decimal 1</cbc:ID>
23 <cbc:IssueDate>2018-02-05</cbc:IssueDate>
24 <cbc:DueDate>2018-02-28</cbc:DueDate>
25 <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
26 <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
27 <cbc:TaxCurrencyCode>EUR</cbc:TaxCurrencyCode>
28 <cac:AccountingSupplierParty>
29 <cac:Party>
30 <cac:PartyIdentification>
31 <cbc:ID>46830600751</cbc:ID>
32 </cac:PartyIdentification>
33 <cac:PostalAddress>
34 <cbc:StreetName>ULICA 1</cbc:StreetName>
35 <cbc:CityName>SPLIT</cbc:CityName>
36 <cbc:PostalZone>10000</cbc:PostalZone>
37 <cac:AddressLine>
38 <cbc:Line>ULICA 1, 10000 SPLIT</cbc:Line>
39 </cac:AddressLine>
40 <cac:Country>
41 <cbc:IdentificationCode>HR</cbc:IdentificationCode>
42 </cac:Country>
43 </cac:PostalAddress>
44 <cac:PartyTaxScheme>
45 <cbc:CompanyID>HR46830600751</cbc:CompanyID>
46 <cac:TaxScheme>
47 <cbc:ID>VAT</cbc:ID>
48 </cac:TaxScheme>
49 </cac:PartyTaxScheme>
50 <cac:PartyLegalEntity>
51 <cbc:RegistrationName>HEP SPLIT</cbc:RegistrationName>
52 <cbc:CompanyID>086374645</cbc:CompanyID>
53 </cac:PartyLegalEntity>
54 </cac:Party>
55 </cac:AccountingSupplierParty>
56 <cac:AccountingCustomerParty>
57 <cac:Party>
58 <cac:PartyIdentification>
59 <cbc:ID>12346830600751</cbc:ID>
60 </cac:PartyIdentification>
61 <cac:PostalAddress>
62 <cbc:StreetName>VUKOVARSKA PROMJENA ADRESE</cbc:StreetName>
63 <cbc:CityName>ZAGREB</cbc:CityName>
64 <cbc:PostalZone>10000</cbc:PostalZone>
65 <cac:AddressLine>
66 <cbc:Line>VUKOVARSKA PROMJENA ADRESE 20, 10000 ZAGREB</cbc:Line>
67 </cac:AddressLine>
68 <cac:Country>
69 <cbc:IdentificationCode>HR</cbc:IdentificationCode>
70 </cac:Country>
71 </cac:PostalAddress>
72 <cac:PartyTaxScheme>
73 <cbc:CompanyID>HR46830600751</cbc:CompanyID>
74 <cac:TaxScheme>
75 <cbc:ID>VAT</cbc:ID>
76 </cac:TaxScheme>
77 </cac:PartyTaxScheme>
78 <cac:PartyLegalEntity>
79 <cbc:RegistrationName>HEP-OPERATOR DISTRIBUCIJSKOG SUSTAVA D.O.O. ZA DISTRIBUCIJU I
80 OPSKRBU ELEKTRICNE ENERGIJE</cbc:RegistrationName>
81 <cbc:CompanyID>08634543</cbc:CompanyID>
82 </cac:PartyLegalEntity>
83 </cac:Party>
84 </cac:AccountingCustomerParty>
85 <cac:PaymentMeans>
86 <cbc:PaymentMeansCode>4</cbc:PaymentMeansCode>
87 </cac:PaymentMeans>
88 <cac:TaxTotal>
89 <cbc:TaxAmount currencyID="EUR">3.03</cbc:TaxAmount>
90 <cac:TaxSubtotal>
91 <cbc:TaxableAmount currencyID="EUR">12.12</cbc:TaxableAmount>
92 <cbc:TaxAmount currencyID="EUR">3.03</cbc:TaxAmount>
93 <cac:TaxCategory>
94 <cbc:ID>S</cbc:ID>
95 <cbc:Percent>25</cbc:Percent>
96 <cac:TaxScheme>
97 <cbc:ID>VAT</cbc:ID>
98 </cac:TaxScheme>
99 </cac:TaxCategory>
100 </cac:TaxSubtotal>
101 </cac:TaxTotal>
102 <cac:LegalMonetaryTotal>
103 <cbc:LineExtensionAmount currencyID="EUR">12.12</cbc:LineExtensionAmount>
104 <cbc:TaxExclusiveAmount currencyID="EUR">12.12</cbc:TaxExclusiveAmount>
105 <cbc:TaxInclusiveAmount currencyID="EUR">15.15</cbc:TaxInclusiveAmount>
106 <cbc:PayableAmount currencyID="EUR">15.15</cbc:PayableAmount>
107 </cac:LegalMonetaryTotal>
108 <cac:InvoiceLine>
109 <cbc:ID>1</cbc:ID>
110 <cbc:InvoicedQuantity unitCode="EA">100.000</cbc:InvoicedQuantity>
111 <cbc:LineExtensionAmount currencyID="EUR">12.12</cbc:LineExtensionAmount>
112 <cac:Item>
113 <cbc:Name>stavka 1</cbc:Name>
114 <cac:OriginCountry>
115 <cbc:IdentificationCode>HR</cbc:IdentificationCode>
116 </cac:OriginCountry>
117 <cac:ClassifiedTaxCategory>
118 <cbc:ID>S</cbc:ID>
119 <cbc:Percent>25</cbc:Percent>
120 <cac:TaxScheme>
121 <cbc:ID>VAT</cbc:ID>
122 </cac:TaxScheme>
123 </cac:ClassifiedTaxCategory>
124 </cac:Item>
125 <cac:Price>
126 <cbc:PriceAmount currencyID="EUR">0.1212</cbc:PriceAmount>
127 <cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
128 <cac:AllowanceCharge>
129 <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
130 <cbc:Amount currencyID="EUR">0.0022</cbc:Amount>
131 <cbc:BaseAmount currencyID="EUR">0.1234</cbc:BaseAmount>
132 </cac:AllowanceCharge>
133 </cac:Price>
134 </cac:InvoiceLine>
135</Invoice>`
136};
137
138
139const run = await client.actor("afkdigital/ubl-e-invoice-technical-validator").call(input);
140
141
142console.log('Results from dataset');
143console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
144const { items } = await client.dataset(run.defaultDatasetId).listItems();
145items.forEach((item) => {
146 console.dir(item);
147});
148
149