class BerlinGroupLinksRewriter implements LinksRewriter {

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

        // < 2 as payment product is the second path param in the URI
        if (linkPaths.length < 2) {
            return Optional.empty();
        }

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

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

}