-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
513 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/tmp | ||
/test/config.json | ||
/vendor | ||
/composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ $ composer require salamek/ppl-my-api:dev-master | |
|
||
### Is API healthy | ||
|
||
Check if PPL MyApi is in working shape | ||
|
||
```php | ||
$pplMyApi = new Salamek\PplMyApi\Api(); | ||
if ($pplMyApi->isHealthy()) | ||
|
@@ -35,13 +37,17 @@ else | |
|
||
### Get API version | ||
|
||
Returns version of PPL MyApi | ||
|
||
```php | ||
$pplMyApi = new Salamek\PplMyApi\Api(); | ||
echo $pplMyApi->getVersion() . PHP_EOL; | ||
``` | ||
|
||
### Get parcel shops | ||
|
||
Returns array of parcel shops filtered by `$code` and `$countryCode` | ||
|
||
```php | ||
$pplMyApi = new Salamek\PplMyApi\Api(); | ||
$result = $pplMyApi->getParcelShops($code = null, $countryCode = Country::CZ); | ||
|
@@ -50,13 +56,17 @@ print_r($result); | |
|
||
### Get sprint routes | ||
|
||
Returns array of sprint routes | ||
|
||
```php | ||
$pplMyApi = new Salamek\PplMyApi\Api(); | ||
$result = $pplMyApi->getSprintRoutes(); | ||
print_r($result); | ||
``` | ||
|
||
### Create Package | ||
### Create Packages | ||
|
||
Creates package/s on PPL MyApi (sends Package object to PPL) | ||
|
||
```php | ||
|
||
|
@@ -86,6 +96,8 @@ catch (\Exception $e) | |
|
||
### Create Orders | ||
|
||
Creates order/s on PPL MyApi (send Order object to PPL) | ||
|
||
```php | ||
|
||
$username = 'my_api_username'; | ||
|
@@ -110,6 +122,8 @@ catch (\Exception $e) | |
|
||
### Create Pickup Orders | ||
|
||
Creates pickup order/s on PPL MyApi (send PickupOrder object to PPL) | ||
|
||
```php | ||
|
||
$username = 'my_api_username'; | ||
|
@@ -133,6 +147,8 @@ catch (\Exception $e) | |
|
||
### Get Cities Routing | ||
|
||
Returns cities routing filtered by `$countryCode`, `$dateFrom`, `$zipCode` | ||
|
||
```php | ||
$username = 'my_api_username'; | ||
$password = 'my_api_password'; | ||
|
@@ -145,6 +161,8 @@ print_r($result); | |
|
||
### Get Packages | ||
|
||
Returns package/s info from ppl filtered by `$customRefs`, `$dateFrom`, `$dateTo`, `$packageNumbers` useful for tracking and checking status of package/s | ||
|
||
```php | ||
$username = 'my_api_username'; | ||
$password = 'my_api_password'; | ||
|
@@ -153,4 +171,23 @@ $customerId = 'my_api_customer_id'; | |
$pplMyApi = new Salamek\PplMyApi\Api($username, $password, $customerId); | ||
$result = $pplMyApi->getPackages($customRefs = null, \DateTimeInterface $dateFrom = null, \DateTimeInterface $dateTo = null, array $packageNumbers = []); | ||
print_r($result); | ||
``` | ||
|
||
### Get Labels | ||
|
||
Returns PDF with label/s for print on paper, two decompositions are supported, LabelDecomposition::FULL (one A4 Label per page) or LabelDecomposition::QUARTER (one label per 1/4 of A4 page) | ||
|
||
```php | ||
$pplMyApi = new Salamek\PplMyApi\Api(); | ||
|
||
$sender = new Salamek\PplMyApi\Model\Sender('Olomouc', 'My Compamy s.r.o.', 'My Address', '77900', '[email protected]', '+420123456789', 'http://www.example.cz', Country::CZ); | ||
$recipient = new Salamek\PplMyApi\Model\Recipient('Olomouc', 'Adam Schubert', 'My Address', '77900', '[email protected]', '+420123456789', 'http://www.salamek.cz', Country::CZ, 'My Compamy a.s.'); | ||
|
||
$myPackageIdFromNumberSeries = 115; | ||
$weight = 3.15; | ||
$package = new Salamek\PplMyApi\Model\Package($myPackageIdFromNumberSeries, Product::PPL_PARCEL_CZ_PRIVATE, $weight, 'Testpvaci balik', Depo::CODE_09, $sender, $recipient); | ||
|
||
|
||
$rawPdf = $pplMyApi->getLabels([$package]); | ||
file_put_contents($package->getPackageNumber() . '.pdf', $rawPdf); | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2016 Adam Schubert <[email protected]>. | ||
*/ | ||
|
||
namespace Salamek\PplMyApi\Enum; | ||
|
||
|
||
class LabelDecomposition | ||
{ | ||
const FULL = 1; | ||
const QUARTER = 4; | ||
|
||
/** @var array */ | ||
public static $list = [ | ||
self::FULL, | ||
self::QUARTER | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2016 Adam Schubert <[email protected]>. | ||
*/ | ||
|
||
namespace Salamek\PplMyApi\Enum; | ||
|
||
|
||
class LabelPosition | ||
{ | ||
const TOP_LEFT = 1; | ||
const TOP_RIGHT = 2; | ||
const BOTTOM_LEFT = 3; | ||
const BOTTOM_RIGHT = 4; | ||
|
||
/** @var array */ | ||
public static $list = [ | ||
self::TOP_LEFT, | ||
self::TOP_RIGHT, | ||
self::BOTTOM_LEFT, | ||
self::BOTTOM_RIGHT | ||
]; | ||
} |
Oops, something went wrong.