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 a35c2c5 commit 25c9928
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/CorreosConnector/CorreosConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class CorreosConnector
const CANCEL_STATUS_CODES = [
'67' => 'The item has not been pre-registered',
'66' => 'The item has already been cancelled.',
'65' => 'The item has already been admitted.'
'65' => 'The item has already been admitted.',
'197' => 'The client and the contract do not belong to the user requesting the operation.'
];

/**
Expand Down Expand Up @@ -97,12 +98,12 @@ public function createShipment(Shipment $shipment): Shipment
* @return string
* @throws CorreosException
*/
public function printLabel(string $trackNumber, \DateTime $shipDateRequest): string
public function printLabel(string $trackNumber, \DateTime $shipDateRequest = null): string
{
$documentationService = new Solicitud($this->correosConfig->getOptions());

$labelData = new SolicitudEtiqueta(
$shipDateRequest->format('d-m-y H:i:s'),
!empty($shipDateRequest) ? $shipDateRequest->format('d-m-y H:i:s') : null,
$this->correosConfig->getClientCode(),
$this->correosConfig->getClientContractNumber(),
$this->correosConfig->getClientNumber(),
Expand Down
4 changes: 2 additions & 2 deletions tests/CreateShipmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ public function testFailShipmentException()
$sendingInsides = new SendingInsides(
SendingInsides::GOODS_CONTENT_TYPE, // GOODS,
SendingInsides::YES_CHOICE, // Y
$totalPrice > 50000 ? SendingInsides::YES_CHOICE : null,
SendingInsides::YES_CHOICE,
$productList,
$totalPrice > 50000 ? SendingInsides::NO_CHOICE : null
SendingInsides::NO_CHOICE
);

$packageSize = new PackageSize(
Expand Down
7 changes: 6 additions & 1 deletion tests/PrintLabelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public function testPrinting()

$dateTime = $invoice->getDateRequest();

$labelPdfByteCode = $this->client->printLabel($trackNumber, $dateTime);
$dateTime = new \DateTime('tomorrow');

$labelPdfByteCode = $this->client->printLabel($trackNumber, null);


$this->assertTrue(strlen($labelPdfByteCode) > 3);

Expand All @@ -41,6 +44,8 @@ public function testfailedPrinting()

$dateTime = $shipment->getDateRequest();

$dateTime = new \DateTime('tomorrow');

$labelPdfByteCode = $this->client->printLabel($trackNumber, $dateTime);

$this->assertTrue(strlen($labelPdfByteCode) > 3);
Expand Down

0 comments on commit 25c9928

Please sign in to comment.