public static String getValidateRegistrationPayLoad( String userId, String registrationCode, String deviceName) { String requestData = ""; try { JSONObject reqJson = new JSONObject(); reqJson.put(Constants.CONTEXT, ContextUtils.getContextJson()); // requestData = reqJson.toString(); JSONObject dataJson = new JSONObject(); dataJson.put(Constants.USER_ID, userId); dataJson.put(Constants.REG_CODE, registrationCode); dataJson.put(Constants.DEVICE_NAME, deviceName); dataJson.put(Constants.CSR, csr()); reqJson.put(Constants.DATA, dataJson); requestData = reqJson.toString(); } catch (JSONException e) { e.printStackTrace(); } return requestData; }
public static String getCertificateIdPayLoad(String userId, DevicePairResponse responseData) { String requestData = ""; try { JSONObject reqJson = new JSONObject(); reqJson.put(Constants.CONTEXT, ContextUtils.getContextJson()); JSONObject json2 = new JSONObject(); json2.put(Constants.USER_ID, userId); JSONObject jResData = new JSONObject(responseData.getData()); // jResData = jResData.getJSONObject(Constants.DATA); // json2.put(Constants.EMAIL, jResData.getJSONArray(Constants.EMAIL).getString(0)); // json2.put(Constants.PHONE, jResData.getJSONArray(Constants.PHONE).getString(0)); // reqJson.put(Constants.DATA, json2); requestData = reqJson.toString(); } catch (JSONException e) { e.printStackTrace(); } return requestData; }