Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from Adiconquerors/master
Browse files Browse the repository at this point in the history
New Nodes Implemented
  • Loading branch information
alex-LE authored May 20, 2022
2 parents 1f414e0 + dd362c6 commit a069b1d
Show file tree
Hide file tree
Showing 12 changed files with 777 additions and 1 deletion.
102 changes: 102 additions & 0 deletions src/ExportDeclaration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
namespace alexLE\DHLExpress;


class ExportDeclaration extends DataClass {

/**
* @var ExportLineItems
*/
protected $exportLineItems;

/**
* @var OtherCharges
*/
protected $otherCharges;

/**
* @var string
*/
protected $invoiceDate;

/**
* @var string
*/
protected $invoiceNumber;

/**
* @return ExportLineItems
*/
public function getExportLineItems() {
return $this->exportLineItems;
}

/**
* @param ExportLineItems $contact
* @return ExportDeclaration
*/
public function setExportLineItems(ExportLineItems $exportLineItems) {
$this->exportLineItems = $exportLineItems;
return $this;
}

/**
* @return string
*/
public function getInvoiceNumber() {
return $this->invoiceNumber;
}

/**
* @param string $invoiceNumber
* @return ExportLineItems
*/
public function setInvoiceNumber($invoiceNumber) {
$this->invoiceNumber = $invoiceNumber;
return $this;
}

/**
* @return string
*/
public function getInvoiceDate() {
return $this->invoiceDate;
}

/**
* @param string $invoiceDate
* @return ExportLineItems
*/
public function setInvoiceDate($invoiceDate) {
$this->invoiceDate = $invoiceDate;
return $this;
}

/**
* @return string
*/
public function getOtherCharges() {
return $this->otherCharges;
}

/**
* @param string $invoiceDate
* @return ExportLineItems
*/
public function setOtherCharges(OtherCharges $otherCharges) {
$this->otherCharges = $otherCharges;
return $this;
}

/**
* @return array
*/
public function buildData() {
return [
'ExportLineItems' => $this->exportLineItems->buildData(),
'InvoiceDate' => $this->invoiceDate,
'InvoiceNumber' => $this->invoiceNumber,
'OtherCharges' => $this->otherCharges->buildData(),
];
}
}
194 changes: 194 additions & 0 deletions src/ExportLineItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
<?php
namespace alexLE\DHLExpress;


class ExportLineItem extends DataClass {

/**
* @var string
*/
protected $itemNumber;

/**
* @var string
*/
protected $quantity;

/**
* @var string
*/
protected $quantityUnitOfMeasurement;

/**
* @var string
*/
protected $itemDescription;

/**
* @var string
*/
protected $unitPrice;

/**
* @var number
*/
protected $netWeight;

/**
* @var number
*/
protected $grossWeight;

/**
* @var string
*/
protected $manufacturingCountryCode;

/**
* @return string
*/
public function getItemNumber() {
return $this->itemNumber;
}

/**
* @param string $itemNumber
* @return ExportLineItem
*/
public function setItemNumber($itemNumber) {
$this->itemNumber = $itemNumber;
return $this;
}

/**
* @return string
*/
public function getQuantity() {
return $this->companyName;
}

/**
* @param string $quantity
* @return ExportLineItem
*/
public function setQuantity($quantity) {
$this->quantity = $quantity;
return $this;
}

/**
* @return string
*/
public function getQuantityUnitOfMeasurement() {
return $this->quantityUnitOfMeasurement;
}

/**
* @param string $quantityUnitOfMeasurement
* @return ExportLineItem
*/
public function setQuantityUnitOfMeasurement($quantityUnitOfMeasurement) {
$this->quantityUnitOfMeasurement = $quantityUnitOfMeasurement;
return $this;
}

/**
* @return string
*/
public function getItemDescription() {
return $this->itemDescription;
}

/**
* @param string $itemDescription
* @return ExportLineItem
*/
public function setItemDescription($itemDescription) {
$this->itemDescription = $itemDescription;
return $this;
}

/**
* @return string
*/
public function getUnitPrice() {
return $this->unitPrice;
}

/**
* @param string $unitPrice
* @return ExportLineItem
*/
public function setUnitPrice($unitPrice) {
$this->unitPrice = $unitPrice;
return $this;
}

/**
* @return string
*/
public function getNetWeight() {
return $this->netWeight;
}

/**
* @param string $netWeight
* @return ExportLineItem
*/
public function setNetWeight($netWeight) {
$this->netWeight = $netWeight;
return $this;
}

/**
* @return string
*/
public function getGrossWeight() {
return $this->grossWeight;
}

/**
* @param string $grossWeight
* @return ExportLineItem
*/
public function setGrossWeight($grossWeight) {
$this->grossWeight = $grossWeight;
return $this;
}

/**
* @return string
*/
public function getManufacturingCountryCode() {
return $this->manufacturingCountryCode;
}

/**
* @param string $manufacturingCountryCode
* @return ExportLineItem
*/
public function setManufacturingCountryCode($manufacturingCountryCode) {
$this->manufacturingCountryCode = $manufacturingCountryCode;
return $this;
}

/**
* @return array
*/
public function buildData() {
$result = [
'ItemNumber' => $this->itemNumber,
'Quantity' => $this->quantity,
'QuantityUnitOfMeasurement' => $this->quantityUnitOfMeasurement,

'ItemDescription' => $this->itemDescription,
'UnitPrice' => $this->unitPrice,
'NetWeight' => $this->netWeight,

'GrossWeight' => $this->grossWeight,
'ManufacturingCountryCode' => $this->manufacturingCountryCode,
];

return $result;
}
}
60 changes: 60 additions & 0 deletions src/ExportLineItems.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
namespace alexLE\DHLExpress;


class ExportLineItems extends DataClass {

/**
* @var ExportLineItem[]
*/
protected $exportLineItems;

function __construct() {
$this->exportLineItems = [];
}

/**
* @return ExportLineItem[]
*/
public function getRequestedPackages() {
return $this->exportLineItems;
}

/**
* @param ExportLineItem $exportLineItem
* @return ExportLineItems
*/
public function addexportLineItem(ExportLineItem $exportLineItem) {
$this->exportLineItems[] = $exportLineItem;

return $this;
}


/**
* @return array
*/
public function buildData() {
/*
$result = [
'ExportLineItem' => $this->exportLineItem->buildData(),
];
return $result;
*/

$result = ['ExportLineItem' => []];

foreach($this->exportLineItems as $index => $exportLineItem) {
// @number has to be the first entry, otherwise the API returns a error 500
$packageData = [
'ItemNumber' => $index + 1
];
$packageData = array_merge($packageData, $exportLineItem->buildData());

$result['ExportLineItem'][] = $packageData;
}

return $result;
}
}
Loading

0 comments on commit a069b1d

Please sign in to comment.