From 597f6b10d4e83f4d03345fd8573b7ab59a5bec53 Mon Sep 17 00:00:00 2001 From: Mohd-Arham Date: Mon, 8 Dec 2025 10:07:21 +0530 Subject: [PATCH 1/3] add rest client --- .../bbps/config/RestClientConfig.java | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/billpaymentservice/bbps/config/RestClientConfig.java b/src/main/java/com/billpaymentservice/bbps/config/RestClientConfig.java index c248203..add99ee 100644 --- a/src/main/java/com/billpaymentservice/bbps/config/RestClientConfig.java +++ b/src/main/java/com/billpaymentservice/bbps/config/RestClientConfig.java @@ -2,38 +2,46 @@ package com.billpaymentservice.bbps.config; import java.security.cert.X509Certificate; +import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.web.client.RestClient; @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()); + @Bean + public RestClient restClient() throws Exception { - // ✅ Create RestClient with custom SSL context - return RestClient.builder() - .requestFactory(new HttpComponentsClientHttpRequestFactory()) - .build(); - } + // Create Trust-All SSL context + 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 sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); + + // Use JDK's Simple HTTP client with custom SSL context + SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); + requestFactory.setBufferRequestBody(false); + + // Apply SSL context to HttpsURLConnection globally + HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); + HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true); + + return RestClient.builder().requestFactory(requestFactory).build(); + } } \ No newline at end of file From c25382bd5c8e74f961e3e43024860944f06d0346 Mon Sep 17 00:00:00 2001 From: Lincpay Tech Date: Mon, 8 Dec 2025 10:43:13 +0530 Subject: [PATCH 2/3] added txnid responsein web --- .../bbps/serviceImpl/PaymentStartServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/billpaymentservice/bbps/serviceImpl/PaymentStartServiceImpl.java b/src/main/java/com/billpaymentservice/bbps/serviceImpl/PaymentStartServiceImpl.java index 42d812a..164d4e5 100644 --- a/src/main/java/com/billpaymentservice/bbps/serviceImpl/PaymentStartServiceImpl.java +++ b/src/main/java/com/billpaymentservice/bbps/serviceImpl/PaymentStartServiceImpl.java @@ -317,6 +317,7 @@ public class PaymentStartServiceImpl implements PaymentStartService { Map result = new HashMap<>(); result.put("OrderId", orderNo); result.put("html", respBody); + result.put("txnId", parsedTxn); LOGGER.info("[startWebPayment] complete txnId={} orderNo={} returning HTML", txnId, orderNo); return ResponseModel.builder() From 1cfe331ff12ae5dbdc6b74db6ede1527f4edb773 Mon Sep 17 00:00:00 2001 From: Lincpay Tech Date: Mon, 8 Dec 2025 17:00:25 +0530 Subject: [PATCH 3/3] improved the customerparamrequest to customerparam --- .../billpaymentservice/bbps/dto/request/BillPaymentRequest.java | 2 +- .../com/billpaymentservice/bbps/util/BillerMapperHelper.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java index ed9aa07..d34d13a 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java @@ -51,7 +51,7 @@ public class BillPaymentRequest extends BaseClass { private String paymentChannel; private List deviceBlockTags; - private List customerParamsRequest; + private List customerParams; private List remitterIdentity; private List amountBreakSet; } diff --git a/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java b/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java index daafc45..bd69a80 100644 --- a/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java +++ b/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java @@ -1079,7 +1079,7 @@ public class BillerMapperHelper { forward.setPaymentChannel(req.getPaymentChannel()); forward.setDeviceBlockTags(req.getDeviceBlockTags()); - forward.setCustomerParamsRequest(req.getCustomerParamsRequest()); + forward.setCustomerParamsRequest(req.getCustomerParams()); forward.setRemitterIdentity(req.getRemitterIdentity()); forward.setAmountBreakSet(req.getAmountBreakSet());