Skip to main content
Published: November 29 2005, 11:55:00 AMUpdated: September 22 2022, 5:02:30 PM

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());
        }
    }

 

 

How well did this answer your question?
Answers others found helpful

Got thoughts? Click the feedback button – your insights help us improve!