Untitled

mail@pastecode.io avatar
unknown
plain_text
21 days ago
1.6 kB
3
Indexable
Never
  private JSONObject getAccountsForDomainWithoutDPP() throws JSONException {
        JSONObject finalresponse = new JSONObject();
        JSONObject response = new JSONObject();
        JSONObject data = new JSONObject();
        JSONObject responseInfo = new JSONObject();
        if (userAccountManager.getUserBean().getIsLoggedIn()) {
            if (isLargeUser(userAccountManager.getUserBean().getUser())) {
                data.put("isLargeUser", true);
            } else {
                data.put("isLargeUser", false);
                data.put("accounts", getAccountsDetails());
            }
            responseInfo.put("error", "null");
            responseInfo.put("status", "Success");
        } else {
            responseInfo.put("error", "User not logged in");
            responseInfo.put("status", "Failed");
        }
        response.put("data", data);
        response.put("responseInfo", responseInfo);
        finalresponse.put("response", response);
        return finalresponse;
    }

    private JSONArray getAccountsDetails() throws JSONException {
        JSONArray accounts = new JSONArray(); // List<Integer> accountlds = accountApiService.getSfUserBeanViewer().getAccountsForDomainWithoutPriReg(); 
        List<String> accountlds = accountApiService.getSfUserBeanViewer().getAccountsForDomainWithoutPR();
        for (String accountld : accountlds) {
            JSONObject account = new JSONObject();
            account.put("accountld", accountld);
            accounts.add(account);
        }
        return accounts;
    }