68 lines
3.6 KiB
Java
68 lines
3.6 KiB
Java
|
|
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;
|
||
|
|
}
|
||
|
|
}
|