diff --git a/src/Address.php b/src/Address.php index 6682477..63bb28e 100644 --- a/src/Address.php +++ b/src/Address.php @@ -43,13 +43,13 @@ public function getName(): string return $this->name; } - public function setPhone(string $phone): self + public function setPhone(?string $phone): self { $this->phone = $phone; return $this; } - public function getPhone(): string + public function getPhone(): ?string { return $this->phone; } diff --git a/src/Client.php b/src/Client.php index eba2639..8f8f4f0 100644 --- a/src/Client.php +++ b/src/Client.php @@ -34,7 +34,7 @@ public function __construct(string $username, string $password) /** * returned object structure: - * + * * object(stdClass)#11 (4) { * ["partner"]=> "string" * ["provider"]=> "string, example: EEPOST" @@ -79,7 +79,9 @@ public function createShipment(Parcel $parcel): stdClass if ($parcel->hasServices()) { $writer->startElement('add_service'); foreach ($parcel->getServices() as $service) { - $writer->writeElement('option', $service->getValue()); + $writer->startElement('option'); + $writer->writeAttribute('code', $service->getValue()); + $writer->endElement(); } $writer->endElement(); } @@ -90,8 +92,13 @@ public function createShipment(Parcel $parcel): stdClass if ($parcel->getCodAmount()) { $writer->startElement('monetary_values'); - $writer->writeElement('item_value', $parcel->getCodAmount()); - $writer->endDocument(); + + $writer->startElement('values'); + $writer->writeAttribute('code', 'item_value'); + $writer->writeAttribute('amount', $parcel->getCodAmount()); + $writer->endElement(); + + $writer->endElement(); $writer->writeElement('account', $parcel->getBankAccount()); } @@ -165,10 +172,10 @@ public function createShipment(Parcel $parcel): stdClass new SoapVar($writer->outputMemory(), XSD_ANYXML) ); } - + /** * response structure - * + * * object(stdClass)#8 (3) { * ["partner"]=> "string" * ["failedAddressCards"]=> object(stdClass)#9 (0) {}