public List<ReceiptListResponse> searchReceipts(int limit, int offset, String piiPrincipalId, String spTenantDomain, String service, String state, String principleTenantDomain) throws ConsentManagementException { int spTenantId = 0; int principalTenantId = 0; if (StringUtils.isNotBlank(spTenantDomain)) { spTenantId = ConsentUtils.getTenantId(realmService, spTenantDomain); } if(StringUtils.isNotBlank(principleTenantDomain)) { principalTenantId = ConsentUtils.getTenantId(realmService, principleTenantDomain); } validatePaginationParameters(limit, offset); if (limit == 0) { limit = getDefaultLimitFromConfig(); if (log.isDebugEnabled()) { log.debug("Limit is not defied the request, default to: " + limit); } } List<ReceiptListResponse> receiptListResponses = getReceiptsDAO(receiptDAOs).searchReceipts(limit, offset, piiPrincipalId, spTenantId, service, state, principalTenantId); receiptListResponses.forEach(rethrowConsumer(receiptListResponse -> receiptListResponse.setTenantDomain (ConsentUtils.getTenantDomain(realmService, receiptListResponse .getTenantId())))); return receiptListResponses; }
/** * This API is used to search receipts. * * @param limit No of search results. * @param offset start index of the search. * @param piiPrincipalId PII principal Id. * @param spTenantDomain SP tenant domain. * @param service Service name. * @return List of Receipts details. * @throws ConsentManagementException Consent Management Exception. */ public List<ReceiptListResponse> searchReceipts(int limit, int offset, String piiPrincipalId, String spTenantDomain, String service, String state) throws ConsentManagementException { validatePaginationParameters(limit, offset); if (limit == 0) { limit = getDefaultLimitFromConfig(); if (log.isDebugEnabled()) { log.debug("Limit is not defied the request, default to: " + limit); } } String piiPrincipalTenantId = ConsentUtils.getTenantDomainFromCarbonContext(); List<ReceiptListResponse> receiptListResponses = searchReceipts(limit, offset, piiPrincipalId, spTenantDomain, service, state, piiPrincipalTenantId); receiptListResponses.forEach(rethrowConsumer(receiptListResponse -> receiptListResponse.setTenantDomain (ConsentUtils.getTenantDomain(realmService, receiptListResponse.getTenantId())))); return receiptListResponses; }