Skip to content

Commit

Permalink
VRP initiation flow implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kalpanakanagasabai committed Jan 5, 2024
1 parent ce4dcd7 commit 54954ab
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.wso2.openbanking.accelerator.consent.extensions.common.ConsentExtensionConstants;
import com.wso2.openbanking.accelerator.consent.extensions.common.ConsentServiceUtil;
import com.wso2.openbanking.accelerator.consent.extensions.common.ResponseStatus;
import com.wso2.openbanking.accelerator.consent.extensions.internal.ConsentExtensionsDataHolder;
import com.wso2.openbanking.accelerator.consent.extensions.manage.model.ConsentManageData;
import com.wso2.openbanking.accelerator.consent.extensions.manage.validator.VRPConsentRequestValidator;
import com.wso2.openbanking.accelerator.consent.extensions.util.ConsentManageUtil;
Expand Down Expand Up @@ -111,8 +110,9 @@ public void handleConsentManageGet(ConsentManageData consentManageData) {
"consent client id: %s, consent manage data client id: %s",
consent.getClientID(), consentManageData.getClientId()));
}
//throw new RuntimeException()
throw new ConsentException(ResponseStatus.BAD_REQUEST,
ErrorConstants.NO_CONSENT_FOR_CLIENT_ERROR);
new String("test"));
}

JSONObject receiptJSON = (JSONObject) new JSONParser(JSONParser.MODE_PERMISSIVE).
Expand All @@ -122,7 +122,7 @@ public void handleConsentManageGet(ConsentManageData consentManageData) {
ConsentExtensionConstants.VRP));
consentManageData.setResponseStatus(ResponseStatus.OK);
} catch (ConsentManagementException | ParseException e) {
log.error(ErrorConstants.INVALID_CLIENT_ID_MATCH);
log.error(ErrorConstants.INVALID_CLIENT_ID_MATCH, e);
throw new ConsentException(ResponseStatus.INTERNAL_SERVER_ERROR,
ErrorConstants.ACC_INITIATION_RETRIEVAL_ERROR);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ public void handlePaymentPost(ConsentManageData consentManageData, Object reques
ConsentExtensionConstants.AWAITING_AUTH_STATUS);

// Create the consent
DetailedConsentResource createdConsent = ConsentExtensionsDataHolder.getInstance().getConsentCoreService()
DetailedConsentResource createdConsent = ConsentServiceUtil.getConsentService()
.createAuthorizableConsent(requestedConsent, null,
CREATED_STATUS, AUTH_TYPE_AUTHORIZATION, true);

Expand All @@ -188,6 +188,7 @@ public void handlePaymentPost(ConsentManageData consentManageData, Object reques
.toString());
consentAttributes.put(ConsentExtensionConstants.PERIOD_ALIGNMENT, ((JSONObject) ((JSONArray)
(controlParameters).get(ConsentExtensionConstants.PERIODIC_LIMITS)).get(0))
//TODO: Improve the logic of storing the PERIODIC_LIMITS
.get(ConsentExtensionConstants.PERIOD_ALIGNMENT).toString());
consentAttributes.put(ConsentExtensionConstants.PERIOD_TYPE, ((JSONObject) ((JSONArray) (controlParameters)
.get(ConsentExtensionConstants.PERIODIC_LIMITS)).get(0)).get(ConsentExtensionConstants.PERIOD_TYPE)
Expand Down

0 comments on commit 54954ab

Please sign in to comment.