shift some constant from bbpsconstant to application properties

This commit is contained in:
Lincpay Tech
2025-12-04 11:54:58 +05:30
parent aea3d0d3a8
commit 08b0689209
3 changed files with 25 additions and 15 deletions
@@ -47,7 +47,14 @@ import com.billpaymentservice.bbps.entites.PaymentStartRecord;
public class PaymentStartServiceImpl implements PaymentStartService {
private static final Logger LOGGER = LoggerFactory.getLogger(PaymentStartServiceImpl.class);
@Value("${payment.enckey}")
private String paymentEncryKey;
@Value("${payment.mid}")
private String paymentMid;
@Value("${payment.callbackurl}")
private String paymentcallbackUrl;
@Value("${payment.companyName}")
private String paymentcompanyName;
private final PaymentStartRecordRepository paymentStartRecordRepository;
private final HttpService httpService;
private final EncryptionUtil encryptionUtil;
@@ -78,7 +85,7 @@ public class PaymentStartServiceImpl implements PaymentStartService {
String requestId = request.getReqId();
String apiName = BBPSConstant.API_START_PAYMENT;
String txnId = helper.generateTxnId(15);
LOGGER.info("MID IS:{}",paymentMid);
LOGGER.info("[startIntentPayment] enter requestId={} txnId={} mid={}", requestId, txnId, request.getMid());
helper.validateMerchant(request.getMid());
@@ -92,14 +99,15 @@ public class PaymentStartServiceImpl implements PaymentStartService {
PaymentDetailSentRequest sent = createPaymentSentRequest(request);
String orderNo = BBPSConstant.ORDER_PREFIX + helper.generateTxnId(12);
sent.setOrderNo(orderNo);
sent.setEnckey(BBPSConstant.enckey);
sent.setEnckey(paymentEncryKey);
String plaintext = helper.convertObjectToJson(sent);
String encrypted = encryptionUtil.encryptMData(plaintext, BBPSConstant.enckey);
String encrypted = encryptionUtil.encryptMData(plaintext, paymentEncryKey);
PaymentRequestPayload finalPayload = new PaymentRequestPayload();
finalPayload.setMid(BBPSConstant.mid);
finalPayload.setMid(paymentMid);
finalPayload.setPayload(encrypted);
String forwardJson = helper.convertObjectToJson(finalPayload);
LOGGER.info("FINAL PAYLODA :{}",forwardJson);
LOGGER.info("[startIntentPayment] outbound payload prepared txnId={} orderNo={}", txnId, orderNo);
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, BBPSConstant.UAT_PAYMENT_URL_INTENT, BBPSConstant.HTTP_POST, forwardJson);
@@ -179,10 +187,10 @@ public class PaymentStartServiceImpl implements PaymentStartService {
sent.setUserId(request.getMid());
sent.setCustomerVpa(request.getCustomerVpa());
sent.setDateOfReg(BBPSConstant.DEFAULT_DATE_OF_REG);
String effectiveMid = (request.getMid() != null && !request.getMid().isEmpty()) ? request.getMid() : BBPSConstant.mid;
sent.setMid(BBPSConstant.mid);
// String effectiveMid = (request.getMid() != null && !request.getMid().isEmpty()) ? request.getMid() : paymentMid;
sent.setMid(paymentMid);
sent.setMobileNo(request.getMobileNo());
sent.setRespUrl(BBPSConstant.callbackurl);
sent.setRespUrl(paymentcallbackUrl);
sent.setTxnReqType(BBPSConstant.TXN_REQ_TYPE);
sent.setName(request.getName());
sent.setUdf1(request.getUdf1());
@@ -227,7 +235,7 @@ public class PaymentStartServiceImpl implements PaymentStartService {
sent.setOrderNo(orderNo);
String plaintext = helper.convertObjectToJson(sent);
String encKey = BBPSConstant.enckey;
String encKey = paymentEncryKey;
sent.setEnckey(encKey);
LOGGER.debug("[startWebPayment] plaintext prepared txnId={} orderNo={}", txnId, orderNo);
@@ -237,7 +245,7 @@ public class PaymentStartServiceImpl implements PaymentStartService {
// ----------- BUILD x-www-form-urlencoded PAYLOAD -----------
String formPayload =
"mid=" + URLEncoder.encode(BBPSConstant.mid, StandardCharsets.UTF_8) +
"mid=" + URLEncoder.encode(paymentMid, StandardCharsets.UTF_8) +
"&payload=" + URLEncoder.encode(encrypted, StandardCharsets.UTF_8);
LOGGER.info("[startWebPayment] Form Payload: {}", formPayload);
OutboundTraceLog outboundLog =
@@ -311,7 +319,7 @@ public class PaymentStartServiceImpl implements PaymentStartService {
LOGGER.debug("[{}] received callback mid={} signaturePresent={}", apiName, mid, signature != null);
// Decrypt data
String decrypted = encryptionUtil.decryptMData(encryptedData, BBPSConstant.enckey);
String decrypted = encryptionUtil.decryptMData(encryptedData,paymentEncryKey);
if (decrypted == null) {
LOGGER.error("[{}] Failed to decrypt callback payload for mid={}", apiName, mid);
return new ResponseModel(BBPSConstant.MSG_DECRYPTION_FAILED, String.valueOf(BBPSConstant.STATUS_CODE_207), BBPSConstant.HTTP_OK_INT, null);
@@ -205,8 +205,4 @@ public class BBPSConstant {
public static final long BILL_VALIDATE_DELAY_MS = 12000L; // used after initiate bill validate
public static final long PAYMENT_STATUS_DELAY_MS = 9000L; // used after initiate payment
public static final String enckey = "zk52olsyr9fl95h50eus8bhtyhoo5lp7";
public static final String mid = "Test-By-Aditya-1001";
public static final String callbackurl = "https://checkout.solwio.in/PGPayU/payu/callback";
public static final String companyName = "techwork technology";
}
@@ -54,6 +54,12 @@ ekyc.secreteKey= secret_live_b2acae6e1fd54d6faa148b08af8ae098
ekyc.mobile=https://ekyc.lincpay.in/EKYC/ekyc/mobile/generate-otp
ekyc.mobile.verify.otp=https://ekyc.lincpay.in/EKYC/ekyc/verify-mobile-otp
payment.enckey = g5c4lr0tgjjqhu0bfgmhjf26ab0z8ktk
payment.mid = MIDBBPS001THA
payment.callbackurl = https://11.godemo.in/BBPS/payment/callback/startPayment
payment.companyName = testing.com
# throw NoHandlerFoundException for 404s
spring.mvc.throw-exception-if-no-handler-found=true