Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

Commit 7bccb71

Browse files
committed
Added missing information in the Basic-Tutorial
1 parent 7178ef4 commit 7bccb71

File tree

1 file changed

+49
-26
lines changed

1 file changed

+49
-26
lines changed

examples/getting-started.md

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ You need to setup the Shipment-Details for your Shipment (like Size/Weight etc).
9797

9898
```php
9999
// Create the Object with the first 10 Digits of your Account-Number (EKP).
100-
// You can use the \Petschko\DHL\Credentials function "->getEko((int) amount)" to get just the first 10 digits if longer
101-
$shipmentDetails = new \Petschko\DHL\ShipmentDetails((string) $credentials->getEkp(10) . '0101'); // Ensure the 0101 at the end
100+
// You can use the \Petschko\DHL\Credentials function "->getEkp((int) amount)" to get just the first 10 digits if longer
101+
$shipmentDetails = new \Petschko\DHL\ShipmentDetails((string) $credentials->getEkp(10) . '0101'); // Ensure the 0101 at the end (or the number you need for your Product)
102102
```
103103

104-
You can setup details for that, if you need. If you don't set them, it use the default values _(This Part is Optional)_
104+
You can setup details for that, if you need. If you don't set them, it uses the default values _(This Part is Optional)_
105105

106106
```php
107107
// Setup details
@@ -144,19 +144,15 @@ $shipmentDetails->setReturnReference((string) 'freetext 35 len'); // Default: nu
144144

145145
// Sizes/Weight
146146
$shipmentDetails->setWeight((float) $weightInKG); // Default: 5.0 (KG)
147-
$shipmentDetails->setLength((int) $lengthInCM); // Default: null -> Unset
148-
$shipmentDetails->setWidth((int) $widthInCM); // Default: null -> Unset
149-
$shipmentDetails->setHeight((int) $heightInCM); // Default: null -> Unset
150-
151-
// -- Package-Type (ONLY NEEDED IN VERSION 1)
152-
/* Sets the Type of the Package. Possible Values:
153-
* PALETTE = 'PL';
154-
* PACKAGE = 'PK';
155-
*/
156-
$shipmentDetails->setPackageType((string) \Petschko\DHL\ShipmentDetails::{type}); // Default: PACKAGE
147+
$shipmentDetails->setLength((int) $lengthInCM); // Default: null -> Unset|none
148+
$shipmentDetails->setWidth((int) $widthInCM); // Default: null -> Unset|none
149+
$shipmentDetails->setHeight((int) $heightInCM); // Default: null -> Unset|none
150+
151+
// Notification E-Mail for this Shipping
152+
$shipmentDetails->setNotificationEmail((string) $email); // Default: null -> Disabled
157153
```
158154

159-
##### \Petschko\DHL\Sender, \Petschko\DHL\Receiver + \Petschko\DHL\ReturnReceiver Object(s)
155+
##### \Petschko\DHL\Sender, \Petschko\DHL\Receiver & \Petschko\DHL\ReturnReceiver Object(s)
160156

161157
Now you have to create a Sender and a Receiver. They are similar to set, just the XML creation is different so you have to use different Objects for that.
162158

@@ -173,12 +169,10 @@ Setup all **Required** Information
173169
```php
174170
$sender->setName((string) 'Organisation Petschko'); // Can be a Person-Name or Company Name
175171

176-
// You can add the whole address with that setter if you want
177-
$sender->setFullStreet((string) 'Oberer Landweg 12a');
178-
179-
// If you want to set the elements on your own use the setter for them
172+
// You need to seperate the StreetName from the Number and set each one to its own setter
173+
// Example Full Address: "Oberer Landweg 12a"
180174
$sender->setStreetName((string) 'Oberer Landweg');
181-
$sender->setStreetNumber((string) '12a');
175+
$sender->setStreetNumber((string) '12a'); // A Number is ALWAYS needed
182176

183177
$sender->setZip((string) '21035');
184178
$sender->setCity((string) 'Hamburg');
@@ -200,7 +194,7 @@ $sender->setName3((string) 'Name Line 3'); // Default: null -> Disabled
200194
$sender->setPhone((string) '04073409677'); // Default: null -> Disabled
201195
$sender->setEmail((string) 'peter-91@hotmail.de'); // Default: null -> Disabled
202196

203-
// Mostly used in bigger Companies
197+
// Mostly used in bigger Companies (Contact-Person)
204198
$sender->setContactPerson((string) 'Peter Dragicevic'); // Default: null -> Disabled
205199
```
206200

@@ -219,7 +213,7 @@ I'll not explain the Service-Object because there are too many settings. Please
219213

