use of org.rembx.jeeshop.user.model.User in project jeeshop by remibantos.
the class UsersCT method notActivatedTestUser.
private User notActivatedTestUser() {
User user = new User("reset1@test.com", "password", "John", "Doe", "+33616161616", null, new Date(), "fr_FR", null);
user.setGender("M.");
final UUID actionToken = UUID.randomUUID();
user.setActionToken(actionToken);
user.setActivated(false);
entityManager.getTransaction().begin();
entityManager.persist(user);
entityManager.getTransaction().commit();
return user;
}
use of org.rembx.jeeshop.user.model.User in project jeeshop by remibantos.
the class UsersCT method modifyUnknownUser_ShouldThrowNotFoundException.
@Test
public void modifyUnknownUser_ShouldThrowNotFoundException() {
User detachedUser = new User("test3@test.com", "test", "John", "Doe", "+33616161616", null, new Date(), "fr_FR", null);
detachedUser.setId(9999L);
try {
service.modify(sessionContextMock, detachedUser);
fail("should have thrown ex");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
}
}
use of org.rembx.jeeshop.user.model.User in project jeeshop by remibantos.
the class DefaultPaymentTransactionEngine method sendOrderConfirmationMail.
protected void sendOrderConfirmationMail(Order order) {
User user = order.getUser();
MailTemplate mailTemplate = mailTemplateFinder.findByNameAndLocale(orderValidated.name(), user.getPreferredLocale());
if (mailTemplate == null) {
LOG.warn("orderValidated e-mail template does not exist. Configure this missing template to allow user e-mail notification");
return;
}
try {
Template mailContentTpl = new Template(orderValidated.name(), mailTemplate.getContent(), new Configuration(Configuration.VERSION_2_3_21));
final StringWriter mailBody = new StringWriter();
mailContentTpl.process(order, mailBody);
mailer.sendMail(mailTemplate.getSubject(), user.getLogin(), mailBody.toString());
} catch (Exception e) {
LOG.error("Unable to send mail " + orderValidated + " to user " + user.getLogin(), e);
}
}
Aggregations