@Override
    public AppResponse process(Flow flow, AppRequest params) {
        var result = digidClient.getWidstatus(appSession.getWidRequestId());

        switch(result.get("status").toString()){
            case "NO_DOCUMENTS":
                appSession.setRdaSessionStatus("NO_DOCUMENTS");
                appSession.setBrpIdentifier(result.get("brp_identifier").toString());
                appSessionService.save(appSession);
                return new StatusResponse("NO_DOCUMENTS");
            case "PENDING":
                setValid(false); // Do not progress to next state
                return new StatusResponse("PENDING");
            case "NOK":
                return new NokResponse();
        }

        digidClient.remoteLog("867", Map.of(lowerUnderscore(ACCOUNT_ID), appSession.getAccountId(), HIDDEN, true));
        appSession.setRdaSessionStatus("DOCUMENTS_RECEIVED");
        Map<String, String> rdaSession = rdaClient.startSession(returnUrl + "/iapi/rda/confirm", appSession.getId(), params.getIpAddress(), result.get("travel_documents"), result.get("driving_licences"));

        if (rdaSession.isEmpty()) {
            digidClient.remoteLog("873", Map.of(lowerUnderscore(ACCOUNT_ID), appSession.getAccountId(), HIDDEN, true));
            return new NokResponse();
        }
        appSession.setConfirmSecret(rdaSession.get("confirmSecret"));

        appSession.setUrl(rdaSession.get("url"));
        appSession.setRdaSessionId(rdaSession.get("sessionId"));
        appSession.setRdaSessionTimeoutInSeconds(rdaSession.get("expiration"));
        appSession.setRdaSessionStatus("SCANNING");
        digidClient.remoteLog("868", Map.of(lowerUnderscore(ACCOUNT_ID), appSession.getAccountId(), HIDDEN, true));

        return new RdaResponse(appSession.getUrl(), appSession.getRdaSessionId());
    }
@Test
    void processWidstatusPending(){
        when(digidClientMock.getWidstatus(mockedAppSession.getWidRequestId())).thenReturn(invalidDigidClientResponsePending);

        AppResponse appResponse = rdaPolling.process(mockedFlow, mockedAbstractAppRequest);

        assertEquals("PENDING", ((StatusResponse)appResponse).getStatus());
    }