292 lines
8.4 KiB
Java
292 lines
8.4 KiB
Java
package it.acxent.bank.paypal;
|
|
|
|
import it.acxent.bank._BankAdapter;
|
|
import it.acxent.common.Parm;
|
|
import it.acxent.common.StatusMsg;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.DBAdapter;
|
|
import java.net.URLEncoder;
|
|
|
|
public class PayPalReq extends _BankAdapter {
|
|
private static final long serialVersionUID = -3355707562295063479L;
|
|
|
|
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) {
|
|
boolean debug = true;
|
|
if (ap != null) {
|
|
DBAdapter.logDebug(debug, "Paypal initParms: start");
|
|
String l_tipoParm = "PAYPAL";
|
|
Parm bean = new Parm(ap);
|
|
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
|
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();
|
|
DBAdapter.logDebug(debug, "Paypal initParms: stop");
|
|
StatusMsg.deleteMsgByTag(ap, "INIT");
|
|
}
|
|
}
|
|
|
|
public String getDESC() {
|
|
return (this.DESC == null) ? "" : this.DESC.trim();
|
|
}
|
|
|
|
public void setDESC(String dESC) {
|
|
this.DESC = dESC;
|
|
}
|
|
}
|