Spoje-NET / php-abraflexi

PHP Library for easy interaction with economic system AbraFlexi.
MIT License
24 stars 7 forks source link

FakturaVydana::odpocetZalohy method does not work #18

Closed petaak closed 3 years ago

petaak commented 3 years ago

After updating from v2.1 to v2.11 the FakturaVydana::odpocetZalohy method does not work properly.

In the 2.1 version you send the eet section as follows:

{
...
         "eetDicPoverujiciho":"",
         "eetFik":"",
         "eetPkp":"",
         "eetBkp":"",
         "eetPokladniZarizeni":"",
         "eetProvozovna":"",
         "eetStavK":"",
         "eetTypK":"",
         "eetDatCasTrzby":"",
...
}

But in the 2.11 version the request is different for the same invoice:

{
...
         "eetDicPoverujiciho":"",
         "eetFik":"",
         "eetPkp":"",
         "eetBkp":"",
         "eetPokladniZarizeni":"",
         "eetProvozovna":0,
         "eetStavK":"",
         "eetTypK":"",
         "eetDatCasTrzby":null,
...
}

The null value of the eetDatCasTrzby property leeds to the following error:

{
   "winstrom":{
      "@version":"1.0",
      "success":"false",
      "stats":{
         "created":"0",
         "updated":"0",
         "deleted":"0",
         "skipped":"0",
         "failed":"1"
      },
      "results":[
         {
            "request-id":"45837",
            "errors":[
               {
                  "message":"Zadaný text 'null' musí být datum [21/05/2316]",
                  "for":"eetDatCasTrzby",
                  "path":"faktura-vydana[id=45837].eetDatCasTrzby",
                  "value":"null",
                  "code":"PROP"
               }
            ]
         }
      ]
   }
}

I think the best way to fix this issue would be to send only the relevant data i.e. the invoice identifier and the 'odpocty-zaloh' section.