Skip to content

Commit

Permalink
PI-17312: Changed SubscriptionOrderEventParser
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulMichardAppDirect authored and naponce committed Mar 26, 2020
1 parent b97a497 commit bca3ecc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>0.23.0.RELEASE</version>
</dependency>
<!-- Guava -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@
class SubscriptionOrderEventParser implements EventParser<SubscriptionOrder> {
@Override
public SubscriptionOrder parse(EventInfo eventInfo, EventHandlingContext eventContext) {
String samlIdpUrl = null;
try {
samlIdpUrl = eventInfo.getLinks().stream().filter(link -> link.getRel().equals("samlIdp")).findFirst().map(Link::getHref).orElse(null);
} catch (Exception e) {
log.warn("Error when recovering samlIdp, proceeding with empty value", e);
}
String samlIdpUrl = eventInfo.getLinks().stream()
.filter(link -> {
try {
return "samlIdp".equals(link.getRel());
} catch (Exception e) {
log.warn("Error when recovering samlIdp, proceeding with empty value", e);
return false;
}
})
.findFirst()
.map(Link::getHref)
.orElse(null);

return new SubscriptionOrder(
eventContext.getConsumerKeyUsedByTheRequest(),
Expand Down

0 comments on commit bca3ecc

Please sign in to comment.