package it.acxent.bank.poste2019; import it.acxent.bank._BankAdapter; import it.acxent.db.ApplParmFull; import it.acxent.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(); } }