resolved Conflict
This commit is contained in:
@@ -3,6 +3,10 @@ package com.billpaymentservice.bbps.controller;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -13,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||||
import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
||||||
|
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
||||||
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
||||||
import com.billpaymentservice.bbps.service.ComplainService;
|
import com.billpaymentservice.bbps.service.ComplainService;
|
||||||
|
|
||||||
@@ -31,6 +36,13 @@ public class ComplainController {
|
|||||||
this.complainService = complainService;
|
this.complainService = complainService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/addComplain", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<ResponseModel> addComplain(@Validated @RequestBody ComplaintRequestDTO complainRequestDTO) {
|
||||||
|
|
||||||
|
ResponseModel response = complainService.addComplain(complainRequestDTO);
|
||||||
|
return ResponseEntity.ok(response);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/checkComplaintStatus")
|
@PostMapping("/checkComplaintStatus")
|
||||||
public ResponseEntity<ResponseModel> getComplaintStatus(@RequestBody ComplainStatusRequest request) {
|
public ResponseEntity<ResponseModel> getComplaintStatus(@RequestBody ComplainStatusRequest request) {
|
||||||
log.info("Received complaint status request for complaintId: {}", request.getComplaintId());
|
log.info("Received complaint status request for complaintId: {}", request.getComplaintId());
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.billpaymentservice.bbps.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ComplaintDetailsDTO {
|
||||||
|
private String complaintId; // UUID
|
||||||
|
private String complaintDescr; // Complaint description
|
||||||
|
private String complaintDispos; // Complaint disposition
|
||||||
|
private String complaintType;
|
||||||
|
// Complaint type
|
||||||
|
@JsonProperty("txnId")
|
||||||
|
private String bankTxnId; // Transaction ID
|
||||||
|
private String txnNpciId; // Transaction NPCI ID
|
||||||
|
private String assignedTo; // Assigned person
|
||||||
|
private String complaintNpciId; // Complaint NPCI ID
|
||||||
|
private String complaintRaisedFrom; // Who raised the complaint
|
||||||
|
private String userId; // User ID
|
||||||
|
private String status; // Complaint status
|
||||||
|
private String refId; // Reference ID
|
||||||
|
private String estimated_TAT; // Estimated Turnaround Time
|
||||||
|
private String creationDate; // ISO timestamp
|
||||||
|
private String modifiedDate; // ISO timestamp
|
||||||
|
private Long createdEpochDate; // Epoch creation time
|
||||||
|
private Long modifiedEpochDate; // Epoch modified time
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.billpaymentservice.bbps.dto.request;
|
package com.billpaymentservice.bbps.dto.request;
|
||||||
|
|
||||||
import com.billpaymentservice.bbps.dto.DeviceDetail;
|
import com.billpaymentservice.bbps.dto.DeviceDetail;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
@@ -15,37 +16,53 @@ import lombok.ToString;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ToString
|
@ToString
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public abstract class BaseClass {
|
public abstract class BaseClass {
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
@NotBlank(message = "MID cannot be null or blank")
|
@NotBlank(message = "MID cannot be null or blank")
|
||||||
private String mid;
|
private String mid;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
|
|
||||||
@NotBlank(message = "Secret key cannot be null or blank")
|
@NotBlank(message = "Secret key cannot be null or blank")
|
||||||
private String secretKey;
|
private String secretKey;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
@NotBlank(message = "Request ID cannot be null or blank")
|
@NotBlank(message = "Request ID cannot be null or blank")
|
||||||
private String reqId;
|
private String reqId;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private DeviceDetail deviceDetial;
|
private DeviceDetail deviceDetial;
|
||||||
// ✅ 10 User Defined Fields (UDF1–UDF10)
|
// ✅ 10 User Defined Fields (UDF1–UDF10)
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf1;
|
private String udf1;
|
||||||
|
|
||||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf2;
|
private String udf2;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf3;
|
private String udf3;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf4;
|
private String udf4;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf5;
|
private String udf5;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf6;
|
private String udf6;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf7;
|
private String udf7;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf8;
|
private String udf8;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf9;
|
private String udf9;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String udf10;
|
private String udf10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.billpaymentservice.bbps.dto.request;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ComplaintRequestDTO extends BaseClass {
|
||||||
|
|
||||||
|
private String complaintDescription; // Complaint description that the user enters
|
||||||
|
private String complaintDisposition; // Complaint disposition
|
||||||
|
private String complaintType; // Type of complaint
|
||||||
|
private String txnId; // Transaction ID (optional)
|
||||||
|
private String clientReqId; // Client Req ID (optional)
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.billpaymentservice.bbps.dto.response;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.billpaymentservice.bbps.dto.ComplaintDetailsDTO;
|
||||||
|
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ComplaintResponse {
|
||||||
|
private ComplaintDetailsDTO complaints; // multiple complaints
|
||||||
|
private GeneralResp generalResp;
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.billpaymentservice.bbps.entites;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "complaint_details")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class ComplaintDetails {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "complaint_id", nullable = false, unique = true)
|
||||||
|
private String complaintId; // Primary key (UUID from BBPS API)
|
||||||
|
|
||||||
|
@Column(name = "req_id")
|
||||||
|
private String reqId;
|
||||||
|
|
||||||
|
@Column(name = "txn_id")
|
||||||
|
private String txnId;
|
||||||
|
|
||||||
|
@Column(name = "complaint_descr")
|
||||||
|
private String complaintDescr;
|
||||||
|
|
||||||
|
@Column(name = "complaint_dispos")
|
||||||
|
private String complaintDispos;
|
||||||
|
|
||||||
|
@Column(name = "complaint_type")
|
||||||
|
private String complaintType;
|
||||||
|
|
||||||
|
@Column(name = "bank_txn_id")
|
||||||
|
private String bankTxnId;
|
||||||
|
|
||||||
|
@Column(name = "txn_npci_id")
|
||||||
|
private String txnNpciId;
|
||||||
|
|
||||||
|
@Column(name = "assigned_to")
|
||||||
|
private String assignedTo;
|
||||||
|
|
||||||
|
@Column(name = "complaint_npci_id")
|
||||||
|
private String complaintNpciId;
|
||||||
|
|
||||||
|
@Column(name = "complaint_raised_from")
|
||||||
|
private String complaintRaisedFrom;
|
||||||
|
|
||||||
|
@Column(name = "user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Column(name = "status")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(name = "ref_id")
|
||||||
|
private String refId;
|
||||||
|
|
||||||
|
@Column(name = "estimated_tat")
|
||||||
|
private String estimated_TAT;
|
||||||
|
|
||||||
|
@Column(name = "creation_date")
|
||||||
|
private String creationDate;
|
||||||
|
|
||||||
|
@Column(name = "modified_date")
|
||||||
|
private String modifiedDate;
|
||||||
|
|
||||||
|
@Column(name = "created_epoch_date")
|
||||||
|
private Long createdEpochDate;
|
||||||
|
|
||||||
|
@Column(name = "modified_epoch_date")
|
||||||
|
private Long modifiedEpochDate;
|
||||||
|
}
|
||||||
@@ -2,10 +2,13 @@ package com.billpaymentservice.bbps.entites;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import jakarta.persistence.ForeignKey;
|
||||||
|
|
||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.CollectionTable;
|
import jakarta.persistence.CollectionTable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ConstraintMode;
|
||||||
import jakarta.persistence.ElementCollection;
|
import jakarta.persistence.ElementCollection;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.FetchType;
|
import jakarta.persistence.FetchType;
|
||||||
@@ -36,10 +39,11 @@ public class Group {
|
|||||||
@Column(name = "input")
|
@Column(name = "input")
|
||||||
private String input;
|
private String input;
|
||||||
|
|
||||||
// Example: "Admission No/Application No/GR No" → stored as multiple params
|
@CollectionTable(
|
||||||
@ElementCollection
|
name = "group_params",
|
||||||
@CollectionTable(name = "group_params", joinColumns = @JoinColumn(name = "group_id"))
|
joinColumns = @JoinColumn(name = "group_id"),
|
||||||
@Column(name = "param_name")
|
foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)
|
||||||
|
)
|
||||||
private List<String> params;
|
private List<String> params;
|
||||||
|
|
||||||
// 🔗 Parent group relationship (for nested groups)
|
// 🔗 Parent group relationship (for nested groups)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.springframework.http.*;
|
|||||||
import org.springframework.validation.FieldError;
|
import org.springframework.validation.FieldError;
|
||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
|
|
||||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||||
|
|
||||||
@@ -37,6 +38,18 @@ public class GlobalExceptionHandler {
|
|||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(resp);
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(NoHandlerFoundException.class)
|
||||||
|
public ResponseEntity<ResponseModel<?>> handleNotFound(NoHandlerFoundException ex) {
|
||||||
|
logger.warn("Endpoint not found: {}", ex.getRequestURL());
|
||||||
|
ResponseModel<?> resp = new ResponseModel<>(
|
||||||
|
"Endpoint not found: " + ex.getRequestURL(),
|
||||||
|
"FAILED",
|
||||||
|
HttpStatus.NOT_FOUND.value(),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(resp);
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(AppException.class)
|
@ExceptionHandler(AppException.class)
|
||||||
public ResponseEntity<ResponseModel<?>> handleAppException(AppException ex) {
|
public ResponseEntity<ResponseModel<?>> handleAppException(AppException ex) {
|
||||||
logger.warn("AppException: status={}, message={}", ex.getStatus(), ex.getMessage());
|
logger.warn("AppException: status={}, message={}", ex.getStatus(), ex.getMessage());
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.billpaymentservice.bbps.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import com.billpaymentservice.bbps.entites.ComplaintDetails;
|
||||||
|
|
||||||
|
public interface ComplainRepository extends JpaRepository<ComplaintDetails, String> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.billpaymentservice.bbps.dto.ResponseModel;
|
|||||||
import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
||||||
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
||||||
|
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
||||||
|
|
||||||
public interface ComplainService {
|
public interface ComplainService {
|
||||||
|
|
||||||
@@ -15,4 +16,6 @@ public interface ComplainService {
|
|||||||
|
|
||||||
ResponseModel closeComplaint(CloseComplaintRequest request);
|
ResponseModel closeComplaint(CloseComplaintRequest request);
|
||||||
|
|
||||||
|
public ResponseModel addComplain(ComplaintRequestDTO complainRequestDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
String txnId = helper.generateTxnId(15);
|
String txnId = helper.generateTxnId(15);
|
||||||
String reqId = billFetchByBillIdRequest.getReqId();
|
String reqId = billFetchByBillIdRequest.getReqId();
|
||||||
String billId = billFetchByBillIdRequest.getBillId();
|
String billId = billFetchByBillIdRequest.getBillId();
|
||||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + "1ced7566-1add-4e01-9ed6-04cd67ac9684";
|
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
|
||||||
|
|
||||||
helper.validateMerchant(billFetchByBillIdRequest.getMid());
|
helper.validateMerchant(billFetchByBillIdRequest.getMid());
|
||||||
|
|
||||||
@@ -347,7 +347,8 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
billFetchByBillIdRequest.setReqId(reqId);
|
billFetchByBillIdRequest.setReqId(reqId);
|
||||||
LOGGER.info("Waiting for 2 seconds before fetching bill by ID...");
|
LOGGER.info("Waiting for 2 seconds before fetching bill by ID...");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
|
||||||
|
Thread.sleep(12000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
LOGGER.warn("Thread interrupted during delay: {}", e.getMessage());
|
LOGGER.warn("Thread interrupted during delay: {}", e.getMessage());
|
||||||
@@ -370,7 +371,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
String txnId = helper.generateTxnId(15);
|
String txnId = helper.generateTxnId(15);
|
||||||
String reqId = billRequest.getReqId();
|
String reqId = billRequest.getReqId();
|
||||||
String billId = billRequest.getBillId();
|
String billId = billRequest.getBillId();
|
||||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_ID_URL+ "c9670952-ebd7-487a-b6ea-49f2b4d4a718";
|
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_ID_URL+ billRequest.getBillId(); ;
|
||||||
|
|
||||||
helper.validateMerchant(billRequest.getMid());
|
helper.validateMerchant(billRequest.getMid());
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.billpaymentservice.bbps.serviceImpl;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.modelmapper.convention.MatchingStrategies;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -19,6 +21,16 @@ import com.billpaymentservice.bbps.dto.response.CloseComplaintStatusResponse;
|
|||||||
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
||||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||||
|
|
||||||
|
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||||
|
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||||
|
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
||||||
|
import com.billpaymentservice.bbps.dto.response.BillerDataResponse;
|
||||||
|
import com.billpaymentservice.bbps.dto.response.ComplaintResponse;
|
||||||
|
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||||
|
import com.billpaymentservice.bbps.entites.BillPayment;
|
||||||
|
import com.billpaymentservice.bbps.entites.BillerDetails;
|
||||||
|
import com.billpaymentservice.bbps.entites.ComplaintDetails;
|
||||||
import com.billpaymentservice.bbps.entites.InboundTraceLog;
|
import com.billpaymentservice.bbps.entites.InboundTraceLog;
|
||||||
import com.billpaymentservice.bbps.entites.OutboundTraceLog;
|
import com.billpaymentservice.bbps.entites.OutboundTraceLog;
|
||||||
import com.billpaymentservice.bbps.exception.CustomException;
|
import com.billpaymentservice.bbps.exception.CustomException;
|
||||||
@@ -28,6 +40,11 @@ import com.billpaymentservice.bbps.util.BBPSConstant;
|
|||||||
import com.billpaymentservice.bbps.util.BillerMapperHelper;
|
import com.billpaymentservice.bbps.util.BillerMapperHelper;
|
||||||
import com.billpaymentservice.bbps.util.Helper;
|
import com.billpaymentservice.bbps.util.Helper;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.billpaymentservice.bbps.repository.ComplainRepository;
|
||||||
|
import com.billpaymentservice.bbps.service.ComplainService;
|
||||||
|
import com.billpaymentservice.bbps.util.BBPSConstant;
|
||||||
|
import com.billpaymentservice.bbps.util.EntityRelationshipUtil;
|
||||||
|
import com.billpaymentservice.bbps.util.Helper;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -38,20 +55,86 @@ public class ComplainServiceImpl implements ComplainService {
|
|||||||
@Value("${agent.data.url}")
|
@Value("${agent.data.url}")
|
||||||
private String agentDtaUrl;
|
private String agentDtaUrl;
|
||||||
|
|
||||||
|
@Value("${complaint.data.url}")
|
||||||
|
private String complainDataUrl;
|
||||||
|
|
||||||
private final RestClient restClient;
|
private final RestClient restClient;
|
||||||
private final HttpService httpService;
|
private final HttpService httpService;
|
||||||
private final Helper helper;
|
private final Helper helper;
|
||||||
private final BharatConnectMasterRepository beneficiaryDetailsRepository;
|
private final BharatConnectMasterRepository beneficiaryDetailsRepository;
|
||||||
private final BillerMapperHelper mapperHelper;
|
private final BillerMapperHelper mapperHelper;
|
||||||
|
private final ComplainRepository complainRepository;
|
||||||
|
|
||||||
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(AgentServiceImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(AgentServiceImpl.class);
|
||||||
|
|
||||||
public ComplainServiceImpl(RestClient restClient, HttpService httpService, Helper helper,
|
public ComplainServiceImpl(RestClient restClient, HttpService httpService, Helper helper,
|
||||||
BharatConnectMasterRepository beneficiaryDetailsRepository, BillerMapperHelper mapperHelper) {
|
BharatConnectMasterRepository beneficiaryDetailsRepository, BillerMapperHelper mapperHelper,
|
||||||
|
ComplainRepository complainRepository) {
|
||||||
this.restClient = restClient;
|
this.restClient = restClient;
|
||||||
this.httpService = httpService;
|
this.httpService = httpService;
|
||||||
this.helper = helper;
|
this.helper = helper;
|
||||||
this.beneficiaryDetailsRepository = beneficiaryDetailsRepository;
|
this.beneficiaryDetailsRepository = beneficiaryDetailsRepository;
|
||||||
this.mapperHelper = mapperHelper;
|
this.mapperHelper = mapperHelper;
|
||||||
|
this.complainRepository = complainRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseModel addComplain(ComplaintRequestDTO complainRequestDTO) {
|
||||||
|
|
||||||
|
LOGGER.info("Initiating addComplain for request ID: {} and MID", complainRequestDTO.getReqId(),
|
||||||
|
complainRequestDTO.getMid());
|
||||||
|
String apiName = "ADDCOMPLAIN";
|
||||||
|
String txnId = helper.generateTxnId(15);
|
||||||
|
String requestId = complainRequestDTO.getReqId();
|
||||||
|
String fullUrl = complainDataUrl + BBPSConstant.ADD_COMPLAIN_ENDPOINT;
|
||||||
|
String requestJson = helper.convertObjectToJson(complainRequestDTO);
|
||||||
|
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.set("x-digiledge-key", headersData.getXDigiledgeKey());
|
||||||
|
headers.set("agentId", headersData.getAgentId());
|
||||||
|
headers.set("tenantId", headersData.getTenantId());
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
|
||||||
|
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnId, apiName, complainRequestDTO.getMid(),
|
||||||
|
"POST", requestJson);
|
||||||
|
|
||||||
|
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, fullUrl, "POST", null);
|
||||||
|
LOGGER.info("Calling external API: {}", fullUrl);
|
||||||
|
LOGGER.info("Request payload: {}", requestJson);
|
||||||
|
Map<String, String> responseMap = httpService.postRequest(fullUrl, requestJson, headers);
|
||||||
|
String responseData = responseMap.get("data");
|
||||||
|
LOGGER.info("fetched data from api is :{}", responseData);
|
||||||
|
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||||
|
try {
|
||||||
|
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||||
|
new TypeReference<Map<String, Object>>() {
|
||||||
|
});
|
||||||
|
LOGGER.info("Parsed response data: {}", dataMap);
|
||||||
|
if (!dataMap.containsKey("generalResp")) {
|
||||||
|
helper.updateInboundLogFailure(inboundLog, responseData, String.valueOf(dataMap.get("status")));
|
||||||
|
throw new CustomException(String.valueOf(dataMap.get("message")), String.valueOf(dataMap.get("status")),
|
||||||
|
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))),
|
||||||
|
String.valueOf(dataMap.get("remarks")));
|
||||||
|
}
|
||||||
|
|
||||||
|
ComplaintResponse responseWrapper = objectMapper.convertValue(dataMap, ComplaintResponse.class);
|
||||||
|
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||||
|
ModelMapper mapper = new ModelMapper();
|
||||||
|
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||||
|
ComplaintDetails entity = mapper.map(responseWrapper.getComplaints(), ComplaintDetails.class);
|
||||||
|
entity.setReqId(complainRequestDTO.getReqId());
|
||||||
|
entity.setTxnId(txnId);
|
||||||
|
complainRepository.save(entity);
|
||||||
|
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
|
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
|
return responseModel;
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
LOGGER.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||||
|
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||||
|
throw new CustomException("Invalid JSON received from API");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -242,7 +325,7 @@ public class ComplainServiceImpl implements ComplainService {
|
|||||||
|
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
String saveComplaintHistory = mapperHelper.saveComplaintHistory(responseWrapper, reqId, txnId);
|
String saveComplaintHistory = mapperHelper.saveComplaintHistory(responseWrapper, reqId, txnId);
|
||||||
LOGGER.info("Complaint ReOpen data saved successfully for Count History: {}",saveComplaintHistory);
|
LOGGER.info("Complaint ReOpen data saved successfully for Count History: {}", saveComplaintHistory);
|
||||||
|
|
||||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
@@ -300,14 +383,15 @@ public class ComplainServiceImpl implements ComplainService {
|
|||||||
String.valueOf(dataMap.get("remarks")));
|
String.valueOf(dataMap.get("remarks")));
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseComplaintStatusResponse responseWrapper = objectMapper.convertValue(dataMap, CloseComplaintStatusResponse.class);
|
CloseComplaintStatusResponse responseWrapper = objectMapper.convertValue(dataMap,
|
||||||
|
CloseComplaintStatusResponse.class);
|
||||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||||
|
|
||||||
String status = generalResp.getStatus();
|
String status = generalResp.getStatus();
|
||||||
LOGGER.info("Current Complaint Close Status: {}", status);
|
LOGGER.info("Current Complaint Close Status: {}", status);
|
||||||
|
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
//mapperHelper.saveReOpenComplaint(responseWrapper, reqId, txnId);
|
// mapperHelper.saveReOpenComplaint(responseWrapper, reqId, txnId);
|
||||||
LOGGER.info("Complaint Close data saved successfully for billId: {}", complaintId);
|
LOGGER.info("Complaint Close data saved successfully for billId: {}", complaintId);
|
||||||
|
|
||||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ public class BBPSConstant {
|
|||||||
public static final String CLOSE_COMPLAINT = " /couapp/complaints/closure";
|
public static final String CLOSE_COMPLAINT = " /couapp/complaints/closure";
|
||||||
|
|
||||||
public static final String PLANS_URL = "/plans";
|
public static final String PLANS_URL = "/plans";
|
||||||
|
public static final String ADD_COMPLAIN_ENDPOINT = "/couapp/complaints";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,16 @@ logging.level.io.github.resilience4j.retry=DEBUG
|
|||||||
master.data.url = https://bbps-staging.digiledge.in/agent/cou-master/masters
|
master.data.url = https://bbps-staging.digiledge.in/agent/cou-master/masters
|
||||||
agent.data.url=https://bbps-staging.digiledge.in/agent/bill-payment-new
|
agent.data.url=https://bbps-staging.digiledge.in/agent/bill-payment-new
|
||||||
payment.data.url=https://bbps-staging.digiledge.in/couapp
|
payment.data.url=https://bbps-staging.digiledge.in/couapp
|
||||||
|
complaint.data.url=https://bbps-staging.digiledge.in
|
||||||
|
|
||||||
|
# throw NoHandlerFoundException for 404s
|
||||||
|
spring.mvc.throw-exception-if-no-handler-found=true
|
||||||
|
|
||||||
|
# disable white-label error page
|
||||||
|
spring.web.resources.add-mappings=false
|
||||||
|
|
||||||
|
# (optional) to avoid path match issues on Spring Boot 2.6+
|
||||||
|
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
|
||||||
|
|
||||||
|
|
||||||
# Resilience4j Retry
|
# Resilience4j Retry
|
||||||
|
|||||||
Reference in New Issue
Block a user