-
Johannes Löthberg authored
All banks are supposed to provide at least 90 days of access. As of July 2023 EEA banks are required to allow access for up to 180 days[0], but this does not apply to UK banks, and apparently there might still be EEA banks which don't comply with the new regulations. We should consider eventually defaulting to 180 days and allowing per-bank and maybe per-country overrides, but bumping it to 90 days immediately provides a better user experience. [0]: https://nordigen.zendesk.com/hc/en-gb/articles/13239212055581-EEA-180-day-access Signed-off-by:
Johannes Löthberg <johannes@kyriasis.com>
Johannes Löthberg authoredAll banks are supposed to provide at least 90 days of access. As of July 2023 EEA banks are required to allow access for up to 180 days[0], but this does not apply to UK banks, and apparently there might still be EEA banks which don't comply with the new regulations. We should consider eventually defaulting to 180 days and allowing per-bank and maybe per-country overrides, but bumping it to 90 days immediately provides a better user experience. [0]: https://nordigen.zendesk.com/hc/en-gb/articles/13239212055581-EEA-180-day-access Signed-off-by:
Johannes Löthberg <johannes@kyriasis.com>
gocardless.ts 1.36 KiB
import type { pushModal as pushModalAction } from 'loot-core/src/client/actions/modals';
import { send } from 'loot-core/src/platform/client/fetch';
import { type GoCardlessToken } from 'loot-core/src/types/models';
function _authorize(
pushModal: typeof pushModalAction,
upgradingAccountId: string | undefined,
{
onSuccess,
onClose,
}: {
onSuccess: (data: GoCardlessToken) => Promise<void>;
onClose?: () => void;
},
) {
pushModal('gocardless-external-msg', {
onMoveExternal: async ({ institutionId }) => {
const resp = await send('gocardless-create-web-token', {
upgradingAccountId,
institutionId,
accessValidForDays: 90,
});
if ('error' in resp) return resp;
const { link, requisitionId } = resp;
window.Actual?.openURLInBrowser(link);
return send('gocardless-poll-web-token', {
upgradingAccountId,
requisitionId,
});
},
onClose,
onSuccess,
});
}
export async function authorizeBank(
pushModal: typeof pushModalAction,
{ upgradingAccountId }: { upgradingAccountId?: string } = {},
) {
_authorize(pushModal, upgradingAccountId, {
onSuccess: async data => {
pushModal('select-linked-accounts', {
accounts: data.accounts,
requisitionId: data.id,
upgradingAccountId,
syncSource: 'goCardless',
});
},
});
}