Commit Graph

23198 Commits

Author SHA1 Message Date
Dave Shoreman b11022cff6
Add EUA error texts 2024-12-24 05:09:37 +00:00
Dave Shoreman bea4ea3387
Show history selection screen instead of guessing
Removes all the guesswork for requisition renewals, instead opting for
the manual approach of simply redirecting to the form and updating its
handling such that it jumps straight to history selection when needed.

When the institution is preloaded (so we skip country/bank selection)
the cloned element is a country and not the bank so we need to replace
athe flag with its logo, but otherwise the code was all moved as-is.
2024-12-24 03:20:40 +00:00
Dave Shoreman 691478d3e7
Support setting custom Nordigen access duration
If agreements are already available and no custom `access_days` is
passed, it will simply take the first match regardless of duration.

When a new agreement is needed, it defaults to the max supported.
2024-12-23 20:31:31 +00:00
Dave Shoreman 5f75b6a9e1
Attempt to reuse existing agreements
Implements changes from #10410 but using `Arr::first()` rather than a
foreach loop to fix bugs returning invalid or expired agreements.

If an agreement exists with at least the requested `$txDays` then that
is used, otherwise a new one is created with the given parameters. If it
fails, we error out because `createRequisition()` would fail regardless.

Skips accepting EUAs: seems it's done automatically during requisition.
2024-12-23 20:09:52 +00:00
Dave Shoreman 3bac46d83f
Cleanup, add return types, normalise quotes 2024-12-22 17:38:54 +00:00
Dave Shoreman b9464c0c25
Fix error on token-invalid failure when expired
The cache data is set to expire after an hour, at which point the call
to `$request->getCompany()` will fail because it depends internally on
the `company_key` in the response of `getTokenContent()` which is null.

By moving the company *after* the context check, we avoid the exception
but need to manually set lang as there's no context for company data.
2024-12-22 17:38:54 +00:00
Dave Shoreman 88149bc39f
Find old EUA to get tx_days for new agreement
The end user agreement ID isn't stored with the bank integration, but it
*is* returned as part of the error for an expired account which works
perfectly for the case of renewing an expired requisition.

When `tx_days` isn't set in the request (i.e. it's a renewal) we instead
extract the EUA ID from the account error after getting the integration,
then once we have the EUA we're able to restore the old tx_days setting.

