www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,25 @@
|
|||
package it.acxent.api.ebay;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
public class EbayAuthNAuthToken {
|
||||
private String token;
|
||||
|
||||
private Date expirationDate;
|
||||
|
||||
public String getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Date getExpirationDate() {
|
||||
return this.expirationDate;
|
||||
}
|
||||
|
||||
public void setExpirationDate(Date expirationDate) {
|
||||
this.expirationDate = expirationDate;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package it.acxent.api.ebay;
|
||||
|
||||
public class EbayOrder {
|
||||
private String buyerId;
|
||||
|
||||
private String orderId;
|
||||
|
||||
private String buyerTaxId;
|
||||
|
||||
private String taxIdType;
|
||||
|
||||
private double amount;
|
||||
|
||||
public EbayOrder(String buyerId, String orderId, String buyerTaxId, String taxIdType, double amount) {
|
||||
this.buyerId = buyerId;
|
||||
this.orderId = orderId;
|
||||
this.buyerTaxId = buyerTaxId;
|
||||
this.taxIdType = taxIdType;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public EbayOrder() {}
|
||||
|
||||
public String getBuyerId() {
|
||||
return (this.buyerId == null) ? "" : this.buyerId.trim();
|
||||
}
|
||||
|
||||
public void setBuyerId(String buyerId) {
|
||||
this.buyerId = buyerId;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return (this.orderId == null) ? "" : this.orderId.trim();
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getBuyerTaxId() {
|
||||
return (this.buyerTaxId == null) ? "" : this.buyerTaxId.trim();
|
||||
}
|
||||
|
||||
public void setBuyerTaxId(String buyerTaxId) {
|
||||
this.buyerTaxId = buyerTaxId;
|
||||
}
|
||||
|
||||
public String getTaxIdType() {
|
||||
return (this.taxIdType == null) ? "" : this.taxIdType.trim();
|
||||
}
|
||||
|
||||
public void setTaxIdType(String taxIdType) {
|
||||
this.taxIdType = taxIdType;
|
||||
}
|
||||
|
||||
public double getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package it.acxent.api.ebay;
|
||||
|
||||
public class EbayResult {
|
||||
private String msg;
|
||||
|
||||
public EbayResult(String msg, boolean status, Object result) {
|
||||
this.msg = msg;
|
||||
this.ok = status;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
private boolean ok = true;
|
||||
|
||||
private Object result;
|
||||
|
||||
public EbayResult() {}
|
||||
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public boolean isOk() {
|
||||
return this.ok;
|
||||
}
|
||||
|
||||
public void setOk(boolean status) {
|
||||
this.ok = status;
|
||||
}
|
||||
|
||||
public Object getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Object result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package it.acxent.api.ebay;
|
||||
|
||||
import com.ebay.sdk.ApiContext;
|
||||
import com.ebay.sdk.ApiCredential;
|
||||
import com.ebay.sdk.call.GetOrdersCall;
|
||||
import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType;
|
||||
import com.ebay.soap.eBLBaseComponents.OrderType;
|
||||
import com.ebay.soap.eBLBaseComponents.TaxIdentifierType;
|
||||
import com.ebay.soap.eBLBaseComponents.TradingRoleCodeType;
|
||||
import com.ebay.soap.eBLBaseComponents.TransactionType;
|
||||
import java.io.IOException;
|
||||
|
||||
public class EbayTrading {
|
||||
public String getPivaCf(String token, String ordine) {
|
||||
String ret = "";
|
||||
try {
|
||||
System.out.print("\n");
|
||||
System.out.print("+++++++++++++++++++++++++++++++++++++++\n");
|
||||
System.out.print("+ Welcome to eBay SDK for Java Sample +\n");
|
||||
System.out.print("+ - ConsoleAddItem +\n");
|
||||
System.out.print("+++++++++++++++++++++++++++++++++++++++\n");
|
||||
System.out.print("\n");
|
||||
System.out.println("===== [1] Account Information ====");
|
||||
ApiContext apiContext = getApiContext();
|
||||
GetOrdersCall call = new GetOrdersCall(apiContext);
|
||||
DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL };
|
||||
call.setDetailLevel(detailLevels);
|
||||
call.setOrderRole(TradingRoleCodeType.SELLER);
|
||||
call.setNumberOfDays(Integer.valueOf(30));
|
||||
System.out.println("getOrders");
|
||||
OrderType[] orders = call.getOrders();
|
||||
for (OrderType order : orders) {
|
||||
System.out.println(order.getBuyerUserID());
|
||||
TaxIdentifierType[] tit = order.getBuyerTaxIdentifier();
|
||||
for (int i = 0; i < tit.length; i++) {
|
||||
TaxIdentifierType ti = tit[i];
|
||||
System.out.println("TaxIdentifierType");
|
||||
System.out.println("ID: " + ti.getID());
|
||||
System.out.println("Type: " + String.valueOf(ti.getType()));
|
||||
System.out.println(" ");
|
||||
}
|
||||
TransactionType[] tp = order.getTransactionArray().getTransaction();
|
||||
for (int j = 0; j < tp.length; j++) {
|
||||
TransactionType tp1 = tp[j];
|
||||
System.out.println("TransactionType");
|
||||
System.out.println("Email: " + tp1.getBuyer().getEmail());
|
||||
System.out.println("Codice Fiscale: " + tp1.getCodiceFiscale());
|
||||
System.out.println("Partita Iva: " + tp1.getBuyer().getVATID());
|
||||
System.out.println(" ");
|
||||
}
|
||||
System.out.println("--------------------");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static ApiContext getApiContext() throws IOException {
|
||||
String token = "AgAAAA**AQAAAA**aAAAAA**8X0lWA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AEloqgCJCLpg+dj6x9nY+seQ**s38DAA**AAMAAA**lknSsx7ror8sUli5r9aVZwFIVw/c6wznYbOjChsXzBnST1dqjWSFxdAHO3NNNlOA58OCDwWYQoyzmREXuXnPFhhxxwqn0re7ri7CzR3oHlSX9ZR1mv/CTIThDycFkD9rK9CCqzYZgpiW7SLwgQt5hPSOYuIejdVA+NL4GWl+zy413Tinu9eS5WF5XeIODQnFAuQHAKcLa7NqKg7BtohzN7l4UNxw7+Ibm7acX5MLsvqquTYNBLQuYhSsNJV2jhM8LuIotg11vMPvJx5dx6oG0f4X2KvlmEP1mF8LlgqcocYJPvc5sg+aMCRG6WKGpeXepbvsh0SWwyGQUL9Xqpwmqrk8RZU3SjgZPHlYDMHJVeJ5c+5g8gcjSk1seJzcWiH48ZGDr6ShgS95zt6wuFZ+ZqRo28I07dNWGGvdY+DAS6Orx0zmhAywjrFFnf8gcqLMIVLzsepHkJqBAno+rK/cGhaxyTAurnTpZUNeT5sv4U/S0AhgO9npRqcYENU7mmdJrTknz3BIeZJzJSWAVgIS1PlyeLAMiXGj8wJaEuX8y4PYfXAO8eOINxGd6Z4h7Ta/Iq7jhIltRR4xryUH/j1c8XpR5RIxFvcwOhE+z10JFaVr4x4pUto5SfnLh+Ig3GClEM7kRaeCSgeoe8/yhc7zLlj1AX0oViae2wbwYDJZvv77hkXeiNUCllHbsnt5Y4dI5y18z1h/a4K+gqZH+7bTLNuVUkKD4dfeoPiaqyZHlfqfmo0nVACO+S9AtghL8+NC";
|
||||
ApiContext apiContext = new ApiContext();
|
||||
ApiCredential cred = apiContext.getApiCredential();
|
||||
cred.seteBayToken(token);
|
||||
apiContext.setApiServerUrl("https://api.ebay.com/wsapi");
|
||||
return apiContext;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package it.acxent.api.ebay.json;
|
||||
|
||||
public class EbayOrder {
|
||||
private String buyerId;
|
||||
|
||||
private String orderId;
|
||||
|
||||
private String buyerTaxId;
|
||||
|
||||
private String taxIdType;
|
||||
|
||||
private double amount;
|
||||
|
||||
public EbayOrder(String buyerId, String orderId, String buyerTaxId, String taxIdType, double amount) {
|
||||
this.buyerId = buyerId;
|
||||
this.orderId = orderId;
|
||||
this.buyerTaxId = buyerTaxId;
|
||||
this.taxIdType = taxIdType;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public EbayOrder() {}
|
||||
|
||||
public String getBuyerId() {
|
||||
return (this.buyerId == null) ? "" : this.buyerId.trim();
|
||||
}
|
||||
|
||||
public void setBuyerId(String buyerId) {
|
||||
this.buyerId = buyerId;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return (this.orderId == null) ? "" : this.orderId.trim();
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getBuyerTaxId() {
|
||||
return (this.buyerTaxId == null) ? "" : this.buyerTaxId.trim();
|
||||
}
|
||||
|
||||
public void setBuyerTaxId(String buyerTaxId) {
|
||||
this.buyerTaxId = buyerTaxId;
|
||||
}
|
||||
|
||||
public String getTaxIdType() {
|
||||
return (this.taxIdType == null) ? "" : this.taxIdType.trim();
|
||||
}
|
||||
|
||||
public void setTaxIdType(String taxIdType) {
|
||||
this.taxIdType = taxIdType;
|
||||
}
|
||||
|
||||
public double getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package it.acxent.api.ebay.json;
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package it.acxent.api.ebay.servlet;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import it.acxent.servlet.SavedHttpRequest;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class EbayAccessKoSvlt extends AblServletSvlt {
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("status", "ko");
|
||||
sendMessage(req, "Attenzione! Non è stata data l'autorizzazione all'accesso ebay. impossibile recuperare il token!");
|
||||
SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("_shr");
|
||||
shr = new SavedHttpRequest();
|
||||
shr.setCompleteRequestedURI(req.getContextPath() + "/admin/ebay/EbayAccess.abl");
|
||||
shr.setServletPath("/admin/ebay/EbayAccess.abl");
|
||||
shr.setAllParametersNAttributes(req);
|
||||
if (useAlwaysSendRedirect())
|
||||
shr.setUseSendRedirect(true);
|
||||
req.getSession().setAttribute("_shr", shr);
|
||||
try {
|
||||
res.sendRedirect(req.getContextPath() + "/admin/menu/index.jsp");
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected void searchOLD(HttpServletRequest req, HttpServletResponse res) {
|
||||
String error = getRequestParameter(req, "error");
|
||||
sendMessage(req, error);
|
||||
setJspPageRelative("ebayRes.jsp", req);
|
||||
req.setAttribute("status", "ko");
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package it.acxent.api.ebay.servlet;
|
||||
|
||||
import it.acxent.api.ebay.EbayAbliaApi;
|
||||
import it.acxent.api.ebay.EbayAuthNAuthToken;
|
||||
import it.acxent.api.ebay.EbayResult;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import it.acxent.servlet.SavedHttpRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class EbayAccessOkSvlt extends AblServletSvlt {
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String code = getRequestParameter(req, "code");
|
||||
String expiresIn = getRequestParameter(req, "expires_in");
|
||||
if (code.isEmpty()) {
|
||||
autNAuthFetchToken(req, res);
|
||||
} else {
|
||||
oAuth2FetchToken(req, res);
|
||||
}
|
||||
SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("_shr");
|
||||
shr = new SavedHttpRequest();
|
||||
shr.setCompleteRequestedURI(req.getContextPath() + "/admin/ebay/EbayAccess.abl");
|
||||
shr.setServletPath("/admin/ebay/EbayAccess.abl");
|
||||
shr.setAllParametersNAttributes(req);
|
||||
if (useAlwaysSendRedirect())
|
||||
shr.setUseSendRedirect(true);
|
||||
req.getSession().setAttribute("_shr", shr);
|
||||
try {
|
||||
res.sendRedirect(req.getContextPath() + "/admin/menu/index.jsp");
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void autNAuthFetchToken(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String username = getRequestParameter(req, "username");
|
||||
EbayAbliaApi eaa = new EbayAbliaApi(apFull);
|
||||
String sessionId = (String)req.getSession().getAttribute("_EBAY_SESSION_ID");
|
||||
System.out.println("Ebay access OK: session id precedente...: " + sessionId);
|
||||
EbayAuthNAuthToken fetchToken = eaa.fetchTokenSdk(sessionId);
|
||||
if (fetchToken.getToken().isEmpty()) {
|
||||
System.out.println("Ebay access ERRORE: token: " + fetchToken.getToken());
|
||||
req.setAttribute("status", "ko");
|
||||
sendMessage(req, "Errore! impossibile recuperare il token!");
|
||||
} else {
|
||||
System.out.println("Ebay access OK: token: " + fetchToken.getToken());
|
||||
System.out.println("Ebay access OK: exp date: " + String.valueOf(fetchToken.getExpirationDate()));
|
||||
Parm parm = getParm("EBAY_USER_TOKEN_PRODUCTION");
|
||||
parm.setTesto(fetchToken.getToken());
|
||||
parm.save();
|
||||
parm = getParm("EBAY_USER_TOKEN_NAME_PRODUCTION");
|
||||
parm.setTesto(username);
|
||||
parm.save();
|
||||
parm = getParm("EBAY_EXPIRE_DATE_TOKEN_PRODUCTION");
|
||||
parm.setDataParm(fetchToken.getExpirationDate());
|
||||
parm.save();
|
||||
getApFull().resetCurrentApParms();
|
||||
req.setAttribute("status", "ok");
|
||||
sendMessage(req, "Rinnovato il token authNAuth per " + username + " correttamente,");
|
||||
}
|
||||
}
|
||||
|
||||
public void oAuth2FetchToken(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String code = getRequestParameter(req, "code");
|
||||
String expiresIn = getRequestParameter(req, "expires_in");
|
||||
System.out.println("Ebay oAuth2 access OK: code: " + code + "\nexpire: " + expiresIn);
|
||||
EbayAbliaApi bean = new EbayAbliaApi(apFull);
|
||||
EbayResult eRes = bean.ebayGetUserAccesToken(code);
|
||||
if (!eRes.isOk()) {
|
||||
System.out.println("Ebay user access token: " + eRes.getMsg());
|
||||
req.setAttribute("status", "ko");
|
||||
sendMessage(req, "Errore! impossibile recuperare il token! " + DBAdapter.convertStringToHtml(eRes.getMsg()));
|
||||
} else {
|
||||
System.out.println("Ebay access OK:\n" + DBAdapter.convertStringToHtml(bean.getStatus()));
|
||||
req.setAttribute("status", "ok");
|
||||
sendMessage(req, "Rinnovato il token oAuth2 ");
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package it.acxent.api.ebay.servlet;
|
||||
|
||||
import it.acxent.api.ebay.EbayAbliaApi;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class EbayAccessSvlt extends AblServletSvlt {
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
EbayAbliaApi eaa = new EbayAbliaApi(apFull);
|
||||
req.setAttribute("eaa", eaa);
|
||||
setJspPageRelative("ebay.jsp", req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void _callEbayLogin(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
EbayAbliaApi eaa = new EbayAbliaApi(apFull);
|
||||
req.setAttribute("eaa", eaa);
|
||||
String sessionId = eaa.getSdkEbaySessionId();
|
||||
System.out.println("sessionid: " + sessionId);
|
||||
if (sessionId.isEmpty()) {
|
||||
sendMessage(req, "Errore! Impossibile trovare il sessionid...");
|
||||
sendHtmlMsgResponse(req, res, "Errore! Impossibile trovare il sessionid...");
|
||||
} else {
|
||||
req.getSession().setAttribute("_EBAY_SESSION_ID", sessionId);
|
||||
String requestPage = getParm("EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK").getTesto() + getParm("EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK").getTesto();
|
||||
try {
|
||||
res.sendRedirect(requestPage);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _callEbayLoginO(HttpServletRequest req, HttpServletResponse res) {
|
||||
String requestPage = getParm("EBAY_SIGN_IN_OAUTH_PRODUCTION_LINK").getTesto();
|
||||
try {
|
||||
res.sendRedirect(requestPage);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package it.acxent.api.ebay.servlet;
|
||||
|
||||
import it.acxent.api.ebay.EbayAbliaApi;
|
||||
import it.acxent.api.ebay.EbayOrder;
|
||||
import it.acxent.api.ebay.EbayResult;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.util.Vector;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class EbayOrdersSvlt extends AblServletSvlt {
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
EbayAbliaApi eaa = new EbayAbliaApi(apFull);
|
||||
req.setAttribute("eaa", eaa);
|
||||
if (getParm("EBAY_USE_SANDBOX").isTrue())
|
||||
eaa.setUseSandbox(true);
|
||||
EbayResult result = eaa.getSdkEbayOrders();
|
||||
if (result.isOk()) {
|
||||
Vector<EbayOrder> resV = (Vector<EbayOrder>)result.getResult();
|
||||
if (resV != null)
|
||||
req.setAttribute("list", new Vectumerator(resV.elements()));
|
||||
sendMessage(req, "Lettura ordini avvenuta correttamente");
|
||||
} else {
|
||||
sendMessage(req, "Impossibile leggere gli ordini ebay! " + result.getMsg());
|
||||
}
|
||||
forceJspPage("/admin/ebay/ebayOrderCR.jsp", req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
if (e.getCause() != null) {
|
||||
msg.append("Causa:\n");
|
||||
msg.append(e.getCause().getMessage());
|
||||
msg.append("\n");
|
||||
}
|
||||
msg.append(e.getMessage());
|
||||
handleDebug(e, 2);
|
||||
forceMessage(req, getJspPage(req));
|
||||
req.setAttribute("errorMsg", msg.toString());
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/config/error.jsp");
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package it.acxent.api.ebay.servlet;
|
||||
Loading…
Add table
Add a link
Reference in a new issue