this.inviteRepository = inviteRepository;
this.acceptUriTemplate = new UriTemplate(acceptUriTemplate);
}
public void sendInvite(Account from, List<Invitee> to, String invitationBody) {
StringTemplate textTemplate = textTemplateFactory.getStringTemplate();
textTemplate.put("account", from);
StringTemplate bodyTemplate = new LocalStringTemplate(invitationBody);
for (Invitee invitee : to) {
bodyTemplate.put("invitee", invitee);
textTemplate.put("body", bodyTemplate.render());
String token = tokenGenerator.generateKey();
textTemplate.put("acceptUrl", acceptUriTemplate.expand(token));
send(from, invitee, textTemplate.render(), token);
}
}