gotrendier / pickit-php-sdk
PHP SDK for PickIt.net services
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 10 255
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
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
PHP SDK for PickIt.net services. Based on https://dev.pickit.net/
Install
composer require gotrendier/pickit-php-sdk
Requirements
>= PHP 7.4
- CURL
Usage
Initialization
$pickIt = new \PickIt\PickItClient('API_KEY', 'TOKEN', 'COUNTRY', $sandBox = true);
Get MapPoints
$response = $pickIt->getMapPoint(1, 10);
Create 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);
Get Label
$response = $pickIt->getLabel($transactionId = 454352);
Get Shipment status
$response = $pickIt->getShipmentStatus("TRACKING_CODE");
Create Budget
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);
Create Transaction
use \PickIt\Requests\TransactionRequest; $request = new TransactionRequest(PickIt::START_TYPE_AVAILABLE_FOR_COLLECTION, "ORDER_ID"); $response = $pickIt->createTransaction("BUDGET_UUID", $request);
Development
cp pre-commit.php .git/hooks/pre-commit
chmod 775 .git/hooks/pre-commit