Package org.jayasoft.woj.portal.model.commercial

Examples of org.jayasoft.woj.portal.model.commercial.Invoice


    public static void main(String[] args) {
        LoggingManager.initSimpleLoggingManagement();
        InvoiceBuilder builder = ItextPDFInvoiceBuilder.instance();
        Order o = new Order();
        o.setTotalCost(50.0d);
        Invoice i = new Invoice();
        PaymentInfo pi = new PaymentInfo();
        License l = new License();
        Price p = new Price();
        p.setPriceByYear(50);
        l.setPrice(p);
View Full Code Here


                        int years = pendingOrder.getSubscribedYears();
                        FidelityService fs = ServiceFactory.getFidelityService();
                        fs.buy(buyer, p, years, pendingOrder.getSubscribedUsers());
                       
                        LOGGER.info("creating invoice...");
                        Invoice invoice = ServiceFactory.getCommercialService().createInvoice(pendingOrder, pendingOrder.getPurchaser());
            ServiceFactory.getRegistrationService().sendLicenseBuyConfirmationMail(pendingOrder.getBuyer(), pendingOrder, lic, invoice);
                        LOGGER.info("payment created");
            return paymentInfo;
          } else  {
                        // TODO g�rer annulation ou refus de paiement
View Full Code Here

    public HibernateInvoiceDao(DaoHelper helper) {
        super(helper, Invoice.class);
    }
   
    public WOJObject newHandledObject() {
        return new Invoice();
    }
View Full Code Here

        doPost(request, response);
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String invoiceId = request.getParameter(Params.USER_INVOICE.SHOW_INVOICE.PARAMS.INVOICE_ID);
        try {
            Invoice i = ServiceFactory.getCommercialService().getInvoice(new Long(invoiceId));
            response.setContentType((String)MimeType.getMimeTypes("pdf").get(0));
            try {
                byte[] pdf = i.getPdf();
                response.getOutputStream().write(pdf);
            } catch (IOException e) {
                LOGGER.warn("cannot write invoice PDF", e);
            }
        } catch (Exception e) {
View Full Code Here

            InvoiceIdService idService = ServiceFactory.getInvoiceIdService();
           
            InvoiceId invId = idService.newWOJIdent(o);
            idService.validateIdent(invId);

            Invoice i = (Invoice)DaoFactory.getInvoiceDao().newHandledObject();
            o.setInvoice(i);
            i.setPdf(InvoiceBuilderFactory.getBuilder().buildInvoicePDF(o, p, invId.getIdent()));
            i.setIdent(invId.getIdent());
           
            DaoFactory.getInvoiceDao().save(i);
            DaoFactory.getOrderDao().save(o);

            LOGGER.info(MessageFormat.format("new invoice[{0}] created for user[{1}]", new Object[] {new Long(i.getId()), o.getBuyer().getLogin()}));
            return i;
        } catch (DataAccessException dae) {
            LOGGER.debug("error creating invoice", dae);
            throw new ServiceException("cannot create invoice", dae);
        } catch (DaoException e) {
View Full Code Here

    public ActionForward showUserInvoice(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall() {
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        String invoiceId = request.getParameter(Params.USER_INVOICE.SHOW_INVOICE.PARAMS.INVOICE_ID);
                        Invoice i = ServiceFactory.getCommercialService().getInvoice(new Long(invoiceId));
                        response.setContentType((String)MimeType.getMimeTypes("pdf").get(0));
                        try {
                            byte[] pdf = i.getPdf();
                            response.getOutputStream().write(pdf);
                        } catch (IOException e) {
                            LOGGER.warn("cannot write invoice PDF", e);
                        }
                        return null;
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.portal.model.commercial.Invoice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.