private void setPIIControllerInfo(ReceiptInput receipt) throws ConsentManagementException { PiiController controllerInfo = getPIIController(piiControllers).getControllerInfo(receipt.getTenantDomain()); JSONObject controller = new JSONObject(); controller.put(PII_CONTROLLER_NAME, controllerInfo.getPiiController()); controller.put(ON_BEHALF, controllerInfo.isOnBehalf()); controller.put(CONTACT, controllerInfo.getContact()); controller.put(EMAIL, controllerInfo.getEmail()); controller.put(PHONE, controllerInfo.getPhone()); controller.put(PII_CONTROLLER_URL, controllerInfo.getPiiControllerUrl()); Address piiAddress = controllerInfo.getAddress(); if (piiAddress != null) { JSONObject address = new JSONObject(); address.put(ADDRESS_COUNTRY, piiAddress.getAddressCountry() ); address.put(ADDRESS_LOCALITY, piiAddress.getAddressLocality()); address.put(ADDRESS_REGION, piiAddress.getAddressRegion()); address.put(POST_OFFICE_BOX_NUMBER, piiAddress.getPostOfficeBoxNumber()); address.put(POSTAL_CODE, piiAddress.getPostalCode()); address.put(STREET_ADDRESS, piiAddress.getStreetAddress()); controller.put(ADDRESS, address); } receipt.setPiiControllerInfo(controller.toString()); }