1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Genkgo\Camt\Decoder\Factory\DTO; |
6
|
|
|
|
7
|
|
|
use Genkgo\Camt\DTO; |
8
|
|
|
use SimpleXMLElement; |
9
|
|
|
|
10
|
|
|
class OrganisationIdentification |
11
|
|
|
{ |
12
|
|
|
use Behavior\Mapping; |
13
|
|
|
|
14
|
23 |
|
public static function createFromXml(SimpleXMLElement $xmlOrganisationIdentification): DTO\OrganisationIdentification |
15
|
|
|
{ |
16
|
|
|
$mapping = [ |
17
|
23 |
|
['setter' => 'setBic', 'value' => 'BIC'], |
18
|
|
|
['setter' => 'setBic', 'value' => 'BICOrBEI'], |
19
|
|
|
['setter' => 'setBic', 'value' => 'AnyBIC'], |
20
|
|
|
['setter' => 'setBei', 'value' => 'BICOrBEI'], |
21
|
|
|
['setter' => 'setIbei', 'value' => 'IBEI'], |
22
|
|
|
['setter' => 'setBei', 'value' => 'BEI'], |
23
|
|
|
['setter' => 'setEangln', 'value' => 'EANGLN'], |
24
|
|
|
['setter' => 'setChipsUniversalId', 'value' => 'USCHU'], |
25
|
|
|
['setter' => 'setDuns', 'value' => 'DUNS'], |
26
|
|
|
['setter' => 'setBankPartyId', 'value' => 'BkPtyId'], |
27
|
|
|
['setter' => 'setTaxId', 'value' => 'TaxIdNb'], |
28
|
|
|
]; |
29
|
|
|
|
30
|
23 |
|
$organisationIdentification = new DTO\OrganisationIdentification(); |
31
|
|
|
|
32
|
23 |
|
static::map($organisationIdentification, $xmlOrganisationIdentification, $mapping); |
33
|
|
|
|
34
|
23 |
|
if (isset($xmlOrganisationIdentification->PrtryId)) { |
35
|
4 |
|
$other = $xmlOrganisationIdentification->PrtryId; |
36
|
|
|
} |
37
|
23 |
|
if (isset($xmlOrganisationIdentification->Othr)) { |
38
|
22 |
|
$other = $xmlOrganisationIdentification->Othr; |
39
|
|
|
} |
40
|
|
|
|
41
|
23 |
|
if (isset($other)) { |
42
|
23 |
|
if (isset($other->Id)) { |
43
|
23 |
|
$organisationIdentification->setOtherId( |
44
|
23 |
|
(string) $other->Id |
45
|
|
|
); |
46
|
|
|
} |
47
|
23 |
|
if (isset($other->Issr)) { |
48
|
23 |
|
$organisationIdentification->setOtherIssuer( |
49
|
23 |
|
(string) $other->Issr |
50
|
|
|
); |
51
|
|
|
} |
52
|
23 |
|
if (isset($other->Tp)) { |
53
|
|
|
$organisationIdentification->setOtherType( |
54
|
|
|
(string) $other->Tp |
55
|
|
|
); |
56
|
|
|
} |
57
|
23 |
|
if (isset($other->SchmeNm)) { |
|
|
|
|
58
|
|
|
$organisationIdentification->setOtherSchemeName( |
59
|
|
|
(string) $other->SchmeNm |
60
|
|
|
); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
64
|
23 |
|
return $organisationIdentification; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|