CleverIT / UBL_invoice

MIT License
36 stars 39 forks source link

company taxScheme validation error #16

Closed boflor closed 5 years ago

boflor commented 5 years ago

It would appear that the company taxscheme is returning errors. The Party.php xmlSerialize function seems to generate an incorrect xml.

The validation passes when changing the code on line 162 from

        if($this->taxScheme){
            $writer->write([
                Schema::CAC.'PartyTaxScheme' => [
                    Schema::CBC.'CompanyID' => $this->companyId,
                    Schema::CAC.'TaxScheme' => [Schema::CAC.'ID' => $this->taxScheme]
                ],
            ]);
        }

to:

        if($this->taxScheme){
            $writer->write([
                Schema::CAC.'PartyTaxScheme' => [
                    Schema::CBC.'CompanyID' => $this->companyId,
                    Schema::CAC.'TaxScheme' => $this->taxScheme
                ],
            ]);
        }

The wrong xml shows:

    <cac:TaxScheme>
     <cac:ID>
      <cbc:ID>0</cbc:ID>
     </cac:ID>
    </cac:TaxScheme>

The correct XML shows

    <cac:TaxScheme>
     <cbc:ID>0</cbc:ID>
    </cac:TaxScheme>
Stormyy commented 5 years ago

Should be fixed at version v1.2.0