Merge pull request 'updating' (#6) from feature1 into develop
Reviewed-on: https://git.zeptic.in/himanshu/bbps/pulls/6
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
package com.billpaymentservice.bbps.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class BillerAdditonalInfoDTO {
|
||||||
|
private String paramConfigId;
|
||||||
|
private String paramName;
|
||||||
|
private String dataTypeDAO;
|
||||||
|
private String dataTypeModel;
|
||||||
|
private boolean optional;
|
||||||
|
private boolean visibility;
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.dto;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.billpaymentservice.bbps.entites.AdditionalInfoBillValidate;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
@@ -102,7 +103,7 @@ public class BillerDTO {
|
|||||||
private BillerResponseParamsDTO billerResponseParams;
|
private BillerResponseParamsDTO billerResponseParams;
|
||||||
|
|
||||||
private List<AdditionalInfoDTO> billerAdditionalInfos;
|
private List<AdditionalInfoDTO> billerAdditionalInfos;
|
||||||
private List<AdditionalInfoDTO> billerAdditionalInfoPayments;
|
private List<BillerAdditonalInfoDTO> billerAdditionalInfoPayments;
|
||||||
|
|
||||||
private List<InterchangeFeeConfDTO> interchangeFeeConves;
|
private List<InterchangeFeeConfDTO> interchangeFeeConves;
|
||||||
private List<InterchangeFeeDTO> interchangeFees;
|
private List<InterchangeFeeDTO> interchangeFees;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import lombok.ToString;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ToString
|
@ToString
|
||||||
public class FetchBillValidateResponse {
|
public class FetchBillValidateResponse {
|
||||||
|
|
||||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private GeneralResp genericResponse;
|
private GeneralResp genericResponse;
|
||||||
private String billId;
|
private String billId;
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.billpaymentservice.bbps.entites;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "additional_info_bill_validate")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class AdditionalInfoBillValidate {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
// ✅ Many Params → One Bill
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "bill_id_fk")
|
||||||
|
private BillValidation bill;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -37,8 +37,8 @@ public class BillValidation {
|
|||||||
@Column(name = "biller_response", columnDefinition = "TEXT")
|
@Column(name = "biller_response", columnDefinition = "TEXT")
|
||||||
private String billerResponse;
|
private String billerResponse;
|
||||||
|
|
||||||
@Column(name = "additional_info", columnDefinition = "TEXT")
|
@OneToMany(mappedBy = "bill", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
private String additionalInfo;
|
private List<AdditionalInfoBillValidate> additionalInfo;
|
||||||
|
|
||||||
// 👇 Proper nested customer params (OneToMany)
|
// 👇 Proper nested customer params (OneToMany)
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bill")
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bill")
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.billpaymentservice.bbps.entites;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Table(name = "biller_additional_info_payment")
|
||||||
|
@Entity
|
||||||
|
public class BillerAdditionalInfoPayment {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id; // primary key for the table
|
||||||
|
|
||||||
|
@Column(name = "param_config_id", nullable = false)
|
||||||
|
@NotBlank(message = "Param Config ID cannot be blank")
|
||||||
|
private String paramConfigId;
|
||||||
|
|
||||||
|
@Column(name = "param_name", nullable = false)
|
||||||
|
@NotBlank(message = "Param name cannot be blank")
|
||||||
|
private String paramName;
|
||||||
|
|
||||||
|
@Column(name = "data_type_dao")
|
||||||
|
private String dataTypeDAO;
|
||||||
|
|
||||||
|
@Column(name = "data_type_model")
|
||||||
|
private String dataTypeModel;
|
||||||
|
|
||||||
|
@Column(name = "optional", nullable = false)
|
||||||
|
private boolean optional;
|
||||||
|
|
||||||
|
@Column(name = "visibility", nullable = false)
|
||||||
|
private boolean visibility;
|
||||||
|
|
||||||
|
// 🔗 Many AdditionalInfos belong to one Biller
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "biller_id", nullable = false)
|
||||||
|
private BillerDetails biller;
|
||||||
|
}
|
||||||
@@ -29,7 +29,8 @@ import lombok.ToString;
|
|||||||
"billerAdditionalInfos",
|
"billerAdditionalInfos",
|
||||||
"interchangeFeeConves",
|
"interchangeFeeConves",
|
||||||
"interchangeFees",
|
"interchangeFees",
|
||||||
"billerPlanResponseParams"
|
"billerPlanResponseParams",
|
||||||
|
"billerAdditionalInfoPayments"
|
||||||
})
|
})
|
||||||
|
|
||||||
@Table(name = "biller_details")
|
@Table(name = "biller_details")
|
||||||
@@ -151,11 +152,9 @@ public class BillerDetails {
|
|||||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
private List<AdditionalInfo> billerAdditionalInfos;
|
private List<AdditionalInfo> billerAdditionalInfos;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval=true)
|
||||||
/*
|
private List<BillerAdditionalInfoPayment> billerAdditionalInfoPayments;
|
||||||
* OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval
|
|
||||||
* =true) private List<AdditionalInfo> billerAdditionalInfoPayments;
|
|
||||||
*/
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
private List<InterchangeFeeConf> interchangeFeeConves;
|
private List<InterchangeFeeConf> interchangeFeeConves;
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseModel initiateBillFetch(FetchBillRequest fetchBillRequest) {
|
public ResponseModel initiateBillFetch(FetchBillRequest fetchBillRequest) {
|
||||||
LOGGER.info("Initiating bill fetch for request ID: {} and MID", fetchBillRequest.getReqId(),
|
LOGGER.info("Initiating bill fetch for request ID: {} and MID :{} and billerId:{} ", fetchBillRequest.getReqId(),
|
||||||
fetchBillRequest.getMid());
|
fetchBillRequest.getMid(),fetchBillRequest.getBillerId());
|
||||||
String apiName = "InitiateBillFetch";
|
String apiName = "InitiateBillFetch";
|
||||||
String txnId = helper.generateTxnId(15);
|
String txnId = helper.generateTxnId(15);
|
||||||
String requestId = fetchBillRequest.getReqId();
|
String requestId = fetchBillRequest.getReqId();
|
||||||
@@ -223,64 +223,80 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseModel fetchBillById(BillFetchByBillIdRequest billFetchByBillIdRequest) {
|
public ResponseModel fetchBillById(BillFetchByBillIdRequest billFetchByBillIdRequest) {
|
||||||
String apiName = "FetchBillById";
|
String apiName = "FetchBillById";
|
||||||
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 + billFetchByBillIdRequest.getBillId();
|
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
|
||||||
|
|
||||||
LOGGER.info("Initiating {} API for billId={} and reqId={}", apiName, billId, reqId);
|
LOGGER.info("Initiating {} API for billId={} and reqId={}", apiName, billId, reqId);
|
||||||
|
|
||||||
try {
|
// create inbound log (GET -> no request body)
|
||||||
helper.validateMerchant(billFetchByBillIdRequest.getMid());
|
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName,
|
||||||
LOGGER.debug("Merchant validated successfully for MID={}", billFetchByBillIdRequest.getMid());
|
billFetchByBillIdRequest.getMid(), "GET", null);
|
||||||
|
|
||||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
try {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
helper.validateMerchant(billFetchByBillIdRequest.getMid());
|
||||||
headers.set("x-digiledge-key", headersData.getXDigiledgeKey());
|
LOGGER.debug("Merchant validated successfully for MID={}", billFetchByBillIdRequest.getMid());
|
||||||
headers.set("agentId", headersData.getAgentId());
|
|
||||||
headers.set("tenantId", headersData.getTenantId());
|
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
||||||
|
|
||||||
LOGGER.info("Calling external BBPS API for FetchBillById, URL={}", fullUrl);
|
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||||
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
HttpHeaders headers = new HttpHeaders();
|
||||||
String responseData = responseMap.get("data");
|
headers.set("x-digiledge-key", headersData.getXDigiledgeKey());
|
||||||
LOGGER.info("Response received from BBPS for billId={} : {}", billId, responseData);
|
headers.set("agentId", headersData.getAgentId());
|
||||||
|
headers.set("tenantId", headersData.getTenantId());
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
// create outbound log
|
||||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, "GET", null);
|
||||||
new TypeReference<Map<String, Object>>() {
|
LOGGER.info("Calling external BBPS API for FetchBillById, URL={}", fullUrl);
|
||||||
});
|
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
||||||
|
String responseData = responseMap.get("data");
|
||||||
|
LOGGER.info("Response received from BBPS for billId={} : {}", billId, responseData);
|
||||||
|
|
||||||
if (!dataMap.containsKey("genericResponse")) {
|
// update outbound log with response
|
||||||
LOGGER.warn("Invalid response structure received for billId={} | Response={}", billId, responseData);
|
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||||
throw new CustomException(String.valueOf(dataMap.get("message")), // message
|
|
||||||
String.valueOf(dataMap.get("status")), // status
|
|
||||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), // statusCode
|
|
||||||
String.valueOf(dataMap.get("remarks")));
|
|
||||||
}
|
|
||||||
|
|
||||||
BillDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillDataResponse.class);
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||||
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
new TypeReference<Map<String, Object>>() {
|
||||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
});
|
||||||
|
|
||||||
helper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId);
|
if (!dataMap.containsKey("genericResponse")) {
|
||||||
LOGGER.info("Bill data saved successfully for billId={} | Status={}", billId, generalResp.getStatus());
|
helper.updateInboundLogFailure(inboundLog, responseData, "INVALID_RESPONSE");
|
||||||
|
LOGGER.warn("Invalid response structure received for billId={} | Response={}", billId, responseData);
|
||||||
|
throw new CustomException(String.valueOf(dataMap.get("message")), // message
|
||||||
|
String.valueOf(dataMap.get("status")), // status
|
||||||
|
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), // statusCode
|
||||||
|
String.valueOf(dataMap.get("remarks")));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return responseModel;
|
BillDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillDataResponse.class);
|
||||||
|
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
||||||
|
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
|
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
|
|
||||||
} catch (JsonProcessingException e) {
|
// update inbound log success and persist bill data
|
||||||
LOGGER.error("Error parsing responseData JSON for billId={} : {}", billId, e.getMessage(), e);
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
throw new CustomException("Invalid JSON received from API");
|
helper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId);
|
||||||
}
|
LOGGER.info("Bill data saved successfully for billId={} | Status={}", billId, generalResp.getStatus());
|
||||||
|
|
||||||
|
return responseModel;
|
||||||
|
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
LOGGER.error("Error parsing responseData JSON for billId={} : {}", billId, e.getMessage(), e);
|
||||||
|
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||||
|
throw new CustomException("Invalid JSON received from API");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseModel initiateBillValidate(FetchBillValidatestRequest fetchBillValidateRequest) {
|
public ResponseModel initiateBillValidate(FetchBillValidatestRequest fetchBillValidateRequest) {
|
||||||
|
LOGGER.info("Initiating bill Validate for request ID: {} and MID:{} and billerId:{}", fetchBillValidateRequest.getReqId(),
|
||||||
|
fetchBillValidateRequest.getMid(),fetchBillValidateRequest.getBillerId());
|
||||||
|
|
||||||
LOGGER.info("Initiating bill Validate for request ID: {} and MID", fetchBillValidateRequest.getReqId(),
|
|
||||||
fetchBillValidateRequest.getMid());
|
|
||||||
String apiName = "InitiateBillValidate";
|
String apiName = "InitiateBillValidate";
|
||||||
String txnId = helper.generateTxnId(15);
|
String txnId = helper.generateTxnId(15);
|
||||||
String reqId = fetchBillValidateRequest.getReqId();
|
String reqId = fetchBillValidateRequest.getReqId();
|
||||||
@@ -436,9 +452,74 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================== Bill fetch and Bill Validate by Client Req
|
|
||||||
// Id==================================//
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseModel initiateBillValidateByBillId(BillFetchByBillIdRequest billRequest) {
|
||||||
|
String apiName = "FetchBillById";
|
||||||
|
String txnId = helper.generateTxnId(15);
|
||||||
|
String reqId = billRequest.getReqId();
|
||||||
|
String billId = billRequest.getBillId();
|
||||||
|
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_ID_URL + billRequest.getBillId();
|
||||||
|
|
||||||
|
LOGGER.info("Initiating {} API for billId={} and reqId={}", apiName, billId, reqId);
|
||||||
|
|
||||||
|
// create inbound log (GET -> no request body)
|
||||||
|
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, billRequest.getMid(), "GET", null);
|
||||||
|
|
||||||
|
try {
|
||||||
|
helper.validateMerchant(billRequest.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);
|
||||||
|
|
||||||
|
// create outbound log
|
||||||
|
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, "GET", null);
|
||||||
|
LOGGER.info("Calling external BBPS API for ValidateByBillId, URL={}", fullUrl);
|
||||||
|
|
||||||
|
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
||||||
|
String responseData = responseMap.get("data");
|
||||||
|
LOGGER.info("Response received from BBPS for billId={} : {}", billId, responseData);
|
||||||
|
|
||||||
|
// update outbound log with response
|
||||||
|
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
Map<String, Object> dataMap = objectMapper.readValue(responseData, new com.fasterxml.jackson.core.type.TypeReference<Map<String, Object>>(){});
|
||||||
|
|
||||||
|
if (!dataMap.containsKey("genericResponse")) {
|
||||||
|
helper.updateInboundLogFailure(inboundLog, responseData, "INVALID_RESPONSE");
|
||||||
|
LOGGER.warn("Invalid response structure received for billId={} | Response={}", billId, responseData);
|
||||||
|
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")));
|
||||||
|
}
|
||||||
|
|
||||||
|
FetchBillValidateResponse responseWrapper = objectMapper.convertValue(dataMap, FetchBillValidateResponse.class);
|
||||||
|
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
||||||
|
|
||||||
|
// update inbound log and save validation data
|
||||||
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
|
helper.saveBillValidation(responseWrapper, billRequest);
|
||||||
|
LOGGER.info("Bill validation saved successfully for billId: {}", billId);
|
||||||
|
|
||||||
|
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(), Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
|
|
||||||
|
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
|
||||||
|
LOGGER.error("Error parsing ValidateByBillId JSON: {}", e.getMessage(), e);
|
||||||
|
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||||
|
throw new CustomException("Invalid JSON received from API");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================================== Bill fetch and Bill Validate by Client Req Id==================================//
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseModel fetchBillValidateByClientReqId(BillValidateByClientIdRequest billValidateByClientIdRequest) {
|
public ResponseModel fetchBillValidateByClientReqId(BillValidateByClientIdRequest billValidateByClientIdRequest) {
|
||||||
|
|
||||||
@@ -568,6 +649,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Override public ResponseModel
|
* @Override public ResponseModel
|
||||||
* initiateBillValidate(FetchBillValidatestRequest fetchBillValidateRequest) {
|
* initiateBillValidate(FetchBillValidatestRequest fetchBillValidateRequest) {
|
||||||
@@ -755,9 +837,5 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResponseModel initiateBillValidateByBillId(BillFetchByBillIdRequest billRequest) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,8 @@ public class MasterDataServiceImpl implements MasterDataService {
|
|||||||
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||||
BillerDetails entity = mapper.map(responseWrapper.getBillerDAO(), BillerDetails.class);
|
BillerDetails entity = mapper.map(responseWrapper.getBillerDAO(), BillerDetails.class);
|
||||||
EntityRelationshipUtil.linkBillerRelationships(entity);// linking nesting entity foreign key
|
EntityRelationshipUtil.linkBillerRelationships(entity);// linking nesting entity foreign key
|
||||||
// helper.saveOrUpdateBillerData(entity);
|
helper.saveOrUpdateBillerData(entity);
|
||||||
|
|
||||||
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ public class EntityRelationshipUtil {
|
|||||||
entity.getBillerAdditionalInfos().forEach(a -> a.setBiller(entity));
|
entity.getBillerAdditionalInfos().forEach(a -> a.setBiller(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(entity.getBillerAdditionalInfoPayments() != null) {
|
||||||
|
entity.getBillerAdditionalInfoPayments().forEach(a -> a.setBiller(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (entity.getInterchangeFees() != null) {
|
if (entity.getInterchangeFees() != null) {
|
||||||
for (InterchangeFee fee : entity.getInterchangeFees()) {
|
for (InterchangeFee fee : entity.getInterchangeFees()) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.billpaymentservice.bbps.dto.sentRequest.BillPaymentForwardRequest;
|
|||||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest;
|
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest;
|
||||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillValidatestForwardRequest;
|
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillValidatestForwardRequest;
|
||||||
import com.billpaymentservice.bbps.entites.AdditionalInfoBill;
|
import com.billpaymentservice.bbps.entites.AdditionalInfoBill;
|
||||||
|
import com.billpaymentservice.bbps.entites.AdditionalInfoBillValidate;
|
||||||
import com.billpaymentservice.bbps.entites.BBPSMastersData;
|
import com.billpaymentservice.bbps.entites.BBPSMastersData;
|
||||||
import com.billpaymentservice.bbps.entites.BillMaster;
|
import com.billpaymentservice.bbps.entites.BillMaster;
|
||||||
import com.billpaymentservice.bbps.entites.BillValidation;
|
import com.billpaymentservice.bbps.entites.BillValidation;
|
||||||
@@ -218,32 +219,7 @@ public class Helper {
|
|||||||
Optional<BillerDetails> existingOpt = billerDataRespository.findByBillerId(newEntity.getBillerId());
|
Optional<BillerDetails> existingOpt = billerDataRespository.findByBillerId(newEntity.getBillerId());
|
||||||
|
|
||||||
if (existingOpt.isPresent()) {
|
if (existingOpt.isPresent()) {
|
||||||
BillerDetails existing = existingOpt.get();
|
//logic to be written
|
||||||
|
|
||||||
// Update base biller fields
|
|
||||||
existing.setBillerName(newEntity.getBillerName());
|
|
||||||
existing.setBillerAliasName(newEntity.getBillerAliasName());
|
|
||||||
existing.setBillerDescription(newEntity.getBillerDescription());
|
|
||||||
existing.setStatus(newEntity.getStatus());
|
|
||||||
existing.setBillerCoverage(newEntity.getBillerCoverage());
|
|
||||||
// ... (update other simple fields as needed)
|
|
||||||
|
|
||||||
// ✅ Clear and replace nested lists to avoid duplicate inserts
|
|
||||||
existing.getBillerPaymentModes().clear();
|
|
||||||
if (newEntity.getBillerPaymentModes() != null) {
|
|
||||||
for (PaymentMode mode : newEntity.getBillerPaymentModes()) {
|
|
||||||
mode.setBiller(existing);
|
|
||||||
existing.getBillerPaymentModes().add(mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
existing.getBillerPaymentChannels().clear();
|
|
||||||
if (newEntity.getBillerPaymentChannels() != null) {
|
|
||||||
for (PaymentChannel channel : newEntity.getBillerPaymentChannels()) {
|
|
||||||
channel.setBiller(existing);
|
|
||||||
existing.getBillerPaymentChannels().add(channel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
billerDataRespository.save(existing);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// brand new biller
|
// brand new biller
|
||||||
@@ -348,7 +324,18 @@ billMasterRepository.save(billMaster);
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
billEntity.setCustomerParams(customerParams);
|
billEntity.setCustomerParams(customerParams);
|
||||||
}
|
}
|
||||||
|
if (responseWrapper.getAdditionalInfo() != null) {
|
||||||
|
List<AdditionalInfoBillValidate> additionalInfos = responseWrapper.getAdditionalInfo()
|
||||||
|
.stream()
|
||||||
|
.map(info -> {
|
||||||
|
AdditionalInfoBillValidate ai = modelMapper.map(info, AdditionalInfoBillValidate.class);
|
||||||
|
ai.setBill(billEntity); // maintain relation
|
||||||
|
return ai;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
billEntity.setAdditionalInfo(additionalInfos);
|
||||||
|
|
||||||
|
}
|
||||||
// ✅ Save everything (cascade handles child)
|
// ✅ Save everything (cascade handles child)
|
||||||
|
|
||||||
billValidationRepository.save(billEntity);
|
billValidationRepository.save(billEntity);
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ swagger.server.description=Local Development Server
|
|||||||
# DataSource
|
# DataSource
|
||||||
spring.datasource.url=jdbc:postgresql://localhost:5432/BBPS
|
spring.datasource.url=jdbc:postgresql://localhost:5432/BBPS
|
||||||
spring.datasource.username=postgres
|
spring.datasource.username=postgres
|
||||||
spring.datasource.password=UAT@DB_2025
|
#spring.datasource.password=UAT@DB_2025
|
||||||
|
|
||||||
#spring.datasource.password=himanshu@123
|
spring.datasource.password=himanshu@123
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user