zangra / exact-online-bundle
A Bundle for Exact Online API
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Type:symfony-bundle
Requires
- php: ^7.4 || ^8.1
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
- doctrine/doctrine-bundle: *
- doctrine/orm: *
- guzzlehttp/guzzle: ^6.2 || ^7.2
- monolog/monolog: ^2.0
- symfony/framework-bundle: ^4.4 || ^5.4
This package is auto-updated.
Last update: 2024-10-22 07:43:08 UTC
README
Author: Bianchi Jefferson / Lambot Maxime
Mail: jefferson@zangra.com / maxime@zangra.com
Exact Online doc: https://support.exactonline.com/community/s/knowledge-base#All-All-DNO-Content-getting-started
Requirements
Symfony HTTP Client 5.1branch for:
Symfony version 4.4
php version 7.2
STEP 1
Create your APP on : https://apps.exactonline.com/be/fr-BE/V2/Manage/
STEP 2
composer require zangra/exact-online-bundle
STEP 3
Now you can use multi account ( by country )
config/package/exact_online.yaml
exact_online:
Belgium:
baseUrl: https://start.exactonline.be/
apiUrl: api/v1
authUrl: api/oauth2/auth
tokenUrl: api/oauth2/token
redirectUrl: https://YOURURL/ExactRequest
clientId: YOURID
clientSecret: YOURSECRET
France:
baseUrl: https://start.exactonline.fr/
apiUrl: api/v1
authUrl: api/oauth2/auth
tokenUrl: api/oauth2/token
redirectUrl: https://YOURURL/ExactRequest
clientId: YOURID
clientSecret: YOURSECRET
Nerderland:
baseUrl: https://start.exactonline.nl/
apiUrl: api/v1
authUrl: api/oauth2/auth
tokenUrl: api/oauth2/token
redirectUrl: https://YOURURL/ExactRequest
clientId: YOURID
clientSecret: YOURSECRET
Spain:
baseUrl: https://start.exactonline.es/
apiUrl: api/v1
authUrl: api/oauth2/auth
tokenUrl: api/oauth2/token
redirectUrl: https://YOURURL/ExactRequest
clientId: YOURID
clientSecret: YOURSECRET
STEP 4
You need to update your database:php app/console doctrine:schema:update --force
STEP 5
In your controller :
use zangra\ExactOnlineBundle\Manager\ExactManager;
public function indexAction(Request $request, ExactManager $exactManager)
{
// the code sended by exact online when the first auth
$code = $request->query->get('code');
//$exactManager->init($code); // use init for the first Authentification, after that you should to use forceRefreshToken();
$exactManager->forceRefreshToken();
}
Next go to http:// YOUR URL.com/ExactRequest Your authentication login will be required, this session will expire after 10 minutes The token is automatically reniew when you launch an Request to Exact with self::refreshAccessToken();
Usage
Init
$code = $request->query->get('code');
$exactManager = $this->get("exact_online.manager");
//$exactManager->init($code); // first init
$exactManager->forceRefreshToken(); // after first init
getList($page, $maxPerPage)
(with pagination)$listAccount = $exactManager->getModel("Account")->getList(1,5);
foreach ($listAccount as $account){
dump($account);
}
findBy()
$criteria = array('AddressLine1' => 'Koningin Astridlaan 166');
$select = array ("AddressLine1", "BusinessType", "CountryName", "Created");
$orderBy = array('Created' => 'desc');
$limit = 1 ;
$account = $exactManager->getModel("Account")->findBy($criteria,$select,$orderBy,$limit);
dump($account);
find
(guid)account = $exactManager->getModel("Account")->find("587707b8-94aa-426a-b7db-56d434d9e83a");
persist()
$item = new Item();
$item->setCode(rand());
$item->setCostPriceStandard(5);
$item->setDescription("description de test");
$item->setIsSalesItem(true);
$item->setSalesVatCode('VN');
$exactManager->persist($item);
update()
$account = $exactManager->getModel("Account")->find("587707b8-94aa-426a-b7db-56d434d9e83a");
$account->setWebsite("https://zangra.com");
$exactManager->update($account);
remove()
$account = $exactManager->getModel("Account")->find("587707b8-94aa-426a-b7db-56d434d9e83a");
$exactManager->remove($account);