Since the BankIntegration query is used in both endpoints, this moves it
to a method with `firstOrFail()` rather than `first()` which also allows
for a cleanup of the integration saving code with try/catch/finally to
make it a little clearer which values apply to both new+existing cases.
2024-12-22 17:38:54 +00:00
Dave Shoreman e97365f434
Fix back/close button display in Nordigen modal
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.
2024-12-22 17:38:54 +00:00
Dave Shoreman c9a702fa3e
Fine-tune transaction history options
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.
2024-12-22 17:38:54 +00:00
Dave Shoreman 74344d1b88
Improve Nordigen error-handling code
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.
2024-12-22 17:38:54 +00:00
Dave Shoreman 248fbe174b
Add selection screen for transaction history
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.
2024-12-22 17:38:54 +00:00
Dave Shoreman 6fde8c8f13
Allow setting number of days of transactions
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.
2024-12-22 17:38:54 +00:00
Dave Shoreman f18510e003
Enable country filtering for Nordigen bank list
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.
2024-12-22 17:38:54 +00:00
Dave Shoreman fa54ef9830
Nordigen: Use institution max for bank integration
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.
2024-12-22 17:38:54 +00:00
Dave Shoreman b723c9e16a
Nordigen: Pass custom agreement with max 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.
2024-12-22 17:38:50 +00:00
David Bomba 08b6bdf7ed
Merge pull request #10418 from turbo124/v5-develop
Fixes for template email engine
2024-12-20 16:28:47 +11:00
David Bomba 1149be6e2a Fixes for template email engine 2024-12-20 16:25:20 +11:00
David Bomba 9a5eea1945
Merge pull request #10417 from turbo124/v5-develop
v5.11.5
2024-12-20 10:46:11 +11:00
David Bomba 08ec334e4c Fixes for tax model migrations 2024-12-20 10:45:49 +11:00
David Bomba 2da23ab5c5
Merge pull request #10415 from turbo124/v5-develop
v5.11.4
2024-12-20 09:39:37 +11:00
David Bomba 2130d9a8dc v5.11.4 2024-12-20 09:39:09 +11:00
David Bomba 55dd968e25 Fixes for update company 2024-12-20 09:36:14 +11:00
David Bomba c62edbcffc
Merge pull request #10410 from paulwer/feature-nordigen-with-end-user-agreement
Feature: nordigen bank_integration setup with end user agreement
2024-12-20 09:35:14 +11:00
David Bomba d4ec75f772
Merge pull request #10414 from beganovich/einvoice-errors
Improve Storecove Proxy error handling
2024-12-20 09:33:01 +11:00
paulwer 700358c9e3 also require access scopes of existing aggreement to be met 2024-12-19 20:36:16 +01:00
Benjamin Beganović 30251436c6 Fixes for proxy error handling 2024-12-19 18:28:04 +01:00
paulwer 26a02596ae fixes 2024-12-19 11:59:52 +01:00
paulwer cb51a63eeb fixes 2024-12-19 08:59:42 +01:00
paulwer b1f0e528be better error handling 2024-12-19 08:52:16 +01:00
paulwer 1c76e60304 Merge branch 'v5-develop' of https://github.com/invoiceninja/invoiceninja into feature-nordigen-with-end-user-agreement 2024-12-19 08:48:53 +01:00
David Bomba 8aff87c37b
Merge pull request #10406 from paulwer/feat-improvements-to-inbound
fix: issue when email body is empty
2024-12-19 13:01:40 +11:00
David Bomba 8af9506695
Merge pull request #10408 from turbo124/v5-develop
v5.11.3
2024-12-19 10:18:29 +11:00
David Bomba 46b5a3039e Fixes for vite config at build 2024-12-19 10:17:56 +11:00
David Bomba a270aac9e1 Updated translations and minor adjustments for react 2024-12-19 10:14:43 +11:00
David Bomba cf2805d55b v5.11.3 2024-12-19 10:10:06 +11:00
paulwer ae158ce1a5 fixes 2024-12-18 18:25:50 +01:00
paulwer a7073e10dd fix: issue when email body is empty 2024-12-18 10:57:28 +01:00
David Bomba c8d95f52ac
Merge pull request #10404 from turbo124/v5-develop
v5.11.2
2024-12-18 20:21:33 +11:00
David Bomba 0cafb2968b v5.11.2 2024-12-18 20:21:17 +11:00
David Bomba 1164507da7 Fixes for nordigen 2024-12-18 20:20:57 +11:00
David Bomba 9bad64b60e
Merge pull request #10401 from dshoreman/ds/nordigen-fixup
Nordigen fixes
2024-12-18 13:46:04 +11:00
David Bomba 16deaf7430
Merge pull request #10399 from beganovich/update-translations-1712
Update translations
2024-12-18 13:42:08 +11:00
David Bomba c78f1e52aa
Merge branch 'v5-develop' into update-translations-1712
Signed-off-by: David Bomba <turbo124@gmail.com>
2024-12-18 13:42:02 +11:00
David Bomba 71a8fc2dfe
Merge pull request #10402 from turbo124/v5-develop
v5.11.1
2024-12-18 13:41:01 +11:00
David Bomba c547ee0e6b
Merge branch 'v5-develop' into v5-develop
Signed-off-by: David Bomba <turbo124@gmail.com>
2024-12-18 13:40:53 +11:00
David Bomba b397512cff v5.11.1 2024-12-18 13:39:40 +11:00
David Bomba 78489a6790 Update for tax model 2024-12-18 13:39:18 +11:00
Dave Shoreman 73166f422a
Fix nordigen account failsafe
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.
2024-12-18 00:05:32 +00:00
Dave Shoreman 365a908b20
Fix ref to wrong type of `$account`
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.
2024-12-17 23:59:28 +00:00
Dave Shoreman 9ad2a1a7ef
Minor text fixes 2024-12-17 23:59:20 +00:00