严重:无法完成HTTPS交易

时间:2018-03-29 11:27:03

标签: java paypal paypal-sandbox

我在使用NVP API向PayPal发送退款请求时遇到运行时异常: 我尝试使用#JAVA_OPTS="$JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2"设置TLS配置并迁移到java 8,仍然面临问题 // ---------要求PayLoad的代码-----------

NVPEncoder encoder = new NVPEncoder();
encoder.add("METHOD", "RefundTransaction");
encoder.add("TRANSACTIONID", captureTrans.getString("referenceNum"));
encoder.add("REFUNDTYPE", "Partial");
encoder.add("CURRENCYCODE", captureTrans.getString("currencyUomId"));
encoder.add("AMT",refundAmount );

// ----------创建signatureAPIProfile()的代码-------

APIProfile profile = ProfileFactory.createSignatureAPIProfile();
            profile.setAPIUsername(payPalConfig.getString("apiUserName"));
            profile.setAPIPassword(payPalConfig.getString("apiPassword"));
            profile.setSignature(payPalConfig.getString("apiSignature"));
            profile.setEnvironment(payPalConfig.getString("apiEnvironment"));
            caller.setAPIProfile(profile);

//触发退款请求的代码

   String requestMessage = encoder.encode();
    String responseMessage = caller.call(requestMessage); //Getting exception in this line
    NVPDecoder decoder = new NVPDecoder();
    decoder.decode(responseMessage);

//异常追踪

[java] Mar 29, 2018 3:41:13 PM com.paypal.sdk.exceptions.FatalException <init>
     [java] SEVERE: Unable to complete HTTPS transaction
     [java] javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
     [java]     at sun.security.ssl.Alerts.getSSLException(Unknown Source)
     [java]     at sun.security.ssl.Alerts.getSSLException(Unknown Source)
     [java]     at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
     [java]     at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
     [java]     at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
     [java]     at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
     [java]     at sun.security.ssl.AppOutputStream.write(Unknown Source)
     [java]     at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
     [java]     at java.io.BufferedOutputStream.flush(Unknown Source)
     [java]     at org.apache.commons.httpclient.methods.StringRequestEntity.writeRequest(StringRequestEntity.java:146)
     [java]     at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
     [java]     at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
     [java]     at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
     [java]     at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
     [java]     at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
     [java]     at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
     [java]     at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
     [java]     at com.paypal.sdk.core.nvp.NVPAPICaller.call(NVPAPICaller.java:353)
     [java]     at com.paypal.sdk.services.NVPCallerServices.call(NVPCallerServices.java:56)
     [java]     at org.ofbiz.accounting.thirdparty.paypal.PayPalServices.sendNVPRequest(PayPalServices.java:1048)

0 个答案:

没有答案