Skip to content

Commit

Permalink
[PPANTT-145] hotfix: Add check on subscription name length before api…
Browse files Browse the repository at this point in the history
… key creation (#503)
  • Loading branch information
gioelemella authored Oct 1, 2024
1 parent dfa0bbb commit ce5888b
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public InstitutionApiKeysResource createSubscriptionKeys(String institutionId, S
InstitutionResponse institution = getInstitutionResponse(institutionId);

String subscriptionId = String.format("%s%s", subscriptionCode.getPrefixId(), institution.getTaxCode());
String subscriptionName = String.format("%s %s", subscriptionCode.getDisplayName(), institution.getDescription());
String subscriptionName = buildSubscriptionName(subscriptionCode, institution);
String subscriptionScope = String.format(subscriptionCode.getScope(), getEnvironment());
createUserIfNotExist(institutionId, institution);
this.apimClient.createInstitutionSubscription(
Expand Down Expand Up @@ -488,6 +488,17 @@ private DelegationInfo getDelegationInfo(

private record DelegationInfo(List<DelegationExternal> delegationResponse,
CreditorInstitutionStationSegregationCodesList ciSegregationCodes) {

}
private String buildSubscriptionName(
Subscription subscriptionCode,
InstitutionResponse institution
) {
String subscriptionName = String.format("%s %s", subscriptionCode.getDisplayName(), institution.getDescription());
if (subscriptionName.length() >= 100) {
return subscriptionName.substring(0, 99);
}
return subscriptionName;
}
}

0 comments on commit ce5888b

Please sign in to comment.