Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?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
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user