From dbacc23b9666f49ccfc9742780a2d8dd2116cad3 Mon Sep 17 00:00:00 2001
From: Mahesh Maney R <mahesh-maney@users.noreply.github.com>
Date: Tue, 29 Aug 2023 16:40:35 +0530
Subject: [PATCH] adding transaction deatils to return url <ManeyMR>.

---
 .../services/impl/PaymentServiceImpl.java           | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/tarento/upsmf/userManagement/services/impl/PaymentServiceImpl.java b/src/main/java/com/tarento/upsmf/userManagement/services/impl/PaymentServiceImpl.java
index d236bf0..14d48b8 100644
--- a/src/main/java/com/tarento/upsmf/userManagement/services/impl/PaymentServiceImpl.java
+++ b/src/main/java/com/tarento/upsmf/userManagement/services/impl/PaymentServiceImpl.java
@@ -78,14 +78,15 @@ public class PaymentServiceImpl implements PaymentService {
                 strEndPoint = AFFILIATION_PAYMENT_GATEWAY_ENDPOINT;
             }
             String responseString = "", transaction_status = "";
+            String transactionDetails = getTransactionDetails(requestData);
             if ((requestData != null) && (requestData.get("Response Code") != null)
                     && requestData.get("Response Code").equals("E000")) {
-                responseString = strEndPoint + "?resp=success";
+                responseString = strEndPoint + "?resp=success" + transactionDetails;
                 transaction_status = "success";
                 logger.info("Payment is successful.");
                 logger.info("Record saved to DB.");
             } else {
-                responseString = strEndPoint + "?resp=failure";
+                responseString = strEndPoint + "?resp=failure" + transactionDetails;
                 transaction_status = "failed.";
                 logger.info("Payment failed.");
             }
@@ -99,6 +100,14 @@ public class PaymentServiceImpl implements PaymentService {
         return new ResponseEntity<String>(null, httpHeaders, HttpStatus.NOT_FOUND);
     }
 
+    private String getTransactionDetails(Map<String, String> requestData) {
+        String transactionAmount = requestData.get("Transaction Amount") != null ? requestData.get("Transaction Amount") : "";
+        String uniqueRefNumber = requestData.get("Unique Ref Number") != null ? requestData.get("Unique Ref Number") : "";
+        String response = "&transaction_amount="+transactionAmount+"&transaction_id="+uniqueRefNumber;
+        logger.info("transaction details {}",response);
+        return response;
+    }
+
     private Transaction getTransaction(final Map<String, String> requestData,  final String strEndPoint, final String transaction_status) {
         Long id = Long.valueOf(requestData.get("ID"));
         Double transactionAmount = Double.valueOf(requestData.get("Transaction Amount"));
-- 
GitLab