0

我正在努力调用 PayPal 的 Web 服务来执行 TransactionSearch,如下所示:

AccountType accountType = AccountType.Live;
tblPayPalAccount account = PayPalAPICallHelperSOAP.GetAccount(accountType);
DateTime endDate = new DateTime(2012, 1, 1);
DateTime startDate = new DateTime(2012, 12, 31);


using (PayPalAPIInterfaceClient client = new PayPalAPIInterfaceClient())
{
    client.Endpoint.Address = new System.ServiceModel.EndpointAddress("https://api-3t.paypal.com/2.0");
    UserIdPasswordType userIdPasswordType = PayPalAPICallHelperSOAP.GetUserIdPasswordType(account);
    CustomSecurityHeaderType header = new CustomSecurityHeaderType();
    header.Credentials = userIdPasswordType;

    TransactionSearchReq request = new TransactionSearchReq();

    request.TransactionSearchRequest = new TransactionSearchRequestType();

    request.TransactionSearchRequest.Version = account.version;
    request.TransactionSearchRequest.StartDate = startDate;

    request.TransactionSearchRequest.EndDate = endDate;

    TransactionSearchResponseType transactionSearchResponseType = client.TransactionSearch(ref header, request);
}

从今天开始,我总是得到 67 个结果,无论我传递给 StartDate/EndDate 什么值(在这种情况下是 2012 年,但我只得到最近几周的值)

我错过了什么吗?这真的让我困扰了很长一段时间,无论我设置什么,结果总是一样的。

4

1 回答 1

1
request.TransactionSearchRequest.EndDateSpecified = true;

告诉网络服务结束日期已设置。这解决了你的问题。不知道为什么需要它。

于 2015-02-24T15:15:30.060 回答