added log tracing classes

This commit is contained in:
himanshu
2025-11-03 18:13:10 +05:30
parent 0e590961e0
commit f7c2669d11
13 changed files with 276 additions and 51 deletions
@@ -1,5 +1,6 @@
package com.billpaymentservice.bbps.util;
import java.security.SecureRandom;
import java.util.function.Function;
import org.slf4j.Logger;
@@ -19,6 +20,9 @@ import com.billpaymentservice.bbps.repository.MerchantRepository;
public class Helper {
private static final Logger LOGGER = LoggerFactory.getLogger(Helper.class);
private static final String CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private static final SecureRandom secureRandom = new SecureRandom();
@Autowired
private MerchantRepository merchantRegisterRepo;
@@ -111,4 +115,14 @@ public class Helper {
// LOGGER.info("Merchant is valid and active for MID: {}", requestModel.getMid());
return "Valid"; // Success message
}
public static String generateTxnId(int n) {
StringBuilder sb = new StringBuilder(n);
for (int i = 0; i < n; i++) {
int index = secureRandom.nextInt(CHARACTERS.length());
sb.append(CHARACTERS.charAt(index));
}
return sb.toString(); // Prefix
}
}