diff --git a/src/CXml/Builder/OrderRequestBuilder.php b/src/CXml/Builder/OrderRequestBuilder.php index eb809eb..2f90709 100644 --- a/src/CXml/Builder/OrderRequestBuilder.php +++ b/src/CXml/Builder/OrderRequestBuilder.php @@ -15,6 +15,7 @@ use CXml\Model\Message\PunchOutOrderMessage; use CXml\Model\MoneyWrapper; use CXml\Model\MultilanguageString; +use CXml\Model\Phone; use CXml\Model\PostalAddress; use CXml\Model\Request\OrderRequest; use CXml\Model\Request\OrderRequestHeader; @@ -103,7 +104,7 @@ public function billTo( string $addressId = null, string $addressIdDomain = null, string $email = null, - string $phone = null, + Phone $phone = null, string $fax = null, string $url = null ): self { diff --git a/src/CXml/Model/Address.php b/src/CXml/Model/Address.php index 998d838..142c270 100644 --- a/src/CXml/Model/Address.php +++ b/src/CXml/Model/Address.php @@ -39,7 +39,7 @@ class Address * @Ser\SerializedName("Phone") * @Ser\XmlElement (cdata=false) */ - private ?string $phone = null; + private ?Phone $phone = null; /** * @Ser\SerializedName("Fax") @@ -53,7 +53,7 @@ class Address */ private ?string $url = null; - public function __construct(MultilanguageString $name, PostalAddress $postalAddress = null, string $addressId = null, string $addressIdDomain = null, string $email = null, string $phone = null, string $fax = null, string $url = null) + public function __construct(MultilanguageString $name, PostalAddress $postalAddress = null, string $addressId = null, string $addressIdDomain = null, string $email = null, Phone $phone = null, string $fax = null, string $url = null) { $this->addressId = $addressId; $this->addressIdDomain = $addressIdDomain; @@ -90,7 +90,7 @@ public function getEmail(): ?string return $this->email; } - public function getPhone(): ?string + public function getPhone(): ?Phone { return $this->phone; } diff --git a/src/CXml/Model/CountryCode.php b/src/CXml/Model/CountryCode.php new file mode 100644 index 0000000..662ea8a --- /dev/null +++ b/src/CXml/Model/CountryCode.php @@ -0,0 +1,35 @@ +isoCountryCode = $isoCountryCode; + $this->name = $name; + } + + public function getIsoCountryCode(): string + { + return $this->isoCountryCode; + } + + public function getName(): ?string + { + return $this->name; + } +} diff --git a/src/CXml/Model/Phone.php b/src/CXml/Model/Phone.php new file mode 100644 index 0000000..26612fa --- /dev/null +++ b/src/CXml/Model/Phone.php @@ -0,0 +1,36 @@ +telephoneNumber = $telephoneNumber; + $this->name = $name; + } + + public function getTelephoneNumber(): TelephoneNumber + { + return $this->telephoneNumber; + } + + public function getName(): ?string + { + return $this->name; + } +} diff --git a/src/CXml/Model/TelephoneNumber.php b/src/CXml/Model/TelephoneNumber.php new file mode 100644 index 0000000..301ead1 --- /dev/null +++ b/src/CXml/Model/TelephoneNumber.php @@ -0,0 +1,48 @@ +countryCode = $countryCode; + $this->areaOrCityCode = $areaOrCityCode; + $this->number = $number; + } + + public function getCountryCode(): CountryCode + { + return $this->countryCode; + } + + public function getAreaOrCityCode(): ?string + { + return $this->areaOrCityCode; + } + + public function getNumber(): ?string + { + return $this->number; + } +} diff --git a/tests/CXmlTest/Model/OrderRequestTest.php b/tests/CXmlTest/Model/OrderRequestTest.php index e87b6e7..0f366f4 100644 --- a/tests/CXmlTest/Model/OrderRequestTest.php +++ b/tests/CXmlTest/Model/OrderRequestTest.php @@ -8,6 +8,7 @@ use CXml\Model\Classification; use CXml\Model\Comment; use CXml\Model\Country; +use CXml\Model\CountryCode; use CXml\Model\Credential; use CXml\Model\Description; use CXml\Model\ItemDetail; @@ -16,11 +17,13 @@ use CXml\Model\MoneyWrapper; use CXml\Model\MultilanguageString; use CXml\Model\PayloadIdentity; +use CXml\Model\Phone; use CXml\Model\PostalAddress; use CXml\Model\Request\OrderRequest; use CXml\Model\Request\OrderRequestHeader; use CXml\Model\Request\Request; use CXml\Model\ShipTo; +use CXml\Model\TelephoneNumber; use CXml\Payload\PayloadIdentityFactoryInterface; use CXml\Serializer; use CXml\Validation\DtdValidator; @@ -75,6 +78,17 @@ public function testMinimumExample(): void 'CA', '90489', 'default' + ), + null, + null, + null, + new Phone( + new TelephoneNumber( + new CountryCode('US', '1'), + '800', + '5551212' + ), + 'personal' ) ) ), @@ -92,6 +106,17 @@ public function testMinimumExample(): void null, '42699', 'default' + ), + null, + null, + null, + new Phone( + new TelephoneNumber( + new CountryCode('DE', '49'), + '761', + '1234567' + ), + 'company' ) ) ), diff --git a/tests/CXmlTest/Model/PunchOutSetupRequestTest.php b/tests/CXmlTest/Model/PunchOutSetupRequestTest.php index 17bd209..6a3b138 100644 --- a/tests/CXmlTest/Model/PunchOutSetupRequestTest.php +++ b/tests/CXmlTest/Model/PunchOutSetupRequestTest.php @@ -6,6 +6,7 @@ use CXml\Model\Address; use CXml\Model\Classification; use CXml\Model\Country; +use CXml\Model\CountryCode; use CXml\Model\Credential; use CXml\Model\Description; use CXml\Model\Extrinsic; @@ -15,10 +16,12 @@ use CXml\Model\MoneyWrapper; use CXml\Model\MultilanguageString; use CXml\Model\PayloadIdentity; +use CXml\Model\Phone; use CXml\Model\PostalAddress; use CXml\Model\Request\PunchOutSetupRequest; use CXml\Model\SelectedItem; use CXml\Model\ShipTo; +use CXml\Model\TelephoneNumber; use CXml\Payload\PayloadIdentityFactoryInterface; use CXml\Serializer; use CXml\Validation\DtdValidator; @@ -75,6 +78,17 @@ public function testMinimumExample(): void 'CA', '90489', 'default' + ), + null, + null, + null, + new Phone( + new TelephoneNumber( + new CountryCode('US', '1'), + '800', + '5551212' + ), + 'personal' ) ) ), diff --git a/tests/CXmlTest/Model/QuoteMessageTest.php b/tests/CXmlTest/Model/QuoteMessageTest.php index 7a4ade6..af0ea7d 100644 --- a/tests/CXmlTest/Model/QuoteMessageTest.php +++ b/tests/CXmlTest/Model/QuoteMessageTest.php @@ -6,6 +6,7 @@ use CXml\Model\Address; use CXml\Model\Contact; use CXml\Model\Country; +use CXml\Model\CountryCode; use CXml\Model\Credential; use CXml\Model\Message\QuoteMessage; use CXml\Model\Message\QuoteMessageHeader; @@ -13,8 +14,10 @@ use CXml\Model\MultilanguageString; use CXml\Model\OrganizationId; use CXml\Model\PayloadIdentity; +use CXml\Model\Phone; use CXml\Model\PostalAddress; use CXml\Model\ShipTo; +use CXml\Model\TelephoneNumber; use CXml\Payload\PayloadIdentityFactoryInterface; use CXml\Serializer; use CXml\Validation\DtdValidator; @@ -83,6 +86,17 @@ public function testMinimumExample(): void null, 'CA', '90489' + ), + null, + null, + null, + new Phone( + new TelephoneNumber( + new CountryCode('US', '1'), + '800', + '1234567' + ), + 'company' ) ) ); diff --git a/tests/metadata/cxml/samples/OrderRequest.xml b/tests/metadata/cxml/samples/OrderRequest.xml index 28e1f81..d2e99df 100644 --- a/tests/metadata/cxml/samples/OrderRequest.xml +++ b/tests/metadata/cxml/samples/OrderRequest.xml @@ -41,6 +41,13 @@ 90489 United States + + + 1 + 800 + 5551212 + + @@ -52,6 +59,13 @@ 42699 Deutschland + + + 49 + 761 + 1234567 + + diff --git a/tests/metadata/cxml/samples/PunchOutSetupRequest.xml b/tests/metadata/cxml/samples/PunchOutSetupRequest.xml index 15e7bf9..c891602 100644 --- a/tests/metadata/cxml/samples/PunchOutSetupRequest.xml +++ b/tests/metadata/cxml/samples/PunchOutSetupRequest.xml @@ -42,6 +42,13 @@ 90489 United States + + + 1 + 800 + 5551212 + + diff --git a/tests/metadata/cxml/samples/QuoteMessage.xml b/tests/metadata/cxml/samples/QuoteMessage.xml index ae82cf6..4c46a26 100644 --- a/tests/metadata/cxml/samples/QuoteMessage.xml +++ b/tests/metadata/cxml/samples/QuoteMessage.xml @@ -45,6 +45,13 @@ 90489 United States + + + 1 + 800 + 1234567 + +