Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VRP consent initiation flow implementation #37

Merged
merged 35 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0d2fca3
VRP consent initiation flow implementation
kalpanakanagasabai Nov 24, 2023
beb78fa
VRP consent initiation flow implementation
kalpanakanagasabai Nov 26, 2023
2c5e3a6
VRP consent initiation flow implementation
kalpanakanagasabai Nov 28, 2023
0c1f9f2
VRP consent initiation flow implementation
kalpanakanagasabai Nov 28, 2023
04e4fad
VRP implementation
kalpanakanagasabai Dec 6, 2023
ecce210
Merge remote-tracking branch 'upstream/main' into vrp
kalpanakanagasabai Dec 6, 2023
ef0339f
VRP initiation flow implementation
kalpanakanagasabai Dec 18, 2023
99be64a
VRP initiation flow implementation
kalpanakanagasabai Dec 19, 2023
c91c818
VRP initiation flow implementation
kalpanakanagasabai Dec 21, 2023
3205f1b
VRP initiation flow implementation
kalpanakanagasabai Dec 21, 2023
5ba1c85
VRP initiation flow implementation
kalpanakanagasabai Jan 3, 2024
00f9bf0
VRP initiation flow implementation
kalpanakanagasabai Jan 4, 2024
75553c7
VRP initiation flow implementation
kalpanakanagasabai Jan 4, 2024
457f1ed
VRP initiation flow implementation
kalpanakanagasabai Jan 4, 2024
28a2441
VRP initiation flow implementation
kalpanakanagasabai Jan 4, 2024
ce4dcd7
VRP initiation flow implementation
kalpanakanagasabai Jan 5, 2024
54954ab
VRP initiation flow implementation
kalpanakanagasabai Jan 5, 2024
0315e59
VRP initiation flow implementation
kalpanakanagasabai Jan 5, 2024
930919b
VRP initiation flow implementation
kalpanakanagasabai Jan 5, 2024
198f16e
VRP initiation flow implementation
kalpanakanagasabai Jan 5, 2024
a575078
VRP initiation flow implementation
kalpanakanagasabai Jan 8, 2024
dd2276f
VRP initiation flow implementation
kalpanakanagasabai Jan 8, 2024
d29df11
VRP initiation flow implementation
kalpanakanagasabai Jan 11, 2024
5d970cd
VRP initiation flow implementation
kalpanakanagasabai Jan 11, 2024
df474ab
VRP initiation flow implementation updated
kalpanakanagasabai Jan 12, 2024
3c0b5a6
VRP initiation flow implementation updated
kalpanakanagasabai Jan 12, 2024
cda8ded
VRP initiation flow implementation updated commit
kalpanakanagasabai Jan 18, 2024
a4220ee
Unit tests for VRP Initiation
kalpanakanagasabai Jan 18, 2024
6487fa3
Unit tests for VRP Initiation
kalpanakanagasabai Jan 18, 2024
876c68f
Resolving the comments for the last update
kalpanakanagasabai Jan 30, 2024
74be5dc
Resolving the comments for the last update
kalpanakanagasabai Jan 30, 2024
e8d8048
Resolving the comments for the last update
kalpanakanagasabai Jan 30, 2024
9ab5abf
Resolving the comments for the last update
kalpanakanagasabai Feb 6, 2024
15aafa4
Change of the header year
kalpanakanagasabai Feb 14, 2024
bc2ef38
vrp Validator Test
kalpanakanagasabai Feb 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@
{% else %}
<FundsConfirmationAPIURL>https://localhost:8243/open-banking/{version}/cbpii/</FundsConfirmationAPIURL>
{% endif %}
{% if open_banking.consent.vrp_consent_self_link is defined %}
<VRPAPIURL>{{open_banking.consent.vrp_consent_self_link}}</VRPAPIURL>
{% else %}
<VRPAPIURL>https://localhost:8243/open-banking/{version}/vrp/</VRPAPIURL>
{% endif %}
<DataRetention>
{% if open_banking.consent.data_retention.enabled is defined %}
<Enabled>{{open_banking.consent.data_retention.enabled}}</Enabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Map;

