wdyousuf/paperfly

此包是paperfly快递的API集成

v1.0.0 2022-06-14 12:31 UTC

This package is auto-updated.

Last update: 2024-09-15 09:37:33 UTC


README

为Laravel开发者提供的Paperfly快递集成包。

步骤 1

composer require wddyousuf/paperfly
php artisan vendor:publish --provider=Wddyousuf\Paperfly\PaperflyServiceProvider
php artisan config:cache

这将在config/目录中创建一个courier.php文件。设置你希望使用的默认提供程序,并填写该提供程序必要的环境变量。

步骤 2

设置.env配置

COURIER_USERNAME="XXXXXXXX"
COURIER_PASSWORD="XXXXXXXXXX"
COURIER_API_KEY="Paperfly_~La?Rj73FcLm"
COURIER_PROVIDER="PAPERFLY"

请求取货的示例代码

use Wddyousuf\Paperfly\Facades\PaperflyCourier;

$OrderInformation=[
    "OrderNo" => "111111",
    "MerchantName" => "Mr. X",
    "MerchantAddress" => "Test",
    "MerchantThana" => "Dhanmondi",
    "MerchantDistrict" => "Dhaka",
    "MerchantPhone" => "017xxxxx",
    "SizeWeight" => "standard",
    "productDetails" => "Usb Fan",
    "packagePrice" => "0",
    "deliveryType" => "regular",
    "CustomerName" => "Mr. Y",
    "CustomerAddress" => "Road 27, Dhanmondi",
    "CustomerThana" => "Adabor",
    "CustomerDistrict" => "Dhaka",
    "CustomerPhone" => "017xxxxx",
    "max_weight" => "10",
];
$response = PaperflyCourier::sendRequest($OrderInformation);

//Collect Thana list from paperfly
//Collect District list from paperfly
// max_weight is only for weight Enabled Pickup Request
//If Thana and District doesn't match with paperfly list,It will occur error

跟踪订单的示例代码

use Wddyousuf\Paperfly\Facades\PaperflyCourier;

$orderId='XXXXXXX';
$response = PaperflyCourier::trackOrder($orderId);

发票的示例代码

use Wddyousuf\Paperfly\Facades\PaperflyCourier;

$orderId='XXXXXXX';
$response = PaperflyCourier::courierInvoice($orderId);

取消订单的示例代码

use Wddyousuf\Paperfly\Facades\PaperflyCourier;

$orderId='XXXXXXX';
$response = PaperflyCourier::CourierOrderCancel($orderId);

许可协议

MIT

如果你觉得缺少某些内容,可以就相关问题提出问题。你可以拉取请求。如果你想为这个库做贡献,我们非常欢迎...