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

Commit a069b1d

Browse files
authored
Merge pull request #2 from Adiconquerors/master
New Nodes Implemented
2 parents 1f414e0 + dd362c6 commit a069b1d

12 files changed

+777
-1
lines changed

src/ExportDeclaration.php

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
namespace alexLE\DHLExpress;
3+
4+
5+
class ExportDeclaration extends DataClass {
6+
7+
/**
8+
* @var ExportLineItems
9+
*/
10+
protected $exportLineItems;
11+
12+
/**
13+
* @var OtherCharges
14+
*/
15+
protected $otherCharges;
16+
17+
/**
18+
* @var string
19+
*/
20+
protected $invoiceDate;
21+
22+
/**
23+
* @var string
24+
*/
25+
protected $invoiceNumber;
26+
27+
/**
28+
* @return ExportLineItems
29+
*/
30+
public function getExportLineItems() {
31+
return $this->exportLineItems;
32+
}
33+
34+
/**
35+
* @param ExportLineItems $contact
36+
* @return ExportDeclaration
37+
*/
38+
public function setExportLineItems(ExportLineItems $exportLineItems) {
39+
$this->exportLineItems = $exportLineItems;
40+
return $this;
41+
}
42+
43+
/**
44+
* @return string
45+
*/
46+
public function getInvoiceNumber() {
47+
return $this->invoiceNumber;
48+
}
49+
50+
/**
51+
* @param string $invoiceNumber
52+
* @return ExportLineItems
53+
*/
54+
public function setInvoiceNumber($invoiceNumber) {
55+
$this->invoiceNumber = $invoiceNumber;
56+
return $this;
57+
}
58+
59+
/**
60+
* @return string
61+
*/
62+
public function getInvoiceDate() {
63+
return $this->invoiceDate;
64+
}
65+
66+
/**
67+
* @param string $invoiceDate
68+
* @return ExportLineItems
69+
*/
70+
public function setInvoiceDate($invoiceDate) {
71+
$this->invoiceDate = $invoiceDate;
72+
return $this;
73+
}
74+
75+
/**
76+
* @return string
77+
*/
78+
public function getOtherCharges() {
79+
return $this->otherCharges;
80+
}
81+
82+
/**
83+
* @param string $invoiceDate
84+
* @return ExportLineItems
85+
*/
86+
public function setOtherCharges(OtherCharges $otherCharges) {
87+
$this->otherCharges = $otherCharges;
88+
return $this;
89+
}
90+
91+
/**
92+
* @return array
93+
*/
94+
public function buildData() {
95+
return [
96+
'ExportLineItems' => $this->exportLineItems->buildData(),
97+
'InvoiceDate' => $this->invoiceDate,
98+
'InvoiceNumber' => $this->invoiceNumber,
99+
'OtherCharges' => $this->otherCharges->buildData(),
100+
];
101+
}
102+
}

