Skip to content

Commit

Permalink
editing ams selection logic and adding log statements (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankita10r authored Apr 14, 2022
1 parent ff68731 commit 03c2119
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ private void collectionRoutes(){

amsUtils.postConstruct();


Map<String, Object> extraVariables = new HashMap<>();
extraVariables.put("initiator", "PAYEE");
extraVariables.put("initiatorType", "BUSINESS");
Expand All @@ -307,37 +308,41 @@ private void collectionRoutes(){
String secondaryIdentifierVal = "";
String primaryIdentifierName = "";
String secondaryIdentifierName = "";
String ams = "";
String finalAmsVal = "value";
primaryIdentifierName= ((JSONObject) payer.get(0)).getString("key");
secondaryIdentifierName = ((JSONObject) payer.get(1)).getString("key");
primaryIdentifierVal = ((JSONObject) payer.get(0)).getString("value");
secondaryIdentifierVal = ((JSONObject) payer.get(1)).getString("value");
for ( AMSProps.AMS amsIdentifier : amsUtils.postConstruct()) {
logger.info("KEY VALUE PAIR : " + amsIdentifier.getIdentifier() + " " + amsIdentifier.getValue());
String identifier = amsIdentifier.getIdentifier();
if (identifier.equalsIgnoreCase(secondaryIdentifierName)) {
ams = amsIdentifier.getValue();
finalAmsVal = amsIdentifier.getValue();
logger.info("Assigned from secondary" + finalAmsVal);
break;
} else {
ams = amsIdentifier.getDefaultValue();
}
}//end for loop
for ( AMSProps.AMS amsIdentifier : amsUtils.postConstruct()) {
String identifier = amsIdentifier.getIdentifier();
if(identifier.equalsIgnoreCase(primaryIdentifierName)){
ams = amsIdentifier.getValue();
else if(identifier.equalsIgnoreCase(primaryIdentifierName)){
finalAmsVal = amsIdentifier.getValue();
// logic to keep correct primary/secondary identifier for line 345-346
String temp = primaryIdentifierVal;
primaryIdentifierVal = secondaryIdentifierVal;
secondaryIdentifierVal = temp;
logger.info("Assigned from primary" + finalAmsVal);
break;
}
else {
ams = amsIdentifier.getDefaultValue();
if(identifier.equalsIgnoreCase("default")){
finalAmsVal = amsIdentifier.getDefaultValue();
logger.info("Assigned default from secondary" + finalAmsVal);
}


}
}//end for loop

}
tenantSpecificBpmn = mpesaFlow.replace("{dfspid}", tenantId)
.replace("{ams}",ams);
logger.info("Final Value for ams : " + finalAmsVal);
tenantSpecificBpmn = mpesaFlow.replace("{dfspid}", tenantId)
.replace("{ams}",finalAmsVal);

String amount = body.getJSONObject("amount").getString("amount");

Expand Down
9 changes: 3 additions & 6 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ bpmn:

ams:
groups:
-
identifier: "accountid"
- identifier: "accountid"
value: "roster"
-
identifier: "foundationalid"
- identifier: "foundationalid"
value: "paygops"
-
identifier: "default"
- identifier: "default"
value : "paygops"


Expand Down

0 comments on commit 03c2119

Please sign in to comment.