package it.acxent.cc.servlet; import it.acxent.anag.Users; import it.acxent.bank.paypalcheckout.PayPalReq; import it.acxent.cc.Attivita; import it.acxent.contab.Documento; import it.acxent.db.ApplParmFull; import it.acxent.db.DBAdapter; import it.acxent.db.ResParm; import it.acxent.gtm.GoogleDataLayer; import it.acxent.gtm.GoogleDataLayerBuilder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONObject; public class PaypalCheckoutSvlt extends it.acxent.bank.servlet.paypalcheckout.PaypalCheckoutSvlt { private static final long serialVersionUID = 5775575153032080843L; protected void recordOrder(HttpServletRequest req, HttpServletResponse res, JSONObject jso) { ApplParmFull apFull = getApFull(req); String orderId = jso.getString("id"); String status = jso.getString("status"); System.out.println("paypalsvltcheckout recordOrder prog www: status" + status + " orderid:" + orderId); if (status.equals("COMPLETED")) { Documento bean = new Documento(apFull); bean.findByDescTransaction(orderId); System.out.println("paypalsvltcheckout recordOrder prog www: " + bean.getProgOrdineWww() + " TROVATO E APPROVATO"); bean.setDataPagamento(DBAdapter.getToday()); bean.setDataTransaction(DBAdapter.getToday()); bean.setDescTransaction(orderId); bean.setFlgPagata(1L); ResParm rp = bean.save(); if (rp.getStatus()) { if (bean.getFlgWwwRichiedeFattura() == 1L) { long l = 22L; } else { long l = 23L; } Attivita attivita1 = Attivita.getDefaultInstance(apFull); Users utente = (Users)getLoginUser(req); rp = attivita1.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req); } Attivita attivita = Attivita.getDefaultInstance(apFull); if (attivita.isTagManagerAttivo()) { GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean)); req.setAttribute("_gdl", gdl); } } } protected PayPalReq getPayPalReq(HttpServletRequest req, HttpServletResponse res) { ApplParmFull apFull = getApFull(req); PayPalReq pReq = new PayPalReq(); String l_id_docCrypt = getRequestParameter(req, "id"); long l_id = 0L; try { l_id = Long.parseLong(DBAdapter.deCrypt(l_id_docCrypt)); } catch (Exception e) {} if (l_id > 0L) { Documento doc = new Documento(apFull); doc.findByPrimaryKey(l_id); pReq.setId_ordine(doc.getId_documento()); pReq.setAmt(doc.getTotaleDocumento()); } return pReq; } protected void updatePaypalOrderId(HttpServletRequest req, PayPalReq pReq) { ApplParmFull apFull = getApFull(req); Documento doc = new Documento(apFull); doc.findByPrimaryKey(pReq.getId_ordine()); if (doc.getId_documento() > 0L) { doc.setDescTransaction(pReq.getPaypalOrderId()); doc.superSave(); } } }