/**
* Open Banking common utility class to publish analytics logs
* Open Banking common utility class to publish analytics logs.
*/
public class AnalyticsLogsUtils {

Expand All @@ -36,7 +36,7 @@ public class AnalyticsLogsUtils {
private static final String DATA_PROCESSING_ERROR = "Error occurred while processing the analytics dataset";

/**
* Method to add analytics logs to the OB analytics log file
* Method to add analytics logs to the OB analytics log file.
*
* @param logFile Name of the logger which is used to log analytics data to the log file
* @param dataStream Name of the data stream to which the data belongs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/

package com.wso2.openbanking.accelerator.common.util;

/**
Expand Down Expand Up @@ -48,12 +49,19 @@ public class ErrorConstants {

public static final String PATH_CREDIT_ACCOUNT_IDENTIFICATION = "Data.Initiation.CreditorAccount.Identification";
public static final String PATH_CREDIT_ACCOUNT_SCHEME = "Data.Initiation.CreditorAccount.SchemeName";

public static final String PATH_INVALID = "Request path invalid";
public static final String PAYLOAD_INVALID = "Consent validation failed due to invalid initiation payload";
public static final String NOT_JSON_OBJECT_ERROR = "Payload is not a JSON object";
public static final String PAYLOAD_FORMAT_ERROR = "Request Payload is not in correct JSON format";
public static final String PAYLOAD_FORMAT_ERROR_VALID_TO_DATE = "Invalid valid_to_date parameter in the payload" +
"for valid to date";
public static final String PAYLOAD_FORMAT_ERROR_DEBTOR_ACC = "Parameter Debtor Account does not exists ";
public static final String PAYLOAD_FORMAT_ERROR_CREDITOR_ACC = "Parameter Creditor Account " +
"does not exists ";
public static final String INVALID_REQ_PAYLOAD = "Invalid request payload";
public static final String INVALID_REQ_PAYLOAD_INITIATION = "Invalid request payload in initiation key";
public static final String INVALID_REQ_PAYLOAD_CONTROL_PARAMETERS = "Invalid request payload in " +
"control parameter key";
public static final String MISSING_DEBTOR_ACC_SCHEME_NAME = "Mandatory parameter Debtor Account Scheme Name does " +
"not exists";
public static final String MISSING_DEBTOR_ACC_IDENTIFICATION = "Mandatory parameter Debtor Account Identification" +
Expand Down Expand Up @@ -108,6 +116,7 @@ public class ErrorConstants {
public static final String PATH_CONSENT_ID = "Data.Initiation.Consent-id";
public static final String PATH_DATA = "Data";
public static final String PATH_INITIATION = "Data.Initiation";
public static final String PATH_CONTROL_PARAMETERS = "Data.ControlParameters";
public static final String PATH_RISK = "Data.Risk";
public static final String PATH_URL = "Data.Url";
public static final String PATH_EXPIRATION_DATE = "Data.Expiration-Date";
Expand All @@ -120,7 +129,6 @@ public class ErrorConstants {
public static final String STATE_INVALID_ERROR = "Consent not in authorizable state";
public static final String DATE_PARSE_MSG = "Parsed OffsetDateTime: %s, current OffsetDateTime: %s";
public static final String EXP_DATE_PARSE_ERROR = "Error occurred while parsing the expiration date. ";

public static final String ACC_CONSENT_RETRIEVAL_ERROR = "Error occurred while retrieving the account initiation" +
" request details";
public static final String CONSENT_EXPIRED = "Provided consent is expired";
Expand Down Expand Up @@ -210,6 +218,7 @@ public class ErrorConstants {
public static final String RISK_MISMATCH = "RISK Does Not Match.:" + ErrorConstants.PATH_RISK;
public static final String RISK_NOT_FOUND = "RISK is not found or empty in the request.:" +
ErrorConstants.PATH_RISK;

public static final String INVALID_URI_ERROR = "Path requested is invalid. :" + ErrorConstants.PATH_URL;
public static final String COF_CONSENT_STATE_INVALID = "Confirmation of Funds validation failed due to invalid" +
" consent state.:" + ErrorConstants.PATH_STATUS;
Expand All @@ -221,9 +230,65 @@ public class ErrorConstants {
" retrieval request";
public static final String INVALID_CONSENT_ID = "Invalid Consent Id found in the request";
public static final String CONSENT_ID_NOT_FOUND = "Consent ID not available in consent data";

public static final String FIELD_INVALID_DATE = "OB.Field.InvalidDate";
public static final String EXPIRED_DATE_ERROR = "The ExpirationDateTime value has to be a future date.";

// VRP error constants

public static final String VRP_INITIATION_HANDLE_ERROR = "Error occurred while handling the VRP " +
"initiation request";

public static final String VRP_INITIATION_RETRIEVAL_ERROR = "Error occurred while handling the VRP initiation" +
" retrieval request";
public static final String PAYLOAD_FORMAT_ERROR_VALID_FROM_DATE = "Request Payload is not in correct JSON format" +
" for valid from date";
public static final String INVALID_VALID_TO_DATE_TIME = "Invalid date time format in validToDateTime";
public static final String INVALID_VALID_FROM_DATE_TIME = "Invalid date time format in validFromDateTime";
public static final String PAYLOAD_FORMAT_ERROR_CONTROL_PARAMETER = "Request Payload is not in correct JSON " +
"format for control parameter key";
public static final String PAYLOAD_FORMAT_ERROR_MAXIMUM_INDIVIDUAL_AMOUNT = "Invalid maximum individual amount";
public static final String MISSING_MAXIMUM_INDIVIDUAL_AMOUNT = "Missing mandatory parameter Maximum Individual" +
" Amount";
public static final String PAYLOAD_FORMAT_ERROR_MAXIMUM_INDIVIDUAL_CURRENCY = "Invalid maximum individual amount" +
"currency";
public static final String PAYLOAD_FORMAT_ERROR_INITIATION = "Missing mandatory parameter Initiation" +
" in the payload";
public static final String PAYLOAD_FORMAT_ERROR_RISK = "Mandatory parameter Risk does not exists" +
" in the payload";
public static final String INVALID_PERIOD_TYPE = "Invalid value for period type in PeriodicLimits";
public static final String INVALID_PARAMETER = "Parameter passed in is null , " +
"empty or not a JSONObject";
public static final String INVALID_CLIENT_ID_MATCH = "Consent validation failed due to client ID mismatch";
public static final String INVALID_DATE_TIME_FORMAT = "Date and Time is not in correct JSON " +
"ISO-8601 date-time format";
public static final String MISSING_DATE_TIME_FORMAT = "The value is empty or the value is not a string";
public static final String MISSING_VALID_TO_DATE_TIME = "Missing parameter ValidToDateTime";
public static final String MISSING_VALID_FROM_DATE_TIME = "Missing parameter ValidFromDateTime";
public static final String INVALID_PARAMETER_PERIODIC_LIMITS = "Parameter passed in is null , " +
"empty or not a JSONArray";
public static final String MISSING_PERIOD_LIMITS = "Mandatory parameter " +
"periodic limits is missing in the payload";
public static final String MISSING_PERIOD_TYPE = "Missing required parameter Period type";
public static final String PAYLOAD_FORMAT_ERROR_PERIODIC_LIMITS_PERIOD_TYPE = "Value of period type is empty or " +
"the value passed in is not a string";
public static final String PAYLOAD_FORMAT_ERROR_PERIODIC_LIMITS_ALIGNMENT = "Value of periodic alignment is empty" +
" or the value passed in is not a string";
public static final String MISSING_PERIOD_ALIGNMENT = "Missing periodic alignment in periodic limits";
public static final String INVALID_PERIOD_ALIGNMENT = "Invalid value for period alignment in PeriodicLimits";
public static final String INVALID_PARAMETER_MESSAGE = "Parameter '%s' passed in is null, empty, or not a %s";
public static final String DATE_INVALID_PARAMETER_MESSAGE = "Invalid date-time range for ValidToDateTime ";



// vrp path parameters
public static final String PATH_VALID_TO_DATE = "Data.ControlParameters.ValidToDateTime";
public static final String PATH_VALID_FROM_DATE = "Data.ControlParameters.ValidFromDateTime";
public static final String PATH_MAXIMUM_INDIVIDUAL_AMOUNT = "Data.ControlParameters.MaximumIndividualAmount";
public static final String PATH_PERIOD_LIMIT = "Data.ControlParameters.PeriodicLimits";
public static final String PATH_PERIOD_LIMIT_AMOUNT = "Data.ControlParameters.PeriodicLimits.Amount";
public static final String PATH_PERIOD_LIMIT_CURRENCY = "Data.ControlParameters.PeriodicLimits.Currency";
public static final String PATH_PERIOD_TYPE = "Data.ControlParameters.PeriodicLimits.PeriodType";
public static final String PATH_PERIOD_ALIGNMENT = "Data.ControlParameters.PeriodicLimits.PeriodAlignment";

}

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static Object getClassInstanceFromFQN(String classpath) {
}

/**
* Extract software_environment (SANDBOX or PRODUCTION) from SSA
* Extract software_environment (SANDBOX or PRODUCTION) from SSA.
*
* @param softwareStatement software statement (jwt) extracted from request payload
* @return software_environment
Expand Down Expand Up @@ -103,7 +103,7 @@ public static boolean isPublishableDisputeData(int statusCode) {
}

/**
* Method to reduce string length
* Method to reduce string length.
*
* @param input and maxLength for dispute data
* @return String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -16,7 +16,6 @@
* under the License.
*/
package com.wso2.openbanking.accelerator.consent.extensions.common;
;

/**
* Constant class for consent extension module.
Expand Down Expand Up @@ -48,6 +47,8 @@ public class ConsentExtensionConstants {
public static final String HTTP_CODE = "httpCode";
public static final String ERRORS = "errors";
public static final String PAYMENTS = "payments";
public static final String VRP = "vrp";

public static final String DATA = "Data";
public static final String INITIATION = "Initiation";
public static final String STATUS = "Status";
Expand Down Expand Up @@ -95,7 +96,6 @@ public class ConsentExtensionConstants {
public static final String DATA_SIMPLE = "data";
public static final String DEBTOR_ACCOUNT_ID = "AccountId";
public static final String ACCOUNT_ID = "account_id";

public static final String DATA_REQUESTED = "data_requested";
public static final String PAYMENT_ACCOUNT = "paymentAccount";
public static final String COF_ACCOUNT = "cofAccount";
Expand All @@ -108,7 +108,6 @@ public class ConsentExtensionConstants {
public static final String OPENBANKING_INTENT_ID = "openbanking_intent_id";
public static final String VALUE = "value";
public static final String AUTHORIZED_STATUS = "authorised";

public static final String EXPIRATION_DATE = "ExpirationDateTime";
public static final String EXPIRATION_DATE_TITLE = "Expiration Date Time";
public static final String INSTRUCTED_AMOUNT_TITLE = "Instructed Amount";
Expand Down Expand Up @@ -153,19 +152,50 @@ public class ConsentExtensionConstants {
public static final String ACCOUNTS_SELF_LINK = "Consent.AccountAPIURL";
public static final String PAYMENT_SELF_LINK = "Consent.PaymentAPIURL";
public static final String COF_SELF_LINK = "Consent.FundsConfirmationAPIURL";
public static final String VRP_SELF_LINK = "Consent.VRPAPIURL";
public static final String REVOKED_STATUS = "revoked";

public static final String DISPLAY_NAME = "display_name";
public static final String ACCOUNT_DATA = "account_data";
public static final String SELECTED_ACCOUNT = "selectedAccount";
public static final String PAYMENT_COF_PATH = "funds-confirmation";

public static final String AWAITING_UPLOAD_STATUS = "awaitingUpload";

public static final String OB_REVOKED_STATUS = "Revoked";
public static final String OB_REJECTED_STATUS = "Rejected";
public static final String OB_AUTHORIZED_STATUS = "Authorised";
public static final String OB_AWAITING_AUTH_STATUS = "AwaitingAuthorisation";
public static final String OB_AWAITING_UPLOAD_STATUS = "AwaitingUpload";

//VRP Constants
public static final String VRP_CONSENT_PATH = "domestic-vrp-consents";
kalpanakanagasabai marked this conversation as resolved.
Show resolved Hide resolved
public static final String VRP_PAYMENT = "vrp-payment";
public static final String PAID_AMOUNT = "paid-amount";
public static final String LAST_PAYMENT_DATE = "last-payment-date";
public static final String AUTH_TYPE_AUTHORIZATION = "authorization";
public static final String CONTROL_PARAMETERS = "ControlParameters";
public static final String MAXIMUM_INDIVIDUAL_AMOUNT = "MaximumIndividualAmount";
public static final String MAXIMUM_INDIVIDUAL_AMOUNT_CURRENCY = "MaximumIndividualAmount.Amount.Currency";
public static final String PERIODIC_LIMITS = "PeriodicLimits";
public static final String PERIOD_AMOUNT_LIMIT = "Amount";
public static final String PERIOD_LIMIT_CURRENCY = "PeriodicLimits.Currency";

//vrp period alignment
public static final String PERIOD_ALIGNMENT = "PeriodAlignment";

// vrp periodic alignment types
public static final String CONSENT = "Consent";
public static final String CALENDAR = "Calendar";

//vrp periodicLimits
public static final String PERIOD_TYPE = "PeriodType";

//vrp periodic types
public static final String DAY = "Day";
public static final String WEEK = "Week";
public static final String FORTNIGHT = "Fortnight";
public static final String MONTH = "Month";
public static final String HALF_YEAR = "Half-year";
public static final String YEAR = "Year";
public static final String VALID_TO_DATE_TIME = "ValidToDateTime";
public static final String VALID_FROM_DATE_TIME = "ValidFromDateTime";
public static final String VRP_RESPONSE_PROCESS_PATH = "vrp-response-process";
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.wso2.openbanking.accelerator.consent.extensions.manage.impl.CofConsentRequestHandler;
import com.wso2.openbanking.accelerator.consent.extensions.manage.impl.ConsentManageRequestHandler;
import com.wso2.openbanking.accelerator.consent.extensions.manage.impl.PaymentConsentRequestHandler;
import com.wso2.openbanking.accelerator.consent.extensions.manage.impl.VRPConsentRequestHandler;

/**
* Factory class to get the class based in request type.
Expand All @@ -55,6 +56,9 @@ public static ConsentManageRequestHandler getConsentManageRequestValidator(Strin
case ConsentExtensionConstants.PAYMENT_CONSENT_PATH:
consentManageRequestHandler = new PaymentConsentRequestHandler();
break;
case ConsentExtensionConstants.VRP_CONSENT_PATH:
consentManageRequestHandler = new VRPConsentRequestHandler();
break;
default:
return null;
}
Expand Down
Loading
Loading