www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
|
|
@ -0,0 +1,340 @@
|
|||
package it.acxent.bank.xpay;
|
||||
|
||||
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;
|
||||
import it.acxent.reg.EcDc;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class XpayReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "ITA";
|
||||
|
||||
public static final String LANG_CODE_EN = "ENG";
|
||||
|
||||
public static final String LANG_CODE_ES = "SPA";
|
||||
|
||||
public static final String LANG_CODE_FR = "FRA";
|
||||
|
||||
public static final String LANG_CODE_DE = "GER";
|
||||
|
||||
public static final String LANG_CODE_ITA_ENG = "ITA-ENG";
|
||||
|
||||
public static final String LANG_CODE_JPN = "JPN";
|
||||
|
||||
public static final String DIV_CODE_LIRA = "18";
|
||||
|
||||
public static final String DIV_CODE_EURO = "242";
|
||||
|
||||
public static final String DIV_CODE_STERLINE = "2";
|
||||
|
||||
public static final String DIV_CODE_YEN = "71";
|
||||
|
||||
public static final String DIV_CODE_DOLLARL_HK = "103";
|
||||
|
||||
public static final String DIV_CODE_REAL = "234";
|
||||
|
||||
private String divisa;
|
||||
|
||||
private String codTrans;
|
||||
|
||||
private String mail;
|
||||
|
||||
private String importo;
|
||||
|
||||
private String languageId;
|
||||
|
||||
public static final String TEST_ALIAS = "payment_3444153";
|
||||
|
||||
public static final String P_XPAY_MAC_KEY = "XPAY_MAC_KEY";
|
||||
|
||||
public static final String P_XPAY_URL_RESPONSE = "XPAY_URL_RESPONSE";
|
||||
|
||||
public static final String P_XPAY_ALIAS = "XPAY_ALIAS";
|
||||
|
||||
public static final String P_XPAY_PAYMENT_OK_PAGE = "XPAY_PAY_OK";
|
||||
|
||||
public static final String P_XPAY_PAYMENT_ERROR_PAGE = "XPAY_PAY_KO";
|
||||
|
||||
public static final String P_XPAY_URL_RESPONSE_NULL = "XPAY_URL_RESPONSE_NULL";
|
||||
|
||||
public static final String TEST_MAC = "TLGHTOWIZXQPTIZRALWKG";
|
||||
|
||||
public static final String REQ_URL = "https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet";
|
||||
|
||||
public static final String TEST_REQ_URL = "https://coll-ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "1";
|
||||
|
||||
public XpayReq() {}
|
||||
|
||||
public XpayReq(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public String getCodTrans() {
|
||||
return (this.codTrans == null) ? "" : this.codTrans;
|
||||
}
|
||||
|
||||
public void setCodTrans(String myamount) {
|
||||
this.codTrans = myamount;
|
||||
}
|
||||
|
||||
public String getImporto() {
|
||||
return (this.importo == null) ? "" : this.importo;
|
||||
}
|
||||
|
||||
public void setImporto(String mybuyeremail) {
|
||||
this.importo = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
return (this.mail == null) ? "" : this.mail;
|
||||
}
|
||||
|
||||
public void setMail(String mybuyername) {
|
||||
this.mail = mybuyername;
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return (this.divisa == null) ? "" : this.divisa;
|
||||
}
|
||||
|
||||
public void setDivisa(String mycurrency) {
|
||||
this.divisa = mycurrency;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return getParm("XPAY_ALIAS").getTesto();
|
||||
}
|
||||
|
||||
private String getMylanguageCode() {
|
||||
if (getLanguageId().toLowerCase().equals("it"))
|
||||
return "ITA";
|
||||
if (getLanguageId().toLowerCase().equals("en"))
|
||||
return "ENG";
|
||||
if (getLanguageId().toLowerCase().equals("es\t"))
|
||||
return "SPA";
|
||||
if (getLanguageId().toLowerCase().equals("fr"))
|
||||
return "FRA";
|
||||
if (getLanguageId().toLowerCase().equals("de"))
|
||||
return "GER";
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getMacEsempio() {
|
||||
String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=1" + getKey();
|
||||
System.out.println("stringa mac: " + temp);
|
||||
String res = "";
|
||||
try {
|
||||
res = EcDc.cryptSHA1Plain(temp);
|
||||
System.out.println(res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=" + getImportoUrl() + getKey();
|
||||
String res = "";
|
||||
try {
|
||||
res = EcDc.cryptSHA1Plain(temp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getLanguageId() {
|
||||
return (this.languageId == null) ? "" : this.languageId;
|
||||
}
|
||||
|
||||
public void setLanguageId(String lang) {
|
||||
this.languageId = lang;
|
||||
}
|
||||
|
||||
public String getFullRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet");
|
||||
theUrl.append("alias=");
|
||||
theUrl.append(getAlias());
|
||||
theUrl.append("&importo=");
|
||||
theUrl.append(getImporto());
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMac(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet");
|
||||
theUrl.append("?alias=");
|
||||
theUrl.append(getAlias());
|
||||
theUrl.append("&importo=");
|
||||
theUrl.append(getImportoUrl());
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMac(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return getParm("XPAY_MAC_KEY").getTesto();
|
||||
}
|
||||
|
||||
public String getImportoUrl() {
|
||||
if (this.importo == null)
|
||||
return "0000";
|
||||
String temp = this.importo;
|
||||
if (temp.indexOf('.') < 0) {
|
||||
temp = temp + "00";
|
||||
} else if (temp.length() - temp.indexOf('.') < 3) {
|
||||
temp = temp + "0";
|
||||
}
|
||||
return temp.replace(".", "");
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return getParm("XPAY_URL_RESPONSE").getTesto();
|
||||
}
|
||||
|
||||
public String getUrl_back() {
|
||||
return getParm("XPAY_URL_RESPONSE_NULL").getTesto();
|
||||
}
|
||||
|
||||
public String getTestRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://coll-ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet");
|
||||
theUrl.append("?alias=");
|
||||
theUrl.append("payment_3444153");
|
||||
theUrl.append("&importo=1");
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMacEsempio(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
boolean debug = false;
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(debug, "Xpay initParms: start");
|
||||
String l_tipoParm = "XPAY";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
Parm bean = new Parm(ap);
|
||||
bean.findByCodice("XPAY_PAY_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_PAY_KO");
|
||||
bean.setDescrizione("XPAY_PAY_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("XPAY_PAY_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_PAY_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_PAY_OK");
|
||||
bean.setDescrizione("XPAY_PAY_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("XPAY_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_MAC_KEY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_MAC_KEY");
|
||||
bean.setDescrizione("XPAY_MAC_KEY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("TLGHTOWIZXQPTIZRALWKG");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("XPAY_MAC_KEY. mac di esempio: TLGHTOWIZXQPTIZRALWKG");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_ALIAS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_ALIAS");
|
||||
bean.setDescrizione("XPAY_ALIAS");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payment_3444153");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("XPAY_MAC_KEY. ALIAS DI TEST: payment_3444153");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_URL_RESPONSE_NULL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_URL_RESPONSE_NULL");
|
||||
bean.setDescrizione("XPAY_URL_RESPONSE_NULL");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/td/RicevutaXPAY.abl");
|
||||
bean.setNota("XPAY_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_URL_RESPONSE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_URL_RESPONSE");
|
||||
bean.setDescrizione("XPAY_URL_RESPONSE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/td/RicevutaXPAY.abl");
|
||||
bean.setNota("XPAY_URL_RESPONSE");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(debug, "Xpay initParms: false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
package it.acxent.bank.xpay;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.reg.EcDc;
|
||||
|
||||
public class XpayResp extends _BankAdapter {
|
||||
private long id_ordine;
|
||||
|
||||
private String importo;
|
||||
|
||||
private String data;
|
||||
|
||||
private String divisa;
|
||||
|
||||
private String session_id;
|
||||
|
||||
private String codTrans;
|
||||
|
||||
private String orario;
|
||||
|
||||
private String esito;
|
||||
|
||||
private String codAut;
|
||||
|
||||
private String BRAND;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String cognome;
|
||||
|
||||
private String email;
|
||||
|
||||
private String mac;
|
||||
|
||||
private String messaggio;
|
||||
|
||||
public static final String ESITO_OK = "OK";
|
||||
|
||||
public static final String ESITO_KO = "KO";
|
||||
|
||||
public XpayResp() {}
|
||||
|
||||
public XpayResp(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getImporto() {
|
||||
return (this.importo == null) ? "" : this.importo;
|
||||
}
|
||||
|
||||
public void setImporto(String importo) {
|
||||
this.importo = importo;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return (this.data == null) ? "" : this.data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return (this.divisa == null) ? "" : this.divisa;
|
||||
}
|
||||
|
||||
public void setDivisa(String divisa) {
|
||||
this.divisa = divisa;
|
||||
}
|
||||
|
||||
public String getSession_id() {
|
||||
return (this.session_id == null) ? "" : this.session_id;
|
||||
}
|
||||
|
||||
public void setSession_id(String session_id) {
|
||||
this.session_id = session_id;
|
||||
}
|
||||
|
||||
public String getCodTrans() {
|
||||
return (this.codTrans == null) ? "" : this.codTrans;
|
||||
}
|
||||
|
||||
public void setCodTrans(String codTrans) {
|
||||
this.codTrans = codTrans;
|
||||
}
|
||||
|
||||
public String getOrario() {
|
||||
return (this.orario == null) ? "" : this.orario;
|
||||
}
|
||||
|
||||
public void setOrario(String orario) {
|
||||
this.orario = orario;
|
||||
}
|
||||
|
||||
public String getEsito() {
|
||||
return (this.esito == null) ? "" : this.esito;
|
||||
}
|
||||
|
||||
public void setEsito(String esito) {
|
||||
this.esito = esito;
|
||||
}
|
||||
|
||||
public String getCodAut() {
|
||||
return (this.codAut == null) ? "" : this.codAut;
|
||||
}
|
||||
|
||||
public void setCodAut(String codAut) {
|
||||
this.codAut = codAut;
|
||||
}
|
||||
|
||||
public String getBRAND() {
|
||||
return (this.BRAND == null) ? "" : this.BRAND;
|
||||
}
|
||||
|
||||
public void setBRAND(String brand) {
|
||||
this.BRAND = brand;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return (this.nome == null) ? "" : this.nome;
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return (this.cognome == null) ? "" : this.cognome;
|
||||
}
|
||||
|
||||
public void setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return (this.email == null) ? "" : this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return (this.mac == null) ? "" : this.mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public String getMessaggio() {
|
||||
return (this.messaggio == null) ? "" : this.messaggio.trim();
|
||||
}
|
||||
|
||||
public void setMessaggio(String messaggio) {
|
||||
this.messaggio = messaggio;
|
||||
}
|
||||
|
||||
public boolean isMacRitornoOk() {
|
||||
String temp = "codTrans=" + getCodTrans() + "esito=" + getEsito() + "importo=" + getImporto() + "divisa=" + getDivisa() + "data=" +
|
||||
getData() + "orario=" + getOrario() + "codAut=" + getCodAut() + getKey();
|
||||
String res = "";
|
||||
try {
|
||||
res = EcDc.cryptSHA1Plain(temp);
|
||||
if (res.equals(getMac()))
|
||||
return true;
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return getParm("XPAY_MAC_KEY").getTesto();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue