This commit is contained in:
Mohd-Arham
2025-12-04 18:37:44 +05:30
parent 812aa3c2ff
commit f15e967e58
17 changed files with 177 additions and 100 deletions
@@ -71,7 +71,7 @@ public class ComplainController {
}
@PostMapping("/viewAllComplaints")
public ResponseEntity<ResponseModel> viewAllComplaints(@RequestBody ViewAllComplaintsTicketsRequest request) {
public ResponseEntity<ResponseModel> viewAllComplaints(@Validated @RequestBody ViewAllComplaintsTicketsRequest request) {
log.info("Received request complaint View All Complaints for Status Type={}", request.getStatusType());
ResponseModel response = complainService.ViewAllComplaints(request);
return ResponseEntity.ok(response);
@@ -1,5 +1,6 @@
package com.billpaymentservice.bbps.dto;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -10,6 +11,7 @@ import lombok.Setter;
@AllArgsConstructor
@NoArgsConstructor
public class Tag {
private String name;
private String value;
private String name;
private String value;
}
@@ -1,6 +1,6 @@
package com.billpaymentservice.bbps.dto.request;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -12,7 +12,7 @@ import lombok.Setter;
@NoArgsConstructor
public class BillFetchByBillIdRequest extends BaseClass {
@NotNull
@NotBlank(message = "bill id not be null")
private String billId;
}
@@ -1,6 +1,9 @@
package com.billpaymentservice.bbps.dto.request;
import java.util.List;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
@@ -8,25 +11,47 @@ import lombok.Setter;
@Setter
public class BillPaymentRequest extends BaseClass {
private String tenantId;
private String refId;
private String billId;
private boolean amountOptions;
private String paymentMode;
private String paymentInformation;
private String billerId;
private String billerName;
private String billerCategory;
private String macAdress;
private String customerMobNo;
private Integer txnAmount;
private String paymentRefId;
private String clientReqId;
private String paymentChannel;
@NotBlank(message = "ref id cannot be null or empty")
private String refId;
private List<DeviceBlockTagRequest> deviceBlockTags;
private List<CustomerParamTagRequest> customerParamsRequest;
private List<RemitterIdentityRequest> remitterIdentity;
private List<AmountBreakRequest> amountBreakSet;
@NotBlank(message = "bill id cannot be null or empty")
private String billId;
// Change the field to Boolean (wrapper) type to allow @NotNull validation
@NotNull(message = "Amount options cannot be null.")
private boolean amountOptions; // Changed to Boolean (wrapper type)
@NotBlank(message = "payment mode cannot be null or empty")
private String paymentMode;
@NotBlank(message = "payment information cannot be null or empty")
private String paymentInformation;
@NotBlank(message = "biller id cannot be null or empty")
private String billerId;
@NotBlank(message = "biller name cannot be null or empty")
private String billerName;
@NotBlank(message = "biller category cannot be null or empty")
private String billerCategory;
private String macAdress;
private String customerMobNo;
@NotNull(message = "Transaction amount cannot be null.")
private Integer txnAmount; // Changed to @NotNull as it's an Integer (non-nullable)
private String paymentRefId;
private String clientReqId;
@NotBlank(message = "payment channel cannot be null or empty")
private String paymentChannel;
private List<DeviceBlockTagRequest> deviceBlockTags;
private List<CustomerParamTagRequest> customerParamsRequest;
private List<RemitterIdentityRequest> remitterIdentity;
private List<AmountBreakRequest> amountBreakSet;
}
@@ -1,5 +1,6 @@
package com.billpaymentservice.bbps.dto.request;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
@@ -10,7 +11,7 @@ import lombok.ToString;
@ToString(callSuper = true)
public class BillerDetailRequest extends BaseClass{
@NotNull
@NotBlank(message = "biller id not be null")
private String billerId;
}
@@ -1,6 +1,6 @@
package com.billpaymentservice.bbps.dto.request;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -14,6 +14,6 @@ import lombok.ToString;
@ToString
public class CustomParamRequest extends BaseClass {
@NotNull
@NotBlank(message = "biller id not be null")
private String billerId;
}
@@ -6,11 +6,13 @@ import com.billpaymentservice.bbps.dto.CustomerParamsRequest;
import com.billpaymentservice.bbps.dto.RemitterIdentity;
import com.billpaymentservice.bbps.dto.Tag;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@AllArgsConstructor
@@ -18,19 +20,29 @@ import lombok.ToString;
@ToString
public class FetchBillRequest extends BaseClass {
// private String tenantId; // M
private String billerId; // M
private String billerName; //M
// private String digiledgeKey; // M
// private String agentId; // M
private String billerCategory; // M
private String clientReqId; // C
private String macAdress; // C
private String customerMobNo; // M
private String remitterName; // O
private String paymentChannel; // M
private List<Tag> deviceBlockTags; // M
private CustomerParamsRequest customerParamsRequest; // M
private List<RemitterIdentity> remitterIdentity; // O
@NotBlank(message = "biller id not be null")
private String billerId;
@NotBlank(message = "biller name not be null")
private String billerName;
@NotBlank(message = "biller category not be null")
private String billerCategory;
private String clientReqId;
private String macAdress;
@NotBlank(message = "customer mob no not be null")
private String customerMobNo;
private String remitterName;
@NotBlank(message = "payment channel not be null")
private String paymentChannel;
private List<Tag> deviceBlockTags;
private CustomerParamsRequest customerParamsRequest;
private List<RemitterIdentity> remitterIdentity;
}
@@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.dto.request;
import com.billpaymentservice.bbps.dto.CustomerParamsRequest;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -14,18 +15,18 @@ import lombok.Setter;
@NoArgsConstructor
public class FetchBillValidatestRequest extends BaseClass {
@NotNull
private String billerId; // Alphanumeric, Unique ID assigned by NPCI
@NotNull
private String billerName; // String, Name of the biller
@NotNull
private String billerCategory; // String, CategoryResponseList of the biller
@NotNull
private String customerMobNo; // String, Mobile of the Customer
@NotBlank(message = "biller id not be null")
private String billerId;
@NotBlank(message = "biller name not be null")
private String billerName;
@NotBlank(message = "biller category not be null")
private String billerCategory;
@NotBlank(message = "biller mob no not be null")
private String customerMobNo;
private String clientReqId;
// Optional Fields
private String macAddress; // Alphanumeric MAC Address of the Agent Server
//private String clientReqId; // String, Unique id provided by the client
private String macAddress;
// private String clientReqId;
private CustomerParamsRequest customerParamsRequest; // Customer parameters for identifying the bill
}
@@ -1,6 +1,7 @@
package com.billpaymentservice.bbps.dto.request;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -15,7 +16,7 @@ public class MasterCategoryRequest extends BaseClass {
private String billerName;
@NotNull
@NotBlank(message = "category name not be null")
private String category;
private Integer pageNo = 0;
@@ -1,6 +1,8 @@
package com.billpaymentservice.bbps.dto.request;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -26,8 +28,9 @@ public class PlanRequest extends BaseClass {
private String circle;
// ✅ Optional pagination parameters
private Integer page;
private Integer page = 0;
@NotNull(message = "pageEnd is required")
@Min(value = 1, message = "pageEnd must be greater than 0")
private Integer pagesize;
}
@@ -1,15 +1,18 @@
package com.billpaymentservice.bbps.dto.request;
import jakarta.validation.constraints.Min;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ViewAllComplaintsTicketsRequest extends BaseClass{
public class ViewAllComplaintsTicketsRequest extends BaseClass {
private String statusType; // e.g. COMPLAINT_OPEN_SUCCESS
private Integer pageNo; // default 0
private Integer pageSize; // default 10
@Min(value = 0, message = "Page number must be a non-negative integer.")
private Integer pageNo;
@Min(value = 1, message = "Page size must be at least 1.")
private Integer pageSize;
private String ticketType; // default 10
}
@@ -59,6 +59,9 @@ public class BillerCategoryWise extends Auditable<String> {
@Column(name = "txn_id")
private String txnId;
@Column(name = "user_id")
private String userId;
// One-to-One mapping with icon
@OneToOne(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
private BillerCategoryIcon icon;
@@ -33,4 +33,7 @@ public class ContactMasterData extends Auditable<String> {
@Column(name = "txn_id")
private String txnId;
@Column(name = "user_id")
private String userId;
}
@@ -1,5 +1,7 @@
package com.billpaymentservice.bbps.entites;
import com.billpaymentservice.bbps.audit.Auditable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
@@ -15,32 +17,40 @@ import lombok.ToString;
@Entity
@ToString
@Table(name = "custom_param")
public class CustomParam {
public class CustomParam extends Auditable<String> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "custom_param_name")
private String customParamName;
@Column(name = "custom_param_name")
private String customParamName;
@Column(name = "data_type")
private String dataType;
@Column(name = "data_type")
private String dataType;
@Column(name = "optional")
private Boolean optional;
@Column(name = "optional")
private Boolean optional;
@Column(name = "min_length")
private Integer minLength;
@Column(name = "min_length")
private Integer minLength;
@Column(name = "max_length")
private Integer maxLength;
@Column(name = "max_length")
private Integer maxLength;
@Column(name = "regex")
private String regex;
@Column(name = "regex")
private String regex;
@Column(name = "visibility")
private Boolean visibility;
@Column(name = "visibility")
private Boolean visibility;
@Column(name = "req_id")
private String reqId;
@Column(name = "txn_id")
private String txnId;
@Column(name = "user_id")
private String userId;
}
@@ -164,6 +164,7 @@ public class AgentServiceImpl implements AgentService {
String txnId = helper.generateTxnId(15);
String reqId = billFetchByBillIdRequest.getReqId();
String billId = billFetchByBillIdRequest.getBillId();
String userId = billFetchByBillIdRequest.getClientUserId();
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET,
null);
@@ -197,7 +198,7 @@ public class AgentServiceImpl implements AgentService {
LOGGER.info("Current Bill Status: {}", status);
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId);
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId, userId);
LOGGER.info("Bill data saved successfully for billId: {}", billId);
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
@@ -216,8 +217,9 @@ public class AgentServiceImpl implements AgentService {
String reqId = billFetchByBillIdRequest.getReqId();
String billId = billFetchByBillIdRequest.getBillId();
String mid = billFetchByBillIdRequest.getMid();
String userId = billFetchByBillIdRequest.getClientUserId();
String requestJson = helper.convertObjectToJson(billFetchByBillIdRequest);
LOGGER.info("[{}] START | reqId={} | mid={} | billId={}", apiName, reqId, mid, billId);
LOGGER.info("[{}] START | reqId={} | mid={} | billId={} | userId={}", apiName, reqId, mid, billId, userId);
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
String txnId = helper.generateTxnId(15);
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, billFetchByBillIdRequest.getMid(),
@@ -253,7 +255,7 @@ public class AgentServiceImpl implements AgentService {
// update inbound log success and persist bill data
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId);
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId, userId);
LOGGER.info("Bill data saved successfully for billId={} | Status={}", billId, generalResp.getStatus());
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
return responseModel;
@@ -396,7 +398,7 @@ public class AgentServiceImpl implements AgentService {
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
System.out.println("responseWrapper:" + responseWrapper);
mapperHelper.saveBillValidation(responseWrapper, billRequest,txnId);
mapperHelper.saveBillValidation(responseWrapper, billRequest, txnId);
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
} catch (JsonProcessingException e) {
@@ -454,7 +456,7 @@ public class AgentServiceImpl implements AgentService {
GeneralResp generalResp = responseWrapper.getGenericResponse();
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
mapperHelper.saveBillValidation(responseWrapper, billRequest,txnId);
mapperHelper.saveBillValidation(responseWrapper, billRequest, txnId);
LOGGER.info("Bill validation saved successfully for billId: {}", billId);
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
@@ -239,9 +239,9 @@ public class MasterDataServiceImpl implements MasterDataService {
String apiName = BBPSConstant.API_GET_CUSTOMER_PARAM_BY_BILLER_ID;
String requestId = customerParamRequest.getReqId();
String mid = customerParamRequest.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid,
customerParamRequest.getBillerId());
String userId = customerParamRequest.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | billerId={} | userId={}", apiName, requestId, mid,
customerParamRequest.getBillerId(), userId);
String txnID = helper.generateTxnId(15);
String billerId = customerParamRequest.getBillerId();
String fullUrl = masterRegisterUrl + BBPSConstant.CUSTOMPARAM_URL + billerId;
@@ -282,8 +282,13 @@ public class MasterDataServiceImpl implements MasterDataService {
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
// Map DTOs to entities
List<CustomParam> entities = customParams.stream().map(dto -> mapper.map(dto, CustomParam.class))
.collect(Collectors.toList());
List<CustomParam> entities = customParams.stream().map(dto -> {
CustomParam mappedParam = mapper.map(dto, CustomParam.class);
mappedParam.setReqId(requestId);
mappedParam.setTxnId(txnID);
mappedParam.setUserId(userId);
return mappedParam;
}).collect(Collectors.toList());
// Save all to DB
customParamReposiotory.saveAll(entities);
LOGGER.info("[{}] Saved {} custom param records to DB", apiName, entities.size());
@@ -306,8 +311,9 @@ public class MasterDataServiceImpl implements MasterDataService {
String apiName = BBPSConstant.API_FETCH_CATEGORY_MASTER_DATA;
String requestId = contactMasterRequest.getReqId();
String mid = contactMasterRequest.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | category={}", apiName, requestId, contactMasterRequest.getMid(),
contactMasterRequest.getCategory());
String userId = contactMasterRequest.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | category={} | userId={}", apiName, requestId,
contactMasterRequest.getMid(), contactMasterRequest.getCategory(), userId);
String txnID = helper.generateTxnId(15);
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID);
@@ -345,8 +351,8 @@ public class MasterDataServiceImpl implements MasterDataService {
}
ContactMasterResponse responseWrapper = objectMapper.convertValue(dataMap, ContactMasterResponse.class);
String result = mapperHelper.saveContactMasterData(responseWrapper.getContactMasterList(), requestId,
txnID);
String result = mapperHelper.saveContactMasterData(responseWrapper.getContactMasterList(), requestId, txnID,
userId);
LOGGER.info("[{}] DB Save Result | reqId={} | result={}", apiName, requestId, result);
GeneralResp generalResp = responseWrapper.getGeneralResp();
@@ -371,9 +377,9 @@ public class MasterDataServiceImpl implements MasterDataService {
String apiName = BBPSConstant.API_FETCH_MASTER_DATA_CATEGORY_WISE;
String requestId = masterRequest.getReqId();
String mid = masterRequest.getMid();
LOGGER.info("[{}] START | reqId={} | mid={} | billerName={} | category={}", apiName, requestId, mid,
masterRequest.getBillerName(), masterRequest.getCategory());
String userId = masterRequest.getClientUserId();
LOGGER.info("[{}] START | reqId={} | mid={} | billerName={} | category={} | userId={}", apiName, requestId, mid,
masterRequest.getBillerName(), masterRequest.getCategory(), userId);
String txnID = helper.generateTxnId(15);
String fullUrl = String.format("%s%s?billerName=%s&category=%s&page=%d&pagesize=%d", masterRegisterUrl,
@@ -414,7 +420,7 @@ public class MasterDataServiceImpl implements MasterDataService {
BillerResponse responseWrapper = objectMapper.convertValue(dataMap, BillerResponse.class);
List<BillerCategoryWise> savedEntities = mapperHelper.mapAndSaveAll(responseWrapper.getBillerResp(),
requestId, txnID);
requestId, txnID, userId);
LOGGER.info("[{}] Saved {} records to DB | reqId={}", apiName, savedEntities.size(), requestId);
GeneralResp generalResp = responseWrapper.getGeneralResp();
@@ -192,7 +192,7 @@ public class BillerMapperHelper {
* returns the saved list
*/
public List<BillerCategoryWise> mapAndSaveAll(List<MasterCategoryBillerResponse> dtos, String requestId,
String txnId) {
String txnId, String userId) {
if (dtos == null || dtos.isEmpty()) {
return Collections.emptyList();
}
@@ -216,6 +216,7 @@ public class BillerMapperHelper {
biller.setCreateDateTime(new Date());
biller.setRequestId(requestId);
biller.setTxnId(txnId);
biller.setUserId(userId);
// Handle icon
BillerIconDTO iconDTO = dto.getBiller_icon();
@@ -871,7 +872,8 @@ public class BillerMapperHelper {
return "SUCCESS";
}
public String saveContactMasterData(List<ContactMaster> contactMasterList, String requestId, String txnID) {
public String saveContactMasterData(List<ContactMaster> contactMasterList, String requestId, String txnID,
String userId) {
if (contactMasterList == null || contactMasterList.isEmpty()) {
return "No contact master data found";
@@ -883,6 +885,7 @@ public class BillerMapperHelper {
entity.setMobNo(dto.getMobNo());
entity.setReqId(requestId);
entity.setTxnId(txnID);
entity.setUserId(userId);
entity.setCreateDateTime(new Date());
return entity;
}).collect(Collectors.toList());
@@ -906,7 +909,7 @@ public class BillerMapperHelper {
}
public void saveOrUpdateBillData(BillDataResponse responseWrapper,
BillFetchByBillIdRequest billFetchByBillIdRequest, String txnId) {
BillFetchByBillIdRequest billFetchByBillIdRequest, String txnId, String reqId, String userId) {
BillMaster billMaster = new BillMaster();
@@ -918,6 +921,8 @@ public class BillerMapperHelper {
billMaster.setUserId(responseWrapper.getUserId());
billMaster.setReqId(billFetchByBillIdRequest.getReqId());
billMaster.setTxnId(txnId);
billMaster.setReqId(reqId);
billMaster.setUserId(userId);
billMaster.setClientUserId(billFetchByBillIdRequest.getClientUserId());
// BILLER RESPONSE
@@ -1056,7 +1061,7 @@ public class BillerMapperHelper {
BillPaymentForwardRequest forward = new BillPaymentForwardRequest();
forward.setTenantId(req.getTenantId());
// forward.setTenantId(req.getTenantId());
forward.setRefId(req.getRefId());
forward.setBillId(req.getBillId());
forward.setAmountOptions(req.isAmountOptions());