Skip to content

Commit

Permalink
Updated interactions examples
Browse files Browse the repository at this point in the history
  • Loading branch information
codedeviate committed Sep 5, 2024
1 parent 61e3dbd commit f94313e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions Writerside/hi.tree
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<toc-element topic="API-Interaction.md">
<toc-element topic="API-Interaction-PHP.md">
<toc-element topic="Get-info-on-non-activated-invoices.md"/>
<toc-element topic="Get-status-log-by-invoice-number.md"/>
</toc-element>
</toc-element>
</instance-profile>
2 changes: 2 additions & 0 deletions Writerside/topics/Get-info-on-non-activated-invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ foreach($invoices as $invoice) {
]]>
</code-block>

Full example can be found [here](https://github.com/Billmate/qvickly-php-module/blob/main/examples/Interactions/getInfoOnNonActivatedInvoices.php)

<include from="Snippets-PHP-Module.md" element-id="snippet-composer-require" />

47 changes: 47 additions & 0 deletions Writerside/topics/Get-status-log-by-invoice-number.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Update status log by invoice number

In this example we will authenticate against the Auth API, fetch the hash of the invoice from the Portal API and then use the Payment API to update the status log.

<code-block lang="php">

<![CDATA[
<?php
declare(strict_types=1);
require __DIR__ . '/../../vendor/autoload.php';
use Dotenv\Dotenv;
use Qvickly\Api\Auth\AuthAPI;
use Qvickly\Api\Portal\PortalAPI;
use Qvickly\Api\Payment\PaymentAPI;
$dotenv = Dotenv::createImmutable(__DIR__ . '/../..');
$dotenv->load();

$authAPI = new AuthAPI();
$auth = $authAPI->login($_ENV['USERNAME'], $_ENV['PASSWORD']);

$portalAPI = new PortalAPI($auth);

$paymentAPI = new PaymentAPI($_ENV['EID'], $_ENV['SECRET']);

$invoice = $portalAPI->get('invoices/' . $_ENV['INVOICEID']);

$hash = $invoice['hash'];

$result = $paymentAPI->updateStatusLogOfInvoiceByHash([
'hash' => $hash,
'body' => [
'text' => 'Updated status log after getting hash from PortalAPI (%(sendtime))',
'sendtime' => date(DATE_ATOM),
],
]);
print_r($result);
]]>

</code-block>

Full example can be found [here](https://github.com/Billmate/qvickly-php-module/blob/main/examples/Interactions/updateStatusLogByInvoiceNumber.php)

<include from="Snippets-PHP-Module.md" element-id="snippet-composer-require" />

0 comments on commit f94313e

Please sign in to comment.