By srdorado
This library consumes the Siigo API enabling:
-
Create, update and consult Sales Invoices.
-
Sending sales invoices to the Dian and customers.
-
Create, consult, update and delete Clients (Third Parties) and Products/Services.
-
Create and consult Accounting Receipts, Credit Notes and Cash Receipts.
-
Consult Inventory of a product in Siigo Cloud.
composer require srdorado/siigo-client-php
- Get token
function getToken()
{
// Create client token
$clientFactory = new \Srdorado\SiigoClient\Factory\ClientFactory();
$clientTokenFactory = $clientFactory->create(\Srdorado\SiigoClient\Enum\ClientType::TOKEN);
$clientToken = $clientTokenFactory->create();
$clientToken->setBaseUrl('https://api.siigo.com/');
// Create entity token
$entity = new \Srdorado\SiigoClient\Model\Entity(\Srdorado\SiigoClient\Enum\ClientType::TOKEN);
$entity->setData(
[
'username' => '',
'access_key' => ''
]
);
// Request token
return $clientToken->getToken($entity);
}
- Create product
function getCustomClient()
{
// generate token
$token = $this->getToken();
// Create client
$clientFactory = new \Srdorado\SiigoClient\Factory\ClientFactory();
$clientProductFactory = $clientFactory->create(\Srdorado\SiigoClient\Enum\ClientType::PRODUCT);
$clientProduct = $clientProductFactory->create();
$clientProduct->setBaseUrl('https://api.siigo.com/');
$clientProduct->setAccessKey($token);
return $clientProduct;
}
function create()
{
$clientProduct = $this->getCustomClient();
$entity = new \Srdorado\SiigoClient\Model\Entity(\Srdorado\SiigoClient\Enum\ClientType::PRODUCT);
$dataEntity = $this->getExampleCompleteProduct();
$entity->setData($dataEntity);
$productId = $clientProduct->create($entity);
$this->assertTrue(true);
}
Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.
This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.