For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Product
Category
Language
Format
SDK
Sort by
Direction

Getting the transactions in the SoldList returned from GetMyeBaySelling call in Java SDK

  • Answer ID 378
  • Published 11/29/2005 10:55 AM
  • Updated 10/20/2013 06:41 AM
  • Permalink https://ebaydts.com/eBayKBDetails?KBid=378
Product
I am making the GetMyeBaySelling call to get sold list using GetMyeBaySellingResponseType.getSoldList() method, and the transaction objects I am getting back are null.

Detailed Description

The GetMyeBaySelling response always contains a SellingSummary node and might contain any combination of these nodes: ScheduledList, ActiveList, SoldList, or UnsoldList. The OrderTransactionArrayType in a SoldList node contains an order or a transaction as below:
     1. A transaction is the sale of one or more items from a seller's listing to a buyer.
     2. An order combines two or more transactions into a single payment.

One should check whether the OrderTransactionType returned from GetMyeBaySelling call is an order or a single transaction and process it accordingly. The following code shows how to process the data in the SoldList:

    public void request(){

           GetMyeBaySellingCall gmes = new GetMyeBaySellingCall(apiContext);
            //set sorting type 
           ItemListCustomizationType itemCust = new ItemListCustomizationType();           
           itemCust.setSort(ItemSortTypeCodeType.ItemID);
           //request the sold entries from My eBay list
           gmes.setSoldList(itemCust);
           //request the unsold entries from My eBay list
           //gmes.setUnsoldList(itemCust);
           try{
                gmes.getMyeBaySelling();
           }catch(Exception e){
                 if( e instanceof SdkSoapException ){
                     SdkSoapException sdkExe = (SdkSoapException)e;
                     ErrorType errs = sdkExe.getErrorType();
                     System.out.println("error code " +errs.getErrorCode()+ "error shot message" + errs.getShortMessage());
                }
                if (e instanceof ApiException ){
                     ApiException apiExe = (ApiException)e;
                     ErrorType[] errs = apiExe.getErrors();
                     for (int j=0; j<errs.length; j++){
                          System.out.println("error code " +errs[j].getErrorCode()+ "error shot message" + errs[j].getShortMessage());
                    }
               }     
           }
           // retrieve the SoldList
           PaginatedOrderTransactionArrayType soldList = gmes.getReturnedSoldList();
           if (soldList !=null){
               OrderTransactionArrayType ordertranarray  = soldList.getOrderTransactionArray();
               OrderTransactionType[] trans = ordertranarray.getOrderTransaction();
               TransactionType transaction =null;
               ItemType item = null;
               for (int i = 0; i < trans.length; i++) {
                    // iterate an order
                    if ( trans[i].getOrder() !=null) {
                        OrderType order = trans[i].getOrder();
                        TransactionArrayType tat = order.getTransactionArray();
                         //  get the SOAP transaction array type
                        TransactionType[] tt= tat.getTransaction();
                         // loop through each transaction
                        for ( int j=0; j<tt.length; j++) {
                            transaction  = tt[j];
                            retrieveTranaction(transaction,order );                       }
                  } else { //getting an item returned from a single transaction                   
                       transaction = trans[i].getTransaction();
                       retrieveTranaction(transaction,order );                 

                 }
            }
        }
    }

    private void retrieveTranaction(TransactionType transaction, OrderType order ){
          ItemType item = transaction.getItem();        
          String listingType = item.getListingType().toString();
          // filter out Half item and StoresFixedPrice items
          if ( (! listingType.equalsIgnoreCase("Half")) && ( ! listingType.equalsIgnoreCase("StoresFixedPrice"))){
               if ( item.getSellingStatus().getCurrentPrice() != null){
                    double price = item.getSellingStatus().getCurrentPrice().getValue();
                     int number = transaction.getQuantityPurchased().intValue();
                     System.out.println("quantity purchased: "+number +", itemSellingPrice: " +price*number);
               }
               if (order !=null)
                   System.out.println("OrderID : " + order.getOrderID() + ",Transactionid : " +transaction.getTransactionID() +", ItemID : "+item.getItemID());
              else System.out.println( "Transactionid : " +transaction.getTransactionID() +", ItemID : "+item.getItemID());
        }
    }


Version Info

The code example above was based on the versions specified below:

API Schema Version479
Java SDK Versionjavasdk v477.0 Point release

Additional Resource

How well did this answer your question?

Answers others found helpful

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter