codeboxr/paperfly-courier

孟加拉国Paperfly快递服务API包

v1.0.2 2022-10-14 11:49 UTC

This package is auto-updated.

Last update: 2024-09-17 08:00:10 UTC


README

PaperflyCourier孟加拉国

这是一个用于Paperfly BD快递系统的Laravel/PHP包。此包可用于laravel或laravel/php项目。您可以使用此包进行无头/rest实现,以及blade或常规模式开发。我们在参与一个项目时创建了此包,并认为将其发布出来以帮助所有人。此包可作为常规php composer包使用。

特性

  1. 创建包裹
  2. 包裹追踪
  3. 包裹详情
  4. 取消包裹

要求

  • PHP >=7.2
  • Laravel >= 6

安装

composer require codeboxr/paperfly-courier

vendor publish (config)

php artisan vendor:publish --provider="Codeboxr\PaperflyCourier\PaperflyCourierServiceProvider"

发布配置文件后,设置您的凭据。您可以在配置目录中的paperfly.php文件中看到这些。

"sandbox"  => env("PAPERFLY_SANDBOX", false),
"username" => env("PAPERFLY_USERNAME", ""),
"password" => env("PAPERFLY_PASSWORD", ""),
"key"      => env("PAPERFLY_KEY", "")

设置.env配置

PAPERFLY_SANDBOX=true // for production mode use false
PAPERFLY_USERNAME=""
PAPERFLY_PASSWORD=""
PAPERFLY_KEY=""

使用

1. 创建包裹

use Codeboxr\PaperflyCourier\Facade\PaperflyCourier;

return PaperflyCourier::order()->create([
  "merOrderRef"          => "", // merchant invoice id
  "pickMerchantName"     => "" // Pickup store name,
  "pickMerchantAddress"  => "" // Pickup address,
  "pickMerchantThana"    => "" // Pickup thana name,
  "pickMerchantDistrict" => "" // Pickup district name,
  "pickupMerchantPhone"  => "" // Pickup contact person name,
  "productSizeWeight"    => "standard",
  "productBrief"         => "" // Parcel product details, 
  "packagePrice"         => "" //parcel price,
  "deliveryOption"       => "regular",
  "custname"             => "" // customer name,
  "custaddress"          => "" // customer address,
  "customerThana"        => "" // customer thana name,
  "customerDistrict"     => "" // customer district name,
  "custPhone"            => "" // customer phone number,
  "max_weight"           => "" // parcel weight in kg
]);

2. 跟踪包裹

use Codeboxr\PaperflyCourier\Facade\PaperflyCourier;

return PaperflyCourier::order()->tracking($trackingNumber) // Tracking Number

3. 包裹详情

use Codeboxr\PaperflyCourier\Facade\PaperflyCourier;

return PaperflyCourier::order()->invoice($referenceNumber) // reference number

4. 取消包裹

use Codeboxr\PaperflyCourier\Facade\PaperflyCourier;

return PaperflyCourier::order()->cancel($referenceNumber) // reference number

贡献

欢迎为Paperfly包做出贡献。在提交pull request之前,请注意以下指南。

  • 遵循 PSR-4 编码标准。
  • 首先阅读Paperfly API文档

许可证

Paperfly包在MIT许可证下授权。

版权 2022 Codeboxr