mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-26 22:50:29 +01:00
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Xentral\Modules\AmazonVendorDF\Data;
|
|
|
|
class ShippingLabelRequest
|
|
{
|
|
/** @var string */
|
|
protected $purchaseOrderNumber;
|
|
/** @var SellingParty */
|
|
protected $sellingParty;
|
|
/** @var Warehouse */
|
|
protected $warehouse;
|
|
/** @var array|Container[] */
|
|
protected $containers = [];
|
|
|
|
public function __construct(string $purchaseOrderNumber, SellingParty $sellingParty, Warehouse $warehouse)
|
|
{
|
|
$this->purchaseOrderNumber = $purchaseOrderNumber;
|
|
$this->sellingParty = $sellingParty;
|
|
$this->warehouse = $warehouse;
|
|
}
|
|
|
|
public function addContainer(Container $container)
|
|
{
|
|
$this->containers[] = $container;
|
|
}
|
|
|
|
public function toArray()
|
|
{
|
|
return [
|
|
'purchaseOrderNumber' => $this->purchaseOrderNumber,
|
|
'sellingParty' => [
|
|
'partyId' => $this->sellingParty->getPartyId()
|
|
],
|
|
'shipFromParty' => [
|
|
'partyId' => $this->warehouse->getWarehouseId()
|
|
],
|
|
'containers' => array_map(
|
|
function (Container $container) {
|
|
return $container->toArray();
|
|
},
|
|
$this->containers
|
|
),
|
|
];
|
|
}
|
|
}
|