-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.php
70 lines (55 loc) · 1.68 KB
/
install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* bunq-to-lunchmoney
* bunq to Lunch Money
*
* @author Mark Jongkind <[email protected]>
* @license http://opensource.org/licenses/mit-license.php MIT License
*
* Uses the official bunq PHP SDK
* https://github.com/bunq/sdk_php
*
*
* bunq-to-lunchmoney installation, run once
*/
use bunq\Model\Generated\Endpoint\MonetaryAccountBank;
require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/config.php');
require_once(__DIR__ . '/functions.php');
echo '<h2>bunq to Lunch Money</h2>';
echo '<hr />';
try
{
// Reuse existing connection
restoreApiContext();
}
catch (Exception $e)
{
// Create the bunq connection
initBunqConnection();
}
// Get user
$user = getUser();
// Add callback URL
addCallbackUrl($user, bunqCallbackUrl);
// First get all monetary accounts for the authenticated user
$MonetaryAccountBankList = MonetaryAccountBank::listing();
$LunchMoneyTransactions = [];
echo '<strong>Bunq accounts:</strong><br />';
echo '<table><tr><th>Account ID</th><th>Description</th></tr>';
foreach ($MonetaryAccountBankList->getValue() as $MonetaryAccountBank)
{
if ($MonetaryAccountBank->getStatus() === 'ACTIVE')
echo '<tr><td><code>' . $MonetaryAccountBank->getId() . '</code></td><td>' . $MonetaryAccountBank->getDescription() . '</td></tr>';
}
echo '</table>';
echo '<hr />';
$LunchMoneyAssetList = listLunchMoneyAssets();
echo '<strong>Lunch Money assets:</strong><br />';
echo '<table><tr><th>Asset ID</th><th>Description</th></tr>';
foreach ($LunchMoneyAssetList as $LunchMoneyAsset)
{
echo '<tr><td><code>' . $LunchMoneyAsset['id'] . '</code></td><td>' . $LunchMoneyAsset['name'] . '</td></tr>';
}
echo '</table>';
?>