-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from MyParcelCOM/feature/customs
Feature/customs
- Loading branch information
Showing
17 changed files
with
1,211 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?php | ||
|
||
namespace MyParcelCom\Sdk\Resources; | ||
|
||
use MyParcelCom\Sdk\Resources\Interfaces\CustomsInterface; | ||
use MyParcelCom\Sdk\Resources\Interfaces\CustomsItemInterface; | ||
use MyParcelCom\Sdk\Resources\Traits\JsonSerializable; | ||
|
||
class Customs implements CustomsInterface | ||
{ | ||
use JsonSerializable; | ||
|
||
/** @var string */ | ||
private $contentType; | ||
/** @var string */ | ||
private $invoiceNumber; | ||
/** @var CustomsItemInterface[] */ | ||
private $items = []; | ||
/** @var string */ | ||
private $nonDelivery; | ||
/** @var string */ | ||
private $incoterm; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getContentType() | ||
{ | ||
return $this->contentType; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setContentType($contentType) | ||
{ | ||
$this->contentType = $contentType; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getInvoiceNumber() | ||
{ | ||
return $this->invoiceNumber; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setInvoiceNumber($invoiceNumber) | ||
{ | ||
$this->invoiceNumber = $invoiceNumber; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getItems() | ||
{ | ||
return $this->items; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function addItem(CustomsItemInterface $item) | ||
{ | ||
$this->items[] = $item; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setItems(array $items) | ||
{ | ||
$this->items = []; | ||
|
||
array_walk($items, function (CustomsItemInterface $item) { | ||
$this->addItem($item); | ||
}); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getNonDelivery() | ||
{ | ||
return $this->nonDelivery; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setNonDelivery($nonDelivery) | ||
{ | ||
$this->nonDelivery = $nonDelivery; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getIncoterm() | ||
{ | ||
return $this->incoterm; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setIncoterm($incoterm) | ||
{ | ||
$this->incoterm = $incoterm; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
<?php | ||
|
||
namespace MyParcelCom\Sdk\Resources; | ||
|
||
use MyParcelCom\Sdk\Resources\Interfaces\CustomsItemInterface; | ||
use MyParcelCom\Sdk\Resources\Traits\JsonSerializable; | ||
|
||
class CustomsItem implements CustomsItemInterface | ||
{ | ||
use JsonSerializable; | ||
|
||
const AMOUNT = 'amount'; | ||
const CURRENCY = 'currency'; | ||
|
||
/** @var string */ | ||
private $sku; | ||
/** @var string */ | ||
private $description; | ||
/** @var string */ | ||
private $hsCode; | ||
/** @var int */ | ||
private $quantity; | ||
/** @var array */ | ||
private $itemValue = [ | ||
self::AMOUNT => null, | ||
self::CURRENCY => null, | ||
]; | ||
/** @var string */ | ||
private $originCountryCode; | ||
|
||
/** | ||
* @param string $sku | ||
* @return $this | ||
*/ | ||
public function setSku($sku) | ||
{ | ||
$this->sku = $sku; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getSku() | ||
{ | ||
return $this->sku; | ||
} | ||
|
||
/** | ||
* @param string $description | ||
* @return $this | ||
*/ | ||
public function setDescription($description) | ||
{ | ||
$this->description = $description; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription() | ||
{ | ||
return $this->description; | ||
} | ||
|
||
/** | ||
* @param string $hsCode | ||
* @return $this | ||
*/ | ||
public function setHsCode($hsCode) | ||
{ | ||
$this->hsCode = $hsCode; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getHsCode() | ||
{ | ||
return $this->hsCode; | ||
} | ||
|
||
/** | ||
* @param int $quantity | ||
* @return $this | ||
*/ | ||
public function setQuantity($quantity) | ||
{ | ||
$this->quantity = (int)$quantity; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getQuantity() | ||
{ | ||
return $this->quantity; | ||
} | ||
|
||
/** | ||
* @param int $value | ||
* @return $this | ||
*/ | ||
public function setItemValue($value) | ||
{ | ||
$this->itemValue[self::AMOUNT] = (int)$value; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getItemValue() | ||
{ | ||
return $this->itemValue[self::AMOUNT]; | ||
} | ||
|
||
/** | ||
* @param string $currency | ||
* @return $this | ||
*/ | ||
public function setCurrency($currency) | ||
{ | ||
$this->itemValue[self::CURRENCY] = $currency; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCurrency() | ||
{ | ||
return $this->itemValue[self::CURRENCY]; | ||
} | ||
|
||
/** | ||
* @param string $countryCode | ||
* @return $this | ||
*/ | ||
public function setOriginCountryCode($countryCode) | ||
{ | ||
$this->originCountryCode = $countryCode; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getOriginCountryCode() | ||
{ | ||
return $this->originCountryCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.