1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Payment.php |
4
|
|
|
* Copyright (c) 2020 [email protected]. |
5
|
|
|
* |
6
|
|
|
* This file is part of the Firefly III bunq importer |
7
|
|
|
* (https://github.com/firefly-iii/bunq-importer). |
8
|
|
|
* |
9
|
|
|
* This program is free software: you can redistribute it and/or modify |
10
|
|
|
* it under the terms of the GNU Affero General Public License as |
11
|
|
|
* published by the Free Software Foundation, either version 3 of the |
12
|
|
|
* License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU Affero General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU Affero General Public License |
20
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
declare(strict_types=1); |
24
|
|
|
|
25
|
|
|
namespace App\Bunq\Requests; |
26
|
|
|
|
27
|
|
|
use App\Exceptions\ImportException; |
28
|
|
|
use bunq\Model\Generated\Endpoint\BunqResponsePaymentList; |
29
|
|
|
use bunq\Model\Generated\Endpoint\Payment as BunqPayment; |
30
|
|
|
use Exception; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Class Payment. |
34
|
|
|
* |
35
|
|
|
* @codeCoverageIgnore |
36
|
|
|
*/ |
37
|
|
|
class Payment |
38
|
|
|
{ |
39
|
|
|
/** |
40
|
|
|
* @param int|null $monetaryAccountId |
41
|
|
|
* @param array|null $params |
42
|
|
|
* @param array|null $customHeaders |
43
|
|
|
* |
44
|
|
|
* @throws ImportException |
45
|
|
|
* @return BunqResponsePaymentList |
46
|
|
|
*/ |
47
|
|
|
public function listing(int $monetaryAccountId = null, array $params = null, array $customHeaders = null): BunqResponsePaymentList |
48
|
|
|
{ |
49
|
|
|
app('log')->debug('Now in Payment::listing()'); |
50
|
|
|
$monetaryAccountId = $monetaryAccountId ?? 0; |
51
|
|
|
$params = $params ?? []; |
52
|
|
|
$customHeaders = $customHeaders ?? []; |
53
|
|
|
try { |
54
|
|
|
$result = BunqPayment::listing($monetaryAccountId, $params, $customHeaders); |
55
|
|
|
} catch (Exception $e) { |
56
|
|
|
app('log')->error(sprintf('Exception: %s', $e->getMessage())); |
57
|
|
|
app('log')->error($e->getTraceAsString()); |
58
|
|
|
throw new ImportException($e->getMessage()); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
return $result; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|