Regalamiunsorriso/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/keyclient/KeyClientReq.java

346 lines
9.6 KiB
Java
Raw Normal View History

2026-04-22 18:41:37 +02:00
package it.acxent.bank.keyclient;
import it.acxent.bank._BankAdapter;
import it.acxent.common.Parm;
import it.acxent.db.ApplParmFull;
import it.acxent.reg.EcDc;
import java.net.URLEncoder;
public class KeyClientReq 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;
private String alias;
private String key;
private String url;
private String url_back;
public static final String P_KC_KEY = "KC_KEY";
public static final String P_URL_RESPONSE = "KC_URL_RESPONSE";
public static final String P_KC_ALIAS = "KC_ALIAS";
public static final String P_PAYMENT_OK_PAGE = "KC_PAY_OK";
public static final String P_PAYMENT_ERROR_PAGE = "KC_PAY_KO";
public static final String P_URL_RESPONSE_NULL = "KC_URL_RESPONSE_NULL";
public static final String TEST_ALIAS = "payment_testm_urlmac";
public static final String REQ_URL = "https://ecommerce.cim-italia.it/ecomm/DispatcherServlet";
public static final String DIV_CODE_DOLLARI = "1";
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 (this.alias == null) ? "" : this.alias;
}
public void setAlias(String mycustominfo) {
this.alias = mycustominfo;
}
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=1esempiodicalcolomac";
String res = "";
try {
res = URLEncoder.encode(EcDc.encode64String(EcDc.cryptMD5Plain(temp)), "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
public String getMac() {
String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=" +
getImportoUrl() + getKey();
String res = "";
try {
res = URLEncoder.encode(EcDc.encode64String(EcDc.cryptMD5Plain(temp)), "UTF-8");
} 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.cim-italia.it/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.cim-italia.it/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 this.key;
}
public void setKey(String key) {
this.key = key;
}
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 (this.url == null) ? "" : this.url.trim();
}
public void setUrl(String url) {
this.url = url;
}
public String getUrl_back() {
return (this.url_back == null) ? "" : this.url_back.trim();
}
public void setUrl_back(String url_back) {
this.url_back = url_back;
}
public String getTestRequestUrl() {
StringBuffer theUrl = new StringBuffer("https://ecommerce.cim-italia.it/ecomm/DispatcherServlet");
theUrl.append("?alias=");
theUrl.append("payment_testm_urlmac");
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) {
if (ap != null) {
String l_tipoParm = "PAYPAL";
Parm bean = new Parm(ap);
l_tipoParm = "KEY CLIENT";
bean.findByCodice("KC_PAY_KO");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("KC_PAY_KO");
bean.setDescrizione("KC_PAY_KO");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("payRes.jsp");
bean.setNota("KC_PAY_KO");
bean.save();
bean.findByCodice("KC_PAY_OK");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("KC_PAY_OK");
bean.setDescrizione("KC_PAY_OK");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("payRes.jsp");
bean.setNota("KC_PAY_OK");
bean.save();
bean.findByCodice("KC_KEY");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("KC_KEY");
bean.setDescrizione("KC_KEY");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("esempiodicalcolomac");
bean.setNota("KC_KEY. mac di esempio: esempiodicalcolomac");
bean.save();
bean.findByCodice("KC_ALIAS");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("KC_ALIAS");
bean.setDescrizione("KC_ALIAS");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("payment_testm_urlmac");
bean.setNota("KC_KEY. ALIAS DI TEST: payment_testm_urlmac");
bean.save();
bean.findByCodice("KC_URL_RESPONSE_NULL");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("KC_URL_RESPONSE_NULL");
bean.setDescrizione("KC_URL_RESPONSE_NULL");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("http://localhost/td/RicevutaKC.abl");
bean.setNota("KC_PAY_OK");
bean.save();
bean.findByCodice("KC_URL_RESPONSE");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("KC_URL_RESPONSE");
bean.setDescrizione("KC_URL_RESPONSE");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("http://localhost/td/RicevutaKC.abl");
bean.setNota("KC_URL_RESPONSE");
bean.save();
}
}
}