Skip to content

Commit

Permalink
VRP initiation flow implementation updated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kalpanakanagasabai committed Jan 18, 2024
1 parent 3c0b5a6 commit cda8ded
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ public class ErrorConstants {
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 = "Request Payload is not in correct JSON " +
"format for debtor account";
public static final String PAYLOAD_FORMAT_ERROR_CREDITOR_ACC = "Request Payload is not in correct JSON " +
"format for creditor account";
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 " +
Expand Down Expand Up @@ -240,13 +239,14 @@ public class ErrorConstants {
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 parameter 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 = "Request Payload is not in correct JSON format" +
" for initiation key";
public static final String PAYLOAD_FORMAT_ERROR_RISK = "Request Payload is not in correct JSON format" +
" for Risk key";
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";
Expand All @@ -263,12 +263,16 @@ public class ErrorConstants {
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 = "Invalid periodic limits";
public static final String PAYLOAD_FORMAT_ERROR_PERIODIC_LIMITS_ALIGNMENT = "Value 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_PERIOD_ALIGNMENT = "Value is empty or the value passed " +
"in for periodic alignment is not a string";
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, " +
"validToDateTime: %s, validFromDateTime: %s, currentDateTime: %s";



// vrp path parameters
public static final String PATH_VALID_TO_DATE = "Data.ControlParameters.ValidToDateTime";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,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 Down Expand Up @@ -174,8 +173,10 @@ public class ConsentExtensionConstants {
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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,33 @@ public void handlePaymentPost(ConsentManageData consentManageData, Object reques

consentAttributes.put(ConsentExtensionConstants.MAXIMUM_INDIVIDUAL_AMOUNT,
((JSONObject) (controlParameters)
.get(ConsentExtensionConstants.MAXIMUM_INDIVIDUAL_AMOUNT)).
get(ConsentExtensionConstants.AMOUNT).toString());
.get(ConsentExtensionConstants.MAXIMUM_INDIVIDUAL_AMOUNT))
.get(ConsentExtensionConstants.AMOUNT).toString());

consentAttributes.put(ConsentExtensionConstants.MAXIMUM_INDIVIDUAL_AMOUNT_CURRENCY,
((JSONObject) (controlParameters)
.get(ConsentExtensionConstants.MAXIMUM_INDIVIDUAL_AMOUNT))
.get(ConsentExtensionConstants.CURRENCY).toString());

//Todo: can we store the currency as an attribute
consentAttributes.put(ConsentExtensionConstants.PERIOD_ALIGNMENT, ((JSONObject) ((JSONArray)
(controlParameters).get(ConsentExtensionConstants.PERIODIC_LIMITS)).get(0))
.get(ConsentExtensionConstants.PERIOD_ALIGNMENT).toString());
//TODO: Improve the logic of storing the PERIODIC_LIMITS and rest of VRP parameters

consentAttributes.put(ConsentExtensionConstants.PERIOD_TYPE,
((JSONObject) ((JSONArray) (controlParameters)
.get(ConsentExtensionConstants.PERIODIC_LIMITS)).get(0)).get(ConsentExtensionConstants.PERIOD_TYPE)
.toString());

consentAttributes.put(ConsentExtensionConstants.PERIOD_AMOUNT_LIMIT, ((JSONObject)
((JSONArray) (controlParameters).get(ConsentExtensionConstants.PERIODIC_LIMITS)).get(0))
.get(ConsentExtensionConstants.PERIOD_AMOUNT_LIMIT).toString());

consentAttributes.put(ConsentExtensionConstants.PERIOD_LIMIT_CURRENCY, ((JSONObject)
((JSONArray) (controlParameters).get(ConsentExtensionConstants.PERIODIC_LIMITS)).get(0))
.get(ConsentExtensionConstants.CURRENCY).toString());

//Store consent attributes
ConsentServiceUtil.getConsentService().storeConsentAttributes(createdConsent.getConsentID(),
consentAttributes);
Expand Down
Loading

0 comments on commit cda8ded

Please sign in to comment.