Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

jacobdekeizer/redjepakketje-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Red je Pakketje api client

Red je Pakketje API documentation

Installation

Get it with composer

composer require jacobdekeizer/redjepakketje-client

Usage

Create the client

$client = new \jacobdekeizer\Client();

$client->setApiKey('api_key');

Create shipment

$shipment = (new \jacobdekeizer\Resources\Shipment())
    ->setCompanyName('Boeren BV')
    ->setName('Gijs Boersma')
    ->setStreet('Lange laan')
    ->setHouseNumber(29)
    ->setHouseNumberExtension('a')
    ->setZipcode('9281EM')
    ->setCity('Zevenaar')
    ->setTelephone('0602938172')
    ->setEmail('[email protected]')
    ->setReference('Bestelling 112')
    ->setNote('Some note')
    ->setName('My Company')
    ->setDeliveryDate(date('Y-m-d'))
    ->setProduct(\jacobdekeizer\Resources\Shipment::PRODUCT_SAME_DAY_PARCEL_STANDARD)
    ->setPickUpPoint('pick_up_point_uuid');

$shipmentResponse = $client->shipments()->create(
    $shipment,
    new \jacobdekeizer\Parameters\Shipments\Create() // optional
);

$label = $shipmentResponse->getLabel();

List shipments

$shipmentsList = $client->shipments()->all(
    new \jacobdekeizer\Parameters\Shipments\All() // optional
);

Get shipment

$shipmentResponse = $client->shipments()->get(
    'your_tracking_code',
    new \jacobdekeizer\Parameters\Shipments\GetLabel() // optional
);

Get label

$labelContents = $client->shipments()->getLabel(
    'your_tracking_code',
    new \jacobdekeizer\Parameters\Shipments\GetLabel() // optional
);

Create return shipments

$returnShipment = (new \jacobdekeizer\Resources\ReturnShipment())
    ->setName('Gijs Boersma')
    ->setStreet('Lange laan')
    ->setHouseNumber(29)
    ->setHouseNumberExtension('a')
    ->setZipcode('9281EM')
    ->setCity('Zevenaar')
    ->setTelephone('0602938172')
    ->setEmail('[email protected]')
    ->setReference('Bestelling 112')
    ->setNote('Some note')
    ->setReceiverName('My company')
    ->setPickUpPoint('pick_up_point_uuid')
    ->setProduct(\jacobdekeizer\Resources\ReturnShipment::PRODUCT_SAME_DAY_PARCEL_STANDARD)
    ->setNote('some text');

$returnShipmentResponse = $client->returns()->create($returnShipment);

List return shipments

$returnShipmentsList = $client->returns()->all(
    new \jacobdekeizer\Parameters\Returns\All() // optional
);

Get return shipment

$returnShipment = $client->returns()->get('return_shipment_uuid');

List pick up points

$pickUpPoints = $client->pickUps()->all();

Get pick up point

$pickUpPoint = $client->pickUps()->get('pick_up_point_uuid');

Create contact

$contact = (new \jacobdekeizer\Resources\Contact())
    ->setFirstName('John')
    ->setLastName('Doe')
    ->setEmail('[email protected]')
    ->setTelephone('+31612345678')
    ->setGender(\jacobdekeizer\Resources\Contact::GENDER_MALE)
    ->setReference('abcdefg');

$contactResponse = $client->contacts()->create($contact);

List all contacts

$contacts = $client->contacts()->all();

Get contact

$contact = $client->contacts()->get('3c8a9435-8b68-4d06-847d-4d1cd5f7c27a');

Update contact

$contact = (new \jacobdekeizer\Resources\Contact())
    ->setUuid('uuid_of_contact')
    ->setFirstName('Jane')
    ->setLastName('Doe')
    ->setEmail('[email protected]')
    ->setTelephone('+31612345678')
    ->setGender(\jacobdekeizer\Resources\Contact::GENDER_FEMALE)
    ->setReference('abcdefg');

$contactResponse = $client->contacts()->update($contact);

About

Red je Pakketje client for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages