Skip to content

Commit

Permalink
Added more tests for UBL to CII
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Nov 8, 2024
1 parent 0687486 commit 631fec5
Show file tree
Hide file tree
Showing 5 changed files with 774 additions and 2 deletions.
1 change: 1 addition & 0 deletions build/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<file>../tests/testcases/CiiToUblTechnical4Test.php</file>
<file>../tests/testcases/CiiToUblTechnical5Test.php</file>
<file>../tests/testcases/UblToCiiSimpleTest.php</file>
<file>../tests/testcases/UblToCiiSimple2Test.php</file>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
Expand Down
13 changes: 11 additions & 2 deletions src/XmlConverterUblToCii.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ function ($invoiceLineNoteNode) {
$this->destination->endElement();

$this->destination->startElement('ram:SpecifiedTradeProduct');
$this->destination->elementWithAttribute('ram:GlobalID', $this->source->queryValue('./cac:Item/cac:StandardItemIdentification/cbc:ID', $invoiceLineNode), 'schemeID', $this->source->queryValue('./cac:Item/cac:StandardItemIdentification/cbc:ID/@schemeID', $invoiceLineNode));
$this->destination->element('ram:SellerAssignedID', $this->source->queryValue('./cac:Item/cac:SellersItemIdentification/cbc:ID', $invoiceLineNode));
$this->destination->element('ram:BuyerAssignedID', $this->source->queryValue('./cac:Item/cac:BuyersItemIdentification/cbc:ID', $invoiceLineNode));
$this->destination->elementWithAttribute('ram:GlobalID', $this->source->queryValue('./cac:Item/cac:StandardItemIdentification/cbc:ID', $invoiceLineNode), 'schemeID', $this->source->queryValue('./cac:Item/cac:StandardItemIdentification/cbc:ID/@schemeID', $invoiceLineNode));
$this->destination->element('ram:Name', $this->source->queryValue('./cac:Item/cbc:Name', $invoiceLineNode));
$this->destination->element('ram:Description', $this->source->queryValue('./cac:Item/cbc:Description', $invoiceLineNode));

Expand Down Expand Up @@ -717,7 +717,16 @@ function ($contractReferenceDocumenntNode) {
function ($additionalDocumentReferenceNode) {
$this->destination->startElement('ram:AdditionalReferencedDocument');
$this->destination->element('ram:IssuerAssignedID', $this->source->queryValue('./cbc:ID', $additionalDocumentReferenceNode));
$this->destination->element('ram:TypeCode', '916');
$this->source->whenExists(
'./cbc:DocumentTypeCode',
$additionalDocumentReferenceNode,
function ($docTypeCodeNode) {
$this->destination->element('ram:TypeCode', $docTypeCodeNode->nodeValue);
},
function () {
$this->destination->element('ram:TypeCode', '916');
}
);
$this->destination->element('ram:Name', $this->source->queryValue('./cbc:DocumentDescription', $additionalDocumentReferenceNode));
$this->source->whenExists(
'./cac:Attachment/cbc:EmbeddedDocumentBinaryObject',
Expand Down
Loading

0 comments on commit 631fec5

Please sign in to comment.