Pass Delivery: Api package library
See the integration page for description of pass delivery api.
See the documentation for pass delivery api documentation.
composer require pass-qa/delivery
The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php file:
'providers' => [
// ...
pass-qa\delivery\src\providers\PassDeliveryApiServiceProvider::class,
];
You should publish the config/passdelivery.php config file with:
php artisan vendor:publish --provider="PassQa\Delivery\Providers\PassDeliveryApiServiceProvider"
After that, you should put your api_key in config file, also you can set test_mode to true for development or false for production.
You must generate a token. See this page to learn how to create a token.
use PassQa\Delivery\PassOrder;
$order = new PassOrder()
Request a quote to receive your exact delivery fee for an order by using the origin address and destination addresses.
This endpoint retrieves calculation information in the format of for a pair of {latitude, longitude} coordinates.
$priceData = [
"pickup" =>[
"lat" =>"25.275047",
"long" => "51.535141"
],
"dropoffs" => [
[
"lat" =>"25.277007",
"long" => "51.530034"
],
[
"lat" =>"25.277005",
"long" => "51.530039"
],
[
"lat" =>"25.277001",
"long" => "51.530030"
]
]
];
use object
use PassQa\Delivery\PassOrder;
$order = new PassOrder();
$response = $order->Price($priceData);
or use facade
use PassQa\Delivery\Facades\PassOrder;
$response = PassOrder::Price($priceData);
Once you calculated the price of your order, you can use this endpoint in order to create a new order.
$orderData = [
"addresses"=> [
"pickup" =>[
"lat"=> "25.275047",
"long"=> "51.535141",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "this street",
"description"=> "it is a sample description"
],
"dropoffs" => [
[
"lat"=> "25.277007",
"long"=> "51.530034",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "that street",
"description"=> "it is a sample description"
],
[
"lat"=> "25.277007",
"long"=> "51.530034",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "other street",
"description"=> "it is a sample description"
],
[
"lat"=> "25.277007",
"long"=> "51.530034",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "another street",
"description"=> "it is a sample description"
]
]
]
];
use object
use PassQa\Delivery\PassOrder;
$order = new PassOrder();
$response = $order->Create($orderData);
or use facade
use PassQa\Delivery\Facades\PassOrder;
$response = PassOrder::Create($orderData);
Once you successfully have created an order, you will be able to watch the Pass driver on a live map.
The driver's location and order status will be change as the driver is moving.
The 'order id' is available in the create API response
use object
use PassQa\Delivery\PassOrder;
$order = new PassOrder();
$response = $order->Tracking('order id');
or use facade
use PassQa\Delivery\Facades\PassOrder;
$response = PassOrder::Tracking('order id');
Call the following endpoint in order to get the order details.
The order details include:
- Pickup and Dropoff details including description
- Driver details including name, phone number, avatar and vehicle information
- Order price and payment details
- Order statuses
- Share URL. A tool which you can use to share a link with your clients to view the live driver status.
The 'order id' is available in the create API response
use object
use PassQa\Delivery\PassOrder;
$order = new PassOrder();
$response = $order->Detail('order id');
or use facade
use PassQa\Delivery\Facades\PassOrder;
$response = PassOrder::Detail('order id');
You can cancel any order before courier arrival (before the pickup status)
The 'order id' is available in the create API response
use object
use PassQa\Delivery\PassOrder;
$order = new PassOrder();
$response = $order->Cancel('order id');
or use facade
use PassQa\Delivery\Facades\PassOrder;
$response = PassOrder::Cancel('order id');
List of all submitted orders by your tokens
use object
use PassQa\Delivery\PassOrder;
$order = new PassOrder();
$response = $order->List();
or use facade
use PassQa\Delivery\Facades\PassOrder;
$response = PassOrder::List();
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.