first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
package com.ablia.bank;
|
||||
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.util.Debug;
|
||||
|
||||
public abstract class _BankAdapter extends Debug {
|
||||
private ApplParmFull ap;
|
||||
|
||||
public static final String DEFAULT_OK_KO_PAGE = "payRes.jsp";
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
|
||||
public Parm getParm(String theKey) {
|
||||
if (getApFull() != null)
|
||||
return getApFull().getParm(theKey);
|
||||
return new Parm();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,319 @@
|
|||
package com.ablia.bank.consel;
|
||||
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
|
||||
public class ConselReq {
|
||||
public static final String P_COD_TIPO_PRODOTTO_CONSEL = "COD_TIPO_PRODOTTO_CONSEL";
|
||||
|
||||
private String tipoesec;
|
||||
|
||||
private String tabfin;
|
||||
|
||||
private String cognome;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String indirizzo;
|
||||
|
||||
private String tel_num;
|
||||
|
||||
private String pref_num;
|
||||
|
||||
private String data_nascita;
|
||||
|
||||
private String testomail;
|
||||
|
||||
private ApplParmFull ap;
|
||||
|
||||
private String ordine;
|
||||
|
||||
private String descri1;
|
||||
|
||||
private String parz1;
|
||||
|
||||
private String h_merce;
|
||||
|
||||
private String h_prod;
|
||||
|
||||
private String convenz;
|
||||
|
||||
private String impdafin;
|
||||
|
||||
public static final String CONSEL_TAB_FIN_90 = "WIP";
|
||||
|
||||
private double anticipo;
|
||||
|
||||
private String impspe;
|
||||
|
||||
private String codfisc;
|
||||
|
||||
public static final String P_CONSEL_IMPORTO_MINIMO = "CONSEL_IMPORTO_MINIMO";
|
||||
|
||||
public static final String P_CONSEL_TEST = "CONSEL_TEST";
|
||||
|
||||
public static final String P_CONSEL_OK_PAGE = "CONSEL_OK_PAGE";
|
||||
|
||||
public static final String CONSEL_TAB_FIN_TASSO_0 = "MPF";
|
||||
|
||||
public static final String CONSEL_TAB_FIN_30 = "WIN";
|
||||
|
||||
public static final String CONSEL_REQUEST_SERVER = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp";
|
||||
|
||||
public static final String P_COD_TIPO_MERCE_CONSEL = "COD_TIPO_MERCE_CONSEL";
|
||||
|
||||
public static final String P_COD_CONVENZIONE_CONSEL = "COD_CONVENZIONE_CONSEL";
|
||||
|
||||
public static final String P_CONSEL_ERROR_PAGE = "CONSEL_ERROR_PAGE";
|
||||
|
||||
public static final String P_CONSEL_RATA0 = "CONSEL_RATA0";
|
||||
|
||||
public ConselReq(ApplParmFull l_ap) {
|
||||
setAp(l_ap);
|
||||
}
|
||||
|
||||
public ConselReq() {}
|
||||
|
||||
public String getTipoesec() {
|
||||
return "T";
|
||||
}
|
||||
|
||||
public void setTipoesec(String tipoesec) {
|
||||
this.tipoesec = tipoesec;
|
||||
}
|
||||
|
||||
public String getTabfin() {
|
||||
return (this.tabfin == null) ? "" : this.tabfin.trim();
|
||||
}
|
||||
|
||||
public void setTabfin(String tabfin) {
|
||||
this.tabfin = tabfin;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return (this.cognome == null) ? "" : this.cognome.trim();
|
||||
}
|
||||
|
||||
public void setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return (this.nome == null) ? "" : this.nome.trim();
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getIndirizzo() {
|
||||
return (this.indirizzo == null) ? "" : this.indirizzo.trim();
|
||||
}
|
||||
|
||||
public void setIndirizzo(String indirizzo) {
|
||||
this.indirizzo = indirizzo;
|
||||
}
|
||||
|
||||
public String getTel_num() {
|
||||
return (this.tel_num == null) ? "" : this.tel_num.trim();
|
||||
}
|
||||
|
||||
public void setTel_num(String tel_num) {
|
||||
this.tel_num = tel_num;
|
||||
}
|
||||
|
||||
public String getPref_num() {
|
||||
return (this.pref_num == null) ? "" : this.pref_num.trim();
|
||||
}
|
||||
|
||||
public void setPref_num(String pref_num) {
|
||||
this.pref_num = pref_num;
|
||||
}
|
||||
|
||||
public String getData_nascita() {
|
||||
return (this.data_nascita == null) ? "" : this.data_nascita.trim();
|
||||
}
|
||||
|
||||
public void setData_nascita(String data_nascita) {
|
||||
this.data_nascita = data_nascita;
|
||||
}
|
||||
|
||||
public String getTestomail() {
|
||||
return (this.testomail == null) ? "" : this.testomail.trim();
|
||||
}
|
||||
|
||||
public void setTestomail(String testomail) {
|
||||
this.testomail = testomail;
|
||||
}
|
||||
|
||||
public String getCodfisc() {
|
||||
return (this.codfisc == null) ? "" : this.codfisc.trim();
|
||||
}
|
||||
|
||||
public void setCodfisc(String codfisc) {
|
||||
this.codfisc = codfisc;
|
||||
}
|
||||
|
||||
public String getOrdine() {
|
||||
return (this.ordine == null) ? "" : this.ordine.trim();
|
||||
}
|
||||
|
||||
public void setOrdine(String ordine) {
|
||||
this.ordine = ordine;
|
||||
}
|
||||
|
||||
public String getDescri1() {
|
||||
return (this.descri1 == null) ? "" : this.descri1.trim();
|
||||
}
|
||||
|
||||
public void setDescri1(String descri1) {
|
||||
this.descri1 = descri1;
|
||||
}
|
||||
|
||||
public String getParz1() {
|
||||
return (this.parz1 == null) ? "" : this.parz1;
|
||||
}
|
||||
|
||||
public void setParz1(String parz1) {
|
||||
this.parz1 = parz1;
|
||||
}
|
||||
|
||||
public String getH_merce() {
|
||||
if (this.h_merce == null)
|
||||
this.h_merce = getApFull().getParm("COD_TIPO_MERCE_CONSEL").getTesto();
|
||||
return this.h_merce;
|
||||
}
|
||||
|
||||
public void setH_merce(String h_merce) {
|
||||
this.h_merce = h_merce;
|
||||
}
|
||||
|
||||
public String getH_prod() {
|
||||
if (this.h_prod == null)
|
||||
this.h_prod = getApFull().getParm("COD_TIPO_PRODOTTO_CONSEL").getTesto();
|
||||
return this.h_prod;
|
||||
}
|
||||
|
||||
public void setH_prod(String h_prod) {
|
||||
this.h_prod = h_prod;
|
||||
}
|
||||
|
||||
public String getConvenz() {
|
||||
if (this.convenz == null)
|
||||
this.convenz = getApFull().getParm("COD_CONVENZIONE_CONSEL").getTesto()
|
||||
.trim();
|
||||
return this.convenz;
|
||||
}
|
||||
|
||||
public void setConvenz(String convenz) {
|
||||
this.convenz = convenz;
|
||||
}
|
||||
|
||||
public String getImpdafin() {
|
||||
return (this.impdafin == null) ? "" : this.impdafin;
|
||||
}
|
||||
|
||||
public void setImpdafin(String impdafin) {
|
||||
this.impdafin = impdafin;
|
||||
}
|
||||
|
||||
public double getAnticipo() {
|
||||
return this.anticipo;
|
||||
}
|
||||
|
||||
public void setAnticipo(double anticipo) {
|
||||
this.anticipo = anticipo;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "CONSEL";
|
||||
bean.findByCodice("COD_CONVENZIONE_CONSEL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_CONVENZIONE_CONSEL");
|
||||
bean.setDescrizione("COD_CONVENZIONE_CONSEL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE CONVENZIONE CONSEL");
|
||||
bean.save();
|
||||
bean.findByCodice("COD_TIPO_MERCE_CONSEL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_TIPO_MERCE_CONSEL");
|
||||
bean.setDescrizione("COD_TIPO_MERCE_CONSEL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE INDICATIVO MERCE FINANZIATA ");
|
||||
bean.save();
|
||||
bean.findByCodice("COD_TIPO_PRODOTTO_CONSEL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_TIPO_PRODOTTO_CONSEL");
|
||||
bean.setDescrizione("COD_TIPO_PRODOTTO_CONSEL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE INDICATIVO PRODOTTO FINANZIATO");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_ERROR_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_ERROR_PAGE");
|
||||
bean.setDescrizione("CONSEL_ERROR_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("conselRes.jsp");
|
||||
bean.setNota("CONSEL_ERROR_PAGE");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_OK_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_OK_PAGE");
|
||||
bean.setDescrizione("CONSEL_OK_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("conselRes.jsp");
|
||||
bean.setNota("CONSEL_OK_PAGE");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_TEST");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_TEST");
|
||||
bean.setDescrizione("CONSEL_TEST");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("0-->NO 1-->SI");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_IMPORTO_MINIMO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_IMPORTO_MINIMO");
|
||||
bean.setDescrizione("CONSEL_IMPORTO_MINIMO");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("CONSEL_IMPORTO_MINIMO");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_RATA0");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_RATA0");
|
||||
bean.setDescrizione("CONSEL_RATA0");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota(" ATTIVA ANCHE RATA 0 SOPRA L'IMPORTO DEFINITO DA CONSEL_IMPORTO_MINIMO<BR>0: RATA 0 NON ATTIVA<br>1: RATA 0 ATTIVA");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public String getImpspe() {
|
||||
return (this.impspe == null) ? "" : this.impspe;
|
||||
}
|
||||
|
||||
public void setImpspe(String impspe) {
|
||||
this.impspe = impspe;
|
||||
}
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.ablia.bank.consel;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
|
||||
public class ConselResp {
|
||||
private String pratica;
|
||||
|
||||
private ApplParmFull ap;
|
||||
|
||||
private String ordine;
|
||||
|
||||
private String praticabis;
|
||||
|
||||
private String stato;
|
||||
|
||||
public static final String CONSEL_VALUTAZIONE = "WW";
|
||||
|
||||
public static final String CONSEL_KO = "KO";
|
||||
|
||||
public static final String CONSEL_OK = "OK";
|
||||
|
||||
public ConselResp(ApplParmFull l_ap) {
|
||||
setAp(l_ap);
|
||||
}
|
||||
|
||||
public ConselResp() {}
|
||||
|
||||
public String getOrdine() {
|
||||
return (this.ordine == null) ? "" : this.ordine.trim();
|
||||
}
|
||||
|
||||
public void setOrdine(String ordine) {
|
||||
this.ordine = ordine;
|
||||
}
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
|
||||
public String getPratica() {
|
||||
return (this.pratica == null) ? "" : this.pratica.trim();
|
||||
}
|
||||
|
||||
public void setPratica(String pratica) {
|
||||
this.pratica = pratica;
|
||||
}
|
||||
|
||||
public String getPraticabis() {
|
||||
return (this.praticabis == null) ? "" : this.praticabis.trim();
|
||||
}
|
||||
|
||||
public void setPraticabis(String praticabis) {
|
||||
this.praticabis = praticabis;
|
||||
}
|
||||
|
||||
public String getStato() {
|
||||
return (this.stato == null) ? "" : this.stato.trim();
|
||||
}
|
||||
|
||||
public void setStato(String stato) {
|
||||
this.stato = stato;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
package com.ablia.bank.consel;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class ConselTabfin extends DBAdapter implements Serializable {
|
||||
public static final double MIN_FIN = 168.0D;
|
||||
|
||||
public static final double MAX_FIN = 7500.0D;
|
||||
|
||||
private long id_conselTabfin;
|
||||
|
||||
private String flgTipo;
|
||||
|
||||
private double valoreBene;
|
||||
|
||||
private long durata;
|
||||
|
||||
private double importoRata;
|
||||
|
||||
private double tan;
|
||||
|
||||
private double taeg;
|
||||
|
||||
private double interessi;
|
||||
|
||||
private double speseGestSingolaRata;
|
||||
|
||||
private double speseGestTotaleRata;
|
||||
|
||||
private double impostaBollo;
|
||||
|
||||
private double importoTotaleDovuto;
|
||||
|
||||
public ConselTabfin(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public ConselTabfin() {}
|
||||
|
||||
public void setId_conselTabfin(long newId_conselTabfin) {
|
||||
this.id_conselTabfin = newId_conselTabfin;
|
||||
}
|
||||
|
||||
public void setFlgTipo(String newFlgTipo) {
|
||||
this.flgTipo = newFlgTipo;
|
||||
}
|
||||
|
||||
public void setValoreBene(double newValoreBene) {
|
||||
this.valoreBene = newValoreBene;
|
||||
}
|
||||
|
||||
public void setDurata(long newDurata) {
|
||||
this.durata = newDurata;
|
||||
}
|
||||
|
||||
public void setImportoRata(double newImportoRata) {
|
||||
this.importoRata = newImportoRata;
|
||||
}
|
||||
|
||||
public void setTan(double newTan) {
|
||||
this.tan = newTan;
|
||||
}
|
||||
|
||||
public void setTaeg(double newTaeg) {
|
||||
this.taeg = newTaeg;
|
||||
}
|
||||
|
||||
public void setInteressi(double newInteressi) {
|
||||
this.interessi = newInteressi;
|
||||
}
|
||||
|
||||
public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) {
|
||||
this.speseGestSingolaRata = newSpeseGestSingolaRata;
|
||||
}
|
||||
|
||||
public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) {
|
||||
this.speseGestTotaleRata = newSpeseGestTotaleRata;
|
||||
}
|
||||
|
||||
public void setImpostaBollo(double newImpostaBollo) {
|
||||
this.impostaBollo = newImpostaBollo;
|
||||
}
|
||||
|
||||
public void setImportoTotaleDovuto(double newImportoTotaleDovuto) {
|
||||
this.importoTotaleDovuto = newImportoTotaleDovuto;
|
||||
}
|
||||
|
||||
public long getId_conselTabfin() {
|
||||
return this.id_conselTabfin;
|
||||
}
|
||||
|
||||
public String getFlgTipo() {
|
||||
return (this.flgTipo == null) ? "" : this.flgTipo.trim();
|
||||
}
|
||||
|
||||
public double getValoreBene() {
|
||||
return this.valoreBene;
|
||||
}
|
||||
|
||||
public long getDurata() {
|
||||
return this.durata;
|
||||
}
|
||||
|
||||
public double getImportoRata() {
|
||||
return this.importoRata;
|
||||
}
|
||||
|
||||
public double getTan() {
|
||||
return this.tan;
|
||||
}
|
||||
|
||||
public double getTaeg() {
|
||||
return this.taeg;
|
||||
}
|
||||
|
||||
public double getInteressi() {
|
||||
return this.interessi;
|
||||
}
|
||||
|
||||
public double getSpeseGestSingolaRata() {
|
||||
return this.speseGestSingolaRata;
|
||||
}
|
||||
|
||||
public double getSpeseGestTotaleRata() {
|
||||
return this.speseGestTotaleRata;
|
||||
}
|
||||
|
||||
public double getImpostaBollo() {
|
||||
return this.impostaBollo;
|
||||
}
|
||||
|
||||
public double getImportoTotaleDovuto() {
|
||||
return this.importoTotaleDovuto;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(ConselTabfinCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from CONSEL_TABFIN AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getValoreBene() > 0.0D)
|
||||
wc.addWc("A.valoreBene=" + CR.getValoreBene());
|
||||
if (!CR.getFlgTipo().isEmpty())
|
||||
wc.addWc("A.flgTipo='" + CR.getFlgTipo() + "'");
|
||||
if (CR.getDurata() > 0L)
|
||||
wc.addWc("A.durata=" + CR.getDurata());
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public void findByTipoValoreDurata(String l_flgTipo, double l_valore, long l_durata) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from CONSEL_TABFIN AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.valoreBene=" + Math.round(l_valore));
|
||||
wc.addWc("A.flgTipo='" + l_flgTipo + "'");
|
||||
wc.addWc("A.durata=" + l_durata);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package com.ablia.bank.consel;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
|
||||
public class ConselTabfinCR extends CRAdapter {
|
||||
private long id_conselTabfin;
|
||||
|
||||
private String flgTipo;
|
||||
|
||||
private double valoreBene;
|
||||
|
||||
private long durata;
|
||||
|
||||
private double importoRata;
|
||||
|
||||
private double tan;
|
||||
|
||||
private double taeg;
|
||||
|
||||
private double interessi;
|
||||
|
||||
private double speseGestSingolaRata;
|
||||
|
||||
private double speseGestTotaleRata;
|
||||
|
||||
private double impostaBollo;
|
||||
|
||||
private double importoTotaleDovuto;
|
||||
|
||||
public ConselTabfinCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public ConselTabfinCR() {}
|
||||
|
||||
public void setId_conselTabfin(long newId_conselTabfin) {
|
||||
this.id_conselTabfin = newId_conselTabfin;
|
||||
}
|
||||
|
||||
public void setFlgTipo(String newFlgTipo) {
|
||||
this.flgTipo = newFlgTipo;
|
||||
}
|
||||
|
||||
public void setValoreBene(double newValoreBene) {
|
||||
this.valoreBene = newValoreBene;
|
||||
}
|
||||
|
||||
public void setDurata(long newDurata) {
|
||||
this.durata = newDurata;
|
||||
}
|
||||
|
||||
public void setImportoRata(double newImportoRata) {
|
||||
this.importoRata = newImportoRata;
|
||||
}
|
||||
|
||||
public void setTan(double newTan) {
|
||||
this.tan = newTan;
|
||||
}
|
||||
|
||||
public void setTaeg(double newTaeg) {
|
||||
this.taeg = newTaeg;
|
||||
}
|
||||
|
||||
public void setInteressi(double newInteressi) {
|
||||
this.interessi = newInteressi;
|
||||
}
|
||||
|
||||
public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) {
|
||||
this.speseGestSingolaRata = newSpeseGestSingolaRata;
|
||||
}
|
||||
|
||||
public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) {
|
||||
this.speseGestTotaleRata = newSpeseGestTotaleRata;
|
||||
}
|
||||
|
||||
public void setImpostaBollo(double newImpostaBollo) {
|
||||
this.impostaBollo = newImpostaBollo;
|
||||
}
|
||||
|
||||
public void setImportoTotaleDovuto(double newImportoTotaleDovuto) {
|
||||
this.importoTotaleDovuto = newImportoTotaleDovuto;
|
||||
}
|
||||
|
||||
public long getId_conselTabfin() {
|
||||
return this.id_conselTabfin;
|
||||
}
|
||||
|
||||
public String getFlgTipo() {
|
||||
return (this.flgTipo == null) ? "" : this.flgTipo.trim();
|
||||
}
|
||||
|
||||
public double getValoreBene() {
|
||||
return this.valoreBene;
|
||||
}
|
||||
|
||||
public long getDurata() {
|
||||
return this.durata;
|
||||
}
|
||||
|
||||
public double getImportoRata() {
|
||||
return this.importoRata;
|
||||
}
|
||||
|
||||
public double getTan() {
|
||||
return this.tan;
|
||||
}
|
||||
|
||||
public double getTaeg() {
|
||||
return this.taeg;
|
||||
}
|
||||
|
||||
public double getInteressi() {
|
||||
return this.interessi;
|
||||
}
|
||||
|
||||
public double getSpeseGestSingolaRata() {
|
||||
return this.speseGestSingolaRata;
|
||||
}
|
||||
|
||||
public double getSpeseGestTotaleRata() {
|
||||
return this.speseGestTotaleRata;
|
||||
}
|
||||
|
||||
public double getImpostaBollo() {
|
||||
return this.impostaBollo;
|
||||
}
|
||||
|
||||
public double getImportoTotaleDovuto() {
|
||||
return this.importoTotaleDovuto;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
package com.ablia.bank.infogroup;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ShopnetReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "0";
|
||||
|
||||
public static final String LANG_CODE_EN = "1";
|
||||
|
||||
public static final String LANG_CODE_ES = "2";
|
||||
|
||||
public static final String LANG_CODE_DE = "3";
|
||||
|
||||
public static final String DIV_CODE_EURO = "1";
|
||||
|
||||
private static NumberFormat nf2;
|
||||
|
||||
private String f;
|
||||
|
||||
private String l;
|
||||
|
||||
private String m;
|
||||
|
||||
private String o;
|
||||
|
||||
private String i;
|
||||
|
||||
private String d;
|
||||
|
||||
private String p;
|
||||
|
||||
private String c;
|
||||
|
||||
private String u;
|
||||
|
||||
private String n;
|
||||
|
||||
private String e;
|
||||
|
||||
private String action;
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "PAY_KO";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "PAY_OK";
|
||||
|
||||
public static final long CC_DINERS = 2L;
|
||||
|
||||
public static final long CC_MASTERCARD = 1L;
|
||||
|
||||
public static final long CC_AMEX = 3L;
|
||||
|
||||
public static final long CC_VISA = 0L;
|
||||
|
||||
public static final String P_SHOPNET_PID = "SHOPNET_PID";
|
||||
|
||||
public static final String P_SHOPNET_ID = "SHOPNET_ID";
|
||||
|
||||
public static final String DEFAULT_SHOPNET_ACTION = "https://ecommerce.infogroup.it/shopnetplus/do";
|
||||
|
||||
public ShopnetReq() {}
|
||||
|
||||
public ShopnetReq(String lang) {
|
||||
setlang(lang);
|
||||
}
|
||||
|
||||
private void setlang(String l_lang) {
|
||||
if (l_lang.toLowerCase().equals("it")) {
|
||||
setL("0");
|
||||
} else if (l_lang.toLowerCase().equals("en")) {
|
||||
setL("1");
|
||||
} else if (l_lang.toLowerCase().equals("es\t")) {
|
||||
setL("2");
|
||||
} else {
|
||||
setL("0");
|
||||
}
|
||||
}
|
||||
|
||||
public String getF() {
|
||||
return (this.f == null) ? "" : this.f.trim();
|
||||
}
|
||||
|
||||
public void setF(String f) {
|
||||
this.f = f;
|
||||
}
|
||||
|
||||
public String getL() {
|
||||
return (this.l == null) ? "" : this.l.trim();
|
||||
}
|
||||
|
||||
public void setL(String l) {
|
||||
this.l = l;
|
||||
}
|
||||
|
||||
public String getM() {
|
||||
return (this.m == null) ? "" : this.m.trim();
|
||||
}
|
||||
|
||||
public void setM(String m) {
|
||||
this.m = m;
|
||||
}
|
||||
|
||||
public String getO() {
|
||||
return (this.o == null) ? "" : this.o.trim();
|
||||
}
|
||||
|
||||
public void setO(String o) {
|
||||
this.o = o;
|
||||
}
|
||||
|
||||
public String getI() {
|
||||
return (this.i == null) ? "" : this.i.trim();
|
||||
}
|
||||
|
||||
public void setI(String i) {
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
public String getD() {
|
||||
return (this.d == null) ? "" : this.d.trim();
|
||||
}
|
||||
|
||||
public void setD(String d) {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
public String getP() {
|
||||
return (this.p == null) ? "" : this.p.trim();
|
||||
}
|
||||
|
||||
public void setP(String p) {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
public String getC() {
|
||||
return (this.c == null) ? "" : this.c.trim();
|
||||
}
|
||||
|
||||
public void setC(String c) {
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public String getU() {
|
||||
return (this.u == null) ? "" : this.u.trim();
|
||||
}
|
||||
|
||||
public void setU(String u) {
|
||||
this.u = u;
|
||||
}
|
||||
|
||||
public String getN() {
|
||||
return (this.n == null) ? "" : this.n.trim();
|
||||
}
|
||||
|
||||
public void setN(String n) {
|
||||
this.n = n;
|
||||
}
|
||||
|
||||
public String getE() {
|
||||
return (this.e == null) ? "" : this.e.trim();
|
||||
}
|
||||
|
||||
public void setE(String e) {
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return (this.action == null) ? "https://ecommerce.infogroup.it/shopnetplus/do" : this.action.trim();
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void setImporto(double l_importo) {}
|
||||
|
||||
public NumberFormat getNf2() {
|
||||
if (nf2 == null) {
|
||||
nf2 = NumberFormat.getInstance(Locale.ITALIAN);
|
||||
nf2.setMaximumFractionDigits(2);
|
||||
nf2.setMinimumFractionDigits(2);
|
||||
}
|
||||
return nf2;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "SHOPNET";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "SHOPNET";
|
||||
bean.findByCodice("PAY_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAY_KO");
|
||||
bean.setDescrizione("PAY_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("PAY_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("PAY_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAY_OK");
|
||||
bean.setDescrizione("PAY_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("SHOPNET_ID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SHOPNET_ID");
|
||||
bean.setDescrizione("SHOPNET_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("SHOPNET_ID");
|
||||
bean.save();
|
||||
bean.findByCodice("SHOPNET_PID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SHOPNET_PID");
|
||||
bean.setDescrizione("SHOPNET_PID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("SHOPNET_PID");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public static final String getCC(long l_cc) {
|
||||
switch ((int)l_cc) {
|
||||
case 3:
|
||||
return "American Express";
|
||||
case 2:
|
||||
return "Diners";
|
||||
case 1:
|
||||
return "Mastercard";
|
||||
case 0:
|
||||
return "Visa";
|
||||
}
|
||||
return "??";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.ablia.bank.infogroup;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
|
||||
public class ShopnetResp extends _BankAdapter {
|
||||
private long m;
|
||||
|
||||
private long o;
|
||||
|
||||
private long l;
|
||||
|
||||
private String a;
|
||||
|
||||
private long s;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
public static final long STATO_TRANS_NON_RICH = 1L;
|
||||
|
||||
public static final long STATO_TRANS_GESTITA = 2L;
|
||||
|
||||
public void fillResponse(String bean) {}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public String getA() {
|
||||
return (this.a == null) ? "" : this.a.trim();
|
||||
}
|
||||
|
||||
public void setA(String a) {
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
public long getM() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public void setM(long m) {
|
||||
this.m = m;
|
||||
}
|
||||
|
||||
public long getO() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public void setO(long o) {
|
||||
this.o = o;
|
||||
}
|
||||
|
||||
public long getL() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public void setL(long l) {
|
||||
this.l = l;
|
||||
}
|
||||
|
||||
public long getS() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public void setS(long s) {
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
public long getStato() {
|
||||
return getS();
|
||||
}
|
||||
|
||||
public String getCodiceAutorizzazione() {
|
||||
return getA();
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,349 @@
|
|||
package com.ablia.bank.keyclient;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.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 = String.valueOf(temp) + "00";
|
||||
} else if (temp.length() - temp.indexOf('.') < 3) {
|
||||
temp = String.valueOf(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package com.ablia.bank.keyclient;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
|
||||
public class KeyClientResp 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;
|
||||
|
||||
public static final String ESITO_OK = "OK";
|
||||
|
||||
public static final String ESITO_KO = "KO";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setImporto(String importo) {
|
||||
this.importo = importo;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return this.divisa;
|
||||
}
|
||||
|
||||
public void setDivisa(String divisa) {
|
||||
this.divisa = divisa;
|
||||
}
|
||||
|
||||
public String getSession_id() {
|
||||
return this.session_id;
|
||||
}
|
||||
|
||||
public void setSession_id(String session_id) {
|
||||
this.session_id = session_id;
|
||||
}
|
||||
|
||||
public String getCodTrans() {
|
||||
return this.codTrans;
|
||||
}
|
||||
|
||||
public void setCodTrans(String codTrans) {
|
||||
this.codTrans = codTrans;
|
||||
}
|
||||
|
||||
public String getOrario() {
|
||||
return this.orario;
|
||||
}
|
||||
|
||||
public void setOrario(String orario) {
|
||||
this.orario = orario;
|
||||
}
|
||||
|
||||
public String getEsito() {
|
||||
return this.esito;
|
||||
}
|
||||
|
||||
public void setEsito(String esito) {
|
||||
this.esito = esito;
|
||||
}
|
||||
|
||||
public String getCodAut() {
|
||||
return this.codAut;
|
||||
}
|
||||
|
||||
public void setCodAut(String codAut) {
|
||||
this.codAut = codAut;
|
||||
}
|
||||
|
||||
public String getBRAND() {
|
||||
return this.BRAND;
|
||||
}
|
||||
|
||||
public void setBRAND(String brand) {
|
||||
this.BRAND = brand;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return this.nome;
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return this.cognome;
|
||||
}
|
||||
|
||||
public void setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return this.mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,287 @@
|
|||
package com.ablia.bank.paypal;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class PayPalReq extends _BankAdapter {
|
||||
public static final String MTH_SET_EXPRESS_CHECKOUT = "SetExpressCheckout";
|
||||
|
||||
private double amt;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String cancelURL;
|
||||
|
||||
private String returnUrl;
|
||||
|
||||
private String TOKEN;
|
||||
|
||||
private String PAYERID;
|
||||
|
||||
private String SHIPTOCITY;
|
||||
|
||||
private String SHIPTOCOUNTRYCODE;
|
||||
|
||||
private String SHIPTONAME;
|
||||
|
||||
private String SHIPTOSTATE;
|
||||
|
||||
private String SHIPTOSTREET;
|
||||
|
||||
private String SHIPTOZIP;
|
||||
|
||||
private String DESC;
|
||||
|
||||
public static final String P_API_PASSWORD = "PAYPAL_API_PWD";
|
||||
|
||||
public static final String P_API_SIGNATURE = "PAYPAL_API_SIGNATURE";
|
||||
|
||||
public static final String P_API_USE_CERTIFICATE = "PAYPAL_USE_CERTIFICATE";
|
||||
|
||||
public static final String P_API_USERNAME = "PAYPAL_API_USERNAME";
|
||||
|
||||
public static final String P_CANCEL_URL = "PAYPAL_CANCELURL";
|
||||
|
||||
public static final String P_CURRENCY = "PAYPAL_CURRENCY";
|
||||
|
||||
public static final String P_PAGE_STYLE = "PAYPAL_PAGE_STYLE";
|
||||
|
||||
public static final String P_PAYMENT_DETAIL_PAGE = "PAYPAL_DETAIL";
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "PAY_PAL_KO";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "PAYPAL_OK";
|
||||
|
||||
public static final String P_RETURN_URL = "PAYPAL_RETURNURL";
|
||||
|
||||
public static final String MTH_GET_EXPRESS_CHECKOUT_DETAIL = "GetExpressCheckoutDetails";
|
||||
|
||||
public static final String MTH_DO_EXPRESS_CHECKOUT_PAYMENT = "DoExpressCheckoutPayment";
|
||||
|
||||
public static final String CMD_ADDROVERRIDE = "ADDROVVERRIDE=1";
|
||||
|
||||
public static final String CMD_PAGESTILE = "PAGESTYLE";
|
||||
|
||||
public static final String CMD_PAYACT_AUTH = "PAYMENTACTION=Authorization";
|
||||
|
||||
public double getAmt() {
|
||||
return this.amt;
|
||||
}
|
||||
|
||||
public void setAmt(double amt) {
|
||||
this.amt = amt;
|
||||
}
|
||||
|
||||
public String getCancelURL() {
|
||||
return (this.cancelURL == null) ? "" : this.cancelURL;
|
||||
}
|
||||
|
||||
public void setCancelURL(String cancelURL) {
|
||||
this.cancelURL = cancelURL;
|
||||
}
|
||||
|
||||
public String getReturnUrl() {
|
||||
return (this.returnUrl == null) ? "" : this.returnUrl;
|
||||
}
|
||||
|
||||
public void setReturnUrl(String returnUrl) {
|
||||
this.returnUrl = returnUrl;
|
||||
}
|
||||
|
||||
public String getTOKEN() {
|
||||
return (this.TOKEN == null) ? "" : this.TOKEN;
|
||||
}
|
||||
|
||||
public void setTOKEN(String token) {
|
||||
this.TOKEN = token;
|
||||
}
|
||||
|
||||
public String getPAYERID() {
|
||||
return this.PAYERID;
|
||||
}
|
||||
|
||||
public void setPAYERID(String payerid) {
|
||||
this.PAYERID = payerid;
|
||||
}
|
||||
|
||||
public String getSHIPTOCITY() {
|
||||
return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY;
|
||||
}
|
||||
|
||||
public String getSHIPTOCOUNTRYCODE() {
|
||||
return (this.SHIPTOCOUNTRYCODE == null) ? "" :
|
||||
this.SHIPTOCOUNTRYCODE;
|
||||
}
|
||||
|
||||
public String getSHIPTONAME() {
|
||||
return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTATE() {
|
||||
return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTREET() {
|
||||
return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET;
|
||||
}
|
||||
|
||||
public String getSHIPTOZIP() {
|
||||
return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getShippingAddressString() {
|
||||
return "SHIPTONAME=" + URLEncoder.encode(getSHIPTONAME()) + "&DESC=" +
|
||||
URLEncoder.encode(getDESC()) + "&SHIPTOSTREET=" +
|
||||
URLEncoder.encode(getSHIPTOSTREET()) + "&SHIPTOCITY=" +
|
||||
URLEncoder.encode(getSHIPTOCITY()) + "&SHIPTOSTATE=" +
|
||||
URLEncoder.encode(getSHIPTOSTATE()) + "&SHIPTOCOUNTRYCODE=" +
|
||||
URLEncoder.encode(getSHIPTOCOUNTRYCODE()) + "&SHIPTOZIP=" +
|
||||
URLEncoder.encode(getSHIPTOZIP()) + "&ADDROVERRIDE=1";
|
||||
}
|
||||
|
||||
public void setSHIPTOCITY(String shiptocity) {
|
||||
this.SHIPTOCITY = shiptocity;
|
||||
}
|
||||
|
||||
public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) {
|
||||
this.SHIPTOCOUNTRYCODE = shiptocountrycode;
|
||||
}
|
||||
|
||||
public void setSHIPTONAME(String shiptoname) {
|
||||
this.SHIPTONAME = shiptoname;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTATE(String shiptostate) {
|
||||
this.SHIPTOSTATE = shiptostate;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTREET(String shiptostreet) {
|
||||
this.SHIPTOSTREET = shiptostreet;
|
||||
}
|
||||
|
||||
public void setSHIPTOZIP(String shiptozip) {
|
||||
this.SHIPTOZIP = shiptozip;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "PAYPAL";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "PAYPAL";
|
||||
bean.findByCodice("PAYPAL_API_PWD");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_API_PWD");
|
||||
bean.setDescrizione("PAYPAL_API_PWD");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_API_PWD");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_API_SIGNATURE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_API_SIGNATURE");
|
||||
bean.setDescrizione("PAYPAL_API_SIGNATURE");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_API_SIGNATURE");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_USE_CERTIFICATE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_USE_CERTIFICATE");
|
||||
bean.setDescrizione("PAYPAL_USE_CERTIFICATE");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_USE_CERTIFICATE");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_API_USERNAME");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_API_USERNAME");
|
||||
bean.setDescrizione("PAYPAL_API_USERNAME");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_API_USERNAME");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CANCELURL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CANCELURL");
|
||||
bean.setDescrizione("PAYPAL_CANCELURL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_CANCELURL");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CURRENCY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CURRENCY");
|
||||
bean.setDescrizione("PAYPAL_CURRENCY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("EUR");
|
||||
bean.setNota("PAYPAL_CURRENCY");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_PAGE_STYLE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_PAGE_STYLE");
|
||||
bean.setDescrizione("PAYPAL_PAGE_STYLE");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_PAGE_STYLE");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_DETAIL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_DETAIL");
|
||||
bean.setDescrizione("PAYPAL_DETAIL");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payPalRes.jsp");
|
||||
bean.setNota("PAYPAL_DETAIL");
|
||||
bean.save();
|
||||
bean.findByCodice("PAY_PAL_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAY_PAL_KO");
|
||||
bean.setDescrizione("PAY_PAL_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payPalRes.jsp");
|
||||
bean.setNota("PAY_PAL_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_OK");
|
||||
bean.setDescrizione("PAYPAL_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payPalRes.jsp");
|
||||
bean.setNota("PAYPAL_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_RETURNURL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_RETURNURL");
|
||||
bean.setDescrizione("PAYPAL_RETURNURL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_RETURNURL");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public String getDESC() {
|
||||
return (this.DESC == null) ? "" : this.DESC.trim();
|
||||
}
|
||||
|
||||
public void setDESC(String dESC) {
|
||||
this.DESC = dESC;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
package com.ablia.bank.paypal;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import java.io.BufferedReader;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
public class PayPalResp extends _BankAdapter {
|
||||
public static final String SESS_TOKEN = "_SESS_TOKEN";
|
||||
|
||||
private String ACK;
|
||||
|
||||
private String TIMESTAMP;
|
||||
|
||||
private String VERSION;
|
||||
|
||||
private String L_ERRORCODE0;
|
||||
|
||||
private String L_SHORTMESSAGE0;
|
||||
|
||||
private String L_SEVERITYCODE0;
|
||||
|
||||
private String L_LONGMESSAGE0;
|
||||
|
||||
private String CORRELATIONID;
|
||||
|
||||
private String BUILD;
|
||||
|
||||
private String AMT;
|
||||
|
||||
private String EMAIL;
|
||||
|
||||
private String PAYERID;
|
||||
|
||||
private String PAYERSTATUS;
|
||||
|
||||
private String FIRSTNAME;
|
||||
|
||||
private String LASTNAME;
|
||||
|
||||
private String SHIPTOSTREET;
|
||||
|
||||
private String COUNTRYCODE;
|
||||
|
||||
private String SHIPTOCITY;
|
||||
|
||||
private String SHIPTOSTATE;
|
||||
|
||||
private String SHIPTOCOUNTRYCODE;
|
||||
|
||||
private String SHIPTOZIP;
|
||||
|
||||
private String ADDRESSID;
|
||||
|
||||
private String ADDRESSSTATUS;
|
||||
|
||||
private String SHIPTONAME;
|
||||
|
||||
private String TRANSACTIONID;
|
||||
|
||||
private String TOKEN;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private boolean paymentDone = false;
|
||||
|
||||
private boolean detailBuyer = false;
|
||||
|
||||
public static final String SESS_ID_ORDER = "_SESS_ID_ORDER";
|
||||
|
||||
public String getACK() {
|
||||
return (this.ACK == null) ? "" : this.ACK;
|
||||
}
|
||||
|
||||
public void setACK(String ack) {
|
||||
this.ACK = ack;
|
||||
}
|
||||
|
||||
public String getBUILD() {
|
||||
return (this.BUILD == null) ? "" : this.BUILD;
|
||||
}
|
||||
|
||||
public void setBUILD(String build) {
|
||||
this.BUILD = build;
|
||||
}
|
||||
|
||||
public String getCORRELATIONID() {
|
||||
return (this.CORRELATIONID == null) ? "" :
|
||||
this.CORRELATIONID;
|
||||
}
|
||||
|
||||
public void setCORRELATIONID(String correlationid) {
|
||||
this.CORRELATIONID = correlationid;
|
||||
}
|
||||
|
||||
public String getTIMESTAMP() {
|
||||
return (this.TIMESTAMP == null) ? "" : this.TIMESTAMP;
|
||||
}
|
||||
|
||||
public void setTIMESTAMP(String timestamp) {
|
||||
this.TIMESTAMP = timestamp;
|
||||
}
|
||||
|
||||
public String getVERSION() {
|
||||
return (this.VERSION == null) ? "" : this.VERSION;
|
||||
}
|
||||
|
||||
public void setVERSION(String version) {
|
||||
this.VERSION = version;
|
||||
}
|
||||
|
||||
public String getL_ERRORCODE0() {
|
||||
return (this.L_ERRORCODE0 == null) ? "" : this.L_ERRORCODE0;
|
||||
}
|
||||
|
||||
public void setL_ERRORCODE0(String l_errorcode0) {
|
||||
this.L_ERRORCODE0 = l_errorcode0;
|
||||
}
|
||||
|
||||
public String getL_LONGMESSAGE0() {
|
||||
return (this.L_LONGMESSAGE0 == null) ? "" :
|
||||
this.L_LONGMESSAGE0;
|
||||
}
|
||||
|
||||
public void setL_LONGMESSAGE0(String l_longmessage0) {
|
||||
this.L_LONGMESSAGE0 = l_longmessage0;
|
||||
}
|
||||
|
||||
public String getL_SEVERITYCODE0() {
|
||||
return (this.L_SEVERITYCODE0 == null) ? "" :
|
||||
this.L_SEVERITYCODE0;
|
||||
}
|
||||
|
||||
public void setL_SEVERITYCODE0(String l_severitycode0) {
|
||||
this.L_SEVERITYCODE0 = l_severitycode0;
|
||||
}
|
||||
|
||||
public String getL_SHORTMESSAGE0() {
|
||||
return (this.L_SHORTMESSAGE0 == null) ? "" :
|
||||
this.L_SHORTMESSAGE0;
|
||||
}
|
||||
|
||||
public void setL_SHORTMESSAGE0(String l_shortmessage0) {
|
||||
this.L_SHORTMESSAGE0 = l_shortmessage0;
|
||||
}
|
||||
|
||||
public String getTOKEN() {
|
||||
return (this.TOKEN == null) ? "" : this.TOKEN;
|
||||
}
|
||||
|
||||
public void setTOKEN(String token) {
|
||||
this.TOKEN = token;
|
||||
}
|
||||
|
||||
public String getADDRESSID() {
|
||||
return this.ADDRESSID;
|
||||
}
|
||||
|
||||
public void setADDRESSID(String addressid) {
|
||||
this.ADDRESSID = addressid;
|
||||
}
|
||||
|
||||
public String getADDRESSSTATUS() {
|
||||
return this.ADDRESSSTATUS;
|
||||
}
|
||||
|
||||
public void setADDRESSSTATUS(String addressstatus) {
|
||||
this.ADDRESSSTATUS = addressstatus;
|
||||
}
|
||||
|
||||
public String getCOUNTRYCODE() {
|
||||
return this.COUNTRYCODE;
|
||||
}
|
||||
|
||||
public boolean isResponseOk() {
|
||||
return getACK().equals("Success");
|
||||
}
|
||||
|
||||
public void setCOUNTRYCODE(String countrycode) {
|
||||
this.COUNTRYCODE = countrycode;
|
||||
}
|
||||
|
||||
public String getEMAIL() {
|
||||
return this.EMAIL;
|
||||
}
|
||||
|
||||
public void setEMAIL(String email) {
|
||||
this.EMAIL = email;
|
||||
}
|
||||
|
||||
public String getFIRSTNAME() {
|
||||
return this.FIRSTNAME;
|
||||
}
|
||||
|
||||
public void fillResponse(BufferedReader reader) {
|
||||
try {
|
||||
String response = URLDecoder.decode(reader.readLine());
|
||||
setACK("Success");
|
||||
setL_LONGMESSAGE0(response);
|
||||
setAMT(getAttribute(response, "AMT"));
|
||||
setACK(getAttribute(response, "ACK"));
|
||||
setTOKEN(getAttribute(response, "TOKEN"));
|
||||
setADDRESSID(getAttribute(response, "ADDRESSID"));
|
||||
setADDRESSSTATUS(getAttribute(response, "ADDRESSSTATUS"));
|
||||
setBUILD(getAttribute(response, "BUILD"));
|
||||
setCORRELATIONID(getAttribute(response, "CORRELATIONID"));
|
||||
setCOUNTRYCODE(getAttribute(response, "COUNTRYCODE"));
|
||||
setEMAIL(getAttribute(response, "EMAIL"));
|
||||
setFIRSTNAME(getAttribute(response, "FIRSTNAME"));
|
||||
setL_ERRORCODE0(getAttribute(response, "L_ERRORCODE0"));
|
||||
setL_LONGMESSAGE0(getAttribute(response, "L_LONGMESSAGE0"));
|
||||
setL_SEVERITYCODE0(getAttribute(response, "L_SEVERITCODE0"));
|
||||
setLASTNAME(getAttribute(response, "LASTNAME"));
|
||||
setPAYERID(getAttribute(response, "PAYERID"));
|
||||
setPAYERSTATUS(getAttribute(response, "PAYERSTATUS"));
|
||||
setSHIPTOCITY(getAttribute(response, "SHIPTOCITY"));
|
||||
setSHIPTOCOUNTRYCODE(getAttribute(response, "SHIPTOCOUNTRYCODE"));
|
||||
setSHIPTONAME(getAttribute(response, "SHIPTONAME"));
|
||||
setSHIPTOSTREET(getAttribute(response, "SHIPTOSTREET"));
|
||||
setSHIPTOSTATE(getAttribute(response, "SHIPTOSTATE"));
|
||||
setSHIPTOZIP(getAttribute(response, "SHIPTOZIP"));
|
||||
setTIMESTAMP(getAttribute(response, "TIMESTAMP"));
|
||||
setVERSION(getAttribute(response, "VERSION"));
|
||||
setTRANSACTIONID(getAttribute(response, "TRANSACTIONID"));
|
||||
} catch (Exception e) {
|
||||
setACK("Error");
|
||||
setL_LONGMESSAGE0(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String getAttribute(String response, String key) {
|
||||
try {
|
||||
if (response.indexOf(key) >= 0) {
|
||||
int idxStart = response.indexOf(key) + key.length() + 1;
|
||||
int idxStop = response.substring(idxStart).indexOf("&") + idxStart;
|
||||
if (idxStop < idxStart)
|
||||
idxStop = response.length();
|
||||
return response.substring(idxStart, idxStop);
|
||||
}
|
||||
return "";
|
||||
} catch (Exception e) {
|
||||
System.out.println(key);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setFIRSTNAME(String firstname) {
|
||||
this.FIRSTNAME = firstname;
|
||||
}
|
||||
|
||||
public String getLASTNAME() {
|
||||
return this.LASTNAME;
|
||||
}
|
||||
|
||||
public void setLASTNAME(String lastname) {
|
||||
this.LASTNAME = lastname;
|
||||
}
|
||||
|
||||
public String getPAYERID() {
|
||||
return this.PAYERID;
|
||||
}
|
||||
|
||||
public void setPAYERID(String payerid) {
|
||||
this.PAYERID = payerid;
|
||||
}
|
||||
|
||||
public String getPAYERSTATUS() {
|
||||
return this.PAYERSTATUS;
|
||||
}
|
||||
|
||||
public void setPAYERSTATUS(String payerstatus) {
|
||||
this.PAYERSTATUS = payerstatus;
|
||||
}
|
||||
|
||||
public String getSHIPTOCITY() {
|
||||
return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY;
|
||||
}
|
||||
|
||||
public void setSHIPTOCITY(String shiptocity) {
|
||||
this.SHIPTOCITY = shiptocity;
|
||||
}
|
||||
|
||||
public String getSHIPTOCOUNTRYCODE() {
|
||||
return (this.SHIPTOCOUNTRYCODE == null) ? "" :
|
||||
this.SHIPTOCOUNTRYCODE;
|
||||
}
|
||||
|
||||
public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) {
|
||||
this.SHIPTOCOUNTRYCODE = shiptocountrycode;
|
||||
}
|
||||
|
||||
public String getSHIPTONAME() {
|
||||
return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME;
|
||||
}
|
||||
|
||||
public void setSHIPTONAME(String shiptoname) {
|
||||
this.SHIPTONAME = shiptoname;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTATE() {
|
||||
return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTATE(String shiptostate) {
|
||||
this.SHIPTOSTATE = shiptostate;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTREET() {
|
||||
return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTREET(String shiptostreet) {
|
||||
this.SHIPTOSTREET = shiptostreet;
|
||||
}
|
||||
|
||||
public String getSHIPTOZIP() {
|
||||
return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP;
|
||||
}
|
||||
|
||||
public void setSHIPTOZIP(String shiptozip) {
|
||||
this.SHIPTOZIP = shiptozip;
|
||||
}
|
||||
|
||||
public String getAMT() {
|
||||
return this.AMT;
|
||||
}
|
||||
|
||||
public void setAMT(String amt) {
|
||||
this.AMT = amt;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public boolean isDetailBuyer() {
|
||||
return this.detailBuyer;
|
||||
}
|
||||
|
||||
public void setDetailBuyer(boolean detailBuyer) {
|
||||
this.detailBuyer = detailBuyer;
|
||||
}
|
||||
|
||||
public boolean isPaymentDone() {
|
||||
return this.paymentDone;
|
||||
}
|
||||
|
||||
public void setPaymentDone(boolean paymentDone) {
|
||||
this.paymentDone = paymentDone;
|
||||
}
|
||||
|
||||
public String getTRANSACTIONID() {
|
||||
return this.TRANSACTIONID;
|
||||
}
|
||||
|
||||
public void setTRANSACTIONID(String transactionid) {
|
||||
this.TRANSACTIONID = transactionid;
|
||||
}
|
||||
}
|
||||
304
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/poste/PeReq.java
Normal file
304
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/poste/PeReq.java
Normal file
|
|
@ -0,0 +1,304 @@
|
|||
package com.ablia.bank.poste;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
|
||||
public class PeReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_USA = "USA";
|
||||
|
||||
public static final String LANG_CODE_ITA = "ITA";
|
||||
|
||||
public static final String DIV_CODE_EURO = "978";
|
||||
|
||||
private String currency;
|
||||
|
||||
private String trackId;
|
||||
|
||||
private String mail;
|
||||
|
||||
private String resourcePath;
|
||||
|
||||
private String language;
|
||||
|
||||
private String alias;
|
||||
|
||||
private String responseURL;
|
||||
|
||||
private String errorURL;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String amt;
|
||||
|
||||
private String action;
|
||||
|
||||
private String flgTipoPagamentoPe;
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
|
||||
public static final String P_USE_IGFS = "PE_USE_IGFS";
|
||||
|
||||
public static final String P_NO_CERTIFICATO = "PE_NO_CERTIFICATO";
|
||||
|
||||
public static final String P_RESOURCE_PATH = "PE_RESOURCE_PATH";
|
||||
|
||||
public static final String P_URL_POST_RESPONSE = "PE_URL_POST_RESPONSE";
|
||||
|
||||
public static final String ALIAS_POSTEPAY = "03";
|
||||
|
||||
public static final String ALIAS_BPOPL = "01";
|
||||
|
||||
public static final String ALIAS_CC = "02";
|
||||
|
||||
public static final String ALIAS_BPIOL = "04";
|
||||
|
||||
public static final String ALIAS_POSTEPAY_IMPRESA = "06";
|
||||
|
||||
public static final String P_MERCHANT_ID = "PE_MERCHANT_ID";
|
||||
|
||||
public static final String DEFAULT_OK_KO_PAGE = "payResPe.jsp";
|
||||
|
||||
public static final String P_URL_REDIRECT_RESULT = "PE_URL_REDIRECT_RESULT";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "PE_PAY_OK";
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "PE_PAY_KO";
|
||||
|
||||
public static final String P_URL_POST_RESPONSE_ERROR = "URL_POST_RESPONSE_ERROR";
|
||||
|
||||
public static final String TEST_ALIAS = "payment_testm_urlmac";
|
||||
|
||||
public static final String REQ_URL = "https://ecommerce.cim-italia.it/ecomm/DispatcherServlet";
|
||||
|
||||
public String getTrackId() {
|
||||
return (this.trackId == null) ? "" : this.trackId;
|
||||
}
|
||||
|
||||
public void setTrackId(String myamount) {
|
||||
this.trackId = myamount;
|
||||
}
|
||||
|
||||
public String getAmt() {
|
||||
return (this.amt == null) ? "" : this.amt;
|
||||
}
|
||||
|
||||
public void setAmt(String mybuyeremail) {
|
||||
this.amt = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
return (this.mail == null) ? "" : this.mail;
|
||||
}
|
||||
|
||||
public void setMail(String mybuyername) {
|
||||
this.mail = mybuyername;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return (this.currency == null) ? "" : this.currency;
|
||||
}
|
||||
|
||||
public void setCurrency(String mycurrency) {
|
||||
this.currency = mycurrency;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return String.valueOf(getMerchantId()) + getFlgTipoPagamentoPe();
|
||||
}
|
||||
|
||||
public void setAlias(String mycustominfo) {
|
||||
this.alias = mycustominfo;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return (this.language == null) ? "" : this.language;
|
||||
}
|
||||
|
||||
public void setLanguage(String lang) {
|
||||
this.language = lang;
|
||||
}
|
||||
|
||||
public String getImportoUrl() {
|
||||
return (this.amt == null) ? "" : this.amt;
|
||||
}
|
||||
|
||||
public String getResponseURL() {
|
||||
return (this.responseURL == null) ? "" :
|
||||
this.responseURL.trim();
|
||||
}
|
||||
|
||||
public void setResponseURL(String url) {
|
||||
this.responseURL = url;
|
||||
}
|
||||
|
||||
public String getErrorURL() {
|
||||
return (this.errorURL == null) ? "" : this.errorURL.trim();
|
||||
}
|
||||
|
||||
public void setErrorURL(String url_back) {
|
||||
this.errorURL = url_back;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "PAYPAL";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "POST ECOMMERCE";
|
||||
bean.findByCodice("PE_MERCHANT_ID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_MERCHANT_ID");
|
||||
bean.setDescrizione("PE_MERCHANT_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("PE_MERCHANT_ID");
|
||||
bean.setNota("PE_MERCHANT_ID");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_PAY_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_PAY_KO");
|
||||
bean.setDescrizione("PE_PAY_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payResPe.jsp");
|
||||
bean.setNota("PE_PAY_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_PAY_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_PAY_OK");
|
||||
bean.setDescrizione("PE_PAY_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payResPe.jsp");
|
||||
bean.setNota("PE_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_NO_CERTIFICATO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_NO_CERTIFICATO");
|
||||
bean.setDescrizione("PE_NO_CERTIFICATO");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("PE_NO_CERTIFICATOSOLO PER IGFS: 0--> CON CERTIFICATO, PRODUZIONE<br>1 --> SENZA CERTIFICATO, SOLO TEST");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_USE_IGFS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_USE_IGFS");
|
||||
bean.setDescrizione("PE_USE_IGFS");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("PE_USE_IGFS: 0--> vecchia versione con resource.cgn<br>1 --> nuova versione con file properties");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_RESOURCE_PATH");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_RESOURCE_PATH");
|
||||
bean.setDescrizione("PE_RESOURCE_PATH");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("/home/xxx/xxx/");
|
||||
bean.setNota("PE_RESOURCE_PATH: per la versione vecchia con / finale. Path assoluto dove trovare resource.cgn<br>per la versione nuova il percorso completo del .properties compreso il nome del file.");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_URL_POST_RESPONSE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_URL_POST_RESPONSE");
|
||||
bean.setDescrizione("PE_URL_POST_RESPONSE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://test.ablia.com/tf/GetResponsePe.abl");
|
||||
bean.setNota("PE_URL_POST_RESPONSE: URL HTTP RICHIAMATA TRAMITE POST. DEVE ESSERE VISIBILE SU INTERNET (NO LOCALHOST)");
|
||||
bean.save();
|
||||
bean.findByCodice("URL_POST_RESPONSE_ERROR");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("URL_POST_RESPONSE_ERROR");
|
||||
bean.setDescrizione("URL_POST_RESPONSE_ERROR");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://test.ablia.com/tf/RicevutaPE.abl");
|
||||
bean.setNota("URL_POST_RESPONSE_ERROR: URL HTTP RICHIAMATA TRAMITE REDIRECT. DEVE ESSERE VISIBILE SU INTERNET (NO LOCALHOST)");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_URL_REDIRECT_RESULT");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_URL_REDIRECT_RESULT");
|
||||
bean.setDescrizione("PE_URL_REDIRECT_RESULT");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf/RicevutaPE.abl");
|
||||
bean.setNota("PE_URL_REDIRECT_RESULT: URL HTTP RICHIAMATA TRAMITE REDIRECT. PUO' ESSERE LOCALHOST IN FASE DI SVILUPPO");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public String getResourcePath() {
|
||||
return (this.resourcePath == null) ? "" : this.resourcePath;
|
||||
}
|
||||
|
||||
public void setResourcePath(String resourcePath) {
|
||||
this.resourcePath = resourcePath;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return (this.userName == null) ? "" : this.userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return "4";
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getTipoPagamentoPE(String tipoPagamento) {
|
||||
if (tipoPagamento.equals("04"))
|
||||
return "conto bpiol";
|
||||
if (tipoPagamento.equals("01"))
|
||||
return "conto bpiol";
|
||||
if (tipoPagamento.equals("04"))
|
||||
return "conto bpol";
|
||||
if (tipoPagamento.equals("02"))
|
||||
return "carta di credito";
|
||||
if (tipoPagamento.equals("03"))
|
||||
return "carta postepay";
|
||||
if (tipoPagamento.equals("06"))
|
||||
return "carta postepay Impresa";
|
||||
return "??";
|
||||
}
|
||||
|
||||
public String getFlgTipoPagamentoPe() {
|
||||
return (this.flgTipoPagamentoPe == null) ? "" :
|
||||
this.flgTipoPagamentoPe.trim();
|
||||
}
|
||||
|
||||
public void setFlgTipoPagamentoPe(String flgTipoPagamentoPe) {
|
||||
this.flgTipoPagamentoPe = flgTipoPagamentoPe;
|
||||
}
|
||||
|
||||
public String getMerchantId() {
|
||||
return (this.merchantId == null) ? "" :
|
||||
this.merchantId.trim();
|
||||
}
|
||||
|
||||
public void setMerchantId(String merchantId) {
|
||||
this.merchantId = merchantId;
|
||||
}
|
||||
|
||||
public String getShopId() {
|
||||
return (this.shopId == null) ? "" : this.shopId.trim();
|
||||
}
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
}
|
||||
118
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/poste/PeResp.java
Normal file
118
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/poste/PeResp.java
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
package com.ablia.bank.poste;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
|
||||
public class PeResp extends _BankAdapter {
|
||||
private long id_ordine;
|
||||
|
||||
private String errorText;
|
||||
|
||||
private String postdate;
|
||||
|
||||
private String paymentid;
|
||||
|
||||
private String trackid;
|
||||
|
||||
private String result;
|
||||
|
||||
private String tranid;
|
||||
|
||||
private String errorCode;
|
||||
|
||||
private String error;
|
||||
|
||||
private String auth;
|
||||
|
||||
private String errorService;
|
||||
|
||||
public static final String ESITO_OK = "APPROVED";
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getErrorText() {
|
||||
return (this.errorText == null) ? "" : this.errorText.trim();
|
||||
}
|
||||
|
||||
public void setErrorText(String importo) {
|
||||
this.errorText = importo;
|
||||
}
|
||||
|
||||
public String getPostdate() {
|
||||
return (this.postdate == null) ? "" : this.postdate.trim();
|
||||
}
|
||||
|
||||
public void setPostdate(String data) {
|
||||
this.postdate = data;
|
||||
}
|
||||
|
||||
public String getPaymentid() {
|
||||
return (this.paymentid == null) ? "" : this.paymentid.trim();
|
||||
}
|
||||
|
||||
public void setPaymentid(String divisa) {
|
||||
this.paymentid = divisa;
|
||||
}
|
||||
|
||||
public String getTrackid() {
|
||||
return (this.trackid == null) ? "" : this.trackid.trim();
|
||||
}
|
||||
|
||||
public void setTrackid(String codTrans) {
|
||||
this.trackid = codTrans;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return (this.result == null) ? "" : this.result.trim();
|
||||
}
|
||||
|
||||
public void setResult(String esito) {
|
||||
this.result = esito;
|
||||
}
|
||||
|
||||
public String getTranid() {
|
||||
return (this.tranid == null) ? "" : this.tranid.trim();
|
||||
}
|
||||
|
||||
public void setTranid(String codAut) {
|
||||
this.tranid = codAut;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return (this.errorCode == null) ? "" : this.errorCode.trim();
|
||||
}
|
||||
|
||||
public void setErrorCode(String nome) {
|
||||
this.errorCode = nome;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return (this.error == null) ? "" : this.error.trim();
|
||||
}
|
||||
|
||||
public void setError(String cognome) {
|
||||
this.error = cognome;
|
||||
}
|
||||
|
||||
public String getAuth() {
|
||||
return (this.auth == null) ? "" : this.auth.trim();
|
||||
}
|
||||
|
||||
public void setAuth(String email) {
|
||||
this.auth = email;
|
||||
}
|
||||
|
||||
public String getErrorService() {
|
||||
return (this.errorService == null) ? "" :
|
||||
this.errorService.trim();
|
||||
}
|
||||
|
||||
public void setErrorService(String errorService) {
|
||||
this.errorService = errorService;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
package com.ablia.bank.poste2019;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.reg.EcDc;
|
||||
|
||||
public class PosteReq extends _BankAdapter {
|
||||
private String VALUTA;
|
||||
|
||||
private String NUMORD;
|
||||
|
||||
private String IMPORTO;
|
||||
|
||||
private String LINGUA;
|
||||
|
||||
private String EMAILESERC;
|
||||
|
||||
private String EMAIL;
|
||||
|
||||
private String USERID;
|
||||
|
||||
public static final String TCONTAB_DIFFERITA = "D";
|
||||
|
||||
public static final String TCONTAB_IMMEDIATA = "I";
|
||||
|
||||
public static final String LANG_CODE_IT = "ITA";
|
||||
|
||||
public static final String LANG_CODE_EN = "EN";
|
||||
|
||||
public static final String P_POSTE19_MAC_KEY_START = "POSTE19_MAC_KEY_START";
|
||||
|
||||
public static final String P_POSTE19_URL_BACK = "POSTE19_URL_BACK";
|
||||
|
||||
public static final String P_POSTE19_URL_DONE = "POSTE19_URL_DONE";
|
||||
|
||||
public static final String P_POSTE19_URL_MS = "POSTE19_URL_MS";
|
||||
|
||||
public static final String P_POSTE19_EMAILESERC = "POSTE19_EMAILESERC";
|
||||
|
||||
public static final String P_POSTE19_MAC_KEY_ESITO = "POSTE19_MAC_KEY_ESITO";
|
||||
|
||||
public static final String P_POSTE19_IDNEGOZIO = "POSTE19_IDNEGOZIO";
|
||||
|
||||
public static final String P_POSTE19_TCONTAB = "POSTE19_TCONTAB";
|
||||
|
||||
public static final String P_POSTE19_OPTIONS = "POSTE19_OPTIONS";
|
||||
|
||||
public static final String URL_POSTE19_TEST = "https://acquistionlinetest.poste.it/poste/pagamenti/main?PAGE=MASTER";
|
||||
|
||||
public static final String URL_POSTE19_PROD = "https://acquistionline.poste.it/poste/pagamenti/main?PAGE=MASTER";
|
||||
|
||||
public static final String DEFAULT_URL_BACK_AND_DONE = "http://localhost/tf15/RicevutaPoste.abl";
|
||||
|
||||
public static final String DEFAULT_URL_MS = "http://localhost/tf15/RicevutaPoste.abl";
|
||||
|
||||
public static final String TEST_MAC = "CHENESOADESSO";
|
||||
|
||||
public static final String OPTIONS_G_REDIRIZIONE_IMMEDIATA = "G";
|
||||
|
||||
public static final String OPTIONS_L_ORDINE_DUPLICATO_CODE_07_URLMS = "L";
|
||||
|
||||
public static final String OPTIONS_N_NEGATA_SU_RULDONE = "N";
|
||||
|
||||
public static final String OPTIONS_P_SEND_RESPONSE_CODE_AUT = "P";
|
||||
|
||||
public PosteReq() {}
|
||||
|
||||
public PosteReq(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public String getNUMORD() {
|
||||
return (this.NUMORD == null) ? "" : this.NUMORD.trim();
|
||||
}
|
||||
|
||||
public void setNUMORD(String myamount) {
|
||||
this.NUMORD = myamount;
|
||||
}
|
||||
|
||||
public String getIMPORTO() {
|
||||
return (this.IMPORTO == null) ? "" : this.IMPORTO;
|
||||
}
|
||||
|
||||
public void setIMPORTO(String mybuyeremail) {
|
||||
this.IMPORTO = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getEMAILESERC() {
|
||||
return (this.EMAILESERC == null) ? "" : this.EMAILESERC;
|
||||
}
|
||||
|
||||
public void setEMAILESERC(String mybuyername) {
|
||||
this.EMAILESERC = mybuyername;
|
||||
}
|
||||
|
||||
public String getVALUTA() {
|
||||
return (this.VALUTA == null) ? "" : this.VALUTA;
|
||||
}
|
||||
|
||||
public void setVALUTA(String mycurrency) {
|
||||
this.VALUTA = mycurrency;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return getParm("POSTE19_MAC_KEY_ESITO").getTesto();
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return getMacPagamento();
|
||||
}
|
||||
|
||||
public String getMacPagamento() {
|
||||
StringBuffer theUrl = new StringBuffer();
|
||||
theUrl.append("&URLMS=");
|
||||
theUrl.append(getURLMS());
|
||||
theUrl.append("&URLDONE=");
|
||||
theUrl.append(getURLDONE());
|
||||
theUrl.append("&NUMORD=");
|
||||
theUrl.append(getNUMORD());
|
||||
theUrl.append("&IDNEGOZIO=");
|
||||
theUrl.append(getIDNEGOZIO());
|
||||
theUrl.append("&IMPORTO=");
|
||||
theUrl.append(getIMPORTO());
|
||||
theUrl.append("&VALUTA=");
|
||||
theUrl.append(getVALUTA());
|
||||
theUrl.append("&TCONTAB=");
|
||||
theUrl.append(getTCONTAB());
|
||||
theUrl.append("&TAUTOR=I");
|
||||
if (!getOPTIONS().isEmpty()) {
|
||||
theUrl.append("&OPTIONS=");
|
||||
theUrl.append(getOPTIONS());
|
||||
}
|
||||
theUrl.append("&USERID=");
|
||||
theUrl.append(getUSERID());
|
||||
String res = "";
|
||||
res = EcDc.encodeHMAC_256(getMAC_KEY_START(), theUrl.toString());
|
||||
System.out.println("stringa mac: " + res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getLINGUA() {
|
||||
return (this.LINGUA == null) ? "" : this.LINGUA;
|
||||
}
|
||||
|
||||
public void setLINGUA(String lang) {
|
||||
this.LINGUA = lang;
|
||||
}
|
||||
|
||||
public String getRequestUrl() {
|
||||
return getRequestUrl(false);
|
||||
}
|
||||
|
||||
public String getImportoUrl() {
|
||||
if (this.IMPORTO == null)
|
||||
return "0000";
|
||||
String temp = this.IMPORTO;
|
||||
if (temp.indexOf('.') < 0) {
|
||||
temp = String.valueOf(temp) + "00";
|
||||
} else if (temp.length() - temp.indexOf('.') < 3) {
|
||||
temp = String.valueOf(temp) + "0";
|
||||
}
|
||||
return temp.replace(".", "");
|
||||
}
|
||||
|
||||
public String getTestRequestUrl() {
|
||||
return getRequestUrl(true);
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "POSTEPAY 2019";
|
||||
Parm bean = new Parm(ap);
|
||||
bean.findByCodice("POSTE19_URL_BACK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_URL_BACK");
|
||||
bean.setDescrizione("POSTE19_URL_BACK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf15/RicevutaPoste.abl");
|
||||
bean.setNota(
|
||||
"La URL verso la quale mandare l’utente in caso di annullamento del processo di pagamento e ritorno alla modifica del carrello");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_URL_DONE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_URL_DONE");
|
||||
bean.setDescrizione("POSTE19_URL_DONE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf15/RicevutaPoste.abl");
|
||||
bean.setNota("POSTE19_URL_MS");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_URL_MS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_URL_MS");
|
||||
bean.setDescrizione("POSTE19_URL_MS");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf15/RicevutaPoste.abl");
|
||||
bean.setNota(
|
||||
"La URL che il sistema deve utilizzare per notificare direttamente al negozio l’esito della transazione compiuta ");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_MAC_KEY_START");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_MAC_KEY_START");
|
||||
bean.setDescrizione("POSTE19_MAC_KEY_START");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("CHENESOADESSO");
|
||||
bean.setNota("E' la chiave per il calcolo del MAC nei messaggi di avvio pagamento");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_MAC_KEY_ESITO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_MAC_KEY_ESITO");
|
||||
bean.setDescrizione("POSTE19_MAC_KEY_ESITO");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.getTesto().equals("");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("E' la chiave per la verifica del MAC nei messaggi di esito emessi da Poste e per l’usodelle API.");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_EMAILESERC");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_EMAILESERC");
|
||||
bean.setDescrizione("POSTE19_EMAILESERC");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.getTesto().equals("");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota(
|
||||
"MAIL ESERCENTE AL QUALE INVIARE L'ESITO DELLA TRANSAZIONE. SE VUOTA VIENE UTILIZZATA QUELLA DELL'ANAGRAFICA DEL NEGOZIO");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_IDNEGOZIO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_IDNEGOZIO");
|
||||
bean.setDescrizione("POSTE19_IDNEGOZIO");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.getTesto().equals("");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("Identificativo del negozio del merchant assegnato da Poste, Merchant ID (MID).");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_TCONTAB");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_TCONTAB");
|
||||
bean.setDescrizione("POSTE19_TCONTAB");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("I");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota(
|
||||
"Tipo di contabilizzazione da utilizzare in questo ordine. Obbligatorio.<br>D --> Differita<br>I --> Immediata");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_OPTIONS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_OPTIONS");
|
||||
bean.setDescrizione("POSTE19_OPTIONS");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.getTesto().equals("");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota(
|
||||
"Opzioni aggiuntive per il pagamento in corso.<br>G – In caso di autorizzazione concessa il sistema invece di mostrare l’esito della transazione al consumatore effettua la redirezione immediata presso URLDONE in modo che il negozio virtuale possa mostrare un proprio “scontrino” personalizzato. In caso di autorizzazione negata all’utente viene riproposta la schermata di inserimento carta.<br>L – Nel caso di ordine duplicato il sistema invia una URLMS con codice di esito 07.<br>N – In caso di autorizzazione negata il sistema, invece di mostrare l’esito della transazione alconsumatore, effettua la redirezione immediata verso URLDONE.<br>P – Viene restituito, in URLMS E URDONE, il campo RESPONSE_CODE_AUT che rappresenta il codice di risposta ritornato dal backend autorizzativo.<br>");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
private String getIDNEGOZIO() {
|
||||
return getParm("POSTE19_IDNEGOZIO").getTesto();
|
||||
}
|
||||
|
||||
public String getURLBACK() {
|
||||
return getParm("POSTE19_URL_BACK").getTesto();
|
||||
}
|
||||
|
||||
public String getURLDONE() {
|
||||
return getParm("POSTE19_URL_DONE").getTesto();
|
||||
}
|
||||
|
||||
public String getURLMS() {
|
||||
return getParm("POSTE19_URL_MS").getTesto();
|
||||
}
|
||||
|
||||
public String getTCONTAB() {
|
||||
return getParm("POSTE19_TCONTAB").getTesto();
|
||||
}
|
||||
|
||||
public String getTAUTOR() {
|
||||
return "I";
|
||||
}
|
||||
|
||||
public String getOPTIONS() {
|
||||
return getParm("POSTE19_OPTIONS").getTesto();
|
||||
}
|
||||
|
||||
public String getEMAIL() {
|
||||
return this.EMAIL;
|
||||
}
|
||||
|
||||
public void setEMAIL(String eMAIL) {
|
||||
this.EMAIL = eMAIL;
|
||||
}
|
||||
|
||||
public String getUSERID() {
|
||||
return this.USERID;
|
||||
}
|
||||
|
||||
public void setUSERID(String uSERID) {
|
||||
this.USERID = uSERID;
|
||||
}
|
||||
|
||||
private String getMAC_KEY_START() {
|
||||
return getParm("POSTE19_MAC_KEY_START").getTesto();
|
||||
}
|
||||
|
||||
private String getRequestUrl(boolean test) {
|
||||
StringBuilder theUrl = new StringBuilder();
|
||||
if (test) {
|
||||
theUrl.append("https://acquistionlinetest.poste.it/poste/pagamenti/main?PAGE=MASTER");
|
||||
} else {
|
||||
theUrl.append("https://acquistionline.poste.it/poste/pagamenti/main?PAGE=MASTER");
|
||||
}
|
||||
theUrl.append("&IMPORTO=");
|
||||
theUrl.append(getIMPORTO());
|
||||
theUrl.append("&VALUTA=");
|
||||
theUrl.append(getVALUTA());
|
||||
theUrl.append("&NUMORD=");
|
||||
theUrl.append(getNUMORD());
|
||||
theUrl.append("&IDNEGOZIO=");
|
||||
theUrl.append(getIDNEGOZIO());
|
||||
theUrl.append("&URLBACK=");
|
||||
theUrl.append(getURLBACK());
|
||||
theUrl.append("&URLDONE=");
|
||||
theUrl.append(getURLDONE());
|
||||
theUrl.append("&URLMS=");
|
||||
theUrl.append(getURLMS());
|
||||
theUrl.append("&TCONTAB=");
|
||||
theUrl.append(getTCONTAB());
|
||||
theUrl.append("&TAUTOR=I");
|
||||
theUrl.append("&MAC=");
|
||||
theUrl.append(getMacPagamento());
|
||||
theUrl.append("&LINGUA=");
|
||||
theUrl.append(getLINGUA());
|
||||
if (!getEMAILESERC().isEmpty()) {
|
||||
theUrl.append("&EMAILESERC=");
|
||||
theUrl.append(getEMAILESERC());
|
||||
}
|
||||
if (!getOPTIONS().isEmpty()) {
|
||||
theUrl.append("&OPTIONS=");
|
||||
theUrl.append(getOPTIONS());
|
||||
}
|
||||
theUrl.append("&EMAIL=");
|
||||
theUrl.append(getEMAIL());
|
||||
theUrl.append("&USERID=");
|
||||
theUrl.append(getUSERID());
|
||||
return theUrl.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,258 @@
|
|||
package com.ablia.bank.poste2019;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.reg.EcDc;
|
||||
|
||||
public class PosteRes extends _BankAdapter {
|
||||
public static final String ESITO_OK = "00";
|
||||
|
||||
public static final String ESITO_KO_01 = "01";
|
||||
|
||||
public static final String ESITO_KO_02 = "02";
|
||||
|
||||
public static final String ESITO_KO_03 = "03";
|
||||
|
||||
public static final String ESITO_KO_04 = "04";
|
||||
|
||||
public static final String ESITO_KO_05 = "05";
|
||||
|
||||
public static final String ESITO_KO_06 = "06";
|
||||
|
||||
public static final String ESITO_KO_07 = "07";
|
||||
|
||||
public static final String ESITO_KO_60 = "60";
|
||||
|
||||
public static final String ESITO_KO_66 = "66";
|
||||
|
||||
private String IMPORTO;
|
||||
|
||||
private String NUMORD;
|
||||
|
||||
private String VALUTA;
|
||||
|
||||
private String ESITO;
|
||||
|
||||
private String AUT;
|
||||
|
||||
private String IDTRANS;
|
||||
|
||||
private String IDNEGOZIO;
|
||||
|
||||
private String MAC;
|
||||
|
||||
private String TCONTAB;
|
||||
|
||||
private String TAUTOR;
|
||||
|
||||
private String BPW_TIPO_TRANSAZIONE;
|
||||
|
||||
private String RESPONSE_CODE_AUT;
|
||||
|
||||
private String ALIASSTR;
|
||||
|
||||
private String EMAILTIT;
|
||||
|
||||
private String CFTIT;
|
||||
|
||||
public PosteRes() {}
|
||||
|
||||
public static final String getEsito(String l_esito) {
|
||||
if (l_esito.equals("01"))
|
||||
return "Negata dal sistema";
|
||||
if (l_esito.equals("02"))
|
||||
return "Negata per problemi sull'anagrafica negozio";
|
||||
if (l_esito.equals("03"))
|
||||
return "Negata per problemi di comunicazione con i circuiti autorizzativi";
|
||||
if (l_esito.equals("04"))
|
||||
return "Negata dall'emittente della carta";
|
||||
if (l_esito.equals("05"))
|
||||
return "Negata per numero carta errato";
|
||||
if (l_esito.equals("06"))
|
||||
return "Errore imprevisto durante l’elaborazione della richiesta";
|
||||
if (l_esito.equals("07"))
|
||||
return "Ordine duplicato";
|
||||
if (l_esito.equals("60"))
|
||||
return "Negata dai controlli antifrode di Poste";
|
||||
if (l_esito.equals("66"))
|
||||
return "Negata per mancata autenticazione dell’utente nelle procedure di verifica (ACS).";
|
||||
if (l_esito.equals("00"))
|
||||
return "Successo";
|
||||
return "??";
|
||||
}
|
||||
|
||||
public PosteRes(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public boolean isMacRitornoOk() {
|
||||
String macCalcolato = getMacEsito();
|
||||
if (getMAC().equals(macCalcolato))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return getParm("XPAY_MAC_KEY").getTesto();
|
||||
}
|
||||
|
||||
public String getIMPORTO() {
|
||||
return this.IMPORTO;
|
||||
}
|
||||
|
||||
public void setIMPORTO(String iMPORTO) {
|
||||
this.IMPORTO = iMPORTO;
|
||||
}
|
||||
|
||||
public String getNUMORD() {
|
||||
return this.NUMORD;
|
||||
}
|
||||
|
||||
public void setNUMORD(String nUMORD) {
|
||||
this.NUMORD = nUMORD;
|
||||
}
|
||||
|
||||
public String getVALUTA() {
|
||||
return this.VALUTA;
|
||||
}
|
||||
|
||||
public void setVALUTA(String vALUTA) {
|
||||
this.VALUTA = vALUTA;
|
||||
}
|
||||
|
||||
public String getESITO() {
|
||||
return this.ESITO;
|
||||
}
|
||||
|
||||
public void setESITO(String eSITO) {
|
||||
this.ESITO = eSITO;
|
||||
}
|
||||
|
||||
public String getAUT() {
|
||||
return this.AUT;
|
||||
}
|
||||
|
||||
public void setAUT(String aUT) {
|
||||
this.AUT = aUT;
|
||||
}
|
||||
|
||||
public String getIDTRANS() {
|
||||
return this.IDTRANS;
|
||||
}
|
||||
|
||||
public void setIDTRANS(String iDTRANS) {
|
||||
this.IDTRANS = iDTRANS;
|
||||
}
|
||||
|
||||
public String getIDNEGOZIO() {
|
||||
return this.IDNEGOZIO;
|
||||
}
|
||||
|
||||
public void setIDNEGOZIO(String iDNEGOZIO) {
|
||||
this.IDNEGOZIO = iDNEGOZIO;
|
||||
}
|
||||
|
||||
public String getMAC() {
|
||||
return this.MAC;
|
||||
}
|
||||
|
||||
public void setMAC(String mAC) {
|
||||
this.MAC = mAC;
|
||||
}
|
||||
|
||||
private String getMAC_KEY_ESITO() {
|
||||
return getParm("POSTE19_MAC_KEY_ESITO").getTesto();
|
||||
}
|
||||
|
||||
public String getMacEsito() {
|
||||
StringBuffer theUrl = new StringBuffer();
|
||||
theUrl.append("&NUMORD=");
|
||||
theUrl.append(getNUMORD());
|
||||
theUrl.append("&IDNEGOZIO=");
|
||||
theUrl.append(getIDNEGOZIO());
|
||||
theUrl.append("&AUT=");
|
||||
theUrl.append(getAUT());
|
||||
theUrl.append("&IMPORTO=");
|
||||
theUrl.append(getIMPORTO());
|
||||
theUrl.append("&VALUTA=");
|
||||
theUrl.append(getVALUTA());
|
||||
theUrl.append("&IDTRANS=");
|
||||
theUrl.append(getIDTRANS());
|
||||
theUrl.append("&TCONTAB=");
|
||||
theUrl.append(getTCONTAB());
|
||||
theUrl.append("&TAUTOR=");
|
||||
theUrl.append(getTAUTOR());
|
||||
theUrl.append("&ESITO=");
|
||||
theUrl.append(getESITO());
|
||||
theUrl.append("&BPW_TIPO_TRANSAZIONE=");
|
||||
theUrl.append(getBPW_TIPO_TRANSAZIONE());
|
||||
if (getOPTIONS().equals("P")) {
|
||||
theUrl.append("&RESPONSE_CODE_AUT=");
|
||||
theUrl.append(getRESPONSE_CODE_AUT());
|
||||
}
|
||||
String res = "";
|
||||
res = EcDc.encodeHMAC_256(getMAC_KEY_ESITO(), theUrl.toString());
|
||||
System.out.println("stringa mac esito: " + res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getTCONTAB() {
|
||||
return this.TCONTAB;
|
||||
}
|
||||
|
||||
public void setTCONTAB(String tCONTAB) {
|
||||
this.TCONTAB = tCONTAB;
|
||||
}
|
||||
|
||||
public String getTAUTOR() {
|
||||
return this.TAUTOR;
|
||||
}
|
||||
|
||||
public void setTAUTOR(String tAUTOR) {
|
||||
this.TAUTOR = tAUTOR;
|
||||
}
|
||||
|
||||
public String getBPW_TIPO_TRANSAZIONE() {
|
||||
return this.BPW_TIPO_TRANSAZIONE;
|
||||
}
|
||||
|
||||
public void setBPW_TIPO_TRANSAZIONE(String bPW_TIPO_TRANSAZIONE) {
|
||||
this.BPW_TIPO_TRANSAZIONE = bPW_TIPO_TRANSAZIONE;
|
||||
}
|
||||
|
||||
public String getRESPONSE_CODE_AUT() {
|
||||
return this.RESPONSE_CODE_AUT;
|
||||
}
|
||||
|
||||
public void setRESPONSE_CODE_AUT(String rESPONSE_CODE_AUT) {
|
||||
this.RESPONSE_CODE_AUT = rESPONSE_CODE_AUT;
|
||||
}
|
||||
|
||||
public String getALIASSTR() {
|
||||
return this.ALIASSTR;
|
||||
}
|
||||
|
||||
public void setALIASSTR(String aLIASSTR) {
|
||||
this.ALIASSTR = aLIASSTR;
|
||||
}
|
||||
|
||||
public String getEMAILTIT() {
|
||||
return this.EMAILTIT;
|
||||
}
|
||||
|
||||
public void setEMAILTIT(String eMAILTIT) {
|
||||
this.EMAILTIT = eMAILTIT;
|
||||
}
|
||||
|
||||
public String getCFTIT() {
|
||||
return this.CFTIT;
|
||||
}
|
||||
|
||||
public void setCFTIT(String cFTIT) {
|
||||
this.CFTIT = cFTIT;
|
||||
}
|
||||
|
||||
public String getOPTIONS() {
|
||||
return getParm("POSTE19_OPTIONS").getTesto();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,722 @@
|
|||
package com.ablia.bank.sella;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.UnknownServiceException;
|
||||
|
||||
public class GestPayCrypt {
|
||||
private String ShopLogin = "";
|
||||
|
||||
private String Currency = "";
|
||||
|
||||
private String Amount = "";
|
||||
|
||||
private String ShopTransactionID = "";
|
||||
|
||||
private String BuyerName = "";
|
||||
|
||||
private String BuyerEmail = "";
|
||||
|
||||
private String Language = "";
|
||||
|
||||
private String CustomInfo = "";
|
||||
|
||||
private String AuthorizationCode = "";
|
||||
|
||||
private String ErrorCode = "";
|
||||
|
||||
private String ErrorDescription = "";
|
||||
|
||||
private String BankTransactionID = "";
|
||||
|
||||
private String AlertCode = "";
|
||||
|
||||
private String AlertDescription = "";
|
||||
|
||||
private String EncryptedString = "";
|
||||
|
||||
private String ToBeEncript = "";
|
||||
|
||||
private String Decripted = "";
|
||||
|
||||
private String TransactionResult = "";
|
||||
|
||||
private String ProtocolAuthServer = "";
|
||||
|
||||
private String DomainName = "";
|
||||
|
||||
private String separator = "";
|
||||
|
||||
private String errDescription = "";
|
||||
|
||||
private String errNumber = "";
|
||||
|
||||
private String Version = "";
|
||||
|
||||
private String Min = "";
|
||||
|
||||
private String CVV = "";
|
||||
|
||||
private String country = "";
|
||||
|
||||
private String vbvrisp = "";
|
||||
|
||||
private String vbv = "";
|
||||
|
||||
private String trans;
|
||||
|
||||
public GestPayCrypt() {
|
||||
this.ShopLogin = "";
|
||||
this.Currency = "";
|
||||
this.Amount = "";
|
||||
this.ShopTransactionID = "";
|
||||
this.BuyerName = "";
|
||||
this.BuyerEmail = "";
|
||||
this.Language = "";
|
||||
this.CustomInfo = "";
|
||||
this.AuthorizationCode = "";
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
this.BankTransactionID = "";
|
||||
this.AlertCode = "";
|
||||
this.AlertDescription = "";
|
||||
this.EncryptedString = "";
|
||||
this.ToBeEncript = "";
|
||||
this.Decripted = "";
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.DomainName = "";
|
||||
this.separator = "*P1*";
|
||||
this.errDescription = "";
|
||||
this.errNumber = "0";
|
||||
this.Version = "3.0";
|
||||
this.Min = "";
|
||||
this.CVV = "";
|
||||
this.country = "";
|
||||
this.vbvrisp = "";
|
||||
this.vbv = "";
|
||||
this.trans = "";
|
||||
}
|
||||
|
||||
public void setShopLogin(String xstr) {
|
||||
this.ShopLogin = xstr;
|
||||
}
|
||||
|
||||
public void setCurrency(String xstr) {
|
||||
this.Currency = xstr;
|
||||
}
|
||||
|
||||
public void setAmount(String xstr) {
|
||||
this.Amount = xstr;
|
||||
}
|
||||
|
||||
public void setShopTransactionID(String xstr) {
|
||||
this.ShopTransactionID = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setMIN(String xstr) {
|
||||
this.Min = xstr;
|
||||
}
|
||||
|
||||
public void setCVV(String xstr) {
|
||||
this.CVV = xstr;
|
||||
}
|
||||
|
||||
public void setBuyerName(String xstr) {
|
||||
this.BuyerName = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setBuyerEmail(String xstr) {
|
||||
this.BuyerEmail = xstr.trim();
|
||||
}
|
||||
|
||||
public void setLanguage(String xstr) {
|
||||
this.Language = xstr.trim();
|
||||
}
|
||||
|
||||
public void setCustomInfo(String xstr) {
|
||||
this.CustomInfo = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setEncryptedString(String xstr) {
|
||||
this.EncryptedString = xstr;
|
||||
}
|
||||
|
||||
public void setProtocolServer(String xstr) {
|
||||
this.ProtocolAuthServer = xstr;
|
||||
}
|
||||
|
||||
public void setDomainName(String xstr) {
|
||||
this.DomainName = xstr;
|
||||
}
|
||||
|
||||
public String getShopLogin() {
|
||||
return this.ShopLogin;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return this.Currency;
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return this.Amount;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public String getVBV() {
|
||||
return this.vbv;
|
||||
}
|
||||
|
||||
public String getVBVrisp() {
|
||||
return this.vbvrisp;
|
||||
}
|
||||
|
||||
public String getShopTransactionID() {
|
||||
String app = "";
|
||||
try {
|
||||
app = URLDecode(this.ShopTransactionID);
|
||||
} catch (Exception e) {}
|
||||
return app;
|
||||
}
|
||||
|
||||
public String getBuyerName() {
|
||||
String appBuyername = "";
|
||||
try {
|
||||
appBuyername = URLDecode(this.BuyerName);
|
||||
} catch (Exception ex) {
|
||||
appBuyername = "errore";
|
||||
}
|
||||
return appBuyername;
|
||||
}
|
||||
|
||||
public String getBuyerEmail() {
|
||||
return this.BuyerEmail;
|
||||
}
|
||||
|
||||
public String getCustomInfo() {
|
||||
String appCustom = "";
|
||||
try {
|
||||
appCustom = URLDecode(this.CustomInfo);
|
||||
} catch (Exception e) {}
|
||||
return appCustom;
|
||||
}
|
||||
|
||||
public String getAuthorizationCode() {
|
||||
return this.AuthorizationCode;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return this.ErrorCode;
|
||||
}
|
||||
|
||||
public String getErrorDescription() {
|
||||
return this.ErrorDescription;
|
||||
}
|
||||
|
||||
public String getBankTransactionID() {
|
||||
return this.BankTransactionID;
|
||||
}
|
||||
|
||||
public String getTransactionResult() {
|
||||
return this.TransactionResult;
|
||||
}
|
||||
|
||||
public String getAlertCode() {
|
||||
return this.AlertCode;
|
||||
}
|
||||
|
||||
public String getAlertDescription() {
|
||||
return this.AlertDescription;
|
||||
}
|
||||
|
||||
public String getEncryptedString() {
|
||||
return this.EncryptedString;
|
||||
}
|
||||
|
||||
public String getProtocolServer() {
|
||||
return this.ProtocolAuthServer;
|
||||
}
|
||||
|
||||
public String getDomainName() {
|
||||
return this.DomainName;
|
||||
}
|
||||
|
||||
public boolean Encrypt() {
|
||||
String sErr = "";
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (controlValues(this.ProtocolAuthServer))
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.trans = this.ShopLogin.substring(0, 6);
|
||||
this.trans = this.trans.toLowerCase();
|
||||
if (controlValues(this.DomainName))
|
||||
if (this.trans.equals("gespay")) {
|
||||
this.DomainName = "testecomm.sella.it/CryptHTTP";
|
||||
} else {
|
||||
this.DomainName = "ecomms2s.sella.it/CryptHTTP";
|
||||
}
|
||||
if (this.Currency.length() <= 0) {
|
||||
this.ErrorCode = "552";
|
||||
this.ErrorDescription = "Currency not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.Amount.length() <= 0) {
|
||||
this.ErrorCode = "553";
|
||||
this.ErrorDescription = "Amount not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.ShopTransactionID.length() <= 0) {
|
||||
this.ErrorCode = "551";
|
||||
this.ErrorDescription = "Shop Transaction ID not valid";
|
||||
return false;
|
||||
}
|
||||
this.ToBeEncript = "";
|
||||
if (this.CVV.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_CVV=" + this.CVV;
|
||||
if (this.Min.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_MIN=" + this.Min;
|
||||
if (this.Currency.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_UICCODE=" + this.Currency;
|
||||
if (this.Amount.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_AMOUNT=" + this.Amount;
|
||||
if (this.ShopTransactionID.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_SHOPTRANSACTIONID=" + this.ShopTransactionID;
|
||||
if (this.BuyerName.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_CHNAME=" + this.BuyerName;
|
||||
if (this.BuyerEmail.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_CHEMAIL=" + this.BuyerEmail;
|
||||
if (this.Language.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_IDLANGUAGE=" + this.Language;
|
||||
if (this.CustomInfo.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + this.CustomInfo;
|
||||
String urlString = String.valueOf(this.ProtocolAuthServer) + this.DomainName + "/Encrypt.asp?a=" +
|
||||
this.ShopLogin + "&b=" + this.ToBeEncript.substring(4, this.ToBeEncript.length()) +
|
||||
"&c=" + this.Version;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#cryptstring#");
|
||||
nEnd = line.lastIndexOf("#/cryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 14) ? true : false))
|
||||
this.EncryptedString = line.substring(nStart + 13, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "ServiceException occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Decrypt() {
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
String strdaelim = "";
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (controlValues(this.ProtocolAuthServer))
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.trans = this.ShopLogin.substring(0, 6);
|
||||
this.trans = this.trans.toLowerCase();
|
||||
if (controlValues(this.DomainName))
|
||||
if (this.trans.equals("gespay")) {
|
||||
this.DomainName = "testecomm.sella.it/CryptHTTP";
|
||||
} else {
|
||||
this.DomainName = "ecomms2s.sella.it/CryptHTTP";
|
||||
}
|
||||
if (this.EncryptedString.length() <= 0) {
|
||||
this.ErrorCode = "1009";
|
||||
this.ErrorDescription = "String to Decrypt not valid";
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String urlString = String.valueOf(this.ProtocolAuthServer) + this.DomainName + "/Decrypt.asp?a=" + this.ShopLogin + "&b=" + this.EncryptedString + "&c=" + this.Version;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#decryptstring#");
|
||||
nEnd = line.lastIndexOf("#/decryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 16) ? true : false))
|
||||
this.Decripted = line.substring(nStart + 15, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
String sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
if (this.Decripted.trim() == "") {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Void String";
|
||||
return false;
|
||||
}
|
||||
if (!Parsing(this.Decripted))
|
||||
return false;
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Service Exception occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean Parsing(String StringToBeParsed) {
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
nStart = StringToBeParsed.indexOf("PAY1_UICCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AMOUNT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_SHOPTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHNAME");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHEMAIL");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AUTHORIZATIONCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_BANKTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_COUNTRY");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBVRISP");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBV");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_IDLANGUAGE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_TRANSACTIONRESULT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
this.CustomInfo = StringToBeParsed.trim();
|
||||
} catch (Exception e) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Error parsing String";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String URLDecode(String str) throws Exception {
|
||||
if (str == null)
|
||||
return null;
|
||||
char[] res = new char[str.length()];
|
||||
int didx = 0;
|
||||
for (int sidx = 0; sidx < str.length(); sidx++) {
|
||||
char ch = str.charAt(sidx);
|
||||
if (ch == '+') {
|
||||
res[didx++] = ' ';
|
||||
} else if (ch == '%') {
|
||||
try {
|
||||
res[didx++] =
|
||||
(char)Integer.parseInt(str.substring(sidx + 1, sidx + 3), 16);
|
||||
sidx += 2;
|
||||
} catch (NumberFormatException e) {
|
||||
didx--;
|
||||
res[didx++] = ch;
|
||||
}
|
||||
} else {
|
||||
res[didx++] = ch;
|
||||
}
|
||||
}
|
||||
return String.valueOf(res, 0, didx);
|
||||
}
|
||||
|
||||
protected boolean controlValues(String str) {
|
||||
return !(str != null && str.length() != 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,676 @@
|
|||
package com.ablia.bank.sella;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.UnknownServiceException;
|
||||
|
||||
public class GestPayCrypt20 {
|
||||
private String ShopLogin;
|
||||
|
||||
private String Currency;
|
||||
|
||||
private String Amount;
|
||||
|
||||
private String ShopTransactionID;
|
||||
|
||||
private String BuyerName;
|
||||
|
||||
private String BuyerEmail;
|
||||
|
||||
private String Language;
|
||||
|
||||
private String CustomInfo;
|
||||
|
||||
private String AuthorizationCode;
|
||||
|
||||
private String ErrorCode;
|
||||
|
||||
private String ErrorDescription;
|
||||
|
||||
private String BankTransactionID;
|
||||
|
||||
private String AlertCode;
|
||||
|
||||
private String AlertDescription;
|
||||
|
||||
private String EncryptedString;
|
||||
|
||||
private String ToBeEncript;
|
||||
|
||||
private String Decripted;
|
||||
|
||||
private String TransactionResult;
|
||||
|
||||
private String ProtocolAuthServer = "";
|
||||
|
||||
private String DomainName = "";
|
||||
|
||||
private String separator;
|
||||
|
||||
private String errDescription;
|
||||
|
||||
private String errNumber;
|
||||
|
||||
private String Version = "2.0";
|
||||
|
||||
private String Min = "";
|
||||
|
||||
private String CVV = "";
|
||||
|
||||
private String country = "";
|
||||
|
||||
private String vbvrisp = "";
|
||||
|
||||
private String vbv = "";
|
||||
|
||||
public GestPayCrypt20() {
|
||||
this.ShopLogin = "";
|
||||
this.Currency = "";
|
||||
this.Amount = "";
|
||||
this.ShopTransactionID = "";
|
||||
this.BuyerName = "";
|
||||
this.BuyerEmail = "";
|
||||
this.Language = "";
|
||||
this.CustomInfo = "";
|
||||
this.AuthorizationCode = "";
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
this.BankTransactionID = "";
|
||||
this.AlertCode = "";
|
||||
this.AlertDescription = "";
|
||||
this.EncryptedString = "";
|
||||
this.ToBeEncript = "";
|
||||
this.Decripted = "";
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.DomainName = "ecomm.sella.it/CryptHTTP";
|
||||
this.separator = "*P1*";
|
||||
this.errDescription = "";
|
||||
this.errNumber = "0";
|
||||
this.Min = "";
|
||||
this.CVV = "";
|
||||
this.country = "";
|
||||
this.vbvrisp = "";
|
||||
this.vbv = "";
|
||||
}
|
||||
|
||||
public void SetShopLogin(String xstr) {
|
||||
this.ShopLogin = xstr;
|
||||
}
|
||||
|
||||
public void SetCurrency(String xstr) {
|
||||
this.Currency = xstr;
|
||||
}
|
||||
|
||||
public void SetAmount(String xstr) {
|
||||
this.Amount = xstr;
|
||||
}
|
||||
|
||||
public void SetShopTransactionID(String xstr) {
|
||||
this.ShopTransactionID = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void SetMIN(String xstr) {
|
||||
this.Min = xstr;
|
||||
}
|
||||
|
||||
public void SetCVV(String xstr) {
|
||||
this.CVV = xstr;
|
||||
}
|
||||
|
||||
public void SetBuyerName(String xstr) {
|
||||
this.BuyerName = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void SetBuyerEmail(String xstr) {
|
||||
this.BuyerEmail = xstr.trim();
|
||||
}
|
||||
|
||||
public void SetLanguage(String xstr) {
|
||||
this.Language = xstr.trim();
|
||||
}
|
||||
|
||||
public void SetCustomInfo(String xstr) {
|
||||
this.CustomInfo = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void SetEncryptedString(String xstr) {
|
||||
this.EncryptedString = xstr;
|
||||
}
|
||||
|
||||
public String GetShopLogin() {
|
||||
return this.ShopLogin;
|
||||
}
|
||||
|
||||
public String GetCurrency() {
|
||||
return this.Currency;
|
||||
}
|
||||
|
||||
public String GetAmount() {
|
||||
return this.Amount;
|
||||
}
|
||||
|
||||
public String GetCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public String GetVBV() {
|
||||
return this.vbv;
|
||||
}
|
||||
|
||||
public String GetVBVrisp() {
|
||||
return this.vbvrisp;
|
||||
}
|
||||
|
||||
public String GetShopTransactionID() {
|
||||
String app = "";
|
||||
try {
|
||||
app = URLDecode(this.ShopTransactionID);
|
||||
} catch (Exception e) {}
|
||||
return app;
|
||||
}
|
||||
|
||||
public String GetBuyerName() {
|
||||
String appBuyername = "";
|
||||
try {
|
||||
appBuyername = URLDecode(this.BuyerName);
|
||||
} catch (Exception ex) {
|
||||
appBuyername = "errore";
|
||||
}
|
||||
return appBuyername;
|
||||
}
|
||||
|
||||
public String GetBuyerEmail() {
|
||||
return this.BuyerEmail;
|
||||
}
|
||||
|
||||
public String GetCustomInfo() {
|
||||
String appCustom = "";
|
||||
try {
|
||||
appCustom = URLDecode(this.CustomInfo);
|
||||
} catch (Exception e) {}
|
||||
return appCustom;
|
||||
}
|
||||
|
||||
public String GetAuthorizationCode() {
|
||||
return this.AuthorizationCode;
|
||||
}
|
||||
|
||||
public String GetErrorCode() {
|
||||
return this.ErrorCode;
|
||||
}
|
||||
|
||||
public String GetErrorDescription() {
|
||||
return this.ErrorDescription;
|
||||
}
|
||||
|
||||
public String GetBankTransactionID() {
|
||||
return this.BankTransactionID;
|
||||
}
|
||||
|
||||
public String GetTransactionResult() {
|
||||
return this.TransactionResult;
|
||||
}
|
||||
|
||||
public String GetAlertCode() {
|
||||
return this.AlertCode;
|
||||
}
|
||||
|
||||
public String GetAlertDescription() {
|
||||
return this.AlertDescription;
|
||||
}
|
||||
|
||||
public String GetEncryptedString() {
|
||||
return this.EncryptedString;
|
||||
}
|
||||
|
||||
public boolean Encrypt() {
|
||||
String sErr = "";
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.Currency.length() <= 0) {
|
||||
this.ErrorCode = "552";
|
||||
this.ErrorDescription = "Currency not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.Amount.length() <= 0) {
|
||||
this.ErrorCode = "553";
|
||||
this.ErrorDescription = "Amount not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.ShopTransactionID.length() <= 0) {
|
||||
this.ErrorCode = "551";
|
||||
this.ErrorDescription = "Shop Transaction ID not valid";
|
||||
return false;
|
||||
}
|
||||
this.ToBeEncript = "";
|
||||
if (this.CVV.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_CVV=" + this.CVV;
|
||||
if (this.Min.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_MIN=" + this.Min;
|
||||
if (this.Currency.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_UICCODE=" + this.Currency;
|
||||
if (this.Amount.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_AMOUNT=" + this.Amount;
|
||||
if (this.ShopTransactionID.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_SHOPTRANSACTIONID=" + this.ShopTransactionID;
|
||||
if (this.BuyerName.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_CHNAME=" + this.BuyerName;
|
||||
if (this.BuyerEmail.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_CHEMAIL=" + this.BuyerEmail;
|
||||
if (this.Language.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + "PAY1_IDLANGUAGE=" + this.Language;
|
||||
if (this.CustomInfo.length() > 0)
|
||||
this.ToBeEncript = String.valueOf(this.ToBeEncript) + this.separator + this.CustomInfo;
|
||||
String urlString = String.valueOf(this.ProtocolAuthServer) + this.DomainName + "/Encrypt.asp?a=" + this.ShopLogin + "&b=" + this.ToBeEncript.substring(4, this.ToBeEncript.length()) + "&c=" + this.Version;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#cryptstring#");
|
||||
nEnd = line.lastIndexOf("#/cryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 14) ? true : false))
|
||||
this.EncryptedString = line.substring(nStart + 13, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "ServiceException occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Decrypt() {
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
String strdaelim = "";
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.EncryptedString.length() <= 0) {
|
||||
this.ErrorCode = "1009";
|
||||
this.ErrorDescription = "String to Decrypt not valid";
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String urlString = String.valueOf(this.ProtocolAuthServer) + this.DomainName + "/Decrypt.asp?a=" + this.ShopLogin + "&b=" + this.EncryptedString + "&c=" + this.Version;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#decryptstring#");
|
||||
nEnd = line.lastIndexOf("#/decryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 16) ? true : false))
|
||||
this.Decripted = line.substring(nStart + 15, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
String sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
if (this.Decripted.trim() == "") {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Void String";
|
||||
return false;
|
||||
}
|
||||
if (!Parsing(this.Decripted))
|
||||
return false;
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Service Exception occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean Parsing(String StringToBeParsed) {
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
nStart = StringToBeParsed.indexOf("PAY1_UICCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AMOUNT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_SHOPTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHNAME");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHEMAIL");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AUTHORIZATIONCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_BANKTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_COUNTRY");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBVRISP");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBV");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_IDLANGUAGE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_TRANSACTIONRESULT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = String.valueOf(StringToBeParsed.substring(0, nStart)) + StringToBeParsed.substring(nEnd + 4, StringToBeParsed.length());
|
||||
}
|
||||
}
|
||||
this.CustomInfo = StringToBeParsed.trim();
|
||||
} catch (Exception e) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Error parsing String";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String URLDecode(String str) throws Exception {
|
||||
if (str == null)
|
||||
return null;
|
||||
char[] res = new char[str.length()];
|
||||
int didx = 0;
|
||||
for (int sidx = 0; sidx < str.length(); sidx++) {
|
||||
char ch = str.charAt(sidx);
|
||||
if (ch == '+') {
|
||||
res[didx++] = ' ';
|
||||
} else if (ch == '%') {
|
||||
try {
|
||||
res[didx++] =
|
||||
(char)Integer.parseInt(str.substring(sidx + 1, sidx + 3), 16);
|
||||
sidx += 2;
|
||||
} catch (NumberFormatException e) {
|
||||
didx--;
|
||||
res[didx++] = ch;
|
||||
}
|
||||
} else {
|
||||
res[didx++] = ch;
|
||||
}
|
||||
}
|
||||
return String.valueOf(res, 0, didx);
|
||||
}
|
||||
}
|
||||
189
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/sella/SellaReq.java
Normal file
189
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/sella/SellaReq.java
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
package com.ablia.bank.sella;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
|
||||
public class SellaReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "1";
|
||||
|
||||
public static final String LANG_CODE_EN = "2";
|
||||
|
||||
public static final String LANG_CODE_ES = "3";
|
||||
|
||||
public static final String LANG_CODE_FR = "4";
|
||||
|
||||
public static final String LANG_CODE_DE = "5";
|
||||
|
||||
public static final String DIV_CODE_LIRA = "18";
|
||||
|
||||
public static final String DIV_CODE_EURO = "242";
|
||||
|
||||
public static final String P_COD_ESER_SELLA = "COD_ESER_SELLA";
|
||||
|
||||
public static final String P_SELLA_FULL = "SELLA_FULL";
|
||||
|
||||
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 myshoplogin;
|
||||
|
||||
private String mycurrency;
|
||||
|
||||
private String myamount;
|
||||
|
||||
private String myshoptransactionID;
|
||||
|
||||
private String mybuyername;
|
||||
|
||||
private String mybuyeremail;
|
||||
|
||||
private String mylanguage;
|
||||
|
||||
private String lang;
|
||||
|
||||
private String mycustominfo;
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "SELLA_OK";
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "SELLA_KO";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "1";
|
||||
|
||||
public String getMyamount() {
|
||||
return (this.myamount == null) ? "" : this.myamount;
|
||||
}
|
||||
|
||||
public void setMyamount(String myamount) {
|
||||
this.myamount = myamount;
|
||||
}
|
||||
|
||||
public String getMybuyeremail() {
|
||||
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
|
||||
}
|
||||
|
||||
public void setMybuyeremail(String mybuyeremail) {
|
||||
this.mybuyeremail = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMybuyername() {
|
||||
return (this.mybuyername == null) ? "" : this.mybuyername;
|
||||
}
|
||||
|
||||
public void setMybuyername(String mybuyername) {
|
||||
this.mybuyername = mybuyername;
|
||||
}
|
||||
|
||||
public String getMycurrency() {
|
||||
return (this.mycurrency == null) ? "" : this.mycurrency;
|
||||
}
|
||||
|
||||
public void setMycurrency(String mycurrency) {
|
||||
this.mycurrency = mycurrency;
|
||||
}
|
||||
|
||||
public String getMycustominfo() {
|
||||
return (this.mycustominfo == null) ? "" : this.mycustominfo;
|
||||
}
|
||||
|
||||
public void setMycustominfo(String mycustominfo) {
|
||||
this.mycustominfo = mycustominfo;
|
||||
}
|
||||
|
||||
public String getMylanguage() {
|
||||
if (this.mylanguage == null || this.mylanguage.isEmpty())
|
||||
this.mylanguage = getMylanguageCode();
|
||||
return this.mylanguage;
|
||||
}
|
||||
|
||||
private String getMylanguageCode() {
|
||||
if (getLang().toLowerCase().equals("it"))
|
||||
return "1";
|
||||
if (getLang().toLowerCase().equals("en"))
|
||||
return "2";
|
||||
if (getLang().toLowerCase().equals("es"))
|
||||
return "3";
|
||||
if (getLang().toLowerCase().equals("fr"))
|
||||
return "4";
|
||||
if (getLang().toLowerCase().equals("de"))
|
||||
return "5";
|
||||
return "2";
|
||||
}
|
||||
|
||||
public String getMyshoplogin() {
|
||||
return (this.myshoplogin == null) ? "" : this.myshoplogin;
|
||||
}
|
||||
|
||||
public void setMyshoplogin(String myshoplogin) {
|
||||
this.myshoplogin = myshoplogin;
|
||||
}
|
||||
|
||||
public String getMyshoptransactionID() {
|
||||
return (this.myshoptransactionID == null) ? "" : this.myshoptransactionID;
|
||||
}
|
||||
|
||||
public void setMyshoptransactionID(String myshoptransactionID) {
|
||||
this.myshoptransactionID = myshoptransactionID;
|
||||
}
|
||||
|
||||
public void setMylanguage(String mylanguage) {
|
||||
this.mylanguage = mylanguage;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return (this.lang == null) ? "" : this.lang;
|
||||
}
|
||||
|
||||
public void setLang(String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "PAYPAL";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "SELLA";
|
||||
bean.findByCodice("COD_ESER_SELLA");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_ESER_SELLA");
|
||||
bean.setDescrizione("COD_ESER_SELLA");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE ESERCENTE BANCA SELLA");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_FULL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_FULL");
|
||||
bean.setDescrizione("SELLA_FULL");
|
||||
bean.setFlgTipo(5L);
|
||||
bean.setNota("SPECIFICA SE IL CONTRATTO CON SELLA E' DI TIPO FULL");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_KO");
|
||||
bean.setDescrizione("SELLA_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("SELLA_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_OK");
|
||||
bean.setDescrizione("SELLA_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("SELLA_OK");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
package com.ablia.bank.sella;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
|
||||
public class SellaResp extends _BankAdapter {
|
||||
private String myshoplogin;
|
||||
|
||||
private int mycurrency;
|
||||
|
||||
private float myamount;
|
||||
|
||||
private String myshoptrxID;
|
||||
|
||||
private String mybuyername;
|
||||
|
||||
private String mybuyeremail;
|
||||
|
||||
private String mytrxresult;
|
||||
|
||||
private String myauthcode;
|
||||
|
||||
private String myerrorcode;
|
||||
|
||||
private String myerrordescription;
|
||||
|
||||
private String myerrorbanktrxid;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String myalertcode;
|
||||
|
||||
private String myalertdescription;
|
||||
|
||||
private String mycustominfo;
|
||||
|
||||
public SellaResp() {}
|
||||
|
||||
public SellaResp(GestPayCrypt bean) {
|
||||
fillResponse(bean);
|
||||
}
|
||||
|
||||
public String getMyalertcode() {
|
||||
return (this.myalertcode == null) ? "" : this.myalertcode;
|
||||
}
|
||||
|
||||
public void fillResponse(GestPayCrypt bean) {
|
||||
setMyshoplogin(bean.getShopLogin().trim());
|
||||
if (!bean.getCurrency().isEmpty())
|
||||
setMycurrency(Integer.parseInt(bean.getCurrency()));
|
||||
if (!bean.getAmount().isEmpty())
|
||||
setMyamount(Float.parseFloat(bean.getAmount()));
|
||||
setMyshoptrxID(bean.getShopTransactionID().trim());
|
||||
setMybuyername(bean.getBuyerName().trim());
|
||||
setMybuyeremail(bean.getBuyerEmail().trim());
|
||||
setMytrxresult(bean.getTransactionResult().trim());
|
||||
setMyauthcode(bean.getAuthorizationCode());
|
||||
setMyerrorcode(bean.getErrorCode());
|
||||
setMyerrordescription(bean.getErrorDescription().trim());
|
||||
setMyerrorbanktrxid(bean.getBankTransactionID().trim());
|
||||
setMyalertcode(bean.getAlertCode().trim());
|
||||
setMyalertdescription(bean.getAlertDescription().trim());
|
||||
setMycustominfo(bean.getCustomInfo().trim());
|
||||
if (!bean.getShopTransactionID().isEmpty())
|
||||
setId_ordine(Long.parseLong(bean.getShopTransactionID()));
|
||||
}
|
||||
|
||||
public void setMyalertcode(String myalertcode) {
|
||||
this.myalertcode = myalertcode;
|
||||
}
|
||||
|
||||
public String getMyalertdescription() {
|
||||
return (this.myalertdescription == null) ? "" :
|
||||
this.myalertdescription;
|
||||
}
|
||||
|
||||
public void setMyalertdescription(String myalertdescription) {
|
||||
this.myalertdescription = myalertdescription;
|
||||
}
|
||||
|
||||
public float getMyamount() {
|
||||
return this.myamount;
|
||||
}
|
||||
|
||||
public void setMyamount(float myamount) {
|
||||
this.myamount = myamount;
|
||||
}
|
||||
|
||||
public String getMyauthcode() {
|
||||
return (this.myauthcode == null) ? "" : this.myauthcode;
|
||||
}
|
||||
|
||||
public void setMyauthcode(String myauthcode) {
|
||||
this.myauthcode = myauthcode;
|
||||
}
|
||||
|
||||
public String getMybuyeremail() {
|
||||
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
|
||||
}
|
||||
|
||||
public void setMybuyeremail(String mybuyeremail) {
|
||||
this.mybuyeremail = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMybuyername() {
|
||||
return (this.mybuyername == null) ? "" : this.mybuyername;
|
||||
}
|
||||
|
||||
public void setMybuyername(String mybuyername) {
|
||||
this.mybuyername = mybuyername;
|
||||
}
|
||||
|
||||
public int getMycurrency() {
|
||||
return this.mycurrency;
|
||||
}
|
||||
|
||||
public void setMycurrency(int mycurrency) {
|
||||
this.mycurrency = mycurrency;
|
||||
}
|
||||
|
||||
public String getMycustominfo() {
|
||||
return (this.mycustominfo == null) ? "" : this.mycustominfo;
|
||||
}
|
||||
|
||||
public void setMycustominfo(String mycustominfo) {
|
||||
this.mycustominfo = mycustominfo;
|
||||
}
|
||||
|
||||
public String getMyerrorbanktrxid() {
|
||||
return (this.myerrorbanktrxid == null) ? "" :
|
||||
this.myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public void setMyerrorbanktrxid(String myerrorbanktrxid) {
|
||||
this.myerrorbanktrxid = myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public String getMyerrorcode() {
|
||||
return (this.myerrorcode == null) ? "" : this.myerrorcode;
|
||||
}
|
||||
|
||||
public void setMyerrorcode(String myerrorcode) {
|
||||
this.myerrorcode = myerrorcode;
|
||||
}
|
||||
|
||||
public String getMyerrordescription() {
|
||||
return (this.myerrordescription == null) ? "" :
|
||||
this.myerrordescription;
|
||||
}
|
||||
|
||||
public void setMyerrordescription(String myerrordescription) {
|
||||
this.myerrordescription = myerrordescription;
|
||||
}
|
||||
|
||||
public String getMyshoplogin() {
|
||||
return (this.myshoplogin == null) ? "" : this.myshoplogin;
|
||||
}
|
||||
|
||||
public void setMyshoplogin(String myshoplogin) {
|
||||
this.myshoplogin = myshoplogin;
|
||||
}
|
||||
|
||||
public String getMyshoptrxID() {
|
||||
return (this.myshoptrxID == null) ? "" : this.myshoptrxID;
|
||||
}
|
||||
|
||||
public void setMyshoptrxID(String myshoptrxID) {
|
||||
this.myshoptrxID = myshoptrxID;
|
||||
}
|
||||
|
||||
public String getMytrxresult() {
|
||||
return (this.mytrxresult == null) ? "" : this.mytrxresult;
|
||||
}
|
||||
|
||||
public void setMytrxresult(String mytrxresult) {
|
||||
this.mytrxresult = mytrxresult;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package com.ablia.bank.servlet.consel;
|
||||
|
||||
import com.ablia.bank.consel.ConselReq;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class ConselReqSvlt extends ConselSvlt {
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String conselSite = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp";
|
||||
ConselReq conselReq = new ConselReq(getApFull());
|
||||
fillObject(req, conselReq);
|
||||
caricaConselRequest(req, conselReq);
|
||||
if (getParm("CONSEL_TEST").getNumeroLong() == 1L)
|
||||
caricaDemoRequest(req, conselReq);
|
||||
req.setAttribute("conselReq", conselReq);
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher("/conselReq.jsp");
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void caricaConselRequest(HttpServletRequest paramHttpServletRequest, ConselReq paramConselReq);
|
||||
|
||||
private void caricaDemoRequest(HttpServletRequest req, ConselReq conselReq) {
|
||||
conselReq.setCodfisc("CLMCST80A01D969I");
|
||||
conselReq.setCognome("COLOMBO");
|
||||
conselReq.setNome("CRISTOFORO");
|
||||
conselReq.setData_nascita("01/01/1980");
|
||||
}
|
||||
|
||||
protected void sendRequestOld(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String conselSite = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp";
|
||||
ConselReq conselReq = new ConselReq(getApFull());
|
||||
fillObject(req, conselReq);
|
||||
caricaConselRequest(req, conselReq);
|
||||
if (getParm("TEST").getNumeroLong() == 1L)
|
||||
caricaDemoRequest(req, conselReq);
|
||||
StringBuffer data = new StringBuffer(String.valueOf(URLEncoder.encode("tiposec",
|
||||
"UTF-8")) +
|
||||
"=" +
|
||||
URLEncoder.encode(conselReq.getTipoesec(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("tabfin", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getTabfin(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("convenz", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getConvenz(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("h_merce", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getH_merce(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("h_prod", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getH_prod(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("cognome", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getCognome(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("nome", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getNome(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("ordine", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getOrdine(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("anticipo", "UTF-8") + "=" +
|
||||
conselReq.getAnticipo());
|
||||
data.append("&" + URLEncoder.encode("descr1", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getDescri1(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("parz1", "UTF-8") + "=" +
|
||||
conselReq.getParz1());
|
||||
data.append("&" + URLEncoder.encode("tel_num", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getTel_num(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("pref_num", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getPref_num(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("impspe", "UTF-8") + "=" +
|
||||
conselReq.getImpspe());
|
||||
data.append("&" + URLEncoder.encode("impdafin", "UTF-8") + "=" +
|
||||
conselReq.getImpdafin());
|
||||
data.append("&" + URLEncoder.encode("data_nascita", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getData_nascita(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("indirizzo", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getIndirizzo(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("testomail", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getTestomail(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("codifisc", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getCodfisc(), "UTF-8"));
|
||||
URL url = new URL(conselSite);
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
OutputStreamWriter wr = new OutputStreamWriter(
|
||||
conn.getOutputStream());
|
||||
wr.write(data.toString());
|
||||
wr.flush();
|
||||
BufferedReader rd = new BufferedReader(new InputStreamReader(
|
||||
conn.getInputStream()));
|
||||
ServletOutputStream sos = res.getOutputStream();
|
||||
String line;
|
||||
while ((line = rd.readLine()) != null)
|
||||
sos.write(line.getBytes(), 0, line.length());
|
||||
wr.close();
|
||||
sos.flush();
|
||||
sos.close();
|
||||
rd.close();
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.ablia.bank.servlet.consel;
|
||||
|
||||
import com.ablia.bank.consel.ConselResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class ConselRespSvlt extends ConselSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
manageResponse(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void manageResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
ConselResp conselResp = new ConselResp(getApFull());
|
||||
fillObject(req, conselResp);
|
||||
if (conselResp.getStato().toLowerCase()
|
||||
.equals("OK".toLowerCase()) ||
|
||||
|
||||
conselResp.getStato()
|
||||
.toLowerCase()
|
||||
.equals("WW".toLowerCase())) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
manageConselResponse(req, conselResp);
|
||||
req.setAttribute("/conselReq.jsp", conselResp);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void manageConselResponse(HttpServletRequest paramHttpServletRequest, ConselResp paramConselResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.ablia.bank.servlet.consel;
|
||||
|
||||
import com.ablia.bank.consel.ConselTabfin;
|
||||
import com.ablia.bank.consel.ConselTabfinCR;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ConselSvlt extends AcServlet {
|
||||
protected static final String CONSEL_REQ_JSP = "/conselReq.jsp";
|
||||
|
||||
protected static final String BEAN_CONSEL_REQ = "conselReq";
|
||||
|
||||
protected static final String BEAN_CONSEL_RESP = "/conselReq.jsp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceConvenzione(HttpServletRequest req) {
|
||||
return getParm("COD_CONVENZIONE_CONSEL").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("CONSEL_ERROR_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("CONSEL_OK_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "conselRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("CONSEL_OK_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "conselRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
ConselTabfin ct = new ConselTabfin(getApFull());
|
||||
ConselTabfinCR CR = new ConselTabfinCR();
|
||||
fillObject(req, CR);
|
||||
req.setAttribute("list", ct.findByCR(CR, 0, 0));
|
||||
req.setAttribute("CR", CR);
|
||||
req.setAttribute("nf3", getNf3());
|
||||
setJspPageRelative("tabfin" + CR.getFlgTipo() + getAct(req) + ".jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.ablia.bank.servlet.infogroup;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetShopnetResponseSvlt extends ShopNetSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.ablia.bank.servlet.infogroup;
|
||||
|
||||
import com.ablia.bank.infogroup.ShopnetResp;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class ShopNetSvlt extends AcServlet {
|
||||
protected static final String BEAN_SHOPNETRES = "shopnetResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void fillIdOrdineByShopnetRes(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
ShopnetResp snRes = new ShopnetResp();
|
||||
fillObject(req, snRes);
|
||||
fillIdOrdineByShopnetRes(req, res, snRes);
|
||||
if (snRes.getStato() == 2L) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, snRes);
|
||||
} else {
|
||||
sendMessage(req, "Errore! Transazione annullata.");
|
||||
payKoUpdateOrder(req, res, snRes);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("shopnetResp", snRes);
|
||||
preparePaymenResPage(req, res, snRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Shopnet! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
getResponse(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp);
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {}
|
||||
|
||||
protected abstract void payKoUpdateOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.ablia.bank.servlet.keyclient;
|
||||
|
||||
import com.ablia.bank.keyclient.KeyClientResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetKeyClientResponseSvlt extends KeyClientSvlt {
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, KeyClientResp paramKeyClientResp);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, KeyClientResp paramKeyClientResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
KeyClientResp kcRes = new KeyClientResp();
|
||||
fillObject(req, kcRes);
|
||||
kcRes.setBRAND(getRequestParameter(req, "$BRAND"));
|
||||
if (kcRes.getEsito().equals("OK")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, kcRes);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("KCResp", kcRes);
|
||||
preparePaymenResPage(req, res, kcRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Key Client! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package com.ablia.bank.servlet.keyclient;
|
||||
|
||||
import com.ablia.bank.infogroup.ShopnetResp;
|
||||
import com.ablia.bank.keyclient.KeyClientReq;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class KeyClientSvlt extends AcServlet {
|
||||
protected static final String BEAN_KC_RES = "KCResp";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
try {
|
||||
if (cmd.equals("send")) {
|
||||
sendRequest(req, res);
|
||||
} else if (cmd.equals("res")) {
|
||||
getResponse(req, res);
|
||||
} else {
|
||||
sendRequest(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void payKoUpdateOrder(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String theUrl;
|
||||
KeyClientReq kcReq = new KeyClientReq();
|
||||
fillObject(req, kcReq);
|
||||
kcReq.setKey(getParm("KC_KEY").getTesto());
|
||||
kcReq.setAlias(getParm("KC_ALIAS").getTesto());
|
||||
kcReq.setUrl(getParm("KC_URL_RESPONSE").getTesto());
|
||||
kcReq.setUrl_back(getParm("KC_URL_RESPONSE_NULL")
|
||||
.getTesto());
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
theUrl = kcReq.getTestRequestUrl();
|
||||
} else {
|
||||
theUrl = kcReq.getRequestUrl();
|
||||
System.out.println(theUrl);
|
||||
System.out.println(kcReq.getTestRequestUrl());
|
||||
}
|
||||
if (!theUrl.equals("")) {
|
||||
res.sendRedirect(theUrl);
|
||||
} else {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!KeyClient Svlt! Impossibile creare url di richiesta!";
|
||||
sendMessage(req, temp);
|
||||
getResponse(req, res);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUrlResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_URL_RESPONSE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getUrlResponseNull(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_URL_RESPONSE_NULL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.ablia.bank.servlet.paypal;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GetPayPalResponseSvlt extends PayPalSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getPayerDatails(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,290 @@
|
|||
package com.ablia.bank.servlet.paypal;
|
||||
|
||||
import com.ablia.bank.paypal.PayPalReq;
|
||||
import com.ablia.bank.paypal.PayPalResp;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PayPalSvlt extends AcServlet {
|
||||
public static final String CMD_SET_EXPRESS_CEHCKOUT = "start";
|
||||
|
||||
public static final String CMD_DO_EXPRESS_CEHCKOUT = "dopayment";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_PAYPALRES = "payPalResp";
|
||||
|
||||
private String payPalHttpServer;
|
||||
|
||||
private static final boolean debug = false;
|
||||
|
||||
private String API_VERSION = "98";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void doSetExpressCheckout(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
PayPalReq ppReq = new PayPalReq();
|
||||
fillObject(req, ppReq);
|
||||
String sec = String.valueOf(getRequiredParameterstring()) + "&CURRENCYCODE=" + getCurrency() + "&METHOD=" + "SetExpressCheckout" +
|
||||
"&AMT=" + URLEncoder.encode(String.valueOf(ppReq.getAmt())) + "&RETURNURL=" +
|
||||
URLEncoder.encode(getReturnURL(req, res)) + "&CANCELURL=" + URLEncoder.encode(getCancelURL(req, res)) + "&" +
|
||||
ppReq.getShippingAddressString();
|
||||
String pageStyle = getPageStyle();
|
||||
if (!pageStyle.equals(""))
|
||||
sec = String.valueOf(sec) + "&PAGESTYLE=" + URLEncoder.encode(pageStyle);
|
||||
String urlString = String.valueOf(getPayPalHttpServer(req)) + "?" + sec;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
PayPalResp ppResponse = new PayPalResp();
|
||||
ppResponse.fillResponse(in);
|
||||
ppResponse.setId_ordine(ppReq.getId_ordine());
|
||||
req.getSession().setAttribute("_SESS_ID_ORDER", new Long(ppReq.getId_ordine()));
|
||||
if (ppResponse.isResponseOk()) {
|
||||
String rediretUrl;
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
rediretUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + ppResponse.getTOKEN();
|
||||
} else {
|
||||
rediretUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + ppResponse.getTOKEN();
|
||||
}
|
||||
req.getSession().setAttribute("_SESS_TOKEN", ppResponse.getTOKEN());
|
||||
res.sendRedirect(rediretUrl);
|
||||
} else {
|
||||
req.setAttribute("payPalResp", ppResponse);
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!PayPal Error! Code: " + ppResponse.getL_ERRORCODE0() + ": " + ppResponse.getL_SHORTMESSAGE0() + " " +
|
||||
ppResponse.getL_LONGMESSAGE0();
|
||||
sendMessage(req, temp);
|
||||
preparePaymenResPage(req, res, ppResponse);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getPayerDatails(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String token = (String)req.getSession().getAttribute("_SESS_TOKEN");
|
||||
String sec = String.valueOf(getRequiredParameterstring()) + "&METHOD=" + "GetExpressCheckoutDetails" + "&TOKEN=" + token;
|
||||
String urlString = String.valueOf(getPayPalHttpServer(req)) + "?" + sec;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
PayPalResp ppResponse = new PayPalResp();
|
||||
ppResponse.fillResponse(in);
|
||||
long l_id_ordine = (Long)req.getSession().getAttribute("_SESS_ID_ORDER");
|
||||
ppResponse.setId_ordine(l_id_ordine);
|
||||
fillObject(req, ppResponse);
|
||||
if (ppResponse.isResponseOk() && !ppResponse.getPAYERID().isEmpty()) {
|
||||
ppResponse.setDetailBuyer(true);
|
||||
setJspPageRelative(getJspPayerDetailsPage(req, res), req);
|
||||
} else {
|
||||
if (ppResponse.isResponseOk())
|
||||
sendMessage(req, "Transazione Abbandonata!");
|
||||
ppResponse.setDetailBuyer(false);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("payPalResp", ppResponse);
|
||||
preparePaymenResPage(req, res, ppResponse);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!PayPal Error! getPayerDetail: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void doExpresssCheckout(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
PayPalReq ppReq = new PayPalReq();
|
||||
fillObject(req, ppReq);
|
||||
long l_id_ordine = (Long)req.getSession().getAttribute("_SESS_ID_ORDER");
|
||||
String sec = String.valueOf(getRequiredParameterstring()) + "&CURRENCYCODE=" + getCurrency() + "&METHOD=" +
|
||||
"DoExpressCheckoutPayment" + "&TOKEN=" + ppReq.getTOKEN() + "&AMT=" + ppReq.getAmt() + "&PAYERID=" +
|
||||
ppReq.getPAYERID() + "&PAYMENTACTION=Sale";
|
||||
String urlString = String.valueOf(getPayPalHttpServer(req)) + "?" + sec;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
PayPalResp ppResponse = new PayPalResp();
|
||||
ppResponse.fillResponse(in);
|
||||
ppResponse.setId_ordine(l_id_ordine);
|
||||
fillObject(req, ppResponse);
|
||||
if (ppResponse.isResponseOk()) {
|
||||
ppResponse.setPaymentDone(true);
|
||||
ppResponse.setDetailBuyer(true);
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, ppResponse);
|
||||
} else {
|
||||
ppResponse.setDetailBuyer(false);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("payPalResp", ppResponse);
|
||||
preparePaymenResPage(req, res, ppResponse);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!PayPal Error! getPayerDetail: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspPayerDetailsPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_DETAIL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getReturnURL(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_RETURNURL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://localhost:8080/mrcocci/PayPalResp.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getCancelURL(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_CANCELURL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://localhost:8080/mrcocci/PayPalResp.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
if (cmd.equals("start")) {
|
||||
doSetExpressCheckout(req, res);
|
||||
} else if (cmd.equals("res")) {
|
||||
getPayerDatails(req, res);
|
||||
} else if (cmd.equals("dopayment")) {
|
||||
doExpresssCheckout(req, res);
|
||||
} else {
|
||||
doSetExpressCheckout(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isApiCertificate(HttpServletRequest req) {
|
||||
long temp = getParm("PAYPAL_USE_CERTIFICATE").getNumeroLong();
|
||||
if (temp == 1L)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {}
|
||||
|
||||
private String getPayPalHttpServer(HttpServletRequest req) {
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
System.out.println("PAYPAL TEST!!!! USING SANDBOX");
|
||||
if (isApiCertificate(req)) {
|
||||
this.payPalHttpServer = "https://api.sandbox.paypal.com/nvp";
|
||||
} else {
|
||||
this.payPalHttpServer = "https://api-aa-3t.sandbox.paypal.com/nvp";
|
||||
}
|
||||
} else if (isApiCertificate(req)) {
|
||||
this.payPalHttpServer = "https://api.paypal.com/nvp";
|
||||
} else {
|
||||
this.payPalHttpServer = "https://api-3t.paypal.com/nvp";
|
||||
}
|
||||
return this.payPalHttpServer;
|
||||
}
|
||||
|
||||
public void setPayPalHttpServer(String payPalHttpServer) {
|
||||
this.payPalHttpServer = payPalHttpServer;
|
||||
}
|
||||
|
||||
private String getRequiredParameterstring() {
|
||||
return "USER=" + getApiUsername() + "&PWD=" + getApiPassword() + "&SIGNATURE=" + getApiSignature() + "&VERSION=" + this.API_VERSION;
|
||||
}
|
||||
|
||||
protected String getApiPassword() {
|
||||
String temp = getParm("PAYPAL_API_PWD").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "1196089261";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getApiSignature() {
|
||||
String temp = getParm("PAYPAL_API_SIGNATURE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "AGAgVmHK8-QsvPbEGnNP6SiFg7qvADQfsLa6GrW8G43-yqX46vNyyZzG";
|
||||
return temp;
|
||||
}
|
||||
|
||||
private String getPageStyle() {
|
||||
String temp = getParm("PAYPAL_PAGE_STYLE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getApiUsername() {
|
||||
String temp = getParm("PAYPAL_API_USERNAME").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "acolzi_1196089239_biz_api1.ablia.com";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getCurrency() {
|
||||
String temp = getParm("PAYPAL_CURRENCY").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "EUR";
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.ablia.bank.servlet.poste;
|
||||
|
||||
import com.ablia.bank.poste.PeResp;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetPeResponseSvlt extends PeSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
ServletOutputStream sout = res.getOutputStream();
|
||||
PeResp peResp = new PeResp();
|
||||
fillObject(req, peResp);
|
||||
peResp.setError(req.getParameter("Error"));
|
||||
peResp.setErrorText(req.getParameter("ErrorText"));
|
||||
peResp.setId_ordine(Long.valueOf(peResp.getTrackid()).longValue());
|
||||
String resultUrl = "REDIRECT=" +
|
||||
getParm("PE_URL_REDIRECT_RESULT").getTesto();
|
||||
if ((peResp.getError() == null || peResp.getError().equals("")) && (
|
||||
peResp.getErrorCode() == null || peResp.getErrorCode()
|
||||
.equals("")) &&
|
||||
peResp.getTranid() != null &&
|
||||
!peResp.getTranid().equals("") &&
|
||||
peResp.getResult() != null && peResp.getResult()
|
||||
.equals("APPROVED")) {
|
||||
recordOrder(req, res, peResp);
|
||||
resultUrl = String.valueOf(resultUrl) + "?result=" +
|
||||
peResp.getResult() + "&paymentid=" +
|
||||
peResp.getPaymentid() + "&trackid=" +
|
||||
peResp.getTrackid() + "&tranid=" + peResp.getTranid() +
|
||||
"&error=" + peResp.getError() + "&errorText=" +
|
||||
peResp.getErrorText() + "&errorCode=" +
|
||||
peResp.getErrorCode() + "&errorService=" +
|
||||
peResp.getErrorService();
|
||||
} else {
|
||||
resultUrl = String.valueOf(resultUrl) + "?result=" +
|
||||
peResp.getResult() + "&paymentid=" +
|
||||
peResp.getPaymentid() + "&trackid=" +
|
||||
peResp.getTrackid() + "&tranid=" + peResp.getTranid() +
|
||||
"&error=" + peResp.getError() + "&errorText=" +
|
||||
peResp.getErrorText() + "&errorCode=" +
|
||||
peResp.getErrorCode() + "&errorService=" +
|
||||
peResp.getErrorService();
|
||||
}
|
||||
sout.print(resultUrl);
|
||||
sout.flush();
|
||||
sout.close();
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Post Ecommerce! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
setJspPageRelative(getParm("PE_PAY_KO").getTesto(),
|
||||
req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, PeResp paramPeResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
package com.ablia.bank.servlet.poste;
|
||||
|
||||
import com.ablia.bank.poste.PeReq;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import com.aciworldwide.commerce.gateway.plugins.e24PaymentPipe;
|
||||
import it.netsw.apps.igfs.cg.coms.plugins.IGFSInit;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PeSvlt extends AcServlet {
|
||||
protected static final String BEAN_PE_RES = "peResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getParm("PE_USE_IGFS").getNumeroLong() == 1L) {
|
||||
sendRequestIGFS(req, res);
|
||||
} else {
|
||||
try {
|
||||
e24PaymentPipe pipe = new e24PaymentPipe();
|
||||
PeReq peReq = new PeReq();
|
||||
fillObject(req, peReq);
|
||||
peReq.setResponseURL(getParm("PE_URL_POST_RESPONSE")
|
||||
.getTesto());
|
||||
peReq.setErrorURL(getParm("URL_POST_RESPONSE_ERROR")
|
||||
.getTesto());
|
||||
peReq.setMerchantId(getParm("PE_MERCHANT_ID").getTesto());
|
||||
peReq.setResourcePath(getParm("PE_RESOURCE_PATH").getTesto());
|
||||
String temp = getRequestParameter(req, "flgTipoPagamentoPe");
|
||||
if (temp.isEmpty()) {
|
||||
peReq.setFlgTipoPagamentoPe("03");
|
||||
} else {
|
||||
peReq.setFlgTipoPagamentoPe(temp);
|
||||
}
|
||||
pipe.setAlias(peReq.getAlias());
|
||||
pipe.setResourcePath(peReq.getResourcePath());
|
||||
pipe.setAction(peReq.getAction());
|
||||
pipe.setCurrency(peReq.getCurrency());
|
||||
pipe.setAmt(peReq.getAmt());
|
||||
pipe.setLanguage(peReq.getLanguage());
|
||||
pipe.setResponseURL(URLEncoder.encode(peReq.getResponseURL(),
|
||||
"UTF-8"));
|
||||
pipe.setErrorURL(URLEncoder.encode(peReq.getErrorURL(), "UTF-8"));
|
||||
pipe.setTrackId(peReq.getTrackId());
|
||||
if (pipe.performPaymentInitialization() != 0) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
temp = "ERRORE!!e24PaymentPipe Error! Code: " +
|
||||
pipe.getErrorMsg();
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
String payID = pipe.getPaymentId();
|
||||
String payURL = pipe.getPaymentPage();
|
||||
String userid = URLEncoder.encode(peReq.getUserName(),
|
||||
"UTF-8");
|
||||
res.sendRedirect(String.valueOf(payURL) + "?PaymentID=" + payID +
|
||||
"&hppUserName=" + userid);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceEsercente(HttpServletRequest req) {
|
||||
return getParm("PE_RESOURCE_PATH").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PE_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PE_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PE_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void sendRequestIGFS(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
IGFSInit pipe = new IGFSInit();
|
||||
PeReq peReq = new PeReq();
|
||||
fillObject(req, peReq);
|
||||
peReq.setResponseURL(getParm("PE_URL_POST_RESPONSE").getTesto());
|
||||
peReq.setErrorURL(getParm("URL_POST_RESPONSE_ERROR")
|
||||
.getTesto());
|
||||
peReq.setMerchantId(getParm("PE_MERCHANT_ID").getTesto());
|
||||
peReq.setResourcePath(getParm("PE_RESOURCE_PATH").getTesto());
|
||||
String temp = getRequestParameter(req, "flgTipoPagamentoPe");
|
||||
if (temp.isEmpty()) {
|
||||
peReq.setFlgTipoPagamentoPe("03");
|
||||
} else {
|
||||
peReq.setFlgTipoPagamentoPe(temp);
|
||||
}
|
||||
pipe.setResourcePath(peReq.getResourcePath());
|
||||
pipe.setAlias(peReq.getAlias());
|
||||
pipe.setAction(peReq.getAction());
|
||||
pipe.setCurrency(peReq.getCurrency());
|
||||
pipe.setAmt(peReq.getAmt());
|
||||
pipe.setLanguage("ITA");
|
||||
pipe.setLanguage(peReq.getLanguage());
|
||||
pipe.setResponseURL(peReq.getResponseURL());
|
||||
pipe.setErrorURL(peReq.getErrorURL());
|
||||
pipe.setTrackId(peReq.getTrackId());
|
||||
pipe.setShopUserRef(peReq.getTrackId());
|
||||
if (getParm("PE_NO_CERTIFICATO").getNumeroLong() == 1L)
|
||||
pipe.disableCheckSSLCert();
|
||||
if (!pipe.execute()) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
temp = "ERRORE!!IGFSInit Error! Code: " + pipe.getErrorMsg();
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
String payURL = pipe.getPaymentURL();
|
||||
String payID = pipe.getPaymentId();
|
||||
String userid = URLEncoder.encode(peReq.getUserName(), "UTF-8");
|
||||
res.sendRedirect(payURL);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.ablia.bank.servlet.poste;
|
||||
|
||||
import com.ablia.bank.poste.PeResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class PrepareOutPeSvlt extends PeSvlt {
|
||||
protected static final String CMD_LAST_STEP = "res";
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
prepareOutput(req, res);
|
||||
}
|
||||
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, PeResp paramPeResp);
|
||||
|
||||
protected void prepareOutput(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getParm("PE_USE_IGFS").getNumeroLong() == 1L) {
|
||||
prepareOutputIGFS(req, res);
|
||||
} else {
|
||||
try {
|
||||
PeResp peResp = new PeResp();
|
||||
fillObject(req, peResp);
|
||||
if (peResp.getResult().equals("APPROVED")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
forceMessage(req, "L'ordine è stato pagato regolarmente.");
|
||||
} else {
|
||||
forceMessage(req,
|
||||
"ERRORE POSTECOMMERCE!. Il pagamento non è andato a buon fine.");
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
if (!peResp.getTrackid().isEmpty())
|
||||
peResp.setId_ordine(Long.valueOf(peResp.getTrackid())
|
||||
.longValue());
|
||||
req.setAttribute("peResp", peResp);
|
||||
preparePaymenResPage(req, res, peResp);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Post Ecommerce! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void prepareOutputIGFS(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
PeResp peResp = new PeResp();
|
||||
fillObject(req, peResp);
|
||||
if (peResp.getResult().equals("APPROVED")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
forceMessage(req, "L'ordine è stato pagato regolarmente.");
|
||||
} else {
|
||||
forceMessage(req,
|
||||
"ERRORE POSTECOMMERCE!. Il pagamento non è andato a buon fine.");
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
if (!peResp.getTrackid().isEmpty())
|
||||
peResp.setId_ordine(Long.valueOf(peResp.getTrackid())
|
||||
.longValue());
|
||||
req.setAttribute("peResp", peResp);
|
||||
preparePaymenResPage(req, res, peResp);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Post Ecommerce! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.ablia.bank.servlet.poste2019;
|
||||
|
||||
import com.ablia.bank.poste2019.PosteRes;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetPosteResponseMESvlt extends PosteSvlt {
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, PosteRes paramPosteRes);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, PosteRes paramPosteRes);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
PosteRes posteRes = new PosteRes();
|
||||
fillObject(req, posteRes);
|
||||
if (posteRes.getESITO().equals("00")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, posteRes);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("KCResp", posteRes);
|
||||
preparePaymenResPage(req, res, posteRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Key Client! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.ablia.bank.servlet.poste2019;
|
||||
|
||||
import com.ablia.bank.poste2019.PosteRes;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetPosteResponseSvlt extends PosteSvlt {
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, PosteRes paramPosteRes);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, PosteRes paramPosteRes);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
PosteRes posteRes = new PosteRes();
|
||||
fillObject(req, posteRes);
|
||||
if (posteRes.getESITO().equals("00")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, posteRes);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("KCResp", posteRes);
|
||||
preparePaymenResPage(req, res, posteRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Key Client! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
package com.ablia.bank.servlet.poste2019;
|
||||
|
||||
import com.ablia.bank.infogroup.ShopnetResp;
|
||||
import com.ablia.bank.poste2019.PosteReq;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PosteSvlt extends AcServlet {
|
||||
protected static final String BEAN_KC_RES = "KCResp";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
try {
|
||||
if (cmd.equals("send")) {
|
||||
sendRequest(req, res);
|
||||
} else if (cmd.equals("res")) {
|
||||
getResponse(req, res);
|
||||
} else {
|
||||
sendRequest(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void payKoUpdateOrder(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String theUrl;
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
PosteReq sendReq = new PosteReq(apFull);
|
||||
fillObject(req, sendReq);
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
theUrl = sendReq.getTestRequestUrl();
|
||||
} else {
|
||||
theUrl = sendReq.getTestRequestUrl();
|
||||
}
|
||||
if (!theUrl.equals("")) {
|
||||
res.sendRedirect(theUrl);
|
||||
} else {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!POSTE Svlt! Impossibile creare url di richiesta!";
|
||||
sendMessage(req, temp);
|
||||
getResponse(req, res);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUrlResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_URL_RESPONSE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getUrlResponseNull(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_URL_RESPONSE_NULL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.ablia.bank.servlet.sella;
|
||||
|
||||
import com.ablia.bank.sella.GestPayCrypt;
|
||||
import com.ablia.bank.sella.SellaResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetSellaResponseSvlt extends SellaSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
GestPayCrypt objCrypt = new GestPayCrypt();
|
||||
String a = req.getParameter("a");
|
||||
String b = req.getParameter("b");
|
||||
a = a.trim();
|
||||
b = b.trim();
|
||||
GestPayCrypt objdeCrypt = new GestPayCrypt();
|
||||
objdeCrypt.setShopLogin(a);
|
||||
objdeCrypt.setEncryptedString(b);
|
||||
objdeCrypt.Decrypt();
|
||||
SellaResp sellaRes = new SellaResp(objdeCrypt);
|
||||
if (sellaRes.getMyerrorcode().equals("0")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, sellaRes);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("sellaResp", sellaRes);
|
||||
preparePaymenResPage(req, res, sellaRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!GestPay Error! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SellaResp paramSellaResp);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SellaResp paramSellaResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.ablia.bank.servlet.sella;
|
||||
|
||||
import com.ablia.bank.sella.GestPayCrypt;
|
||||
import com.ablia.bank.sella.SellaReq;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class SellaSvlt extends AcServlet {
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_SELLA_RES = "sellaResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
GestPayCrypt objCrypt = new GestPayCrypt();
|
||||
SellaReq sellareq = new SellaReq();
|
||||
fillObject(req, sellareq);
|
||||
objCrypt.setShopLogin(getCodiceEsercente(req));
|
||||
objCrypt.setCurrency(sellareq.getMycurrency());
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
objCrypt.setAmount("0.12");
|
||||
} else {
|
||||
objCrypt.setAmount(sellareq.getMyamount());
|
||||
}
|
||||
objCrypt.setShopTransactionID(sellareq.getMyshoptransactionID());
|
||||
if (getParm("SELLA_FULL").isTrue()) {
|
||||
if (!sellareq.getMybuyername().isEmpty())
|
||||
objCrypt.setBuyerName(sellareq.getMybuyername());
|
||||
if (!sellareq.getMybuyeremail().isEmpty())
|
||||
objCrypt.setBuyerEmail(sellareq.getMybuyeremail());
|
||||
if (!sellareq.getMylanguage().isEmpty())
|
||||
objCrypt.setLanguage(sellareq.getMylanguage());
|
||||
if (!sellareq.getMycustominfo().isEmpty())
|
||||
objCrypt.setCustomInfo(sellareq.getMycustominfo());
|
||||
}
|
||||
String tempX = "cod eserc.: " + objCrypt.getShopLogin() + " curr:" + objCrypt.getCurrency() + " amount:" + objCrypt.getAmount() +
|
||||
" shoptranid:" + objCrypt.getShopTransactionID() + " buyername:" + objCrypt.getBuyerName() + " buyeremail:" +
|
||||
objCrypt.getBuyerEmail() + " lang:" + sellareq.getMylanguage() + " custinfo:" + objCrypt.getCustomInfo();
|
||||
System.out.println("SELLA:SENDREQUEST ENCRYPT: " + tempX);
|
||||
objCrypt.Encrypt();
|
||||
String b = "";
|
||||
String a = "";
|
||||
if (objCrypt.getErrorCode().equals("0")) {
|
||||
String sellaSite;
|
||||
b = objCrypt.getEncryptedString();
|
||||
a = objCrypt.getShopLogin();
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
sellaSite = "testecomm.sella.it";
|
||||
} else {
|
||||
sellaSite = "ecomm.sella.it";
|
||||
}
|
||||
String requestPage = "https://" + sellaSite + "/gestpay/pagam.asp?a=" + a + "&b=" + b;
|
||||
res.sendRedirect(requestPage);
|
||||
} else {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!GestPay Error! Code: " + objCrypt.getErrorCode() + ": " + objCrypt.getErrorDescription();
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceEsercente(HttpServletRequest req) {
|
||||
return getParm("COD_ESER_SELLA").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
package com.ablia.bank.servlet.setefi;
|
||||
|
||||
import com.ablia.bank.setefi.SetefiReq;
|
||||
import com.ablia.bank.setefi.SetefiResp;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class MonetaOnlineSvlt extends AcServlet {
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getResponsePage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("MONETAONLINE_RESPONSE_PAGE")
|
||||
.getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://www.miodominio.it/xxx_response-#-@.html";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
if (cmd.equals("send")) {
|
||||
sendRequest(req, res);
|
||||
} else if (getCmd(req).equals("risultato") ||
|
||||
getCmd(req).equals("result")) {
|
||||
preparePaymentResultPage(req, res);
|
||||
setJspPage(getResponseJsp(req, res), req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
boolean testMode = (getParm("TEST").getNumeroInt() == 1);
|
||||
SetefiReq setefiReq = new SetefiReq();
|
||||
fillObject(req, setefiReq);
|
||||
String theUrl = "https://test.monetaonline.it/monetaweb/hosted/init/http";
|
||||
if (testMode) {
|
||||
theUrl = "https://test.monetaonline.it/monetaweb/hosted/init/http";
|
||||
setefiReq.setId(getParm("MONETAONLINE_ID").getTesto());
|
||||
setefiReq.setPassword(getParm("MONETAONLINE_PASSWORD")
|
||||
.getTesto());
|
||||
} else {
|
||||
setefiReq.setId("99999999");
|
||||
setefiReq.setPassword("99999999");
|
||||
}
|
||||
setefiReq.setResponseurl(getResponseUrl(req, res));
|
||||
String rawData = setefiReq.getRawdata();
|
||||
if (!rawData.equals("")) {
|
||||
String type = "application/x-www-form-urlencoded";
|
||||
String encodedData = rawData;
|
||||
URL u = new URL("https://test.monetaonline.it/monetaweb/hosted/init/http");
|
||||
HttpURLConnection conn = (HttpURLConnection)u.openConnection();
|
||||
conn.setDoInput(true);
|
||||
conn.setDoOutput(true);
|
||||
conn.setUseCaches(false);
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-Type", type);
|
||||
conn.setRequestProperty("Content-Length",
|
||||
String.valueOf(encodedData.length()));
|
||||
conn.connect();
|
||||
DataOutputStream os = new DataOutputStream(
|
||||
conn.getOutputStream());
|
||||
os.writeBytes(encodedData);
|
||||
os.flush();
|
||||
os.close();
|
||||
BufferedReader read = new BufferedReader(new InputStreamReader(
|
||||
conn.getInputStream()));
|
||||
String line = read.readLine();
|
||||
String html = "";
|
||||
while (line != null) {
|
||||
html = String.valueOf(html) + line;
|
||||
line = read.readLine();
|
||||
}
|
||||
int idx2dot = html.indexOf(":");
|
||||
String paymentId = html.substring(0, html.indexOf(":"));
|
||||
String url = html.substring(idx2dot + 1, html.length());
|
||||
String paymentUrl = String.valueOf(url) + "?paymentid=" + paymentId;
|
||||
System.out.println(paymentUrl);
|
||||
ResParm rp = recordPaymentId(req, res, paymentId);
|
||||
if (rp.getStatus()) {
|
||||
res.sendRedirect(paymentUrl);
|
||||
} else {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
getResponse(req, res);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
String temp = "ERRORE!!MonetaOnline Svlt! Impossibile creare url di richiesta!";
|
||||
sendMessage(req, temp);
|
||||
getResponse(req, res);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getResponseJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("MONETAONLINE_RESPONSE_JSP").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "/payResMO.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected abstract ResParm recordPaymentId(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString);
|
||||
|
||||
protected String getResponseUrl(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("MONETAONLINE_RESPONSE_URL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://www.miodoninio.it/RicevutaMO.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected abstract void preparePaymentResultPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse);
|
||||
|
||||
protected abstract void checkPaymentId(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SetefiResp paramSetefiResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
req.setAttribute("responsecode", "000");
|
||||
req.setAttribute("result", "Accepted");
|
||||
req.setAttribute("trackid", "6");
|
||||
req.setAttribute("paymentid", "316061656072333389");
|
||||
req.setAttribute("tranid", "316061656072333389");
|
||||
SetefiResp setefiResp = new SetefiResp();
|
||||
fillObject(req, setefiResp);
|
||||
checkPaymentId(req, res, setefiResp);
|
||||
String theUrl = getResponsePage(req, res).replace("#",
|
||||
setefiResp.getTrackid());
|
||||
theUrl = theUrl.replace("@",
|
||||
String.valueOf(setefiResp.getPaymentid()));
|
||||
System.out.println("redirect url :" + theUrl);
|
||||
sendHtmlMsgResponse(req, res, "redirect=" + theUrl);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
String temp = "ERRORE!!MONETAONLINE ! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
setJspPage(getResponsePage(req, res), req);
|
||||
callJsp(req, res);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.ablia.bank.servlet.xpay;
|
||||
|
||||
import com.ablia.bank.xpay.XpayResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetXpayResponseSvlt extends XpaySvlt {
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
XpayResp xpRes = new XpayResp(getApFull(req));
|
||||
fillObject(req, xpRes);
|
||||
xpRes.setBRAND(getRequestParameter(req, "$BRAND"));
|
||||
if (xpRes.isMacRitornoOk()) {
|
||||
if (xpRes.getEsito() != null && xpRes.getEsito().equals("OK")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, xpRes);
|
||||
req.setAttribute("XPAYResp", xpRes);
|
||||
preparePaymenResPage(req, res, xpRes);
|
||||
} else {
|
||||
preparePaymenResPage(req, res, xpRes);
|
||||
resetId_documentoXpay(req, res, xpRes);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
xpRes.setEsito("KO");
|
||||
preparePaymenResPage(req, res, xpRes);
|
||||
resetId_documentoXpay(req, res, xpRes);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
sendMessage(req, "ATTENZIONE!! Codice mac di controllo errato.");
|
||||
req.setAttribute("XPAYResp", xpRes);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!XPAY ! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
|
||||
protected void prepareSendRequest(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected abstract void resetId_documentoXpay(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.ablia.bank.servlet.xpay;
|
||||
|
||||
import com.ablia.bank.infogroup.ShopnetResp;
|
||||
import com.ablia.bank.xpay.XpayReq;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class XpaySvlt extends AcServlet {
|
||||
protected static final String BEAN_XPAY_RES = "XPAYResp";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
try {
|
||||
if (cmd.equals("send")) {
|
||||
sendRequest(req, res);
|
||||
} else if (cmd.equals("res")) {
|
||||
getResponse(req, res);
|
||||
} else {
|
||||
sendRequest(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void payKoUpdateOrder(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String theUrl;
|
||||
prepareSendRequest(req, res);
|
||||
XpayReq xpayReq = new XpayReq(getApFull(req));
|
||||
fillObject(req, xpayReq);
|
||||
if (getParm("TEST").isTrue()) {
|
||||
theUrl = xpayReq.getTestRequestUrl();
|
||||
} else {
|
||||
theUrl = xpayReq.getRequestUrl();
|
||||
}
|
||||
System.out.println(theUrl);
|
||||
if (!theUrl.equals("")) {
|
||||
res.sendRedirect(theUrl);
|
||||
} else {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!XPAY Svlt! Impossibile creare url di richiesta!";
|
||||
sendMessage(req, temp);
|
||||
getResponse(req, res);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUrlResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_URL_RESPONSE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getUrlResponseNull(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_URL_RESPONSE_NULL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected abstract void prepareSendRequest(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse);
|
||||
}
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
package com.ablia.bank.setefi;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
|
||||
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) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "MONETAONLINE";
|
||||
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<BR>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<BR> 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<br>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 <br>/payResMO.jsp.<br> 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 <br>http://www.nomedominio.it/xxx_result-#-@.html.<br> si userà una regola di rewrite rule dove # è il trackid mentre @ +è il paymentid<br>Esempio rewrite rule:<br>result,PayMO.abl,result,,@id_astaUtente@paymentid");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
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(String.valueOf(getTitolareCarta()) + ";" + getEmail());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return (this.divisa == null) ? "" : this.divisa.trim();
|
||||
}
|
||||
|
||||
public void setDivisa(String divisa) {
|
||||
this.divisa = divisa;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.ablia.bank.setefi;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
|
||||
public class SetefiResp extends _BankAdapter {
|
||||
private String trackid;
|
||||
|
||||
private String paymentid;
|
||||
|
||||
private String udf3;
|
||||
|
||||
private String udf1;
|
||||
|
||||
private String result;
|
||||
|
||||
private String auth;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String responsecode;
|
||||
|
||||
private String tranid;
|
||||
|
||||
private String udf4;
|
||||
|
||||
private String udf2;
|
||||
|
||||
public String getResponsecode() {
|
||||
return (this.responsecode == null) ? "" : this.responsecode;
|
||||
}
|
||||
|
||||
public void setResponsecode(String myalertcode) {
|
||||
this.responsecode = myalertcode;
|
||||
}
|
||||
|
||||
public String getTranid() {
|
||||
return (this.tranid == null) ? "" : this.tranid;
|
||||
}
|
||||
|
||||
public void setTranid(String myalertdescription) {
|
||||
this.tranid = myalertdescription;
|
||||
}
|
||||
|
||||
public String getAuth() {
|
||||
return (this.auth == null) ? "" : this.auth;
|
||||
}
|
||||
|
||||
public void setAuth(String myauthcode) {
|
||||
this.auth = myauthcode;
|
||||
}
|
||||
|
||||
public String getUdf2() {
|
||||
return (this.udf2 == null) ? "" : this.udf2;
|
||||
}
|
||||
|
||||
public void setUdf2(String mybuyeremail) {
|
||||
this.udf2 = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getUdf3() {
|
||||
return (this.udf3 == null) ? "" : this.udf3;
|
||||
}
|
||||
|
||||
public void setUdf3(String mybuyername) {
|
||||
this.udf3 = mybuyername;
|
||||
}
|
||||
|
||||
public String getTrackid() {
|
||||
return (this.trackid == null) ? "" : this.trackid;
|
||||
}
|
||||
|
||||
public void setTrackid(String myshoplogin) {
|
||||
this.trackid = myshoplogin;
|
||||
}
|
||||
|
||||
public String getPaymentid() {
|
||||
return this.paymentid;
|
||||
}
|
||||
|
||||
public void setPaymentid(String myshoptrxID) {
|
||||
this.paymentid = myshoptrxID;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return (this.result == null) ? "" : this.result;
|
||||
}
|
||||
|
||||
public void setResult(String mytrxresult) {
|
||||
this.result = mytrxresult;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getUdf1() {
|
||||
return (this.udf1 == null) ? "" : this.udf1;
|
||||
}
|
||||
|
||||
public void setUdf1(String udf1) {
|
||||
this.udf1 = udf1;
|
||||
}
|
||||
|
||||
public String getUdf4() {
|
||||
return (this.udf4 == null) ? "" : this.udf4;
|
||||
}
|
||||
|
||||
public void setUdf4(String udf4) {
|
||||
this.udf4 = udf4;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Bank_02_00_121213
|
||||
12-12-2013 aggiustato paypal. Ultima versione su iperaste
|
||||
26-11-2013 aggiunto setefi
|
||||
13-05-2013 aggiunto rate0 su consel
|
||||
26-03-2013 aggiunto DESC su paypalreq
|
||||
24-01-2013 xpay\n
|
||||
14-12-2012 nuovo form consel\n
|
||||
334
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/xpay/XpayReq.java
Normal file
334
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/xpay/XpayReq.java
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
package com.ablia.bank.xpay;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.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 = String.valueOf(temp) + "00";
|
||||
} else if (temp.length() - temp.indexOf('.') < 3) {
|
||||
temp = String.valueOf(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) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "XPAY";
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
186
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/xpay/XpayResp.java
Normal file
186
rus/WEB-INF/lib/abliaBank_src/com/ablia/bank/xpay/XpayResp.java
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
package com.ablia.bank.xpay;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.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();
|
||||
}
|
||||
}
|
||||
134
rus/WEB-INF/lib/abliaBank_src/com/ablia/gtbill/GTBillReq.java
Normal file
134
rus/WEB-INF/lib/abliaBank_src/com/ablia/gtbill/GTBillReq.java
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
package com.ablia.gtbill;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
|
||||
public class GTBillReq extends _BankAdapter {
|
||||
public static final String P_GTBILL_MERCHANT_ID = "GTBILL_MERCHANT_ID";
|
||||
|
||||
public static final String P_GTBILL_SITE_ID = "GTBILL_SITE_ID";
|
||||
|
||||
public static final String P_GTBILL_RETURN_URL = "GTBILL_RETURN_URL";
|
||||
|
||||
public static final String DIV_CODE_EURO = "EUR";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "USD";
|
||||
|
||||
public static final String DIV_CODE_STERLINE = "GBP";
|
||||
|
||||
public static final String DIV_CODE_CAN = "CAD";
|
||||
|
||||
public static final String DIV_CODE_REAL = "234";
|
||||
|
||||
private String mycurrencyid;
|
||||
|
||||
private String myamounttotal;
|
||||
|
||||
private String myamountshipping;
|
||||
|
||||
private String myitemname;
|
||||
|
||||
private String myitemquantity;
|
||||
|
||||
private String myitemamount;
|
||||
|
||||
private String myitemdesc;
|
||||
|
||||
public static final String FORM_URL_POST = "https://sale.GTBill.com/quickpay.aspx";
|
||||
|
||||
public static final String PROG_LANG_URL_POST = "https://sale.GTBill.com/quickpay2.aspx";
|
||||
|
||||
public static final String PROG_LANG_URL_POST_REDIRECT = "https://sale.GTBill.com/quickpay.aspx?refid=";
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
Parm bean = new Parm(ap);
|
||||
String l_tipoParm = "GTBILL";
|
||||
bean.findByCodice("GTBILL_MERCHANT_ID");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("GTBILL_MERCHANT_ID");
|
||||
bean.setDescrizione("GTBILL_MERCHANT_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("MERCHANT ID ASSEGNATO DALLA BANCA");
|
||||
bean.save();
|
||||
bean.findByCodice("GTBILL_SITE_ID");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("GTBILL_SITE_ID");
|
||||
bean.setDescrizione("GTBILL_SITE_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("SITE ID ASSEGNATO DALLA BANCA");
|
||||
bean.save();
|
||||
bean.findByCodice("GTBILL_RETURN_URL");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("GTBILL_RETURN_URL");
|
||||
bean.setDescrizione("GTBILL_RETURN_URL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("URL AL QUALE SI DEVE RITORNARE DOPO IL PAGAMENTO");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public String getMyamounttotal() {
|
||||
return (this.myamounttotal == null) ? "" :
|
||||
this.myamounttotal.replace(".", ",").replace(",", ".");
|
||||
}
|
||||
|
||||
public void setMyamounttotal(String myamount) {
|
||||
this.myamounttotal = myamount;
|
||||
}
|
||||
|
||||
public String getMycurrencyid() {
|
||||
return (this.mycurrencyid == null) ? "" : this.mycurrencyid;
|
||||
}
|
||||
|
||||
public void setMycurrencyid(String mycurrency) {
|
||||
this.mycurrencyid = mycurrency;
|
||||
}
|
||||
|
||||
public String getMyamountshipping() {
|
||||
return (this.myamountshipping == null) ? "" :
|
||||
this.myamountshipping;
|
||||
}
|
||||
|
||||
public void setMyamountshipping(String myamountshipping) {
|
||||
this.myamountshipping = myamountshipping;
|
||||
}
|
||||
|
||||
public String getMyitemname() {
|
||||
return (this.myitemname == null) ? "" : this.myitemname;
|
||||
}
|
||||
|
||||
public void setMyitemname(String myitemname) {
|
||||
this.myitemname = myitemname;
|
||||
}
|
||||
|
||||
public String getMyitemquantity() {
|
||||
return (this.myitemquantity == null) ? "" :
|
||||
this.myitemquantity;
|
||||
}
|
||||
|
||||
public void setMyitemquantity(String myitemquantity) {
|
||||
this.myitemquantity = myitemquantity;
|
||||
}
|
||||
|
||||
public String getMyitemamount() {
|
||||
return (this.myitemamount == null) ? "" :
|
||||
this.myitemamount.replace(".", ",").replace(",", ".");
|
||||
}
|
||||
|
||||
public void setMyitemamount(String myitemamount) {
|
||||
this.myitemamount = myitemamount;
|
||||
}
|
||||
|
||||
public String getMyitemdesc() {
|
||||
return (this.myitemdesc == null) ? "" : this.myitemdesc;
|
||||
}
|
||||
|
||||
public void setMyitemdesc(String myitemdesc) {
|
||||
this.myitemdesc = myitemdesc;
|
||||
}
|
||||
}
|
||||
158
rus/WEB-INF/lib/abliaBank_src/com/ablia/gtbill/GTBillRes.java
Normal file
158
rus/WEB-INF/lib/abliaBank_src/com/ablia/gtbill/GTBillRes.java
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
package com.ablia.gtbill;
|
||||
|
||||
import com.ablia.bank._BankAdapter;
|
||||
|
||||
public class GTBillRes extends _BankAdapter {
|
||||
private String myshoplogin;
|
||||
|
||||
private int mycurrency;
|
||||
|
||||
private float myamount;
|
||||
|
||||
private String myshoptrxID;
|
||||
|
||||
private String mybuyername;
|
||||
|
||||
private String mybuyeremail;
|
||||
|
||||
private String mytrxresult;
|
||||
|
||||
private String myauthcode;
|
||||
|
||||
private String myerrorcode;
|
||||
|
||||
private String myerrordescription;
|
||||
|
||||
private String myerrorbanktrxid;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String myalertcode;
|
||||
|
||||
private String myalertdescription;
|
||||
|
||||
private String mycustominfo;
|
||||
|
||||
public String getMyalertcode() {
|
||||
return (this.myalertcode == null) ? "" : this.myalertcode;
|
||||
}
|
||||
|
||||
public void setMyalertcode(String myalertcode) {
|
||||
this.myalertcode = myalertcode;
|
||||
}
|
||||
|
||||
public String getMyalertdescription() {
|
||||
return (this.myalertdescription == null) ? "" :
|
||||
this.myalertdescription;
|
||||
}
|
||||
|
||||
public void setMyalertdescription(String myalertdescription) {
|
||||
this.myalertdescription = myalertdescription;
|
||||
}
|
||||
|
||||
public float getMyamount() {
|
||||
return this.myamount;
|
||||
}
|
||||
|
||||
public void setMyamount(float myamount) {
|
||||
this.myamount = myamount;
|
||||
}
|
||||
|
||||
public String getMyauthcode() {
|
||||
return (this.myauthcode == null) ? "" : this.myauthcode;
|
||||
}
|
||||
|
||||
public void setMyauthcode(String myauthcode) {
|
||||
this.myauthcode = myauthcode;
|
||||
}
|
||||
|
||||
public String getMybuyeremail() {
|
||||
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
|
||||
}
|
||||
|
||||
public void setMybuyeremail(String mybuyeremail) {
|
||||
this.mybuyeremail = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMybuyername() {
|
||||
return (this.mybuyername == null) ? "" : this.mybuyername;
|
||||
}
|
||||
|
||||
public void setMybuyername(String mybuyername) {
|
||||
this.mybuyername = mybuyername;
|
||||
}
|
||||
|
||||
public int getMycurrency() {
|
||||
return this.mycurrency;
|
||||
}
|
||||
|
||||
public void setMycurrency(int mycurrency) {
|
||||
this.mycurrency = mycurrency;
|
||||
}
|
||||
|
||||
public String getMycustominfo() {
|
||||
return (this.mycustominfo == null) ? "" : this.mycustominfo;
|
||||
}
|
||||
|
||||
public void setMycustominfo(String mycustominfo) {
|
||||
this.mycustominfo = mycustominfo;
|
||||
}
|
||||
|
||||
public String getMyerrorbanktrxid() {
|
||||
return (this.myerrorbanktrxid == null) ? "" :
|
||||
this.myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public void setMyerrorbanktrxid(String myerrorbanktrxid) {
|
||||
this.myerrorbanktrxid = myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public String getMyerrorcode() {
|
||||
return (this.myerrorcode == null) ? "" : this.myerrorcode;
|
||||
}
|
||||
|
||||
public void setMyerrorcode(String myerrorcode) {
|
||||
this.myerrorcode = myerrorcode;
|
||||
}
|
||||
|
||||
public String getMyerrordescription() {
|
||||
return (this.myerrordescription == null) ? "" :
|
||||
this.myerrordescription;
|
||||
}
|
||||
|
||||
public void setMyerrordescription(String myerrordescription) {
|
||||
this.myerrordescription = myerrordescription;
|
||||
}
|
||||
|
||||
public String getMyshoplogin() {
|
||||
return (this.myshoplogin == null) ? "" : this.myshoplogin;
|
||||
}
|
||||
|
||||
public void setMyshoplogin(String myshoplogin) {
|
||||
this.myshoplogin = myshoplogin;
|
||||
}
|
||||
|
||||
public String getMyshoptrxID() {
|
||||
return (this.myshoptrxID == null) ? "" : this.myshoptrxID;
|
||||
}
|
||||
|
||||
public void setMyshoptrxID(String myshoptrxID) {
|
||||
this.myshoptrxID = myshoptrxID;
|
||||
}
|
||||
|
||||
public String getMytrxresult() {
|
||||
return (this.mytrxresult == null) ? "" : this.mytrxresult;
|
||||
}
|
||||
|
||||
public void setMytrxresult(String mytrxresult) {
|
||||
this.mytrxresult = mytrxresult;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.ablia.gtbill.servlet;
|
||||
|
||||
import com.ablia.gtbill.GTBillReq;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GTBillSvlt extends Object {
|
||||
private static final long serialVersionUID = 6201212373211424420L;
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_SELLA_RES = "sellaResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
GTBillReq gtbillreq = new GTBillReq();
|
||||
fillObject(req, gtbillreq);
|
||||
String theUrl = "https://sale.GTBill.com/quickpay2.aspx";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("?MerchantID=");
|
||||
sb.append(getApFull().getParm("GTBILL_MERCHANT_ID"));
|
||||
sb.append("&SiteID=");
|
||||
sb.append(getApFull().getParm("GTBILL_SITE_ID"));
|
||||
sb.append("&AmountTotal=");
|
||||
sb.append(gtbillreq.getMyamounttotal());
|
||||
sb.append("&CurrencyID=");
|
||||
sb.append("EUR");
|
||||
sb.append("&AmountShipping=");
|
||||
sb.append(gtbillreq.getMyamountshipping());
|
||||
sb.append("&ReturnURL=");
|
||||
sb.append(getApFull().getParm("GTBILL_RETURN_URL"));
|
||||
sb.append("&ItemAmount[0]=");
|
||||
sb.append(gtbillreq.getMyitemamount());
|
||||
sb.append("&ItemDesc[0]=");
|
||||
sb.append(gtbillreq.getMyitemdesc());
|
||||
sb.append("&ItemName[0]=");
|
||||
sb.append(gtbillreq.getMyitemname());
|
||||
sb.append("&ItemQuantity[0]=");
|
||||
sb.append(gtbillreq.getMyitemquantity());
|
||||
URL url = new URL(String.valueOf(theUrl) + sb.toString());
|
||||
System.out.println("startremotecmd: chiamata a " + theUrl +
|
||||
sb.toString());
|
||||
HttpURLConnection connection = (HttpURLConnection)
|
||||
url.openConnection();
|
||||
BufferedReader read = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
String line = read.readLine();
|
||||
String html = "";
|
||||
while (line != null) {
|
||||
html = String.valueOf(html) + line;
|
||||
line = read.readLine();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceEsercente(HttpServletRequest req) {
|
||||
return getParm("COD_ESER_SELLA").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
101
rus/WEB-INF/lib/abliaBank_src/com/ablia/taglib/SellaObjTag.java
Normal file
101
rus/WEB-INF/lib/abliaBank_src/com/ablia/taglib/SellaObjTag.java
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
package com.ablia.taglib;
|
||||
|
||||
import com.ablia.common.Parm;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
|
||||
public class SellaObjTag extends AbstractDbTag {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String value;
|
||||
|
||||
private boolean condition = true;
|
||||
|
||||
protected int currentNestedValue;
|
||||
|
||||
private String codice;
|
||||
|
||||
private Parm parm;
|
||||
|
||||
protected static final String _WC = "_WC";
|
||||
|
||||
protected static final String _NESTVAL = "_WCNESTVAL";
|
||||
|
||||
public int doAfterBody() throws JspException {
|
||||
try {
|
||||
this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter());
|
||||
setNestedValue();
|
||||
return 0;
|
||||
} catch (IOException ex) {
|
||||
throw new JspTagException(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public int doStartTag() {
|
||||
this.currentNestedValue = getNestedValue();
|
||||
this.pageContext.setAttribute("_WC" + this.currentNestedValue, new Boolean(
|
||||
getWherecondition()));
|
||||
if (getWherecondition())
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected int getNestedValue() {
|
||||
if (this.pageContext.getAttribute("_WCNESTVAL") == null) {
|
||||
this.pageContext.setAttribute("_WCNESTVAL", "1");
|
||||
return 1;
|
||||
}
|
||||
int nv = Integer.parseInt((String)
|
||||
this.pageContext.getAttribute("_WCNESTVAL"));
|
||||
nv++;
|
||||
this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(nv));
|
||||
return nv;
|
||||
}
|
||||
|
||||
public boolean getWherecondition() {
|
||||
getParm().findByCodice(getCodice());
|
||||
if (this.parm.getDBState() == 1) {
|
||||
if ((getParm().getValore().equals(getValue()) && getCondition()) || (
|
||||
!getParm().getValore().equals(getValue()) && !getCondition()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void setNestedValue() {
|
||||
this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(this.currentNestedValue));
|
||||
}
|
||||
|
||||
public String getCodice() {
|
||||
return this.codice;
|
||||
}
|
||||
|
||||
public Parm getParm() {
|
||||
if (this.parm == null)
|
||||
this.parm = new Parm(getApFull());
|
||||
return this.parm;
|
||||
}
|
||||
|
||||
public void setCodice(String code) {
|
||||
this.codice = code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return (this.value == null) ? "" : this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean getCondition() {
|
||||
return this.condition;
|
||||
}
|
||||
|
||||
public void setCondition(boolean condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue