tocaan/aramex

将 Laravel 项目与 Aramex 集成。

1.0.5 2022-09-05 20:57 UTC

This package is auto-updated.

Last update: 2024-09-06 01:14:06 UTC


README

将 Aramex 功能添加到您的 Laravel 项目中。

此存储库是 DigitalCloud/aramex 的完整重建。

目录

安装

运行以下命令以安装该包的最新适用版本

composer require tocaan/aramex

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="ExtremeSa\Aramex\AramexServiceProvider" --tag="config"

您可以使用以下命令发布资源文件

php artisan vendor:publish --provider="ExtremeSa\Aramex\AramexServiceProvider" --tag="lang"

快速入门

位置

获取国家列表

此方法允许用户获取世界国家列表。

Aramex::fetchCountries()->run();

获取某个国家的详细信息

此方法允许用户获取某个国家的详细信息。

Aramex::fetchCountry()
    ->setCode('PS')
    ->run();

获取某个国家内的所有州

此方法允许用户获取某个国家(国家代码)内的所有州。

Aramex::fetchStates()
    ->setCountryCode('AE')
    ->run();

获取某个国家内的所有城市

此方法允许用户获取某个国家(国家代码)内的所有城市。允许用户获取以特定前缀开头城市的列表。需要填写必要的节点是客户端信息和国家代码。

Aramex::fetchCities()
    ->setCountryCode('AE')
    ->run();

验证地址

此方法允许用户搜索特定地址并确保地址结构正确。

Aramex::validateAddress()
    ->setAddress(
        (new Address()) ...
    )->run();

计费

计算费用

此方法允许用户获取源/目的地的运输费用。

$source = (new Address()) ... ;

$destination = (new Address()) ...;

$details = (new ShipmentDetails()) ...;

Aramex::calculateRate()
    ->setOriginalAddress($source)
    ->setDestinationAddress($destination)
    ->setShipmentDetails($details)
    ->setPreferredCurrencyCode('USD')
    ->run();

运输

创建取货请求

此方法允许用户创建取货请求。

$source = (new Address());

$contact = (new Contact());
    
$pickupItem = (new PickupItem());

$pickup = (new Pickup())
    ->setPickupAddress($source)
    ->setPickupContact($contact)
    ->setPickupLocation('Reception')
    ->setPickupDate(Carbon::now()->timestamp)
    ->setReadyTime(Carbon::now()->timestamp)
    ->setLastPickupTime(Carbon::now()->addDay()->timestamp)
    ->setClosingTime(Carbon::now()->addDay()->timestamp)
    ->setStatus('Pending')
    ->setReference1('')
    ->addPickupItem($pickupItem);
    
$labelInfo = (new LabelInfo())
    ->setReportId(9201)
    ->setReportType('URL');
    
Aramex::createPickup()
    ->setLabelInfo($labelInfo)
    ->setPickup($pickup)
    ->run();

取消取货

此方法允许您在取货未分配或待定详情的情况下取消取货。

Aramex::cancelPickup()
    ->setPickupGUID('PICKUP_GUID')
    ->run();

创建运输

此方法允许用户在 Aramex 系统中创建运输。

Aramex::createShipments()->run();

获取最后一批运输编号范围

此方法允许您使用特定实体和产品组查询最后预留的范围。

Aramex::getLastShipmentsNumbersRange()
    ->setEntity('ENTITY')
    ->setProductGroup('PRODUCT_GROUP')
    ->run();

打印标签

此方法允许用户为现有运输打印标签。

$labelInfo = (new \ExtremeSa\Aramex\API\Classes\LabelInfo())
    ->setReportId(9201)
    ->setReportType('URL');
    
Aramex::printLabel()
    ->setShipmentNumber('SHIPMENT_NO')
    ->setLabelInfo()
    ->run();

预留运输编号范围

此方法允许您预留一系列运输编号。

Aramex::reserveShipmentNumberRange()->run();

安排送货

此方法允许您在指定的时间和地点(经度和纬度)安排运输的交付。

Aramex::scheduleDelivery()->run();

跟踪

跟踪取货

此方法允许用户跟踪现有取货的更新和最新状态。

Aramex::trackPickup()
    ->setReference('PICKUP_NO')
    ->setPickup('PICKUP') // any number
    ->run();

跟踪运输

此方法允许用户跟踪现有运输的更新和最新状态。

Aramex::trackShipments()
    ->setShipments(['SHIPMENT_NO'])
    ->run();

积分