Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.5 kB
2
Indexable
Never
private boolean isUserLoggedIn()
    {
        if ((sfUserBean == null) || (sfUserBean.getUser() == null))
        {
            return false;
        }
        return sfUserBean.getUser().isLoggedIn();
    }

    private JSONObject getAccountsForDomainWithoutDPP(SFUser sfUser)throws JSONException {
        JSONObject finalResponse = new JSONObject();
        JSONObject response = new JSONObject();
        JSONObject data = new JSONObject();
        JSONObject responseInfo = new JSONObject();

        if(isUserLoggedIn()){
            if (isLargeUser(sfUser)){
                data.put("isLargeUser", true);
            }
            else
            {   data.put("isLargeUser", false);
                data.put("account", getAccountsDetails());

            }

        }
        else{
            finalResponse.put("error","User not logged in");
        }

        response.put("data", data);
        finalResponse.put("responseInfo", responseInfo);
        finalResponse.put("response", response);

        return finalResponse;
    }

    private JSONArray getAccountsDetails() throws JSONException{
        JSONArray accounts = new JSONArray();
        JSONObject account = new JSONObject();
        account.put("accountId", sfUserBeanViewer.getPurchasableAccountsForDomainWithoutGivenType(SFClassNameConstant.PRIVATE_REGISTRATION_TYPE.getDescription()));
        // accounts.put("accountName",getAccountsDetails());
        accounts.put(account);
        return accounts;
    }