2017 © Pedro Peláez
 

library postisgate

Postis API Client

image

seniorprogramming/postisgate

Postis API Client

  • Monday, April 16, 2018
  • by spgwebdev
  • Repository
  • 0 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 56 % Grown

The README.md

PostisGate API Client

A simple PostisGate implementation for Laravel., (*1)

Installation

Install the package through Composer., (*2)

Run the Composer require command from the Terminal:, (*3)

composer require seniorprogramming/postisgate

Now all you have to do is add the service provider of the package and alias the package. To do this open your config/app.php file., (*4)

Add a new line to the providers array:, (*5)

SeniorProgramming\PostisGate\Providers\ApiServiceProvider::class,

And optionally add a new line to the aliases array:, (*6)

'PostisGate' => SeniorProgramming\PostisGate\Facades\PostisGate::class,

Important, add in .env PostisGate credentials:, (*7)

POSTISGATE_USERNAME=
POSTISGATE_PASSWORD=
POSTISGATE_API=

And in config/filesystems.php, (*8)

    'postisgate' => [
        'driver' => 'local',
        'root' => storage_path('postisgate'),
    ],

Now you're ready to start using the PostisGate API Client in your application., (*9)

Overview

Look at one of the following topics to learn more about PostisGate API Clien, (*10)

Usage

The PostisGate API Client gives you the following methods to use:, (*11)

Login()

Retrieves the token for authentication when calling methods., (*12)

PostisGate::login()

CreateShipment()

Creates the shipment for the client order. The login command is not required. It does it automatically., (*13)

PostisGate::createShipment()

The createShipment() method will return an array of objects with: clientOrderDate, createdDate, sendType, productCategory, courierId, shipmentId, shipmentParcels[parcelReferenceId, parcelType, itemCode, itemDescription1, barCode], clientOrderId., (*14)

GetShipmentLabel()

Retrieve the AWB to a pdf file. The login command is not required. It does it automatically., (*15)

PostisGate::getShipmentLabel()

The getShipmentLabel() method will return TRUE., (*16)

Exceptions

The PostisGate package will throw exceptions if something goes wrong. This way it's easier to debug your code using the PostisGate package or to handle the error based on the type of exceptions. The PostisGate packages can throw the following exceptions:, (*17)

Exception
PostisGateInstanceException
PostisGateInvalidParamException
PostisGateTokenInvalidException
PostisGateUnknownModelException

Example

Login(), (*18)

PostisGate::login(['name'=>'your_username', 'password'=>'your_password'])

CreateShipment(), (*19)

PostisGate::createShipment([
    "clientId" => "your_client_id",
    "clientOrderDate" => "2018-04-12 07:03:03",
    "clientOrderId" => "0005",
    "paymentType" => "CASH",
    "productCategory" => "Standard Delivery",
    "recipientLocation" => [
        "addressText" => "Cal. Floreasca 40",
        "contactPerson" => "Gheorghe Ion",
        "country" => "Romania",
        "county" => "Bucuresti",
        "locality" => "Bucuresti",
        "locationId" => "1",
        "name" => "Georghe Ion",
        "phoneNumber" => "0700000000",
        "postalCode" => "123456",
    ],
    "sendType" => "FORWARD",
    "senderLocation" => [
        "addressText" => "Calea Bucuresti 22, Tunari, Ilfov",
        "buildingNumber" => "22",
        "contactPerson" => "depozit",
        "country" => "Romania",
        "county" => "Ilfov",
        "locality" => "Tunari",
        "locationId" => "149",
        "name" => "Depozit central",
        "phoneNumber" => "0212210000",
        "postalCode" => "012345",
        "streetName" => "Calea Bucuresti",
    ],
    "shipmentParcels" => [[
        "itemCode" => "AB1564",
        "itemDescription1" => "product_name",
        "itemUOMCode" => "BUC",
        "parcelBrutWeight" => 20,
        "parcelDeclaredValue" => 0,
        "parcelReferenceId" => "PRE0005",
        "parcelType" => "PACKAGE",
    ]],
    "shipmentPayer" => "SENDER",
    "shipmentReference" => "SRE0005",
    "sourceChannel" => "ONLINE",
])

GetShipmentLabel(), (*20)

PostisGate::getShipmentLabel([
    'shipmentId' => '1234567890',
    'filename' => '0005_1234567890.pdf'
])

For more information use the PostisgGate API documentation., (*21)

If you want to create more operations, create a class in the src/Operations folder just like the existing one and call through:, (*22)

PostisGate::the_name_of_the_class([parameters])

The Versions

16/04 2018

dev-master

9999999-dev

Postis API Client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Cristian Popovici