PayPal NVP/SOAP API TransactionSearchReq 调用

PayPal NVP/SOAP API TransactionSearchReq Call

我目前正在尝试在 Java 中实现一个 class,它列出了特定时间范围内的所有 PayPal 交易。我正在使用 NVP/SOAP API Merchant SDK (https://github.com/paypal/merchant-sdk-java),因为这似乎是列出 'all' 交易的唯一可能性。根据关于 Whosebug 的其他问题,REST SDK 仅列出由 REST 调用进行的事务,这不适合我的情况。

不幸的是,README 文件中显示的 github 上的 TransactionSearchReq 调用的示例代码不完整,也没有该调用的其他示例实现可用。

所以我的问题是: 1)任何人都可以提供示例代码吗? 2) 商家 NVP/API SDK 是否满足 2018 年 6 月之前进行的 PayPal (https://www.paypal-engineering.com/2016/05/12/upcoming-security-changes-notice/ & https://www.paypal.com/au/webapps/mpp/tls-http-upgrade) 新安全更新的要求?

问题 1 的答案):

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import urn.ebay.api.PayPalAPI.*;
import urn.ebay.apis.eBLBaseComponents.PaymentTransactionSearchResultType;

public class PaymentManager {

public static void main(String[] args) {

    Map<String,String> configMap = new HashMap<String,String>();

    configMap.put("mode", "live");

    // Account Credential
    configMap.put("acct1.UserName", "...");
    configMap.put("acct1.Password", "...");
    configMap.put("acct1.Signature", "...-...");
    // Subject is optional, only required in case of third party permission
    //configMap.put("acct1.Subject", "");

    // Sample Certificate credential
    // configMap.put("acct2.UserName", "certuser_biz_api1.paypal.com");
    // configMap.put("acct2.Password", "D6JNKKULHN3G5B8A");
    // configMap.put("acct2.CertKey", "password");
    // configMap.put("acct2.CertPath", "resource/sdk-cert.p12");
    // configMap.put("acct2.AppId", "APP-80W284485P519543T");


    TransactionSearchReq txnreq = new TransactionSearchReq();
    TransactionSearchRequestType requestType = new TransactionSearchRequestType();

    requestType.setStartDate("2018-04-01T00:00:00.000Z"); 
    requestType.setEndDate("2018-04-05T23:59:59.000Z"); 
    requestType.setVersion("95.0");
    requestType.setTransactionID("");
    txnreq.setTransactionSearchRequest(requestType);

    PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configMap);

    try {
        TransactionSearchResponseType txnresponse = service.transactionSearch(txnreq, configMap.get("acct1.UserName"));

        List<PaymentTransactionSearchResultType> transactions = txnresponse.getPaymentTransactions();

        for (int i = 0; i < transactions.size(); i++) {
            System.out.println(transactions.get(i).getPayer());
        }

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
}