leroy-merlin-br / laravel-axado-api
A consumer for Axado API.
Installs: 5 967
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 12
Forks: 2
Open Issues: 0
Requires
- php: >=7.0
- ext-curl: *
Requires (Dev)
- mockery/mockery: ^0.9
- phpunit/phpunit: ^6.0
- satooshi/php-coveralls: dev-master
README
A wrapper to Axado API.
Instalation
To get started, install Laravel Axado API via the Composer package manager:
composer require leroy-merlin-br/laravel-axado-api
Setup
Make your Product
class implement VolumeInterface
.
Optionally, you can use VolumeTrait
too. For example:
class Product implements Axado\Volume\VolumeInterface { use Axado\Volume\VolumeTrait; public function getSku() { return "123"; } public function getQuantity() { return 10; } public function getPriceUnit() { return 10.5; } public function getHeight() { return 10; } public function getLength() { return 10; } public function getWidth() { return 10; } public function getWeight() { return 10; } }
Usage
-
Setting the Token API.
\Axado\Shipping::$token = "your-token";
-
Creating a new Shipping
$shipping = new Axado\Shipping(); $shipping->setPostalCodeOrigin('04661100'); $shipping->setPostalCodeDestination('13301430'); $shipping->setTotalPrice('40'); $shipping->setAdditionalDays('10'); $shipping->setAdditionalPrice('12.6');
-
Adding Volume
$volume = new Product(); $shipping->addVolume($volume);
-
Getting all quotations
$shipping->quotations();
-
Getting costs and deadline
$shipping->getCosts(); // in reais $shipping->getDeadline(); // in days