@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | protected function mapApiRoutes(): void |
69 | 69 | { |
70 | 70 | Route::prefix('api') |
71 | - ->middleware('api') |
|
72 | - ->namespace($this->namespace) |
|
73 | - ->group(base_path('routes/api.php')); |
|
71 | + ->middleware('api') |
|
72 | + ->namespace($this->namespace) |
|
73 | + ->group(base_path('routes/api.php')); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | protected function mapWebRoutes(): void |
84 | 84 | { |
85 | 85 | Route::middleware('web') |
86 | - ->namespace($this->namespace) |
|
87 | - ->group(base_path('routes/web.php')); |
|
86 | + ->namespace($this->namespace) |
|
87 | + ->group(base_path('routes/web.php')); |
|
88 | 88 | } |
89 | 89 | } |
@@ -94,7 +94,7 @@ |
||
94 | 94 | public function withValidator(Validator $validator): void |
95 | 95 | { |
96 | 96 | $validator->after( |
97 | - static function (Validator $validator) { |
|
97 | + static function(Validator $validator) { |
|
98 | 98 | $data = $validator->getData(); |
99 | 99 | // if (!isset($data['accounts'])) { |
100 | 100 | // $validator->errors()->add( |
@@ -66,13 +66,13 @@ |
||
66 | 66 | $response = response($result); |
67 | 67 | $name = sprintf('bunq_import_config_%s.json', date('Y-m-d')); |
68 | 68 | $response->header('Content-disposition', 'attachment; filename=' . $name) |
69 | - ->header('Content-Type', 'application/json') |
|
70 | - ->header('Content-Description', 'File Transfer') |
|
71 | - ->header('Connection', 'Keep-Alive') |
|
72 | - ->header('Expires', '0') |
|
73 | - ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') |
|
74 | - ->header('Pragma', 'public') |
|
75 | - ->header('Content-Length', strlen($result)); |
|
69 | + ->header('Content-Type', 'application/json') |
|
70 | + ->header('Content-Description', 'File Transfer') |
|
71 | + ->header('Connection', 'Keep-Alive') |
|
72 | + ->header('Expires', '0') |
|
73 | + ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') |
|
74 | + ->header('Pragma', 'public') |
|
75 | + ->header('Content-Length', strlen($result)); |
|
76 | 76 | |
77 | 77 | return $response; |
78 | 78 | } |
@@ -101,8 +101,8 @@ |
||
101 | 101 | return redirect()->route('import.download.index'); |
102 | 102 | } |
103 | 103 | // get list of asset accounts in Firefly III |
104 | - $uri = (string) config('bunq.uri'); |
|
105 | - $token = (string) config('bunq.access_token'); |
|
104 | + $uri = (string)config('bunq.uri'); |
|
105 | + $token = (string)config('bunq.access_token'); |
|
106 | 106 | $request = new GetAccountsRequest($uri, $token); |
107 | 107 | $request->setType(GetAccountsRequest::ASSET); |
108 | 108 | $ff3Accounts = $request->get(); |
@@ -119,7 +119,7 @@ |
||
119 | 119 | case MonetaryAccountBank::class: |
120 | 120 | case MonetaryAccountSavings::class: |
121 | 121 | case MonetaryAccountJoint::class: |
122 | - $return = [ |
|
122 | + $return = [ |
|
123 | 123 | 'id' => $object->getId(), |
124 | 124 | 'currency' => $object->getCurrency(), |
125 | 125 | 'description' => $object->getDescription(), |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | } |
95 | 95 | $totalCount = 0; |
96 | 96 | foreach (array_keys($this->configuration->getAccounts()) as $bunqAccountId) { |
97 | - $bunqAccountId = (int) $bunqAccountId; |
|
97 | + $bunqAccountId = (int)$bunqAccountId; |
|
98 | 98 | try { |
99 | 99 | $return[$bunqAccountId] = $this->getForAccount($bunqAccountId); |
100 | - $totalCount += count($return[$bunqAccountId]); |
|
100 | + $totalCount += count($return[$bunqAccountId]); |
|
101 | 101 | } catch (ImportException $e) { |
102 | 102 | app('log')->error($e->getMessage()); |
103 | 103 | app('log')->error($e->getTraceAsString()); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $disk = Storage::disk('downloads'); |
129 | 129 | try { |
130 | - $content = (string) $disk->get($this->downloadIdentifier); |
|
130 | + $content = (string)$disk->get($this->downloadIdentifier); |
|
131 | 131 | } catch (FileNotFoundException $e) { |
132 | 132 | app('log')->error('Could not store download'); |
133 | 133 | app('log')->error($e->getMessage()); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | return null; |
258 | 258 | } |
259 | 259 | |
260 | - $transaction = [ |
|
260 | + $transaction = [ |
|
261 | 261 | // TODO country, bunqMe, isLight, swiftBic, swiftAccountNumber, transferwiseAccountNumber, transferwiseBankCode |
262 | 262 | // TODO merchantCategoryCode, bunqtoStatus, bunqtoSubStatus, bunqtoExpiry, bunqtoTimeResponded |
263 | 263 | // TODO merchantReference, batchId, scheduledId, addressShipping, addressBilling, geolocation, allowChat, |
@@ -145,9 +145,9 @@ |
||
145 | 145 | $doImport = $array['do_import'] ?? []; |
146 | 146 | $accounts = []; |
147 | 147 | foreach ($doImport as $bunqId => $selected) { |
148 | - $selected = (int) $selected; |
|
148 | + $selected = (int)$selected; |
|
149 | 149 | if (1 === $selected) { |
150 | - $accounts[(int) $bunqId] = (int) ($array['accounts'][$bunqId] ?? 0); |
|
150 | + $accounts[(int)$bunqId] = (int)($array['accounts'][$bunqId] ?? 0); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | $object->accounts = $accounts; |
@@ -46,7 +46,7 @@ |
||
46 | 46 | // account ID's in the right order |
47 | 47 | $low = min($transaction['source_id'], $transaction['destination_id']); |
48 | 48 | $high = max($transaction['source_id'], $transaction['destination_id']); |
49 | - $amount = (string) round($transaction['amount'], 2); |
|
49 | + $amount = (string)round($transaction['amount'], 2); |
|
50 | 50 | $datetime = substr($transaction['datetime'], 0, 19); // shave off the milli seconds. |
51 | 51 | $description = $transaction['description']; |
52 | 52 | $key = sprintf($format, $low, $high, $amount, $description, $datetime); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function send(array $transactions): array |
52 | 52 | { |
53 | - $uri = (string) config('bunq.uri'); |
|
54 | - $token = (string) config('bunq.access_token'); |
|
53 | + $uri = (string)config('bunq.uri'); |
|
54 | + $token = (string)config('bunq.access_token'); |
|
55 | 55 | foreach ($transactions as $index => $transaction) { |
56 | 56 | app('log')->debug(sprintf('Trying to send transaction #%d', $index), $transaction); |
57 | 57 | $this->sendTransaction($uri, $token, $index, $transaction); |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | return []; |
110 | 110 | } |
111 | 111 | $groupId = $group->id; |
112 | - $uri = (string) config('bunq.uri'); |
|
113 | - $groupUri = (string) sprintf('%s/transactions/show/%d', $uri, $groupId); |
|
112 | + $uri = (string)config('bunq.uri'); |
|
113 | + $groupUri = (string)sprintf('%s/transactions/show/%d', $uri, $groupId); |
|
114 | 114 | |
115 | 115 | /** @var Transaction $tr */ |
116 | 116 | foreach ($group->transactions as $tr) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $index + 1, |
119 | 119 | sprintf( |
120 | 120 | 'Created transaction #%d: <a href="%s">%s</a> (%s %s)', $groupId, $groupUri, $tr->description, $tr->currencyCode, |
121 | - round((float) $tr->amount, 2) |
|
121 | + round((float)$tr->amount, 2) |
|
122 | 122 | ) |
123 | 123 | ); |
124 | 124 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | { |
68 | 68 | Log::debug('Going to collect all target accounts from Firefly III.'); |
69 | 69 | // send account list request to Firefly III. |
70 | - $token = (string) config('bunq.access_token'); |
|
71 | - $uri = (string) config('bunq.uri'); |
|
70 | + $token = (string)config('bunq.access_token'); |
|
71 | + $uri = (string)config('bunq.uri'); |
|
72 | 72 | $request = new GetAccountsRequest($uri, $token); |
73 | 73 | /** @var GetAccountsResponse $result */ |
74 | 74 | $result = $request->get(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | $iban = $entry->iban; |
84 | - if ('' === (string) $iban) { |
|
84 | + if ('' === (string)$iban) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | Log::debug(sprintf('Collected %s (%s) under ID #%d', $iban, $entry->type, $entry->id)); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $return = []; |
105 | 105 | /** @var array $entry */ |
106 | 106 | foreach ($bunq as $bunqAccountId => $entries) { |
107 | - $bunqAccountId = (int) $bunqAccountId; |
|
107 | + $bunqAccountId = (int)$bunqAccountId; |
|
108 | 108 | app('log')->debug(sprintf('Going to parse account #%d', $bunqAccountId)); |
109 | 109 | foreach ($entries as $entry) { |
110 | 110 | $return[] = $this->generateTransaction($bunqAccountId, $entry); |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | $return['transactions'][0]['amount'] = $entry['amount']; |
168 | 168 | |
169 | 169 | // destination is bunq |
170 | - $return['transactions'][0]['destination_id'] = (int) $this->accounts[$bunqAccountId]; |
|
170 | + $return['transactions'][0]['destination_id'] = (int)$this->accounts[$bunqAccountId]; |
|
171 | 171 | |
172 | 172 | // source is the other side: |
173 | 173 | $return['transactions'][0]['source_iban'] = $entry['counter_party']['iban']; |
174 | 174 | $return['transactions'][0]['source_name'] = $entry['counter_party']['display_name']; |
175 | 175 | |
176 | - $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string) $entry['counter_party']['iban']); |
|
176 | + $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string)$entry['counter_party']['iban']); |
|
177 | 177 | if (null !== $mappedId && 0 !== $mappedId) { |
178 | 178 | $mappedType = $this->getMappedType($mappedId); |
179 | 179 | $return['transactions'][0]['type'] = $this->getTransactionType($mappedType, 'asset'); |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | $return['transactions'][0]['amount'] = bcmul($entry['amount'], '-1'); |
203 | 203 | |
204 | 204 | // source is bunq: |
205 | - $return['transactions'][0]['source_id'] = (int) $this->accounts[$bunqAccountId]; |
|
205 | + $return['transactions'][0]['source_id'] = (int)$this->accounts[$bunqAccountId]; |
|
206 | 206 | |
207 | 207 | // dest is shop |
208 | 208 | $return['transactions'][0]['destination_iban'] = $entry['counter_party']['iban']; |
209 | 209 | $return['transactions'][0]['destination_name'] = $entry['counter_party']['display_name']; |
210 | 210 | |
211 | - $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string) $entry['counter_party']['iban']); |
|
211 | + $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string)$entry['counter_party']['iban']); |
|
212 | 212 | //Log::debug(sprintf('Mapped ID is %s', var_export($mappedId, true))); |
213 | 213 | if (null !== $mappedId && 0 !== $mappedId) { |
214 | 214 | $return['transactions'][0]['destination_id'] = $mappedId; |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function getAccountType(int $accountId): string |
245 | 245 | { |
246 | - $uri = (string) config('bunq.uri'); |
|
247 | - $token = (string) config('bunq.access_token'); |
|
246 | + $uri = (string)config('bunq.uri'); |
|
247 | + $token = (string)config('bunq.access_token'); |
|
248 | 248 | app('log')->debug(sprintf('Going to download account #%d', $accountId)); |
249 | 249 | $request = new GetAccountRequest($uri, $token); |
250 | 250 | $request->setId($accountId); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $fullName = sprintf('%s (%s)', $name, $iban); |
271 | 271 | } |
272 | 272 | if (isset($this->configuration->getMapping()[$fullName])) { |
273 | - return (int) $this->configuration->getMapping()[$fullName]; |
|
273 | + return (int)$this->configuration->getMapping()[$fullName]; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | return null; |