Merge branch 'spectre' into develop

* spectre:
  Fix encryption.
  Can handle some mandatory fields (not all).
  More code for Spectre import.
  Initial code to get providers from Spectre.
  Exceptions when class does not exist.
This commit is contained in:
James Cole
2017-12-11 14:53:01 +01:00
26 changed files with 1999 additions and 85 deletions

View File

@@ -23,6 +23,19 @@ declare(strict_types=1);
return [
'bunq_prerequisites_title' => 'Prerequisites for an import from bunq',
'bunq_prerequisites_text' => 'In order to import from bunq, you need to obtain an API key. You can do this through the app.',
'bunq_prerequisites_title' => 'Prerequisites for an import from bunq',
'bunq_prerequisites_text' => 'In order to import from bunq, you need to obtain an API key. You can do this through the app.',
// Spectre:
'spectre_title' => 'Import using Spectre',
'spectre_prerequisites_title' => 'Prerequisites for an import using Spectre',
'spectre_prerequisites_text' => 'In order to import data using the Spectre API, you need to prove some secrets. They can be found on the <a href="https://www.saltedge.com/clients/profile/secrets">secrets page</a>.',
'spectre_enter_pub_key' => 'The import will only work when you enter this public key on your <a href="https://www.saltedge.com/clients/security/edit">security page</a>.',
'spectre_select_country_title' => 'Select a country',
'spectre_select_country_text' => 'Firefly III has a large selection of banks and sites from which Spectre can download transactional data. These banks are sorted by country. Please not that there is a "Fake Country" for when you wish to test something. If you wish to import from other financial tools, please use the imaginary country called "Other financial applications". By default, Spectre only allows you to download data from fake banks. Make sure your status is "Live" on your <a href="https://www.saltedge.com/clients/dashboard">Dashboard</a> if you wish to download from real banks.',
'spectre_select_provider_title' => 'Select a bank',
'spectre_select_provider_text' => 'Spectre supports the following banks or financial services grouped under <em>:country</em>. Please pick the one you wish to import from.',
'spectre_input_fields_title' => 'Input mandatory fields',
'spectre_input_fields_text' => 'The following fields are mandated by ":provider" (from :country).',
'spectre_instructions_english' => 'These instructions are provided by Spectre for your convencience. They are in English:',
];

View File

