dinja / mytnt-express-connect-italy
myTNT Italy Express Connect (API) client
3.0.14
2024-09-03 08:28 UTC
Requires
- php: >=7.0
- lib-libxml: *
Requires (Dev)
- phpunit/phpunit: 5.5.*
- squizlabs/php_codesniffer: 3.*
README
Client version for myTNT Italy APIs
Original upstream repository documentation
PHP client which helps developers integrate TNT EC with their application. This package supports following services:
Forked repository documentation
This package is an unofficial PHP client for myTNT Italy Express Connect APIs.
Installing
Install with composer
composer require dinja/mytnt-express-connect-italy
Usage
Shipping
- Minimal request to create shipment
use thm\tnt_ec\service\ShippingService\ShippingService; $timestamp = new \DateTime(); $timezone = new \DateTimeZone('Europe/Rome'); $timestamp->setTimezone($timezone); $shipping = new ShippingService('User ID', 'Password'); $shipping->setAccountNumber('') // will be provided by your TNT representative. ->setSenderAccId(''); // will be provided by your TNT representative. $c1 = $shipping->addConsignment()->setConReference('') ->setContype('T') ->setPaymentind('S') // who pays for shipping S-sender, R-receiver ->setItems(1) ->setTotalWeight("00001000") ->setTotalVolume(0.00) ->setPackagetype('C') ->setDivision('D') ->setCollectionDate($timestamp->format('Ymd')) ->setService('N'); // will be provided by your TNT representative. $c1->setSender()->setCompanyName('Your company') ->setAddressLine('Address 1') ->setCity('') ->setPostcode('') ->setProvince('') ->setCountry('') ->setContactDialCode('') ->setContactPhone('') ->setContactEmail(''); $c1->setReceiver()->setCompanyName('Receiver address. NOT DELIVERY!') ->setAddressLine('') ->setCity('') ->setPostcode('') ->setProvince('') ->setCountry('') ->setContactDialCode('') ->setContactPhone('') ->setContactEmail(''); $response = $shipping->send();
- Delete Shipment
use thm\tnt_ec\service\ShippingService\ShippingService; $timestamp = new \DateTime(); $timezone = new \DateTimeZone('Europe/Rome'); $timestamp->setTimezone($timezone); $shipping = new ShippingService('User ID', 'Password'); $shipping->setAccountNumber('') // will be provided by your TNT representative. ->setSenderAccId(''); // will be provided by your TNT representative. $c1 = $shipping->addConsignment()->setConAction("D") ->setConNumber('tracking_number'); // Shipment Number to delete $response = $shipping->send();
Tracking
use thm\tnt_ec\service\TrackingService\TrackingService; $ts = new TrackingService('User ID', 'Password'); $ts->setAccountNumber(''); // will be provided by your TNT representative. $response = $ts->searchByConsignment(array('tracking_number')); // Shipment Number to search