Skip to content

Commit 7bcfb44

Browse files
committed
Adis: rtrim address->castObce
1 parent f3f7462 commit 7bcfb44

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

src/Adis/StatusBusinessSubjects/StatusBusinessSubjectsTransformer.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,22 @@ public function transform(stdClass $data): Subject
1313

1414
$exists = $data->$attributes->typSubjektu !== 'NENALEZEN';
1515
$isVatPayer = $data->$attributes->typSubjektu === 'PLATCE_DPH';
16+
$address = null;
17+
if (isset($data->adresa)) {
18+
$address = $data->adresa;
19+
if (isset($address->castObce)) {
20+
$address->castObce = rtrim($address->castObce);
21+
}
22+
}
23+
1624
return new Subject(
1725
$exists,
1826
$data->$attributes->typSubjektu,
1927
$data->$attributes->dic,
2028
$exists && $isVatPayer ? $data->$attributes->nespolehlivyPlatce !== 'ANO' : null,
2129
$isVatPayer,
2230
$data->$attributes->cisloFu ?? '',
23-
$data->adresa ?? null
31+
$address
2432
);
2533
}
2634
}

tests/fixtures/adis/CZ27082440.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"taxOfficeNumber": "13",
88
"address": {
99
"uliceCislo": "Jankovcova 1522\/53",
10-
"castObce": "HOLE\u0160OVICE (PRAHA 7) ",
10+
"castObce": "HOLE\u0160OVICE (PRAHA 7)",
1111
"mesto": "PRAHA 7",
1212
"psc": "17000",
1313
"stat": "\u010cesk\u00e1 republika"

tests/fixtures/adis/CZ27445798.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"taxOfficeNumber": "451",
88
"address": {
99
"uliceCislo": "Var\u0161avsk\u00e1 715\/36",
10-
"castObce": "VINOHRADY (PRAHA 2) ",
10+
"castObce": "VINOHRADY (PRAHA 2)",
1111
"mesto": "PRAHA 2",
1212
"psc": "12000",
1313
"stat": "\u010cesk\u00e1 republika"

tests/fixtures/adis/CZ8612301071.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"taxOfficeNumber": "452",
88
"address": {
99
"uliceCislo": "Dubov\u00e1 765",
10-
"castObce": "DOLN\u00cd BOUSOV ",
10+
"castObce": "DOLN\u00cd BOUSOV",
1111
"mesto": "DOLN\u00cd BOUSOV",
1212
"psc": "29404",
1313
"stat": "\u010cesk\u00e1 republika"

tests/fixtures/adis/CZ8702080024.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"taxOfficeNumber": "452",
88
"address": {
99
"uliceCislo": "Na Dlaskov\u011b 94",
10-
"castObce": "BRTNICE ",
10+
"castObce": "BRTNICE",
1111
"mesto": "VELK\u00c9 POPOVICE",
1212
"psc": "25169",
1313
"stat": "\u010cesk\u00e1 republika"
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)