-
Notifications
You must be signed in to change notification settings - Fork 2
/
deserialize.php
169 lines (164 loc) · 6.24 KB
/
deserialize.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
include 'vendor/autoload.php';
//Deserialize UBL Invoice
$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
<cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>
<cbc:ProfileID>urn:fdc:peppol.eu:2017</cbc:ProfileID>
<cbc:ID>1234</cbc:ID>
<cbc:IssueDate>2022-01-17</cbc:IssueDate>
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
<cbc:Note>invoice note</cbc:Note>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cbc:AccountingCost>4217:2323:2323</cbc:AccountingCost>
<cbc:BuyerReference>BUYER_REF</cbc:BuyerReference>
<cac:InvoicePeriod>
<cbc:StartDate>2022-01-17</cbc:StartDate>
</cac:InvoicePeriod>
<cac:OrderReference>
<cbc:ID>5009567</cbc:ID>
<cbc:SalesOrderID>tRST-tKhM</cbc:SalesOrderID>
</cac:OrderReference>
<cac:AccountingSupplierParty>
` <cac:Party>
<cbc:EndpointID schemeID="0007">7300010000001</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID>99887766</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>PonderSource</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>Lisk Center Utreht</cbc:StreetName>
<cbc:AdditionalStreetName>De Burren</cbc:AdditionalStreetName>
<cbc:CityName>Utreht</cbc:CityName>
<cbc:PostalZone>3521</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>NL</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>NL123456789</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>PonderSource</cbc:RegistrationName>
<cbc:CompanyID>NL123456789</cbc:CompanyID>
</cac:PartyLegalEntity>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="0002">7300010000002</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID>9988217</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>Client Company Name</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>Lisk Center Utreht</cbc:StreetName>
<cbc:AdditionalStreetName>De Burren</cbc:AdditionalStreetName>
<cbc:CityName>Utreht</cbc:CityName>
<cbc:PostalZone>3521</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>NL</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>BE123456789</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>Client Company Name</cbc:RegistrationName>
<cbc:CompanyID>Client Company Registration</cbc:CompanyID>
</cac:PartyLegalEntity>
<cac:Contact>
<cbc:Name>Client name</cbc:Name>
<cbc:Telephone>908-99-74-74</cbc:Telephone>
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cbc:ActualDeliveryDate>2022-02-07</cbc:ActualDeliveryDate>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Delivery street 2</cbc:StreetName>
<cbc:AdditionalStreetName>Building 56</cbc:AdditionalStreetName>
<cbc:CityName>Utreht</cbc:CityName>
<cbc:PostalZone>3521</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>NL</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode>31</cbc:PaymentMeansCode>
<cbc:PaymentID>our invoice 1234</cbc:PaymentID>
<cac:PayeeFinancialAccount>
<cbc:ID>NL00RABO0000000000</cbc:ID>
<cbc:Name>Customer Account Holder</cbc:Name>
<cac:FinancialInstitutionBranch>
<cbc:ID>RABONL2U</cbc:ID>
</cac:FinancialInstitutionBranch>
</cac:PayeeFinancialAccount>
</cac:PaymentMeans>
<cac:PaymentTerms>
<cbc:Note>30 days net</cbc:Note>
</cac:PaymentTerms>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="EUR">2.10</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="EUR">10.00</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="EUR">2.10</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>21.00</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="EUR">10.00</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="EUR">10.00</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="EUR">12.10</cbc:TaxInclusiveAmount>
<cbc:AllowanceTotalAmount currencyID="EUR">0.00</cbc:AllowanceTotalAmount>
<cbc:PayableAmount currencyID="EUR">12.10</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>0</cbc:ID>
<cbc:InvoicedQuantity unitCode="C62">1.00</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">10.00</cbc:LineExtensionAmount>
<cac:InvoicePeriod>
<cbc:StartDate>2022-02-07</cbc:StartDate>
</cac:InvoicePeriod>
<cac:Item>
<cbc:Description>Product Description</cbc:Description>
<cbc:Name>Product Name</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>21.00</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="EUR">10.00</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="C62">1.00</cbc:BaseQuantity>
</cac:Price>
</cac:InvoiceLine>
</Invoice>
XML;
$des = new Pondersource\Invoice\DeserializeInvoice;
$res = $des->deserializeXML($xml);
var_dump($res);
exit;