Source Code
<?php
require_once '../vendor/autoload.php';
use Swagger\Client\Api\AccountApi;
use Swagger\Client\ApiException;
// PARAMETERS
$id = clear('id');
$current_account_type = clear('current_account_type');
$offset = clear('offset');
$limit = clear('limit');
$document_name = null;
$document_type = clear('document_type');
$document_serie = clear('document_serie');
$start_date = formatDate('start_date');
$end_date = formatDate('end_date');
$start_due_date = formatDate('start_due_date');
$end_due_date = formatDate('end_due_date');
$account = null;
$salesman = null;
// E2E ACCESS KEYS
$client = new GuzzleHttp\Client([
'headers' => [
'api_key' => 'JHSV2V6KyqcbxvMHshRlPfunJymVt7GDfXyoK229o=',
'company_key' => 'E2ELIVE',
]
]);
try {
// SEARCH CHECKING ACCOUNTS
$api = new AccountApi($client);
$result = $api->currentAccountList(
$id,
$offset,
$limit,
$document_name,
$document_type,
$document_serie,
$start_date,
$end_date,
$start_due_date,
$end_due_date,
$current_account_type,
$account,
$salesman
);
header('Content-Type: application/json; charset=utf-8');
echo $result->__toString();
} catch (Exception $e) {
http_response_code($e->getCode());
$msg = $e instanceof ApiException ? $e->getResponseBody() : $e->getMessage();
if (!empty($msg)) {
echo $msg;
}
}
function clear($field)
{
return empty($_REQUEST[$field]) ? null : $_REQUEST[$field];
}
function formatDate($field)
{
$date = clear($field);
if (!empty($date)) {
$date = DateTime::createFromFormat('Y-m-d', $date);
$date = $date->format(DateTime::ISO8601);
}
return $date;
}