use of site.model.Registrant in project jprime by bgjug.
the class AdminInvoiceController method sendInvoice.
@Transactional
@RequestMapping(value = "/send", method = RequestMethod.POST)
public String sendInvoice(@Valid final InvoiceData invoiceData, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return INVOICE_DATA_JSP;
}
Registrant registrant = registrantFacade.findById(invoiceData.getRegistrantId());
registrantFacade.setRegistrantPaid(registrant);
invoiceData.setInvoiceType(InvoiceData.ORIGINAL_BG);
if (invoiceData.getInvoiceNumber().equals("0")) {
registrantFacade.generateInvoiceNumber(registrant);
}
invoiceData.setInvoiceNumber(String.valueOf(registrant.getRealInvoiceNumber()));
try {
byte[] invoice = invoiceExporter.exportInvoice(invoiceData, registrant.isCompany());
mailFacade.sendInvoice(registrant.getEmail(), "jPrime.io original invoice", "Please find attached the invoice for the conference passes that you purchased.", invoice, TicketsController.generatePdfFilename(registrant, invoiceData.getSinglePriceWithVAT()));
mailFacade.sendInvoice("conference@jprime.io", "jPrime.io invoice", "The attached invoice was sent to " + registrant.getEmail(), invoice, TicketsController.generatePdfFilename(registrant, invoiceData.getSinglePriceWithVAT()));
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:/admin/registrant/view";
}
use of site.model.Registrant in project jprime by bgjug.
the class AdminRegistrantController method getNewRegistrantForm.
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String getNewRegistrantForm(Model model) {
model.addAttribute("registrant", new Registrant());
model.addAttribute("paymentTypes", Registrant.PaymentType.values());
model.addAttribute("branches", Branch.values());
return REGISTRANT_EDIT_JSP;
}
use of site.model.Registrant in project jprime by bgjug.
the class TicketsEpayRegisterControllerTest method postNonCompanyRegistrantShouldSaveVisitorDataAsRegistrant.
@Test
@Ignore("ignored since adding captcha, has to be updated")
public void postNonCompanyRegistrantShouldSaveVisitorDataAsRegistrant() throws Exception {
mockMvc.perform(post("/tickets/epay").param("visitors[0].name", "John Doe").param("visitors[0].email", "john@example.com").param("visitors[0].company", "Example").param("company", "false")).andExpect(status().isOk()).andExpect(view().name(TICKETS_RESULT_JSP));
List<Registrant> allRegistrants = (List<Registrant>) registrantRepository.findAll();
assertThat(allRegistrants.size(), is(1));
Registrant registrant = allRegistrants.get(0);
assertThat("John Doe", is(registrant.getName()));
assertThat("john@example.com", is(registrant.getEmail()));
assertThat(false, is(registrant.isCompany()));
assertThat(1, is(registrant.getVisitors().size()));
assertThat("John Doe", is(registrant.getVisitors().get(0).getName()));
assertThat("john@example.com", is(registrant.getVisitors().get(0).getEmail()));
assertThat("Example", is(registrant.getVisitors().get(0).getCompany()));
}
use of site.model.Registrant in project jprime by bgjug.
the class TicketsEpayRegisterControllerTest method postCompanyRegistrantShouldSaveInvoiceData.
@Test
@Ignore("ignored since adding captcha, has to be updated")
public void postCompanyRegistrantShouldSaveInvoiceData() throws Exception {
mockMvc.perform(post("/tickets/epay").param("visitors[0].name", "John Doe").param("visitors[0].email", "john@example.com").param("visitors[0].company", "Example").param("company", "true").param("name", "Adams Family").param("address", "0001 Cemetery Lane").param("eik", "666").param("vatNumber", "666").param("mol", "Gomez Adams").param("email", "gomez@adams.com")).andExpect(status().isOk()).andExpect(view().name(TICKETS_RESULT_JSP));
List<Registrant> allRegistrants = (List<Registrant>) registrantRepository.findAll();
assertThat(allRegistrants.size(), is(1));
Registrant registrant = allRegistrants.get(0);
assertThat("Adams Family", is(registrant.getName()));
assertThat("gomez@adams.com", is(registrant.getEmail()));
assertThat("Adams Family", is(registrant.getName()));
assertThat("0001 Cemetery Lane", is(registrant.getAddress()));
assertThat("BG666", is(registrant.getVatNumber()));
assertThat("666", is(registrant.getEik()));
assertThat("Gomez Adams", is(registrant.getMol()));
assertThat(true, is(registrant.isCompany()));
assertThat(1, is(registrant.getVisitors().size()));
assertThat("John Doe", is(registrant.getVisitors().get(0).getName()));
assertThat("john@example.com", is(registrant.getVisitors().get(0).getEmail()));
assertThat("Example", is(registrant.getVisitors().get(0).getCompany()));
assertThat(VisitorStatus.REQUESTING, is(registrant.getVisitors().get(0).getStatus()));
}
Aggregations