220214
##### \Petschko\DHL\BankData Object
221215

222-
You can also use the `\Petschko\DHL\BankData` Object. Bank data can be provided for different purposes. E.g. if COD is booked as service, bank data must be provided by DHL customer (mandatory server logic). The collected money will be transferred to specified bank account.
216+
You can also use the `\Petschko\DHL\BankData` Object. Bank data can be provided for different purposes. E.g. if COD (Cash on Delivery) is booked as service, bank data must be provided by DHL customer (mandatory server logic). The collected money will be transferred to specified bank account.
223217

224218
You can look to the PHP-File of the `\Petschko\DHL\BankData`-Object, and checkout what you can set there. I will not explain it here.
225219

@@ -265,9 +259,6 @@ $dhl->setLog((bool) true);
265259
// Set a Sequence-Number if you need a referrence when you get the response
266260
$dhl->setSequenceNumber((string) '1'); // Default: '1'
267261

268-
// You can let DHL send a Mail to the Receiver, if you want that set the Mail
269-
$dhl->setReceiverEmail((string) 'receiver@mail.com'); // Default: null -> Disabled
270-
271262
/* You can get the Label as URL or as Base64-Data-String - set it how you want to have it
272263
* Possible Values:
273264
* RESPONSE_TYPE_URL = 'URL';
@@ -386,10 +377,40 @@ It works like deleting a Shipment:
386377
$dhl = new \Petschko\DHL\BusinessShipment($credentials);
387378

388379
// Do the Manifest-Request
389-
$dhl->doManifest((string) 'shipment_number');
380+
$response = $dhl->doManifest((string) 'shipment_number');
390381
```
391382

392383
If the request failed, you get `false` else a `\Petschko\DHL\Response` Object.
384+
For more Information about the Response, look down where I describe the `\Petschko\DHL\Response` Class.
385+
386+
### GetManifest
387+
388+
_Please note, that you need the `\Petschko\DHL\Credentials` Object with Valid Login-Information for that._
389+
390+
I personally also don't know for what is this for, but it works!
391+
392+
#### Classes used
393+
394+
- `\Petschko\DHL\Credentials` **(Req)** - Login Information
395+
- `\Petschko\DHL\BusinessShipment` **(Req)** - Manages all Actions + Information
396+
- `\Petschko\DHL\Version` (Parent)
397+
- `\Petschko\DHL\Response` **(Req|Auto)** - Response Information
398+
- `\Petschko\DHL\Version` (Parent)
399+
400+
#### How to create
401+
402+
The syntax is quite simple, you just need to specify the date where you want to have the manifest:
403+
404+
```php
405+
// Create a \Petschko\DHL\BusinessShipment Object with your credentials
406+
$dhl = new \Petschko\DHL\BusinessShipment($credentials);
407+
408+
// Request to get the manifest from a specific date, the date can be given with an ISO-Date String (YYYY-MM-DD) or with the `time()` value of the day
409+
$response = $dhl->getManifest('2018-08-06');
410+
```
411+
412+
If the request failed, you get `false` else a `\Petschko\DHL\Response` Object.
413+
For more Information about the Response, look down where I describe the `\Petschko\DHL\Response` Class.
393414

394415
### \Petschko\DHL\Response Object
395416

@@ -403,6 +424,8 @@ I will explain which values you can get from the Response-Object
403424
(string) $response->getShipmentNumber(); // Returns the Shipment-Number of the Request or null
404425
(string) $response->getLabel(); // Returns the Label URL or Base64-Label-String or null
405426
(string) $response->getReturnLabel(); // Returns the ReturnLabel (URL/B64) or null
427+
(string) $response->getExportDoc(); // Returns the Export-Document (URL/B64) or null (Can only be obtained if the Export-Doc Object was added to the Shipment request)
428+
(string) $response->getManifestData(); // Returns the Manifest PDF-Data as Base64 String (Can be obtained via getManifest) or null
406429
(string) $response->getSequenceNumber(); // Returns your provided sequence number or null
407430
(int) $response->getStatusCode(); // Returns the Status-Code (Difference to DHL - Weak-Validation is 1 not 0)
408431
(string) $response->getStatusText(); // Returns the Status-Text or null
@@ -411,7 +434,7 @@ I will explain which values you can get from the Response-Object
411434

412435
If a value is not set you get usually `null` as result. Not every Action fills out all of these values!
413436

414-
You can also take a look at the Class Constance's, they are helping you to identify the Status-Codes:
437+
You can also take a look at the Class Constants, they are helping you to identify the Status-Codes:
415438

416439
```php
417440
const \Petschko\DHL\Response::ERROR_NOT_SET = -1;

0 commit comments

Comments
 (0)