PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Stefan Ninic  >  Laravel WebShipper  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Laravel WebShipper
Manage e-commerce orders using Webshipper API
Author: By
Last change:
Date: 1 year ago
Size: 7,236 bytes
 

 

Contents

Class file image Download

Laravel webshipper integration

This plugin provides a laravel wrapper for webshipper api. Webshipper at this point uses 2 versions of api. V1 api uses its own classes while V2 uses different classes Usage of any of it is based on the classes you use so it can be used as pleased

laravel-webshipper v1

Creating and using webshipper api:

To instantiate and create api instance

use Webshipper\Webshipper';
$api = new Webshipper();

Using api to create orders

Api has an exposed property called orders $this->api->orders This property is used to manipualte orders

Creating webshipper order $data object

[
        'billing_address' =>
            [
                'address_1' => 'Test Road 66',
                'address_2' => 'Test Road 120',
                'city' => 'Test City',
                'company_name' => 'webshipr Aps',
                'contact_name' => 'mathias',
                'country_code' => 'DK',
                'email' => 'info@webshipr.com',
                'phone' => '66666666',
                'phone_area' => '+45',
                'zip' => '8230',
            ],
        'delivery_address' =>
            [
                'address_1' => 'Test Road 66',
                'address_2' => 'Test Road 120',
                'city' => 'Test City',
                'company_name' => 'webshipr Aps',
                'contact_name' => 'mathias',
                'country_code' => 'DK',
                'email' => 'info@webshipr.com',
                'phone' => '66666666',
                'phone_area' => '+45',
                'zip' => '8230',
            ],
        'dynamic_address' =>
            [
                'address_1' => 'GLS Pakkeshop XX',
                'address_2' => '',
                'city' => 'Åbyhøj',
                'company_name' => 'GLS Pakkeshop XX',
                'contact_name' => '',
                'country_code' => 'DK',
                'email' => 'info@webshipr.com',
                'phone' => '',
                'phone_area' => '',
                'zip' => '8230',
            ],
        'custom_pickup_identifier' => '341',
        'items' =>
            [
                [
                    'description' => 'Testdesc1',
                    'product_name' => 'TestName1',
                    'product_no' => 12,
                    'quantity' => 45,
                    'uom' => 'pcs',
                    'weight' => 500,
                    'location' => 'EP432S2',
                    'sub_total_price' => 50,
                    'total_price' => 60,
                    'currency' => 'EUR',
                    'tarif_number' => '1234',
                    'origin_country_code' => 'NO',
                    'ext_ref' => 'myitemref1',
                ],
                [
                    'description' => 'Testdesc1',
                    'product_name' => 'TestName1',
                    'product_no' => 12,
                    'quantity' => 45,
                    'uom' => 'pcs',
                    'weight' => 500,
                    'location' => 'EP432S2',
                    'sub_total_price' => 50,
                    'total_price' => 60,
                    'currency' => 'EUR',
                    'tarif_number' => '1234',
                    'origin_country_code' => 'NO',
                    'ext_ref' => 'myitemref2',
                ],
            ],
        'webshop_id' => 3752,
        'ext_ref' => '00929812',
        'shipping_rate_id' => 983,
        'user_id' => 123,
        'comment' => 'Sample Comment',
    ]

Full create order will look like:

$this->api->orders->create(
    [
            'billing_address' =>
                [
                    'address_1' => 'Test Road 66',
                    'address_2' => 'Test Road 120',
                    'city' => 'Test City',
                    'company_name' => 'webshipr Aps',
                    'contact_name' => 'mathias',
                    'country_code' => 'DK',
                    'email' => 'info@webshipr.com',
                    'phone' => '66666666',
                    'phone_area' => '+45',
                    'zip' => '8230',
                ],
            'delivery_address' =>
                [
                    'address_1' => 'Test Road 66',
                    'address_2' => 'Test Road 120',
                    'city' => 'Test City',
                    'company_name' => 'webshipr Aps',
                    'contact_name' => 'mathias',
                    'country_code' => 'DK',
                    'email' => 'info@webshipr.com',
                    'phone' => '66666666',
                    'phone_area' => '+45',
                    'zip' => '8230',
                ],
            'dynamic_address' =>
                [
                    'address_1' => 'GLS Pakkeshop XX',
                    'address_2' => '',
                    'city' => 'Åbyhøj',
                    'company_name' => 'GLS Pakkeshop XX',
                    'contact_name' => '',
                    'country_code' => 'DK',
                    'email' => 'info@webshipr.com',
                    'phone' => '',
                    'phone_area' => '',
                    'zip' => '8230',
                ],
            'custom_pickup_identifier' => '341',
            'items' =>
                [
                    [
                        'description' => 'Testdesc1',
                        'product_name' => 'TestName1',
                        'product_no' => 12,
                        'quantity' => 45,
                        'uom' => 'pcs',
                        'weight' => 500,
                        'location' => 'EP432S2',
                        'sub_total_price' => 50,
                        'total_price' => 60,
                        'currency' => 'EUR',
                        'tarif_number' => '1234',
                        'origin_country_code' => 'NO',
                        'ext_ref' => 'myitemref1',
                    ],
                    [
                        'description' => 'Testdesc1',
                        'product_name' => 'TestName1',
                        'product_no' => 12,
                        'quantity' => 45,
                        'uom' => 'pcs',
                        'weight' => 500,
                        'location' => 'EP432S2',
                        'sub_total_price' => 50,
                        'total_price' => 60,
                        'currency' => 'EUR',
                        'tarif_number' => '1234',
                        'origin_country_code' => 'NO',
                        'ext_ref' => 'myitemref2',
                    ],
                ],
            'webshop_id' => 3752,
            'ext_ref' => '00929812',
            'shipping_rate_id' => 983,
            'user_id' => 123,
            'comment' => 'Sample Comment',
        ]
)

Updating order is done by using this code:

$this->api->orders->update($id, $data)

$data in update is the same as in create

Finding order is done by following code:

$this->api->orders-find($id)

Deleting order is done by following code:

$this->api->orders-delete($id)

laravel-webshipper v2


For more information send a message to info at phpclasses dot org.