Skip to content

Commit

Permalink
sender email required param
Browse files Browse the repository at this point in the history
  • Loading branch information
aahmetgaliev committed Sep 5, 2019
1 parent 335409f commit 00d0808
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/CorreosConnector/CorreosConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(CorreosConfig $correosConfig, SenderUnitedIdentity $
* @return Shipment
* @throws CorreosException
*/
public function createShipment(Shipment $invoice): Shipment
public function createShipment(Shipment $shipment): Shipment
{

try {
Expand All @@ -68,27 +68,27 @@ public function createShipment(Shipment $invoice): Shipment
CorreosConfig::TOTAL_BULTOS,
self::XML_TYPE_REQUEST,
$this->senderUnitedIdentity->buildSenderIdentity(),
$invoice->getReceiverUnitedIdentity()->buildReceiverIdentity(),
$invoice->getSendingContent()->buildSendingContent(),
$shipment->getReceiverUnitedIdentity()->buildReceiverIdentity(),
$shipment->getSendingContent()->buildSendingContent(),
null,
null,
null
);
$response = $createOptions->PreRegistro($registerData); // SOAP REQUEST

$invoice->setResponse($response);

} catch (InvalidArgumentException $exception) {
throw new CorreosException($exception->getMessage() . " _ " . $exception->getTraceAsString(), $exception->getCode(), $exception->getPrevious());
}

$this->checkMethodException($response);

$invoice->setTrackNumber($response->CodExpedicion);
$shipment->setResponse($response);

$invoice->setDateRequest(new \DateTime($response->FechaRespuesta));
$shipment->setTrackNumber($response->CodExpedicion);

return $invoice;
$shipment->setDateRequest(new \DateTime($response->FechaRespuesta));

return $shipment;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Factories/ReceiverUnitedIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public function __construct(
Identification $receiverIdentity,
string $internationalPostcode,
string $countryISO,
string $receiverEmail,
string $postcode = null,
string $receiverPhone = null,
string $receiverEmail = null,
string $isInternationalPostBox = null,
string $spanishPostBoxNumber = null,
Sms $sms = null
Expand Down
4 changes: 0 additions & 4 deletions tests/CreateShipmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public function testCreateShipmentException()
$receiverIdentity,
"423",
"RU",
null,
"89274269594",
"[email protected]"
);

Expand Down Expand Up @@ -115,9 +113,7 @@ public function testFailShipmentException()
$receiverAddress,
$receiverIdentity,
"42300", // must be less than < 6
"423000",
"RU",
"89274269594",
"[email protected]"
);

Expand Down
4 changes: 2 additions & 2 deletions tests/InitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ protected function createShipment() : Shipment
$receiverIdentity,
"48059", // must be less than < 6
"US",
"[email protected]",
null,
"89274269594",
"[email protected]"
null
);

$product = new ProductDescription(
Expand Down

0 comments on commit 00d0808

Please sign in to comment.