When the country filtering mode is enabled, it adds a "Go back" button
but the close button is right on top of it. This moves the close button
to the right to avoid any click conflicts.
To fix an annoying display bug with the top offset, an observer is used
to override the default `display: none` of the back button to keep its
flex mode but with a hidden visibility so the UI doesn't move around.
Replaces 360 days with 365, skips the last auto-generated option to
avoid getting e.g. 720 and 730 as options when it's close to max, and
gradually increases the accumulator so options aren't so overwhelming.
Since the loop will no longer generate the final option (0 < 15), this
commit also removes the `% 30` check so the real max is always used.
All failures boil down to about 3 variations - one with reason/lang, one
that has context defined but no company data, and a full variant that
also fills the company and account keys in the view.
The only other difference is redirect url coming from config when it's
not available in the context, so to simplify things this commit merges
all the failure view responses into one unified `failed` method.
Instead of directing the user straight to GoCardless, when a bank is
selected this will replace the institution list with a list of options
from 30 days—up to the bank's transaction limit—in 30 day increments.
If e.g. `&tx_days=365` is added to the URL, this will use it to set the
amount of history that's fetched from Nordigen on sync, with basic
safeguards to prevent it being set too low or above the bank's max.
Enabling the country filter stops the selector loop from working because
instead of a `.ob-list-institution` it starts with `.ob-country-list`
items which then get replaced on click so banks don't exist on load.
By wrapping the institution loop in an observer it'll automatically
attach the events when a country is selected and it works wonderfully.
While we set the days in the agreement, how many we fetch when
processing transactions depends on the `from_date` of the bank
integration. We could call `getInstitution($id)` on the API, but
consistency would dictate adding a wrapper in the Nordigen class and
it's already being called within `$nordigen->getAccount()` so it makes
more sense to extract the data in the account transformer instead.
App\Jobs\Bank\ProcessBankTransactionsNordigen also sets a from date, but
that's only used when not set on the bank integration so it can be left
at the Nordigen default of 90 days worth of transaction history.
In order to change the total days of transactions we can request, a
custom end user agreement is needed. There *are* methods to find
existing agreements, but assuming nothing else breaks it's probably
fairly safe to just go ahead and create one.
If it works, it only runs once... as far as I can tell.
This check was added at a time when `getAccount` would return `false`
for failures, but at some point it was updated to always return arrays.
This fixes the check to avoid issues like #10396 where the following
line triggers a missing 'id' key error.
There was a time when `$account` served two purposes depending how far
through the code you got. Commit e349f151 changed that, introducing a
dedicated `$nordigen_account` variable, but it missed some references.
This commit fixes them so they no longer point to the *company* account.