package it.acxent.bank.setefi; import it.acxent.bank._BankAdapter; import it.acxent.common.Parm; import it.acxent.common.StatusMsg; import it.acxent.db.ApplParmFull; import it.acxent.db.DBAdapter; public class SetefiReq extends _BankAdapter { public static final String LANG_CODE_IT = "ITA"; public static final String LANG_CODE_EN = "USA"; public static final String LANG_CODE_ES = "SPA"; public static final String LANG_CODE_FR = "FRA"; public static final String LANG_CODE_DE = "DEU"; public static final String DIV_CODE_EURO = "978"; public static final String P_MONETAONLINE_ID = "MONETAONLINE_ID"; public static final String DEFAULT_RESPONSE_URL = "MONETAONLINE_ID"; public static final String DEFAULT_RESPONSE_PAGE = "payResMO.jsp"; public static final String DIV_CODE_DOLLARL_HK = "103"; public static final String TEST_URL = "https://test.monetaonline.it/monetaweb/hosted/init/http"; public static final String REQ_URL = "https://test.monetaonline.it/monetaweb/hosted/init/http"; private String id; private String trackid; private String titolareCarta; private String email; private String lang; private String responseurl; private double amt; private String password; private String descPagamento; private String divisa; public static final String BEAN_MO_RES = "MOResp"; public static final String P_MONETAONLINE_RESPONSE_JSP = "MONETAONLINE_RESPONSE_JSP"; public static final String TEST_PASSWORD = "99999999"; public static final String TEST_ID = "99999999"; public static final String P_MONETAONLINE_RESPONSE_URL = "MONETAONLINE_RESPONSE_URL"; public static final String P_MONETAONLINE_PASSWORD = "MONETAONLINE_PASSWORD"; public static final String P_MONETAONLINE_RESPONSE_PAGE = "MONETAONLINE_RESPONSE_PAGE"; public static final String DIV_CODE_DOLLARI = "1"; public double getAmt() { return this.amt; } public void setAmt(double myamount) { this.amt = myamount; } public String getEmail() { return (this.email == null) ? "" : this.email; } public void setEmail(String mybuyeremail) { this.email = mybuyeremail; } public String getTitolareCarta() { return (this.titolareCarta == null) ? "" : this.titolareCarta; } public void setTitolareCarta(String mybuyername) { this.titolareCarta = mybuyername; } public String getCurrencycode() { if (getDivisa().toLowerCase().equals("eu")) return "978"; return "978"; } public String getDescPagamento() { return (this.descPagamento == null) ? "" : this.descPagamento; } public void setDescPagamento(String mycustominfo) { this.descPagamento = mycustominfo; } private String getMylanguageCode() { if (getLang().toLowerCase().equals("it")) return "ITA"; if (getLang().toLowerCase().equals("en")) return "USA"; if (getLang().toLowerCase().equals("es\t")) return "SPA"; if (getLang().toLowerCase().equals("fr")) return "FRA"; if (getLang().toLowerCase().equals("de")) return "DEU"; return ""; } public String getTrackid() { return (this.trackid == null) ? "" : this.trackid; } public void setTrackid(String myshoptransactionID) { this.trackid = myshoptransactionID; } public String getLang() { return (this.lang == null) ? "" : this.lang; } public void setLang(String lang) { this.lang = lang; } public static void initApplicationParms(ApplParmFull ap) { boolean debug = true; if (ap != null) { DBAdapter.logDebug(debug, "Setefi initParms: start"); String l_tipoParm = "MONETAONLINE"; StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); Parm bean = new Parm(ap); bean.findByCodice("MONETAONLINE_ID"); bean.setFlgAdmin(0L); bean.setTipoParm(l_tipoParm); bean.setCodice("MONETAONLINE_ID"); bean.setDescrizione("MONETAONLINE_ID"); bean.setFlgTipo(0L); if (bean.getTesto().equals("")) bean.setTesto("99999999"); bean.setNota("ID MONETAONLINE
CODICE DI PROVA: 99999999"); bean.save(); bean.findByCodice("MONETAONLINE_PASSWORD"); bean.setFlgAdmin(0L); bean.setTipoParm(l_tipoParm); bean.setCodice("MONETAONLINE_PASSWORD"); bean.setDescrizione("MONETAONLINE_PASSWORD"); bean.setFlgTipo(0L); if (bean.getTesto().equals("")) bean.setTesto("99999999"); bean.setNota("PASSWORD MONETAONLINE
PASSWORD DI PROVA: 99999999"); bean.save(); bean.findByCodice("MONETAONLINE_RESPONSE_URL"); bean.setFlgAdmin(0L); bean.setTipoParm(l_tipoParm); bean.setCodice("MONETAONLINE_RESPONSE_URL"); bean.setDescrizione("MONETAONLINE_RESPONSE_URL"); bean.setFlgTipo(0L); if (bean.getTesto().equals("")) bean.setTesto("http://www.nomedominio.it/PayMO.abl"); bean.setNota("QUALCOSA DEL TIPO http://www.nomedominio.it/PayMO.abl
E' l'url chiamata da setefi. Su moneta Online è sempre la stessa servlet!!"); bean.save(); bean.findByCodice("MONETAONLINE_RESPONSE_JSP"); bean.setFlgAdmin(0L); bean.setTipoParm(l_tipoParm); bean.setCodice("MONETAONLINE_RESPONSE_JSP"); bean.setDescrizione("MONETAONLINE_RESPONSE_JSP"); bean.setFlgTipo(0L); if (bean.getTesto().equals("")) bean.setTesto("/payResMO.jsp"); bean.setNota("QUALCOSA DEL TIPO
/payResMO.jsp.
E' la pagina jsp dove visualizziamo il risultato."); bean.save(); bean.findByCodice("MONETAONLINE_RESPONSE_PAGE"); bean.setFlgAdmin(0L); bean.setTipoParm(l_tipoParm); bean.setCodice("MONETAONLINE_RESPONSE_PAGE"); bean.setDescrizione("MONETAONLINE_RESPONSE_PAGE"); bean.setFlgTipo(0L); if (bean.getTesto().equals("")) bean.setTesto("http://www.nomedominio.it/transazione_result-#-@.html"); bean.setNota("QUALCOSA DEL TIPO
http://www.nomedominio.it/xxx_result-#-@.html.
si userà una regola di rewrite rule dove # è il trackid mentre @ +è il paymentid
Esempio rewrite rule:
result,PayMO.abl,result,,@id_astaUtente@paymentid"); bean.save(); DBAdapter.logDebug(debug, "Setefi initParms: stop"); } } public String getId() { return (this.id == null) ? "" : this.id.trim(); } public void setId(String id) { this.id = id; } public String getPassword() { return (this.password == null) ? "" : this.password.trim(); } public void setPassword(String password) { this.password = password; } public String getResponseurl() { return (this.responseurl == null) ? "" : this.responseurl.trim(); } public void setResponseurl(String responseurl) { this.responseurl = responseurl; } public String getRawdata() { StringBuffer theUrl = new StringBuffer(); theUrl.append("id="); theUrl.append(getId()); theUrl.append("&password="); theUrl.append(getPassword()); theUrl.append("&action=4"); theUrl.append("&amt="); theUrl.append(getAmt()); theUrl.append("¤cycode="); theUrl.append(getCurrencycode()); theUrl.append("&langid="); theUrl.append(getMylanguageCode()); theUrl.append("&responseurl="); theUrl.append(getResponseurl()); theUrl.append("&errorurl="); theUrl.append(getResponseurl()); theUrl.append("&trackid="); theUrl.append(getTrackid()); if (!getDescPagamento().trim().isEmpty()) { theUrl.append("&udf1="); theUrl.append(getDescPagamento()); } if (!getTitolareCarta().trim().isEmpty()) { theUrl.append("&udf2="); theUrl.append(getTitolareCarta() + ";" + getTitolareCarta()); } return theUrl.toString(); } public String getDivisa() { return (this.divisa == null) ? "" : this.divisa.trim(); } public void setDivisa(String divisa) { this.divisa = divisa; } }