Tests in error:
postmerchantPushPaymentsPostTest(com.visa.developer.sample.mvisa_api.api.MvisaApiTest): I/O error on POST request for "https://sandbox.api.visa.com/visadirect/mvisa/v1/merchantpushpayments": PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Solved! Go to Solution
Hey @vascubrian,
I'm happy to help. Please review the below sample code, try it and make changes. Then try to conduct the test again and share your results with us.
1. No need to set any password for private key. Please comment that line.
//apiClient.setPrivateKeyPassword("******");
2. Kindly comment the below highlighted line in ApiClient.java.
protected RestTemplate getRestTemplateForMutualAuth() {
try {
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
FileInputStream keystoreInputStream = new FileInputStream(keystorePath);
keystore.load(keystoreInputStream, keystorePassword.toCharArray());
keystoreInputStream.close();
SSLContext sslcontext = SSLContexts.custom().useProtocol("TLS")
.loadKeyMaterial(keystore, keystorePassword.toCharArray())
//.loadTrustMaterial(new File(keystorePath), keystorePassword.toCharArray())
.build();