Skip to content

benjiam-gh/tnt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TNT ExpressConnect

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:

  1. Shipping
  2. Tracking

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

  1. 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();
  1. 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

About

Unofficial PHP client for myTNT Italy Express Connect APIs

Resources

License

Stars

Watchers

Forks

Languages

  • PHP 100.0%