redaawad622/aramex

将 Laravel 项目与 Aramex 集成。

0.8 2021-11-08 21:18 UTC

This package is not auto-updated.

Last update: 2024-09-25 09:04:33 UTC


README

为您的 Laravel 项目添加 Aramex 功能。

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

目录

安装

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

composer require extremesa/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();

信用