EBay Developer API - GetSellerTransactions

时间:2016-11-22 18:00:14

标签: java ebay ebay-api

我正在尝试通过EBay Developers API获取买家的送货地址,但我收到的是NullPointerException。我不明白为什么因为我确定买家已支付该物品并且有送货地址。

这是我正在使用的代码:

        GetSellerTransactionsCall getSellerTransactions = new GetSellerTransactionsCall();
        getSellerTransactions.setApiContext(getAPIContext());

        Calendar calFrom = new GregorianCalendar();
        Date todayFrom = new Date();
        calFrom.setTime(todayFrom);
        calFrom.add(Calendar.DAY_OF_MONTH, -29);


        Calendar calTo = new GregorianCalendar();
        Date todayTo = new Date();
        calTo.setTime(todayTo);



        TimeFilter modifiedTimeFilter = new TimeFilter(calFrom, calTo);

        getSellerTransactions.setModifiedTimeFilter(modifiedTimeFilter);



        TransactionType[] transactionType = getSellerTransactions.getSellerTransactions();

        System.out.println("Size: " + transactionType.length);
        // ^^ This returns 2 items as length


        UserType userType = transactionType[1].getBuyer();


        AddressType shippingAddress = userType.getShippingAddress();


        String buyerFirstName = shippingAddress.getFirstName();
        // ^^ This line causes a NullPointerException. Same error when I try to get the street address or any other shipping details of buyer. I can get the buyers email just fine using String email = userType.getEmail(); but no shipping details.

任何人都知道为什么?

0 个答案:

没有答案