我正在努力调用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年,但我只获得过去几周的价值)
我错过了什么吗?这真的让我烦恼了一段时间,无论我设置什么,结果都是一样的。
答案 0 :(得分:1)
request.TransactionSearchRequest.EndDateSpecified = true;
告诉网络服务已设置结束日期。这解决了您的问题。不知道为什么需要它。