Skip to content

Commit

Permalink
Ares: ADIS set vat_payer = null if does not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
h4kuna committed Oct 9, 2023
1 parent 618894a commit d9cd391
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
14 changes: 8 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ Přidal jsem ADIS, služba která ověří zda se jedná o plátce DPH, identifi

### Chování validace pomocí ADIS

| | ARES | ADIS (Data::$adis::$exists) | Data::$vat_payer | Data::$tin | Spolehlivý plátce DPH Data::$adis::$reliable |
|----------------------|-----------|-----------------------------|------------------|------------|----------------------------------------------|
| Plátce DPH | vrací DIČ | Existuje (true) | true | vyplněno | true/false |
| Skupinové DPH | vrátí DIČ | Neexistuje (false) | true | null | null |
| Identifikovaná osoba | vrátí DIČ | Existuje (true) | false | vyplněno | null |
| neplátce | null | null | false | null | null |
| | ARES | ADIS (Data::$adis::$exists) | Data::$vat_payer | Data::$tin | Spolehlivý plátce DPH Data::$adis::$reliable |
|-------------------------------------|-----------|-----------------------------|------------------|------------|----------------------------------------------|
| Plátce DPH | vrací DIČ | Existuje (true) | true | vyplněno | true/false |
| Skupinové DPH / již není plátce DPH | vrátí DIČ | Neexistuje (false) | null * | null | null |
| Identifikovaná osoba | vrátí DIČ | Existuje (true) | false | vyplněno | null |
| neplátce | null | null | false | null | null |

> * Nelze určit, zda se jedná o Skupinové DPH nebo společnost již není plátce DPH
# v2.0.0

Expand Down
3 changes: 2 additions & 1 deletion src/Ares/Core/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Data implements JsonSerializable, Stringable
*/
public ?string $tin;

public bool $vat_payer;
public ?bool $vat_payer;

public ?string $zip;

Expand Down Expand Up @@ -74,6 +74,7 @@ public function setAdis(Subject $adis): void
$this->vat_payer = $adis->isVatPayer;
$this->tin = $adis->tin;
} else {
$this->vat_payer = null;
$this->tin = null;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/ares/02445344.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"house_number": "682\/34a",
"street": "K\u0159i\u017e\u00edkova",
"tin": null,
"vat_payer": true,
"vat_payer": null,
"zip": "18600",
"country": "\u010cesk\u00e1 republika",
"country_code": "CZ",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/ares/49240901.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"house_number": "1716\/2b",
"street": "Hv\u011bzdova",
"tin": null,
"vat_payer": true,
"vat_payer": null,
"zip": "14000",
"country": "\u010cesk\u00e1 republika",
"country_code": "CZ",
Expand Down
2 changes: 1 addition & 1 deletion tests/src/E2E/Ares/CoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testGroupVAT(): void
$in = '2319918';
$data = (new Ares\AresFactory())->create()->loadBasic($in);
Assert::null($data->tin);
Assert::true($data->vat_payer);
Assert::null($data->vat_payer);
}


Expand Down

0 comments on commit d9cd391

Please sign in to comment.