class BerlinGroupLinksRewriter implements LinksRewriter {

    protected Optional<String> retrievePaymentId(String link) {
        String[] linkPaths = getLinkPathsAsArray(link);

        // < 3 as payment id is the third path param in the URI
        if (linkPaths.length < 3) {
            return Optional.empty();
        }

        // as payment links (that contains payment id) are compliant
        // with the following pattern: `{paymentService}/{paymentProduct}/{paymentId}`
        // it means that the linkPaths[2] returns payment id value
        return Optional.of(linkPaths[2]);
    }

    public  BerlinGroupLinksRewriter(LinksTemplate linksTemplate,
                                    String host,
                                    String version);

}