public Map<String, String> confirm(RdaConfirmRequest params) {
        AppSession appSession = appSessionService.getSession(params.getAppSessionId());
        AppAuthenticator appAuthenticator = appAuthenticatorService.findByUserAppId(appSession.getUserAppId());

        if(!checkSecret(params, appSession) || !checkAccount(params, appSession)){
            appSession.setRdaSessionStatus("ABORTED");
            appSessionService.save(appSession);
            return Map.of("arrivalStatus", "NOK");
        }
        if(checkAndProcessError(params, appSession)){
            appSessionService.save(appSession);
            return Map.of("arrivalStatus", "OK");
        }

        if (!switchService.digidAppSwitchEnabled()) {
            digidClient.remoteLog("853",
                Map.of(lowerUnderscore(ACCOUNT_ID), appAuthenticator.getAccountId(), lowerUnderscore(HIDDEN), true));
            appSession.setRdaSessionStatus("REFUTED");
        } else if (!switchService.digidRdaSwitchEnabled()){
            digidClient.remoteLog("579",
                Map.of(lowerUnderscore(ACCOUNT_ID), appAuthenticator.getAccountId(), lowerUnderscore(HIDDEN), true));
            appSession.setRdaSessionStatus("REFUTED");
        } else if (params.isVerified() && (SCANNING.equals(appSession.getRdaSessionStatus()) ||
                                            SCANNING_FOREIGN.equals(appSession.getRdaSessionStatus()))) {
            appSession.setRdaSessionStatus("VERIFIED");
            appAuthenticator.setSubstantieelActivatedAt(ZonedDateTime.now());
            appAuthenticator.setSubstantieelDocumentType(params.getDocumentType().toLowerCase());

            if (appAuthenticator.getWidActivatedAt() == null) {
                appAuthenticator.setIssuerType("rda");
            }

            storeIdCheckDocument(params.getDocumentNumber(), params.getDocumentType(), appSession.getAccountId(), appAuthenticator.getUserAppId());

            if (ID_CHECK_ACTION.equals(appSession.getRdaAction())) {
                digidClient.remoteLog("1321",
                    Map.of("document_type", params.getDocumentType().toLowerCase(), lowerUnderscore(ACCOUNT_ID), appAuthenticator.getAccountId()));
            } else {
                digidClient.remoteLog("848",
                    Map.of("document_type", params.getDocumentType().toLowerCase(),
                        lowerUnderscore(ACCOUNT_ID), appAuthenticator.getAccountId(),
                        lowerUnderscore(APP_CODE), appAuthenticator.getAppCode(),
                        lowerUnderscore(DEVICE_NAME), appAuthenticator.getDeviceName()));
            }

            appAuthenticatorService.save(appAuthenticator);

            if(appSession.getFlow().equals(UpgradeLoginLevel.NAME)) {
                digidClient.sendNotificationMessage(appSession.getAccountId(), "ED024", "SMS20");
                logger.debug("Sending notify email ED024 / SMS20 for device {}", appAuthenticator.getDeviceName());
            }
        }
        appSession.setAppAuthenticationLevel(appAuthenticator.getAuthenticationLevel());
        appSessionService.save(appSession);
        return Map.of("arrivalStatus", "OK");
    }
@Test
    void checkAccountError(){
        appSession.setAccountId(null);
        when(appSessionService.getSession(any())).thenReturn(appSession);
        when(appAuthenticatorService.findByUserAppId(any())).thenReturn(appAuthenticator);

        Map<String, String> result = rdaService.confirm(rdaConfirmRequest);

        assertEquals("ABORTED", appSession.getRdaSessionStatus());
        assertEquals("NOK", result.get("arrivalStatus"));
    }