c24-toys / sdk-api-bcs-returns
DHL Paket Retoure API SDK
1.0.0
2024-08-06 13:45 UTC
Requires
- php: ^7.2.0 || ^8.0.0
- ext-json: *
- php-http/discovery: ^1.10.0
- php-http/httplug: ^2.2.0
- php-http/logger-plugin: ^1.2.1
- psr/http-client: ^1.0.1
- psr/http-client-implementation: ^1.0.0
- psr/http-factory: ^1.0.0
- psr/http-factory-implementation: ^1.0.0
- psr/http-message: ^1.0.0 || ^2.0.0
- psr/http-message-implementation: ^1.0.0
- psr/log: ^1.1.0 || ^2.0.0 || ^3.0.0
Requires (Dev)
- nyholm/psr7: ^1.0.0
- php-http/mock-client: ^1.5.0
- phpstan/phpstan: ^1.10.0
- phpunit/phpunit: ^8.0.0 || ^9.0.0
- squizlabs/php_codesniffer: ^3.4
This package is not auto-updated.
Last update: 2024-11-13 13:20:11 UTC
README
The DHL Paket Retoure API SDK package offers an interface to the following web services:
- API Retoure
Requirements
System Requirements
- PHP 7.2+ with JSON extension
Package Requirements
php-http/discovery
: Discovery service for HTTP client and message factory implementationsphp-http/httplug
: Pluggable HTTP client abstractionphp-http/logger-plugin
: HTTP client logger plugin for HTTPlugpsr/http-client
: PSR-18 HTTP client interfacespsr/http-factory
: PSR-7 HTTP message factory interfacespsr/http-message
: PSR-7 HTTP message interfacespsr/log
: PSR-3 logger interfaces
Virtual Package Requirements
psr/http-client-implementation
: Any package that provides a PSR-18 compatible HTTP clientpsr/http-factory-implementation
: Any package that provides PSR-7 compatible HTTP message factoriespsr/http-message-implementation
: Any package that provides PSR-7 HTTP messages
Development Package Requirements
nyholm/psr7
: PSR-7 HTTP message factory & message implementationphpunit/phpunit
: Testing frameworkphp-http/mock-client
: HTTPlug mock client implementationphpstan/phpstan
: Static analysis toolsquizlabs/php_codesniffer
: Static analysis tool
Installation
$ composer require dhl/sdk-api-bcs-returns
Uninstallation
$ composer remove dhl/sdk-api-bcs-returns
Testing
$ ./vendor/bin/phpunit -c test/phpunit.xml
Features
The DHL Paket Retoure API SDK supports the following features:
- Book return labels (
BookLabel
)
Return Label Service
Create a return label PDF or QR code to be scanned by a place of committal (e.g. post office). For return shipments from outside of the EU, a customs document can also be requested.
Public API
The library's components suitable for consumption comprise of
- service:
- service factory
- return label service
- data transfer object builder
- data transfer objects:
- authentication storage
- booking confirmation with label data
Usage
$authStorage = new \Dhl\Sdk\Paket\Retoure\Auth\AuthenticationStorage( 'applicationId', 'applicationToken', 'user', 'signature' ); $logger = new \Psr\Log\NullLogger(); $serviceFactory = new \Dhl\Sdk\Paket\Retoure\Service\ServiceFactory(); $service = $serviceFactory->createReturnLabelService($authStorage, $logger, $sandbox = true); $requestBuilder = new \Dhl\Sdk\Paket\Retoure\Model\ReturnLabelRequestBuilder(); $requestBuilder->setAccountDetails($receiverId = 'deu'); $requestBuilder->setShipperAddress( $name = 'Jane Doe', $countryCode = 'DEU', $postalCode = '53113', $city = 'Bonn', $streetName = 'Sträßchensweg', $streetNumber = '2' ); $returnOrder = $requestBuilder->create(); $confirmation = $service->bookLabel($returnOrder);