Skip to content

Commit

Permalink
Fix dev test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hasithakn committed Dec 3, 2024
1 parent c00923f commit f2dcee2
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import com.wso2.openbanking.accelerator.consent.extensions.internal.ConsentExtensionsDataHolder;
import com.wso2.openbanking.accelerator.consent.mgt.dao.models.ConsentAttributes;
import com.wso2.openbanking.accelerator.consent.mgt.dao.models.ConsentResource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.Serializable;
import java.util.ArrayList;
Expand All @@ -43,6 +45,8 @@
*/
public class CIBAConsentPersistStep implements ConsentPersistStep {

private static final Log log = LogFactory.getLog(CIBAConsentPersistStep.class);

@Override
public void execute(ConsentPersistData consentPersistData) throws ConsentException {

Expand Down Expand Up @@ -96,10 +100,18 @@ private static void storeAuthReqIdAttribute(String authReqId, ConsentResource co
private static void removeExistingAuthReqIdAttribute(ConsentResource consentResource)
throws ConsentManagementException {

ConsentAttributes currentConsentAttributes = ConsentExtensionsDataHolder.getInstance()
.getConsentCoreService().getConsentAttributes(consentResource.getConsentID());
ConsentAttributes currentConsentAttributes = null;
try {
currentConsentAttributes = ConsentExtensionsDataHolder.getInstance()
.getConsentCoreService().getConsentAttributes(consentResource.getConsentID());
} catch (ConsentManagementException e) {
if (log.isDebugEnabled()) {
log.debug("Error while retrieving consent attributes.", e);
}
}
// Remove if existing aut_req_id is already in attributes.
if (currentConsentAttributes.getConsentAttributes().containsKey(OpenBankingConstants.AUTH_REQ_ID)) {
if (currentConsentAttributes != null &&
currentConsentAttributes.getConsentAttributes().containsKey(OpenBankingConstants.AUTH_REQ_ID)) {
ArrayList<String> toRemoveAttributes = new ArrayList<>();
toRemoveAttributes.add(OpenBankingConstants.AUTH_REQ_ID);
ConsentExtensionsDataHolder.getInstance().getConsentCoreService().deleteConsentAttributes(
Expand Down

0 comments on commit f2dcee2

Please sign in to comment.