-
Notifications
You must be signed in to change notification settings - Fork 3
/
callback.php
49 lines (41 loc) · 1.07 KB
/
callback.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
<?php
/**
* bunq-to-lunchmoney
* bunq to Lunch Money
*
* @author Mark Jongkind <mark@backscreen.nl>
* @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 callback handler
*/
require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/config.php');
require_once(__DIR__ . '/functions.php');
try
{
echo '<h2>bunq to Lunch Money</h2>';
echo '<hr />';
restoreApiContext();
// Get recent bunq transations
$bunqTransactions = getBunqTransactions();
// Upload transactions to Lunch Money
$result = uploadLunchMoneyTransactions($bunqTransactions);
if( $result !== false )
{
echo 'Retrieved <strong>' . count($bunqTransactions) . '</strong> transactions from bunq<br />';
echo 'Created <strong>' . count($result['ids']) . '</strong> new transactions in Lunch Money';
}
else
{
echo 'No transactions created in Lunch Money';
}
}
catch (Exception $e)
{
echo $e->getMessage();
}
?>