@@ -195,6 +195,11 @@ return [
'csv_delimiter' => 'CSV field delimiter',
'csv_import_account' => 'Default import account',
'csv_config' => 'CSV import configuration',
'client_id' => 'Client ID',
'service_secret' => 'Service secret',
'app_secret' => 'App secret',
'public_key' => 'Public key',
'country_code' => 'Country code',
'due_date' => 'Due date',

View File

@@ -20,21 +20,34 @@
</div>
<div class="row">
<div class="col-lg-8">
<p>
<div class="col-lg-1 text-center">
{# file import #}
<a href="{{ route('import.file.index') }}" class="btn btn-app">
<i class="fa fa-file-text-o"></i>
<a href="{{ route('import.file.index') }}">
<img src="images/logos/csv.png" alt="bunq"/><br />
{{ 'import_general_index_csv_file'|_ }}
</a>
</div>
<div class="col-lg-1 text-center">
{# bunq import #}
{#
<a href="{{ route('import.bank.prerequisites', ['bunq']) }}" class="btn btn-app">
<a href="{{ route('import.bank.prerequisites', ['bunq']) }}">
<img src="images/logos/bunq.png" alt="bunq"/><br />
Import from bunq
</a>
#}
</p>
</div>
<div class="col-lg-1 text-center">
{# import from Spectre #}
<a href="{{ route('import.bank.prerequisites', ['spectre']) }}">
<img src="images/logos/spectre.png" alt="Spectre"/><br />
Import using Spectre
</a>
</div>
<div class="col-lg-1 text-center">
{# import from Plaid #}
<a href="{{ route('import.bank.prerequisites', ['plaid']) }}">
<img src="images/logos/plaid.png" alt="Plaid"/><br />
Import using Plaid
</a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,65 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists }}
{% endblock %}
{% block content %}
<div class="row">
<form class="form-horizontal" action="{{ route('import.file.process-configuration', job.key) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('bank.spectre_input_fields_title') }}</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-lg-8">
<p>
{{ trans('bank.spectre_input_fields_text',{provider: data.provider.data.name, country: data.country})|raw }}
</p>
<p>
{{ trans('bank.spectre_instructions_english') }}
</p>
<p>
{{ data.provider.data.instruction|nl2br }}
</p>
</div>
</div>
<div class="row">
<div class="col-lg-8">
{% for field in data.fields %}
{# text, password, select, file #}
{% if field.nature == 'text' %}
{{ ExpandedForm.text(field.name,null, {label: field.english_name ~ ' ('~field.localized_name~')'}) }}
{% endif %}
{% if field.nature == 'password' %}
{{ ExpandedForm.password(field.name, {label: field.english_name ~ ' ('~field.localized_name~')'}) }}
{% endif %}
{% if field.nature == 'select' %}
DO NOT SUPPORT
{{ dump(field) }}
{% endif %}
{% if field.narture == 'file' %}
DO NOT SUPPORT
{{ dump(field) }}
{% endif %}
{% endfor %}
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn pull-right btn-success">
{{ ('submit')|_ }}
</button>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
{% block scripts %}
{% endblock %}
{% block styles %}
{% endblock %}

View File

@@ -0,0 +1,58 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists }}
{% endblock %}
{% block content %}
<div class="row">
<form class="form-horizontal" action="{{ route('import.bank.prerequisites.post',['spectre']) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('bank.spectre_prerequisites_title') }}</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-lg-8">
<p>
{{ trans('bank.spectre_prerequisites_text')|raw }}
</p>
</div>
</div>
<div class="row">
<div class="col-lg-8">
{{ ExpandedForm.text('client_id') }}
{{ ExpandedForm.text('service_secret') }}
{{ ExpandedForm.text('app_secret') }}
</div>
</div>
<div class="row">
<div class="col-lg-8">
<p>{{ trans('bank.spectre_enter_pub_key')|raw }}</p>
<div class="form-group" id="pub_key_holder">
<label for="ffInput_pub_key_holder" class="col-sm-4 control-label">{{ trans('form.public_key') }}</label>
<div class="col-sm-8">
<textarea class="form-control"
rows="10"
id="ffInput_pub_key_holder" name="pub_key_holder" contenteditable="false">{{ publicKey }}</textarea>
</div>
</div>
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn pull-right btn-success">
{{ ('submit')|_ }}
</button>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
{% block scripts %}
{% endblock %}
{% block styles %}
{% endblock %}

View File

@@ -0,0 +1,42 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists }}
{% endblock %}
{% block content %}
<div class="row">
<form class="form-horizontal" action="{{ route('import.file.process-configuration', job.key) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('bank.spectre_select_country_title') }}</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-lg-8">
<p>
{{ trans('bank.spectre_select_country_text')|raw }}
</p>
</div>
</div>
<div class="row">
<div class="col-lg-8">
{{ ExpandedForm.select('country_code', data.countries, null)|raw }}
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn pull-right btn-success">
{{ ('submit')|_ }}
</button>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
{% block scripts %}
{% endblock %}
{% block styles %}
{% endblock %}

View File

@@ -0,0 +1,42 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists }}
{% endblock %}
{% block content %}
<div class="row">
<form class="form-horizontal" action="{{ route('import.file.process-configuration', job.key) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('bank.spectre_select_bank_title') }}</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-lg-8">
<p>
{{ trans('bank.spectre_select_provider_text',{country: data.country})|raw }}
</p>
</div>
</div>
<div class="row">
<div class="col-lg-8">
{{ ExpandedForm.select('provider_code', data.providers, null)|raw }}
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn pull-right btn-success">
{{ ('submit')|_ }}
</button>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
{% block scripts %}
{% endblock %}
{% block styles %}
{% endblock %}