From f15e967e58d96a0070710f20c5a5f6cddec66d8b Mon Sep 17 00:00:00 2001 From: Mohd-Arham Date: Thu, 4 Dec 2025 18:37:44 +0530 Subject: [PATCH] 04-12-25 --- .../bbps/controller/ComplainController.java | 2 +- .../com/billpaymentservice/bbps/dto/Tag.java | 6 +- .../dto/request/BillFetchByBillIdRequest.java | 4 +- .../bbps/dto/request/BillPaymentRequest.java | 65 +++++++++++++------ .../bbps/dto/request/BillerDetailRequest.java | 3 +- .../bbps/dto/request/CustomParamRequest.java | 4 +- .../bbps/dto/request/FetchBillRequest.java | 42 +++++++----- .../request/FetchBillValidatestRequest.java | 21 +++--- .../dto/request/MasterCategoryRequest.java | 3 +- .../bbps/dto/request/PlanRequest.java | 7 +- .../ViewAllComplaintsTicketsRequest.java | 9 ++- .../bbps/entites/BillerCategoryWise.java | 3 + .../bbps/entites/ContactMasterData.java | 3 + .../bbps/entites/CustomParam.java | 48 ++++++++------ .../bbps/serviceImpl/AgentServiceImpl.java | 12 ++-- .../serviceImpl/MasterDataServiceImpl.java | 32 +++++---- .../bbps/util/BillerMapperHelper.java | 13 ++-- 17 files changed, 177 insertions(+), 100 deletions(-) diff --git a/src/main/java/com/billpaymentservice/bbps/controller/ComplainController.java b/src/main/java/com/billpaymentservice/bbps/controller/ComplainController.java index 856d30b..47d7245 100644 --- a/src/main/java/com/billpaymentservice/bbps/controller/ComplainController.java +++ b/src/main/java/com/billpaymentservice/bbps/controller/ComplainController.java @@ -71,7 +71,7 @@ public class ComplainController { } @PostMapping("/viewAllComplaints") - public ResponseEntity viewAllComplaints(@RequestBody ViewAllComplaintsTicketsRequest request) { + public ResponseEntity 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); diff --git a/src/main/java/com/billpaymentservice/bbps/dto/Tag.java b/src/main/java/com/billpaymentservice/bbps/dto/Tag.java index 0e152b7..114fb38 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/Tag.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/Tag.java @@ -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; } diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/BillFetchByBillIdRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/BillFetchByBillIdRequest.java index 01ee703..1a2e387 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/BillFetchByBillIdRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/BillFetchByBillIdRequest.java @@ -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; } diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java index 90d441a..ed9aa07 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/BillPaymentRequest.java @@ -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 deviceBlockTags; - private List customerParamsRequest; - private List remitterIdentity; - private List 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 deviceBlockTags; + private List customerParamsRequest; + private List remitterIdentity; + private List amountBreakSet; } - diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/BillerDetailRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/BillerDetailRequest.java index 867638c..baca884 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/BillerDetailRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/BillerDetailRequest.java @@ -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; } diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/CustomParamRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/CustomParamRequest.java index 8bb1e68..844e052 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/CustomParamRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/CustomParamRequest.java @@ -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; } diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillRequest.java index 3bc58c6..b193444 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillRequest.java @@ -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 deviceBlockTags; // M - private CustomerParamsRequest customerParamsRequest; // M - private List 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 deviceBlockTags; + + private CustomerParamsRequest customerParamsRequest; + private List remitterIdentity; + } diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillValidatestRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillValidatestRequest.java index ab3c764..4346cf1 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillValidatestRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/FetchBillValidatestRequest.java @@ -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 } diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/MasterCategoryRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/MasterCategoryRequest.java index d1816cc..abf6564 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/MasterCategoryRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/MasterCategoryRequest.java @@ -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; diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/PlanRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/PlanRequest.java index 740c379..b10072b 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/PlanRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/PlanRequest.java @@ -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; } diff --git a/src/main/java/com/billpaymentservice/bbps/dto/request/ViewAllComplaintsTicketsRequest.java b/src/main/java/com/billpaymentservice/bbps/dto/request/ViewAllComplaintsTicketsRequest.java index 949e600..7969ed0 100644 --- a/src/main/java/com/billpaymentservice/bbps/dto/request/ViewAllComplaintsTicketsRequest.java +++ b/src/main/java/com/billpaymentservice/bbps/dto/request/ViewAllComplaintsTicketsRequest.java @@ -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 } diff --git a/src/main/java/com/billpaymentservice/bbps/entites/BillerCategoryWise.java b/src/main/java/com/billpaymentservice/bbps/entites/BillerCategoryWise.java index beef7d1..0f856a4 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/BillerCategoryWise.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/BillerCategoryWise.java @@ -59,6 +59,9 @@ public class BillerCategoryWise extends Auditable { @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; diff --git a/src/main/java/com/billpaymentservice/bbps/entites/ContactMasterData.java b/src/main/java/com/billpaymentservice/bbps/entites/ContactMasterData.java index 4f81d17..1306964 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/ContactMasterData.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/ContactMasterData.java @@ -33,4 +33,7 @@ public class ContactMasterData extends Auditable { @Column(name = "txn_id") private String txnId; + + @Column(name = "user_id") + private String userId; } diff --git a/src/main/java/com/billpaymentservice/bbps/entites/CustomParam.java b/src/main/java/com/billpaymentservice/bbps/entites/CustomParam.java index c76e6fe..a1bcd53 100644 --- a/src/main/java/com/billpaymentservice/bbps/entites/CustomParam.java +++ b/src/main/java/com/billpaymentservice/bbps/entites/CustomParam.java @@ -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 { - @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; - } diff --git a/src/main/java/com/billpaymentservice/bbps/serviceImpl/AgentServiceImpl.java b/src/main/java/com/billpaymentservice/bbps/serviceImpl/AgentServiceImpl.java index 0f57d1e..0fd168b 100644 --- a/src/main/java/com/billpaymentservice/bbps/serviceImpl/AgentServiceImpl.java +++ b/src/main/java/com/billpaymentservice/bbps/serviceImpl/AgentServiceImpl.java @@ -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(), diff --git a/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java b/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java index 66ac465..f620ce6 100644 --- a/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java +++ b/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java @@ -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 entities = customParams.stream().map(dto -> mapper.map(dto, CustomParam.class)) - .collect(Collectors.toList()); + List 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 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(); diff --git a/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java b/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java index bf428f3..d795fda 100644 --- a/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java +++ b/src/main/java/com/billpaymentservice/bbps/util/BillerMapperHelper.java @@ -192,7 +192,7 @@ public class BillerMapperHelper { * returns the saved list */ public List mapAndSaveAll(List 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 contactMasterList, String requestId, String txnID) { + public String saveContactMasterData(List 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());