Skip to content

Commit d5e8670

Browse files
committed
initaial pathao bd courier service
0 parents  commit d5e8670

12 files changed

Lines changed: 672 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor
2+
composer.lock

README.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<p align="center">
2+
<img src="https://pathao.com/wp-content/uploads/2019/02/Pathao-logo.svg">
3+
</p>
4+
5+
<h1 align="center">Pathao Courier Banagladesh</h1>
6+
<p align="center" >
7+
<img src="https://img.shields.io/packagist/dt/codeboxr/pathao-courier">
8+
<img src="https://img.shields.io/packagist/stars/codeboxr/pathao-courier">
9+
</p>
10+
11+
12+
## Requirements
13+
14+
- PHP >=7.2
15+
- Laravel >= 6
16+
17+
## Installation
18+
19+
```bash
20+
composer require codeboxr/pathao-courier
21+
```
22+
23+
### vendor publish (config)
24+
```bash
25+
php artisan vendor:publish --provider="Codeboxr\PathaoCourier\PathaoCourierServiceProvider"
26+
```
27+
28+
After publish config file setup your credential. you can see this in your config directory pathao.php file
29+
```
30+
"sandbox" => env("PATHAO_SANDBOX", false), // for sandbox mode use true
31+
"client_id" => env("PATHAO_CLIENT_ID", ""),
32+
"client_secret" => env("PATHAO_CLIENT_SECRET", ""),
33+
"username" => env("PATHAO_USERNAME", ""),
34+
"password" => env("PATHAO_PASSWORD", "")
35+
```
36+
37+
### Set .env configuration
38+
```
39+
PATHAO_SANDBOX=true // for production mode use false
40+
PATHAO_CLIENT_ID=""
41+
PATHAO_CLIENT_SECRET=""
42+
PATHAO_USERNAME=""
43+
PATHAO_PASSWORD=""
44+
```
45+
46+
47+
## Usage
48+
49+
### 1. Get pathao delivery city list
50+
51+
```
52+
use Codeboxr\PathaoCourier\Facade\PathaoCourier
53+
54+
return PathaoCourierFacade::area()->city();
55+
56+
```
57+
58+
### 2. To get pathao zone list
59+
60+
```
61+
use Codeboxr\PathaoCourier\Facade\PathaoCourier
62+
63+
return PathaoCourier::area()->zone($cityId); // City ID
64+
```
65+
66+
### 3. To get pathao delivery area list
67+
68+
```
69+
use Codeboxr\PathaoCourier\Facade\PathaoCourier
70+
71+
return PathaoCourier::area()->area($zoneId); // Zone ID
72+
```
73+
74+
75+
### 4. Create new store
76+
77+
```
78+
use Codeboxr\PathaoCourier\Facade\PathaoCourier
79+
80+
return PathaoCourier::store()
81+
->create([
82+
"name" => "", // Store Name
83+
"contact_name" => "", // Store contact person name
84+
"contact_number" => "", // Contact person number
85+
"address" => "", // Store address
86+
"secondary_contact" => "", // Contact person secondary number not mandatory
87+
"city_id" => "", // Find in city method
88+
"zone_id" => "", // Find in zone method
89+
"area_id" => "", // Find in Area method
90+
]);
91+
```
92+
93+
### 5. Get Store List
94+
95+
```
96+
use Codeboxr\PathaoCourier\Facade\PathaoCourier
97+
98+
return PathaoCourier::store()->list();
99+
```
100+
101+
### 6. Create new parcel
102+
103+
```
104+
use Codeboxr\PathaoCourier\Facade\PathaoCourier
105+
106+
return PathaoCourier::order()
107+
->create([
108+
"store_id" => "", // Find in store list,
109+
"merchant_order_id" => "", // Unique order id
110+
"recipient_name" => "", // Customer name
111+
"recipient_phone" => "", // Customer phone
112+
"recipient_address" => "", // Customer address
113+
"recipient_city" => "", // Find in city method
114+
"recipient_zone" => "", // Find in zone method
115+
"recipient_area" => "", // Find in Area method
116+
"delivery_type" => "", // 48 for normal delivery or 12 for on demand delivery
117+
"item_type" => "", // 1 for document,
118+
2 for parcel
119+
"special_instruction" => "",
120+
"item_quantity" => "", // item quantity
121+
"item_weight" => "", // parcel weight
122+
"amount_to_collect" => "", // amount to collect
123+
"item_description" => "" // product details
124+
]);
125+
```
126+
127+
### 7. Get Order Details
128+
129+
```
130+
use Codeboxr\PathaoCourier\Facade\PathaoCourier
131+
132+
return PathaoCourier::order()->orderDetails($consignmentId); // After successfully create order they given a consignment_id
133+
```
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
144+
145+
146+
147+
148+
149+
## Contributing
150+
151+
Contributions to the Pathao package are welcome. Please note the following guidelines before submitting your pull request.
152+
153+
- Follow [PSR-4](http://www.php-fig.org/psr/psr-4/) coding standards.
154+
- Read Pathao API documentations first
155+
156+
## License
157+
158+
Pathao package is licensed under the [MIT License](http://opensource.org/licenses/MIT).
159+
160+
Copyright 2022 [Codeboxr](https://codeboxr.com)

composer.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "codeboxr/pathao-courier",
3+
"description": "Bangladeshi Pathao courier service api package",
4+
"type": "library",
5+
"license": "MIT",
6+
"autoload": {
7+
"psr-4": {
8+
"Codeboxr\\PathaoCourier\\": "src/"
9+
}
10+
},
11+
"authors": [
12+
{
13+
"name": "Codeboxr"
14+
}
15+
],
16+
"minimum-stability": "dev",
17+
"require": {
18+
"php": "^7.2|^7.3|^8.0|^8.1",
19+
"illuminate/support": "~6|~7|~8",
20+
"guzzlehttp/guzzle": "^7.0.1"
21+
},
22+
"extra": {
23+
"laravel": {
24+
"providers": [
25+
"Codeboxr\\PathaoCourier\\PathaoCourierServiceProvider"
26+
]
27+
}
28+
}
29+
}

config/pathao.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
return [
4+
"sandbox" => env("PATHAO_SANDBOX", false),
5+
"client_id" => env("PATHAO_CLIENT_ID", ""),
6+
"client_secret" => env("PATHAO_CLIENT_SECRET", ""),
7+
"username" => env("PATHAO_USERNAME", ""),
8+
"password" => env("PATHAO_PASSWORD", "")
9+
];

src/Apis/AreaApi.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace Codeboxr\PathaoCourier\Apis;
4+
5+
use GuzzleHttp\Exception\GuzzleException;
6+
use Codeboxr\PathaoCourier\Exceptions\PathaoException;
7+
8+
class AreaApi extends BaseApi
9+
{
10+
/**
11+
* get city List
12+
*
13+
* @return mixed
14+
* @throws PathaoException
15+
* @throws GuzzleException
16+
*/
17+
public function city()
18+
{
19+
$response = $this->authorization()->send("GET", "aladdin/api/v1/countries/1/city-list");
20+
return $response->data;
21+
}
22+
23+
/**
24+
* Get zone list city wise
25+
*
26+
* @param int $cityId
27+
*
28+
* @return mixed
29+
* @throws GuzzleException
30+
* @throws PathaoException
31+
*/
32+
public function zone($cityId)
33+
{
34+
$response = $this->authorization()->send("GET", "aladdin/api/v1/cities/{$cityId}/zone-list");
35+
return $response->data;
36+
}
37+
38+
/**
39+
* Get area list zone wise
40+
*
41+
* @param int $zoneId
42+
*
43+
* @return mixed
44+
* @throws GuzzleException
45+
* @throws PathaoException
46+
*/
47+
public function area($zoneId)
48+
{
49+
$response = $this->authorization()->send("GET", "aladdin/api/v1/zones/{$zoneId}/area-list");
50+
return $response->data;
51+
}
52+
}

0 commit comments

Comments
 (0)