Exemple #1
0
  @Override
  public void sendMailAcceptedPyamentAfterPending(
      OrderFullDTO order, MailPropertiesDTO mailProps, TypeStateOrder state)
      throws MailNotSendException {
    // TODO Auto-generated method stub
    String content = null;
    String mail = order.getIdUser();
    try {
      content = Template.getContenFile(TipoTemplate.MailIPNAcceptedPaymemtAfetPending);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      throw new MailNotSendException(e);
    }

    content =
        content.replaceAll(
            "<COMPANY_NAME>", mailProps.getCompanyName() == null ? "" : mailProps.getCompanyName());
    content = content.replaceAll("<NAME>", order.getNameUser() + " " + order.getSurnameUser());
    content = content.replaceAll("<idTransazione>", order.getIdTransaction());
    content = content.replaceAll("<idOrder>", String.valueOf(order.getIdOrder()));
    content = content.replaceAll("<importo>", OthalaCommonUtils.getImporto(order.getImOrdine()));

    String subject = "Pagamento Accettato ";
    subject += mailProps.getCompanyName();

    mailService.inviaMail(new String[] {mail}, subject, content, mailProps);
    // invia le mail al cliente e ai negozi sUll'avvenuta ricezione
    // delpagamento
    sendMailAcceptedPyament(order, mailProps, TypeStateOrder.getDescrState(state.getState()));
  }
Exemple #2
0
  @Override
  public void sendMailRefusedPayment(OrderFullDTO order, MailPropertiesDTO mailProps)
      throws MailNotSendException {
    // TODO Auto-generated method stub
    String content = null;
    String mail = order.getIdUser();
    try {
      content = Template.getContenFile(TipoTemplate.MailIPNRefusePayment);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      throw new MailNotSendException(e);
    }

    content = content.replaceAll("<COMPANY_NAME>", mailProps.getCompanyName());
    content = content.replaceAll("<NAME>", order.getNameUser() + " " + order.getSurnameUser());
    content = content.replaceAll("<idTransazione>", order.getIdTransaction());
    content = content.replaceAll("<idOrder>", String.valueOf(order.getIdOrder()));
    content = content.replaceAll("<importo>", OthalaCommonUtils.getImporto(order.getImOrdine()));

    String subject = "Pagamento Rifiutato ";
    subject += mailProps.getCompanyName();

    mailService.inviaMail(new String[] {mail}, subject, content, mailProps);
  }
Exemple #3
0
  @Override
  public void sendMailAcceptedPyament(OrderFullDTO order, MailPropertiesDTO mailDTO, String status)
      throws MailNotSendException {
    TypeStateOrder state = TypeStateOrder.fromString(status);
    URL res = Thread.currentThread().getContextClassLoader().getResource("");
    Map<String, String> inlineImages = new HashMap<String, String>();
    String basePath = res.getPath().replace("/WEB-INF/classes", "");
    basePath = basePath.replace("/", "");
    String template =
        Template.getNomeFile("mailConfermaOrdine", order.getShippingAddress().getNazione());
    String html = generateHtmlOrder(order, mailDTO, inlineImages, state, template, null);

    String oggetto = null;
    if (state == TypeStateOrder.SPEDITO) {
      oggetto = "Spedizione ordine";
    } else {
      oggetto = "Conferma ordine";
    }

    mailService.inviaHTMLMail(
        new String[] {order.getIdUser()}, oggetto, html, inlineImages, mailDTO, true);

    List<ShopDTO> lsShop = productDAO.listShop();
    if (state == TypeStateOrder.SPEDITO) {

    } else {
      /*
       * for (ArticleFullDTO art : order.getCart()) {
       *
       * ShopDTO shopStock =
       * externalService.getShopStock(art.getPrdFullDTO().getIdProduct(),
       * art.getPgArticle(), art.getTxBarCode());
       *
       * art.getShop().setIdShop(shopStock.getIdShop());
       * art.getShop().setTxShop(shopStock.getTxShop());
       *
       * }
       */

      html = generateHtmlOrder(order, mailDTO, inlineImages, state, "mailInserimentoOrdine", null);

      mailService.inviaHTMLMail(
          new String[] {lsShop.get(0).getTxMail()},
          "Nuovo Ordine WEB",
          html,
          inlineImages,
          mailDTO,
          true);

      // Cambiare
      // Creare un metodo doppio in externalservice che tira fuori nel
      // caso del deg il magazzino con maggior capienza
      // nel caso normale il negozio
      // Poi
      // Per ogni articolo va preso il magazzino con maggior capienza e
      // mandata la mail per deg
      // Per ogni articolo mandare la mail al negozio
      // invia la mai di notifica ordine ai negozi
      /*
       * List<ShopDTO> lstShop = new ArrayList<ShopDTO>(); lstShop =
       * productDAO.listShop(); for (int i = 0; i < lstShop.size(); i++) {
       * for (ArticleFullDTO art : order.getCart()) { if
       * (art.getShop().getIdShop() == lstShop.get(i).getIdShop()) { html
       * = generateHtmlOrder(order, mailDTO, inlineImages, state,
       * "mailInserimentoOrdine", lstShop .get(i).getIdShop());
       * mailService.inviaHTMLMail(new String[] {
       * lstShop.get(i).getTxMail() }, "Nuovo Ordine WEB", html,
       * inlineImages, mailDTO, true); break; } } }
       */
    }
  }