Skip to content

Commit

Permalink
Update code style in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
casperbakker authored Jul 1, 2021
1 parent 7882d66 commit 1502a8b
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,32 @@ $connection->setRedirectUrl('CALLBACK_URL');
$connection->setExactClientId('CLIENT_ID');
$connection->setExactClientSecret('CLIENT_SECRET');

if (getValue('authorizationcode')) // Retrieves authorizationcode from database
$connection->setAuthorizationCode(getValue('authorizationcode'));
if (getValue('authorizationcode')) {
// Retrieves authorizationcode from database
$connection->setAuthorizationCode(getValue('authorizationcode'));
}

if (getValue('accesstoken')) // Retrieves accesstoken from database
$connection->setAccessToken(unserialize(getValue('accesstoken')));
if (getValue('accesstoken')) {
// Retrieves accesstoken from database
$connection->setAccessToken(unserialize(getValue('accesstoken')));
}

if (getValue('refreshtoken')) // Retrieves refreshtoken from database
$connection->setRefreshToken(getValue('refreshtoken'));
if (getValue('refreshtoken')) {
// Retrieves refreshtoken from database
$connection->setRefreshToken(getValue('refreshtoken'));
}

if (getValue('expires_in')) // Retrieves expires timestamp from database
$connection->setTokenExpires(getValue('expires_in'));
if (getValue('expires_in')) {
// Retrieves expires timestamp from database
$connection->setTokenExpires(getValue('expires_in'));
}

// Make the client connect and exchange tokens
try {
$connection->connect();
$connection->connect();
} catch (\Exception $e)
{
throw new Exception('Could not connect to Exact: ' . $e->getMessage());
throw new Exception('Could not connect to Exact: ' . $e->getMessage());
}

// Save the new tokens for next connections
Expand Down Expand Up @@ -158,9 +166,9 @@ $items = $item->filter("Code eq '$productcode'"); // Uses filters as described i

// Create new invoice with invoice lines
$invoiceLines[] = [
'Item' => $itemId,
'Quantity' => $orderproduct['amount'],
'UnitPrice' => $orderproduct['price']
'Item' => $itemId,
'Quantity' => $orderproduct['amount'],
'UnitPrice' => $orderproduct['price']
];

$salesInvoice = new SalesInvoice($connection);
Expand Down

0 comments on commit 1502a8b

Please sign in to comment.