added log tracing classes
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user