src/ExportLineItem.php

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<?php
2+
namespace alexLE\DHLExpress;
3+
4+
5+
class ExportLineItem extends DataClass {
6+
7+
/**
8+
* @var string
9+
*/
10+
protected $itemNumber;
11+
12+
/**
13+
* @var string
14+
*/
15+
protected $quantity;
16+
17+
/**
18+
* @var string
19+
*/
20+
protected $quantityUnitOfMeasurement;
21+
22+
/**
23+
* @var string
24+
*/
25+
protected $itemDescription;
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $unitPrice;
31+
32+
/**
33+
* @var number
34+
*/
35+
protected $netWeight;
36+
37+
/**
38+
* @var number
39+
*/
40+
protected $grossWeight;
41+
42+
/**
43+
* @var string
44+
*/
45+
protected $manufacturingCountryCode;
46+
47+
/**
48+
* @return string
49+
*/
50+
public function getItemNumber() {
51+
return $this->itemNumber;
52+
}
53+
54+
/**
55+
* @param string $itemNumber
56+
* @return ExportLineItem
57+
*/
58+
public function setItemNumber($itemNumber) {
59+
$this->itemNumber = $itemNumber;
60+
return $this;
61+
}
62+
63+
/**
64+
* @return string
65+
*/
66+
public function getQuantity() {
67+
return $this->companyName;
68+
}
69+
70+
/**
71+
* @param string $quantity
72+
* @return ExportLineItem
73+
*/
74+
public function setQuantity($quantity) {
75+
$this->quantity = $quantity;
76+
return $this;
77+
}
78+
79+
/**
80+
* @return string
81+
*/
82+
public function getQuantityUnitOfMeasurement() {
83+
return $this->quantityUnitOfMeasurement;
84+
}
85+
86+
/**
87+
* @param string $quantityUnitOfMeasurement
88+
* @return ExportLineItem
89+
*/
90+
public function setQuantityUnitOfMeasurement($quantityUnitOfMeasurement) {
91+
$this->quantityUnitOfMeasurement = $quantityUnitOfMeasurement;
92+
return $this;
93+
}
94+
95+
/**
96+
* @return string
97+
*/
98+
public function getItemDescription() {
99+
return $this->itemDescription;
100+
}
101+
102+
/**
103+
* @param string $itemDescription
104+
* @return ExportLineItem
105+
*/
106+
public function setItemDescription($itemDescription) {
107+
$this->itemDescription = $itemDescription;
108+
return $this;
109+
}
110+
111+
/**
112+
* @return string
113+
*/
114+
public function getUnitPrice() {
115+
return $this->unitPrice;
116+
}
117+
118+
/**
119+
* @param string $unitPrice
120+
* @return ExportLineItem
121+
*/
122+
public function setUnitPrice($unitPrice) {
123+
$this->unitPrice = $unitPrice;
124+
return $this;
125+
}
126+
127+
/**
128+
* @return string
129+
*/
130+
public function getNetWeight() {
131+
return $this->netWeight;
132+
}
133+
134+
/**
135+
* @param string $netWeight
136+
* @return ExportLineItem
137+
*/
138+
public function setNetWeight($netWeight) {
139+
$this->netWeight = $netWeight;
140+
return $this;
141+
}
142+
143+
/**
144+
* @return string
145+
*/
146+
public function getGrossWeight() {
147+
return $this->grossWeight;
148+
}
149+
150+
/**
151+
* @param string $grossWeight
152+
* @return ExportLineItem
153+
*/
154+
public function setGrossWeight($grossWeight) {
155+
$this->grossWeight = $grossWeight;
156+
return $this;
157+
}
158+
159+
/**
160+
* @return string
161+
*/
162+
public function getManufacturingCountryCode() {
163+
return $this->manufacturingCountryCode;
164+
}
165+
166+
/**
167+
* @param string $manufacturingCountryCode
168+
* @return ExportLineItem
169+
*/
170+
public function setManufacturingCountryCode($manufacturingCountryCode) {
171+
$this->manufacturingCountryCode = $manufacturingCountryCode;
172+
return $this;
173+
}
174+
175+
/**
176+
* @return array
177+
*/
178+
public function buildData() {
179+
$result = [
180+
'ItemNumber' => $this->itemNumber,
181+
'Quantity' => $this->quantity,
182+
'QuantityUnitOfMeasurement' => $this->quantityUnitOfMeasurement,
183+
184+
'ItemDescription' => $this->itemDescription,
185+
'UnitPrice' => $this->unitPrice,
186+
'NetWeight' => $this->netWeight,
187+
188+
'GrossWeight' => $this->grossWeight,
189+
'ManufacturingCountryCode' => $this->manufacturingCountryCode,
190+
];
191+
192+
return $result;
193+
}
194+
}

src/ExportLineItems.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
namespace alexLE\DHLExpress;
3+
4+
5+
class ExportLineItems extends DataClass {
6+
7+
/**
8+
* @var ExportLineItem[]
9+
*/
10+
protected $exportLineItems;
11+
12+
function __construct() {
13+
$this->exportLineItems = [];
14+
}
15+
16+
/**
17+
* @return ExportLineItem[]
18+
*/
19+
public function getRequestedPackages() {
20+
return $this->exportLineItems;
21+
}
22+
23+
/**
24+
* @param ExportLineItem $exportLineItem
25+
* @return ExportLineItems
26+
*/
27+
public function addexportLineItem(ExportLineItem $exportLineItem) {
28+
$this->exportLineItems[] = $exportLineItem;
29+
30+
return $this;
31+
}
32+
33+
34+
/**
35+
* @return array
36+
*/
37+
public function buildData() {
38+
/*
39+
$result = [
40+
'ExportLineItem' => $this->exportLineItem->buildData(),
41+
];
42+
43+
return $result;
44+
*/
45+
46+
$result = ['ExportLineItem' => []];
47+
48+
foreach($this->exportLineItems as $index => $exportLineItem) {
49+
// @number has to be the first entry, otherwise the API returns a error 500
50+
$packageData = [
51+
'ItemNumber' => $index + 1
52+
];
53+
$packageData = array_merge($packageData, $exportLineItem->buildData());
54+
55+
$result['ExportLineItem'][] = $packageData;
56+
}
57+
58+
return $result;
59+
}
60+
}

0 commit comments

Comments
 (0)