I am getting Run time exception while making refund request to PayPal using NVP API:
I tried setting up TLS configuration using #JAVA_OPTS="$JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2"
and migrated to java 8, still facing issue.
//---------Code to make request 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 );
//----------Code for creating 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);
// Code to fire refund request
String requestMessage = encoder.encode();
String responseMessage = caller.call(requestMessage); //Getting exception in this line
NVPDecoder decoder = new NVPDecoder();
decoder.decode(responseMessage);
// Exception trace
[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)