Browse Source

Make sure Nordigen selection selects the pre-selected country + bank from the configuration.

pull/17/head
James Cole 4 years ago
parent
commit
394e5b9a7e
No known key found for this signature in database GPG Key ID: BDE6667570EADBD5
  1. 10
      app/Http/Controllers/Import/Nordigen/SelectionController.php
  2. 2
      app/Services/Nordigen/Conversion/Routine/GenerateTransactions.php
  3. 3
      resources/views/import/009-selection/index.twig

10
app/Http/Controllers/Import/Nordigen/SelectionController.php

@ -70,9 +70,11 @@ class SelectionController extends Controller
public function index()
{
Log::debug(sprintf('Now at %s', __METHOD__));
$countries = config('nordigen.countries');
$mainTitle = 'Selection';
$subTitle = 'Select your country and the bank you wish to use.';
$countries = config('nordigen.countries');
$mainTitle = 'Selection';
$subTitle = 'Select your country and the bank you wish to use.';
$configuration = $this->restoreConfiguration();
// get banks and countries
$accessToken = TokenManager::getAccessToken();
@ -90,7 +92,7 @@ class SelectionController extends Controller
if ($response instanceof ErrorResponse) {
throw new ImporterErrorException((string) $response->message);
}
return view('import.009-selection.index', compact('mainTitle', 'subTitle', 'response', 'countries'));
return view('import.009-selection.index', compact('mainTitle', 'subTitle', 'response', 'countries', 'configuration'));
}
/**

2
app/Services/Nordigen/Conversion/Routine/GenerateTransactions.php

@ -183,7 +183,7 @@ class GenerateTransactions
Log::debug(sprintf('[%d/%d] Done parsing transaction.', ($index + 1), $total));
}
}
$this->addMessage(0, sprintf('Parsed %d Spectre transactions for further processing.', count($return)));
$this->addMessage(0, sprintf('Parsed %d Nordigen transactions for further processing.', count($return)));
Log::debug('Done parsing transactions.');
return $return;
}

3
resources/views/import/009-selection/index.twig

@ -61,6 +61,7 @@
<option label="(no selection)" value="XX">(no selection)</option>
{% for country in response %}
<option label="{{ countries[country.code]|default('Unknown') }}"
{% if country.code == configuration.getNordigenCountry %}selected="selected"{% endif %}
value="{{ country.code }}">{{ countries[country.code]|default('Unknown') }}</option>
{% endfor %}
</select>
@ -91,6 +92,7 @@
<option label="(no bank)" value="XX" data-days="0">(no bank)</option>
{% for bank in country.banks %}
<option label="{{ bank.name }}"
{% if bank.id == configuration.getNordigenBank %}selected="selected"{% endif %}
data-days="{{ bank.transactionTotalDays }}"
value="{{ bank.id }}">{{ bank.name }}</option>
{% endfor %}
@ -172,6 +174,7 @@
$(document).ready(function () {
$('#country').change(selectCountry)
$('.bank-selector').change(showDayCounter);
selectCountry();
});
function showDayCounter() {

Loading…
Cancel
Save