added requestBillFetch api

This commit is contained in:
himanshu
2025-10-29 10:11:35 +05:30
parent 92e71695a5
commit c8191b54cd
10 changed files with 218 additions and 34 deletions
@@ -0,0 +1,38 @@
package com.billpaymentservice.bbps.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestClient;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.X509Certificate;
@Configuration
public class RestClientConfig {
@Bean
public RestClient restClient() throws Exception {
// ✅ Create trust all SSL context
SSLContext sslContext = SSLContext.getInstance("TLS");
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
// ✅ Create RestClient with custom SSL context
return RestClient.builder()
.requestFactory(new HttpComponentsClientHttpRequestFactory())
.build();
}
}