363 lines
8.5 KiB
Java
363 lines
8.5 KiB
Java
package it.acxent.bank.paypal;
|
|
|
|
import it.acxent.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;
|
|
}
|
|
}
|