Moved changes from develop to feature1
This commit is contained in:
@@ -36,7 +36,7 @@ public class ComplainController {
|
||||
public ComplainController(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) {
|
||||
|
||||
@@ -78,4 +78,6 @@ public class ComplainController {
|
||||
ResponseModel response = complainService.viewComplaintById(request);
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -24,7 +25,9 @@ public class ViewComplaintDTO {
|
||||
private String modifiedEpochDate;
|
||||
private String refId;
|
||||
private String status;
|
||||
private String txnId;
|
||||
@JsonProperty("txnId")
|
||||
private String bankTxnId;
|
||||
|
||||
private String userId;
|
||||
private String category;
|
||||
private String billerName;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TxnStatusRequest extends BaseClass {
|
||||
|
||||
private String id;
|
||||
private String idType;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.billpaymentservice.bbps.dto.response;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TxnStatusResponse {
|
||||
|
||||
private String txnStatusReqRefId;
|
||||
private String agentId;
|
||||
private String billerId;
|
||||
private String approvalRefNum;
|
||||
private String txnRefId;
|
||||
private String mti;
|
||||
private String txnDate; // RFC3339 format
|
||||
private String amount;
|
||||
private String txnStatus; // SUCCESS / FAILED
|
||||
private String customerMobile;
|
||||
|
||||
private GeneralResp generalResp;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(name = "complaint_status_details")
|
||||
public class ComplaintStatusDetails {
|
||||
|
||||
|
||||
@Id
|
||||
@Column(name = "req_id")
|
||||
private String reqId;
|
||||
|
||||
@Column(name = "txn_id")
|
||||
private String txnId;
|
||||
|
||||
private String complaintId;
|
||||
|
||||
@Column(name = "assigned_to")
|
||||
private String assignedTo;
|
||||
|
||||
@Column(name = "comment")
|
||||
private String comment;
|
||||
|
||||
@Column(name = "complaint_descr")
|
||||
private String complaintDescr;
|
||||
|
||||
@Column(name = "complaint_dispos")
|
||||
private String complaintDispos;
|
||||
|
||||
@Column(name = "complaint_npci_id")
|
||||
private String complaintNpciId;
|
||||
|
||||
@Column(name = "complaint_raised_from")
|
||||
private String complaintRaisedFrom;
|
||||
|
||||
@Column(name = "complaint_type")
|
||||
private String complaintType;
|
||||
|
||||
@Column(name = "created_epoch_date")
|
||||
private String createdEpochDate;
|
||||
|
||||
@Column(name = "creation_date")
|
||||
private String creationDate;
|
||||
|
||||
@Column(name = "estimated_tat")
|
||||
private String estimated_TAT;
|
||||
|
||||
@Column(name = "modified_date")
|
||||
private String modifiedDate;
|
||||
|
||||
@Column(name = "modified_epoch_date")
|
||||
private String modifiedEpochDate;
|
||||
|
||||
@Column(name = "ref_id")
|
||||
private String refId;
|
||||
|
||||
@Column(name = "status")
|
||||
private String status;
|
||||
|
||||
@Column(name = "bank_txn_id")
|
||||
private String bank_txnId;
|
||||
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
@Column(name = "category")
|
||||
private String category;
|
||||
|
||||
@Column(name = "biller_name")
|
||||
private String billerName;
|
||||
|
||||
@Column(name = "txn_amount")
|
||||
private String txnAmount;
|
||||
|
||||
@Column(name = "total_txn_amount")
|
||||
private String totalTxnAmount;
|
||||
|
||||
@Column(name = "complaint_status")
|
||||
private String complaintStatus;
|
||||
|
||||
@Column(name = "super_level_esc")
|
||||
private String superLevelEsc;
|
||||
|
||||
@Column(name = "open_complaint")
|
||||
private String openComplaint;
|
||||
|
||||
@Column(name = "reopen_complaint")
|
||||
private String reopenComplaint;
|
||||
|
||||
@Column(name = "remarks")
|
||||
private String remarks;
|
||||
|
||||
@Column(name = "agent_id")
|
||||
private String agentId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
public class TxnStatus {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.billpaymentservice.bbps.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.ComplaintStatusDetails;
|
||||
|
||||
@Repository
|
||||
public interface ComplainDetailRepository extends JpaRepository<ComplaintStatusDetails,String> {
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
||||
import com.billpaymentservice.bbps.dto.request.TxnStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
||||
|
||||
@@ -17,8 +18,10 @@ public interface ComplainService {
|
||||
|
||||
ResponseModel closeComplaint(CloseComplaintRequest request);
|
||||
|
||||
public ResponseModel addComplain(ComplaintRequestDTO complainRequestDTO);
|
||||
ResponseModel addComplain(ComplaintRequestDTO complainRequestDTO);
|
||||
|
||||
ResponseModel viewComplaintById(ViewComplainByIdRequest request);
|
||||
|
||||
ResponseModel checkTxnStatus(TxnStatusRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,10 +17,12 @@ import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ComplainStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ReOpenComplain;
|
||||
import com.billpaymentservice.bbps.dto.request.TxnStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.response.CloseComplaintStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.TxnStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||
|
||||
@@ -461,7 +463,7 @@ public class ComplainServiceImpl implements ComplainService {
|
||||
LOGGER.info("Current Complaint ReOpen Status: {}", status);
|
||||
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||
//String saveComplaintHistory = mapperHelper.saveComplaintHistory(responseWrapper, reqId, txnId);
|
||||
String saveComplaint = mapperHelper.saveComplainStatusDetail(responseWrapper, reqId, txnId);
|
||||
//LOGGER.info("Complaint ReOpen data saved successfully for Count History: {}", saveComplaintHistory);
|
||||
|
||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
@@ -473,4 +475,72 @@ public class ComplainServiceImpl implements ComplainService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseModel checkTxnStatus(TxnStatusRequest request) {
|
||||
LOGGER.info("Fetching TxnStatusRequest by Id={} and ReqId ={}", request.getId(),
|
||||
request.getReqId());
|
||||
String apiName = "CheckTxnStatus";
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String reqId = request.getReqId();
|
||||
String ID = request.getId();
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.CHECK_TRANSACTION_URL + request.getId();
|
||||
|
||||
helper.validateMerchant(request.getMid());
|
||||
|
||||
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);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
String requestJson = helper.convertObjectToJson(request);
|
||||
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), "GET",
|
||||
requestJson);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, "GET", ID);
|
||||
LOGGER.debug("Outbound log created successfully for Complaint : {}", fullUrl);
|
||||
|
||||
try {
|
||||
LOGGER.info("Calling external API: {}", fullUrl);
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
||||
String responseData = responseMap.get("data");
|
||||
LOGGER.info("checkTxnStatus: {}", responseData);
|
||||
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
|
||||
if (!dataMap.containsKey("generalResp")) {
|
||||
helper.updateInboundLogFailure(inboundLog, responseData, "INVALID_RESPONSE");
|
||||
LOGGER.warn("Invalid response structure for txnId: {}", txnId);
|
||||
throw new CustomException(String.valueOf(dataMap.get("message")), String.valueOf(dataMap.get("status")),
|
||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), String.valueOf(""));
|
||||
}
|
||||
|
||||
TxnStatusResponse responseWrapper = objectMapper.convertValue(dataMap,
|
||||
TxnStatusResponse.class);
|
||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||
|
||||
String status = generalResp.getStatus();
|
||||
LOGGER.info("Current Complaint ReOpen Status: {}", status);
|
||||
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||
//String saveComplaint = mapperHelper.saveComplainStatusDetail(responseWrapper, reqId, txnId);
|
||||
//LOGGER.info("Complaint ReOpen data saved successfully for Count History: {}", saveComplaintHistory);
|
||||
|
||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing Complaint Id JSON: {}", e.getMessage(), e);
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.modelmapper.convention.MatchingStrategies;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,6 +24,7 @@ import com.billpaymentservice.bbps.dto.response.AmountOptionsResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.PlanResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
||||
import com.billpaymentservice.bbps.entites.AdditionalInfoPlans;
|
||||
import com.billpaymentservice.bbps.entites.AmountOptionByBillerId;
|
||||
import com.billpaymentservice.bbps.entites.AmountOptionDetails;
|
||||
@@ -29,7 +32,9 @@ import com.billpaymentservice.bbps.entites.BillerCategoryIcon;
|
||||
import com.billpaymentservice.bbps.entites.BillerCategoryWise;
|
||||
import com.billpaymentservice.bbps.entites.CategoryResponseList;
|
||||
import com.billpaymentservice.bbps.entites.ComplainStatus;
|
||||
import com.billpaymentservice.bbps.entites.ComplaintDetails;
|
||||
import com.billpaymentservice.bbps.entites.ComplaintHistory;
|
||||
import com.billpaymentservice.bbps.entites.ComplaintStatusDetails;
|
||||
import com.billpaymentservice.bbps.entites.CustomerParamGroupById;
|
||||
import com.billpaymentservice.bbps.entites.GroupParam;
|
||||
import com.billpaymentservice.bbps.entites.Plan;
|
||||
@@ -46,6 +51,7 @@ import com.billpaymentservice.bbps.repository.CustomerParamGroupByBillerIdReposi
|
||||
import com.billpaymentservice.bbps.repository.FetchBillValidateRepository;
|
||||
import com.billpaymentservice.bbps.repository.PlanResponseRepository;
|
||||
import com.billpaymentservice.bbps.repository.ReOpenComplaintRepository;
|
||||
import com.billpaymentservice.bbps.repository.ComplainDetailRepository;
|
||||
import com.billpaymentservice.bbps.serviceImpl.AgentServiceImpl;
|
||||
|
||||
@Component
|
||||
@@ -62,6 +68,8 @@ public class BillerMapperHelper {
|
||||
private final ComplaintStatusRepository complaintStatusRepository;
|
||||
private final ReOpenComplaintRepository reOpenComplaintRepository;
|
||||
private final ComplaintHistoryRepository complaintHistoryRepository;
|
||||
|
||||
private final ComplainDetailRepository complainDetailRepository;
|
||||
|
||||
public BillerMapperHelper(BillerCategoryWiseRepository billerRepo,
|
||||
CustomerParamGroupByBillerIdRepository customerParamGroupByBillerIdRepo,
|
||||
@@ -70,7 +78,8 @@ public class BillerMapperHelper {
|
||||
CategoryResponseListRepository categoryResponseListRepository,
|
||||
FetchBillValidateRepository fetchBillValidateRepository,
|
||||
ComplaintStatusRepository complaintStatusRepository, ReOpenComplaintRepository reOpenComplaintRepository,
|
||||
ComplaintHistoryRepository complaintHistoryRepository) {
|
||||
ComplaintHistoryRepository complaintHistoryRepository,
|
||||
ComplainDetailRepository complainDetailRepository) {
|
||||
this.billerRepo = billerRepo;
|
||||
this.customerParamGroupByBillerIdRepo = customerParamGroupByBillerIdRepo;
|
||||
this.amountOptionByBillerIdRepository = amountOptionByBillerIdRepository;
|
||||
@@ -80,6 +89,7 @@ public class BillerMapperHelper {
|
||||
this.complaintStatusRepository = complaintStatusRepository;
|
||||
this.reOpenComplaintRepository = reOpenComplaintRepository;
|
||||
this.complaintHistoryRepository = complaintHistoryRepository;
|
||||
this.complainDetailRepository = complainDetailRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -534,4 +544,31 @@ public class BillerMapperHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public String saveComplainStatusDetail(ViewComplainByIdResponse responseWrapper, String reqId, String txnId) {
|
||||
|
||||
ModelMapper mapper = new ModelMapper();
|
||||
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||
|
||||
// Map list → ComplaintStatusDetails list
|
||||
List<ComplaintStatusDetails> entityList = responseWrapper.getComplaintsList()
|
||||
.stream()
|
||||
.map(c -> mapper.map(c, ComplaintStatusDetails.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// Set extra fields
|
||||
for (ComplaintStatusDetails entity : entityList) {
|
||||
entity.setReqId(reqId);
|
||||
entity.setTxnId(txnId);
|
||||
}
|
||||
|
||||
// Save to repository
|
||||
complainDetailRepository.saveAll(entityList);
|
||||
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user