gotrendier / pickit-php-sdk
PickIt.net服务的PHP SDK
该包的规范仓库似乎已消失,因此该包已被冻结。
dev-main
2023-05-11 11:09 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.1
- phpmd/phpmd: ^2.10
- phpunit/phpunit: 9.5.*
- squizlabs/php_codesniffer: ^3.6
- symfony/console: ^5.3
- symfony/process: ^5.3
- tetreum/perfect-print: dev-master
This package is not auto-updated.
Last update: 2024-06-18 16:00:08 UTC
README
PickIt PHP SDK
PickIt.net服务的PHP SDK。基于 https://dev.pickit.net/
安装
composer require gotrendier/pickit-php-sdk
需求
>= PHP 7.4- CURL
使用方法
初始化
$pickIt = new \PickIt\PickItClient('API_KEY', 'TOKEN', 'COUNTRY', $sandBox = true);
获取MapPoints
$response = $pickIt->getMapPoint(1, 10);
创建SimplifiedTransaction
$products = [ new Product("Botines dulces", new Measure(55, Measure::UNIT_G), new Measure(150, Measure::UNIT_CM), new Measure(30, Measure::UNIT_CM), new Measure(30, Measure::UNIT_CM), 1 ) ]; $customer = (new Person("Marta", "Fernandez")) ->setPid("345345") ->setEmail("edualdo@gmail.com") ->setAddress(new Address( "11320", "LAGO COMO 21", "ciudad de México", "México" )) ; $budgetRequest = new BudgetPetitionRequest(PickItClient::SERVICE_TYPE_PICKIT_POINT, PickItClient::WORKFLOW_DISPATCH, PickItClient::OPERATION_TYPE_TO_HOME, $products, PickItClient::SLA_STANDARD, $customer); $budgetRequest->setPointId('1086'); $transactionRequest = new TransactionRequest(PickItClient::START_TYPE_RETAILER, "ORDER_ID"); $request = new SimplifiedTransactionRequest($budgetRequest, $transactionRequest); $response = $pickIt->createSimplifiedTransaction($request);
获取标签
$response = $pickIt->getLabel($transactionId = 454352);
获取运输状态
$response = $pickIt->getShipmentStatus("TRACKING_CODE");
创建预算
use \PickIt\Entities\Person; use \PickIt\Entities\Product; use \PickIt\Entities\Measure; use \PickIt\Entities\Address; use \PickIt\Requests\BudgetPetitionRequest; $products = [ new Product("Botines dulces", new Measure(55, Measure::UNIT_G), new Measure(150, Measure::UNIT_CM), new Measure(30, Measure::UNIT_CM), new Measure(30, Measure::UNIT_CM), 1 ) ]; $customer = (new Person("Marta", "Fernandez")) ->setPid("345345") ->setEmail("edualdo@gmail.com") ->setAddress(new Address( "11320", "LAGO COMO 21", "ciudad de México", "México" )) ; $request = new BudgetPetitionRequest(PickIt::SERVICE_TYPE_PICKIT_POINT, PickIt::WORKFLOW_DISPATCH, PickIt::OPERATION_TYPE_TO_POINT, $products, PickIt::SLA_STANDARD, $customer); $request->setPointId('1086'); $response = $pickIt->createBudget($request);
创建交易
use \PickIt\Requests\TransactionRequest; $request = new TransactionRequest(PickIt::START_TYPE_AVAILABLE_FOR_COLLECTION, "ORDER_ID"); $response = $pickIt->createTransaction("BUDGET_UUID", $request);
开发
cp pre-commit.php .git/hooks/pre-commitchmod 775 .git/hooks/pre-commit