From d5bb5b3294063bd83598b0b7f987ade89519573d Mon Sep 17 00:00:00 2001 From: Enan Date: Fri, 15 Dec 2023 00:25:01 +0600 Subject: [PATCH] Readme: Readme update V1 --- README.md | 175 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 150 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index e472313..1e83237 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,18 @@ -# A complete Laravel package for Pathao Courier +
+ +
+# A complete Laravel Package for Pathao Courier [![Latest Version on Packagist](https://img.shields.io/packagist/v/enan/pathao-courier.svg?style=flat-square)](https://packagist.org/packages/enan/pathao-courier) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/enan/pathao-courier/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/enan/pathao-courier/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/enan/pathao-courier/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/enan/pathao-courier/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/enan/pathao-courier.svg?style=flat-square)](https://packagist.org/packages/enan/pathao-courier) -This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. +This is a laravel package for [Merchant Pathao Courier](https://merchant.pathao.com/) to create order. Now this package is supporting only with one store. Creating new store and create new order with them will be in newer version. ## Support us -[](https://spatie.be/github-ad-click/pathao-courier) - -We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). - -We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards). - -## Installation +## ⚙️ Installation You can install the package via composer: @@ -27,36 +24,157 @@ You can publish and run the migrations with: ```bash php artisan vendor:publish --tag="pathao-courier-migrations" +``` + +Add the following environment variables to your `.env` file: + +``` +PATHAO_DB_TABLE_NAME='pathao-courier' // You can choose the table name of migration before running the migration. Default is 'pathao-courier' +PATHAO_CLIENT_ID= +PATHAO_CLIENT_SECRET= +PATHAO_SECRET_TOKEN= +``` + +### 🔑 Where can I find the PATHAO_CLIENT_ID? + +Go to your [Pathao Developers Api](https://merchant.pathao.com/courier/developer-api) and you'll find `Merchant API Credentials` therer. +And for `PATHAO_SECRET_TOKEN=` you'll be provided it after the successfull authentication. + +### 🎫 Setup + +Run the migration + +```bash php artisan migrate ``` -You can publish the config file with: +You have to set the token of pathao courier. To set run below artisan command
+The command will ask the credentials. This is a one time process. You don't have to setup this again.
+If you want to update current token and secret you can run the command again.
+You will be provided a secret token here. Please set the token in your `.env` file with `PATHAO_SECRET_TOKEN=` ```bash -php artisan vendor:publish --tag="pathao-courier-config" +php artisan set:pathao-courier ``` -This is the contents of the published config file: +Add the following in `config\app.php` ```php -return [ -]; -``` +// add below line in the providers array +Enan\PathaoCourier\PathaoCourierServiceProvider::class, -Optionally, you can publish the views using -```bash -php artisan vendor:publish --tag="pathao-courier-views" +// add below line in the alias array +'PathaoCourier' => Enan\PathaoCourier\Facades\PathaoCourier::class, ``` -## Usage +### 🏗 Usage ```php -$pathaoCourier = new Enan\PathaoCourier(); -echo $pathaoCourier->echoPhrase('Hello, Enan!'); +use Enan\PathaoCourier\PathaoCourier; + + +/** + * To Get the days left of token expiration + * You'll get the expected date of the expiration and total days left + * + * @type + */ +PathaoCourier::GET_ACCESS_TOKEN_EXPIRY_DAYS_LEFT(); + +/** To Get the cities + * + * @type + */ +PathaoCourier::GET_CITIES(); + +/** + * To Get the Zones + * @type + * + * @param int $city_id + */ +PathaoCourier::GET_ZONES(int $city_id); + +/** + * To Get the Areas + * @type + * + * @param int $zone_id + */ +PathaoCourier::GET_AREAS(int $zone_id); + +/** + * To Get the Stores + * @type + * + * @param int $page + * $page param is optional. If you want you can implement pagination here. + */ +PathaoCourier::GET_STORES(int $page); + +/** + * To Create Store + * @type + * + * @param $name + * @param $contact_name + * @param $contact_number + * @param $address + * @param $city_id + * @param $zone_id + * @param $area_id + */ +PathaoCourier::CREATE_STORE(int $page); + +/** + * To Create Order + * @type + * + * @param $store_id + * @param $merchant_order_id + * @param $sender_name + * @param $sender_phone + * @param $recipient_name + * @param $recipient_phone + * @param $recipient_address + * @param $recipient_city + * @param $recipient_zone + * @param $recipient_area + * @param $delivery_type is provided by the merchant and not changeable. 48 for Normal Delivery, 12 for On Demand Delivery" + * @param $item_type is provided by the merchant and not changeable. 1 for Document, 2 for Parcel" + * @param $special_instruction + * @param $item_quantity + * @param $item_weight + * @param $amount_to_collect + * @param $item_description + */ +PathaoCourier::CREATE_ORDER(int $page); + +/** + * To Get Price Calculation + * @type + * + * @param $delivery_type + * @param $item_type + * @param $item_weight + * @param $recipient_city + * @param $recipient_zone + * @param $store_id + */ +PathaoCourier::GET_PRICE_CALCULATION(PathaoOrderPriceCalculationRequest $request); + + +/** + * To Create Order + * @type + * @param string $consignment_id + */ +PathaoCourier::VIEW_ORDER(string $consignment_id); + ``` -## Testing + ## Credits -- [Moammer Farshid Enan](https://github.com/Enan) -- [All Contributors](../../contributors) +- [Moammer Farshid Enan](https://github.com/Enan) +- [All Contributors](../../contributors) ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information. + +## Check me on + +- [Portfolio](https://moammer-enan.com/) +- [Facebook](https://www.facebook.com/moammerfarshidenan) +- [GitHub](https://github.com/enuenan) +- [LinkedIn](https://www.linkedin.com/in/moammer-farshid/)