improved bill fetching data is getting saved before making call
This commit is contained in:
@@ -22,8 +22,8 @@ public class TransactionHistoryMasterDTO {
|
|||||||
private String billId;
|
private String billId;
|
||||||
private String userType;
|
private String userType;
|
||||||
private String userId;
|
private String userId;
|
||||||
private Double txnAmount;
|
private String txnAmount;
|
||||||
private Double totalTxnAmount;
|
private String totalTxnAmount;
|
||||||
private String billerId;
|
private String billerId;
|
||||||
private String billerCategory;
|
private String billerCategory;
|
||||||
private String billerName;
|
private String billerName;
|
||||||
@@ -33,15 +33,15 @@ public class TransactionHistoryMasterDTO {
|
|||||||
private String quickPay;
|
private String quickPay;
|
||||||
private String paymentMode;
|
private String paymentMode;
|
||||||
private String agentPaymentInformation;
|
private String agentPaymentInformation;
|
||||||
private Double custConvFee;
|
private String custConvFee;
|
||||||
private String currency;
|
private String currency;
|
||||||
private String status;
|
private String status;
|
||||||
private String requestedIp;
|
private String requestedIp;
|
||||||
private String customerMobNo;
|
private String customerMobNo;
|
||||||
private String macAddress;
|
private String macAddress;
|
||||||
private Double splitPayAmount;
|
private String splitPayAmount;
|
||||||
private Double couCustConvFee;
|
private String couCustConvFee;
|
||||||
private Boolean settlementVerification;
|
private String settlementVerification;
|
||||||
private String fundTxnType;
|
private String fundTxnType;
|
||||||
private String reason;
|
private String reason;
|
||||||
private String amountTags;
|
private String amountTags;
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ public class TransactionHistoryParticularDetailsDTO {
|
|||||||
|
|
||||||
private String billerName;
|
private String billerName;
|
||||||
|
|
||||||
private Double totalTxnAmount;
|
private String totalTxnAmount;
|
||||||
|
|
||||||
private String bankTxnId;
|
private String bankTxnId;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,15 @@ package com.billpaymentservice.bbps.dto.auth;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class LoginRequest {
|
public class LoginRequest {
|
||||||
|
|
||||||
@NotNull(message = "Mobile number cannot be null.")
|
@NotNull(message = "Mobile number cannot be null.")
|
||||||
@@ -11,18 +19,5 @@ public class LoginRequest {
|
|||||||
@Pattern(regexp = "^[0-9]{10}$", message = "Mobile number must contain only digits.")
|
@Pattern(regexp = "^[0-9]{10}$", message = "Mobile number must contain only digits.")
|
||||||
private String mobile;
|
private String mobile;
|
||||||
|
|
||||||
public LoginRequest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoginRequest(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,17 @@
|
|||||||
package com.billpaymentservice.bbps.dto.auth;
|
package com.billpaymentservice.bbps.dto.auth;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class OtpSendResponse {
|
public class OtpSendResponse {
|
||||||
private boolean success;
|
private boolean success;
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
public OtpSendResponse() {}
|
|
||||||
|
|
||||||
public OtpSendResponse(boolean success, String message) {
|
|
||||||
this.success = success;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSuccess() {
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccess(boolean success) {
|
|
||||||
this.success = success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,15 @@ import jakarta.validation.constraints.Email;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class RegisterRequest extends BaseClass {
|
public class RegisterRequest extends BaseClass {
|
||||||
|
|
||||||
@NotNull(message = "Mobile number cannot be null.")
|
@NotNull(message = "Mobile number cannot be null.")
|
||||||
|
|||||||
@@ -3,7 +3,15 @@ package com.billpaymentservice.bbps.dto.auth;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class VerifyOtpRequest {
|
public class VerifyOtpRequest {
|
||||||
|
|
||||||
@NotNull(message = "Mobile number cannot be null.")
|
@NotNull(message = "Mobile number cannot be null.")
|
||||||
@@ -16,27 +24,5 @@ public class VerifyOtpRequest {
|
|||||||
@Pattern(regexp = "^[0-9]{6}$", message = "OTP must contain only 6 digits.")
|
@Pattern(regexp = "^[0-9]{6}$", message = "OTP must contain only 6 digits.")
|
||||||
private String otp;
|
private String otp;
|
||||||
|
|
||||||
public VerifyOtpRequest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public VerifyOtpRequest(String mobile, String otp) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
this.otp = otp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOtp() {
|
|
||||||
return otp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOtp(String otp) {
|
|
||||||
this.otp = otp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import java.util.List;
|
|||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
@@ -26,16 +28,23 @@ import lombok.Setter;
|
|||||||
public class BillMaster extends Auditable {
|
public class BillMaster extends Auditable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
@Column(name = "bill_id", unique = true)
|
||||||
private String billId; // primary key
|
private String billId; // primary key
|
||||||
|
|
||||||
private String reqId; // client se aaya hua
|
private String reqId; // client se aaya hua
|
||||||
private String txnId; // system-generated
|
private String txnId; // system-generated
|
||||||
private String refId;
|
private String refId;
|
||||||
private String billerId;
|
private String billerId;
|
||||||
private String status;
|
private String status;
|
||||||
|
private String mid;
|
||||||
private String actionType;
|
private String actionType;
|
||||||
private String clientUserId;
|
private String clientUserId;
|
||||||
private String userId;
|
private String userId;
|
||||||
|
@Column(name = "initiator_txn_id")
|
||||||
|
private String initiatorTxnId;
|
||||||
|
@Column(name = "checker_txn_id")
|
||||||
|
private String checkerTxnId;
|
||||||
@OneToOne(cascade = CascadeType.ALL)
|
@OneToOne(cascade = CascadeType.ALL)
|
||||||
@JoinColumn(name = "biller_response_id")
|
@JoinColumn(name = "biller_response_id")
|
||||||
private BillerResponse billerResponse;
|
private BillerResponse billerResponse;
|
||||||
|
|||||||
@@ -8,15 +8,24 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "bbps_bill_validation")
|
@Table(name = "bbps_bill_validation_master")
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class BillValidation extends Auditable {
|
public class BillValidation extends Auditable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "bill_id", nullable = false, length = 100)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "bill_id", unique = true)
|
||||||
private String billId;
|
private String billId;
|
||||||
|
|
||||||
|
private String mid;
|
||||||
|
|
||||||
|
private String initiatorTxnId;
|
||||||
|
|
||||||
|
private String checkerTxnId;
|
||||||
|
|
||||||
@Column(name = "ref_id", length = 100)
|
@Column(name = "ref_id", length = 100)
|
||||||
private String refId;
|
private String refId;
|
||||||
@@ -55,6 +64,4 @@ public class BillValidation extends Auditable {
|
|||||||
@Column(name = "client_user_id")
|
@Column(name = "client_user_id")
|
||||||
private String clientUserId;
|
private String clientUserId;
|
||||||
|
|
||||||
// Removed local audit fields: creationDate, modifiedDate, createdEpochDate, modifiedEpochDate
|
|
||||||
// They are now handled by Auditable base class
|
|
||||||
}
|
}
|
||||||
@@ -82,10 +82,10 @@ public class TransactionMaster extends Auditable {
|
|||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
@Column(name = "txn_amount")
|
@Column(name = "txn_amount")
|
||||||
private Double txnAmount;
|
private String txnAmount;
|
||||||
|
|
||||||
@Column(name = "total_txn_amount")
|
@Column(name = "total_txn_amount")
|
||||||
private Double totalTxnAmount;
|
private String totalTxnAmount;
|
||||||
|
|
||||||
@Column(name = "biller_id")
|
@Column(name = "biller_id")
|
||||||
private String billerId;
|
private String billerId;
|
||||||
@@ -115,7 +115,7 @@ public class TransactionMaster extends Auditable {
|
|||||||
private String agentPaymentInformation;
|
private String agentPaymentInformation;
|
||||||
|
|
||||||
@Column(name = "cust_conv_fee")
|
@Column(name = "cust_conv_fee")
|
||||||
private Double custConvFee;
|
private String custConvFee;
|
||||||
|
|
||||||
@Column(name = "currency")
|
@Column(name = "currency")
|
||||||
private String currency;
|
private String currency;
|
||||||
@@ -133,13 +133,13 @@ public class TransactionMaster extends Auditable {
|
|||||||
private String macAddress;
|
private String macAddress;
|
||||||
|
|
||||||
@Column(name = "split_pay_amount")
|
@Column(name = "split_pay_amount")
|
||||||
private Double splitPayAmount;
|
private String splitPayAmount;
|
||||||
|
|
||||||
@Column(name = "cou_cust_conv_fee")
|
@Column(name = "cou_cust_conv_fee")
|
||||||
private Double couCustConvFee;
|
private String couCustConvFee;
|
||||||
|
|
||||||
@Column(name = "settlement_verification")
|
@Column(name = "settlement_verification")
|
||||||
private Boolean settlementVerification;
|
private String settlementVerification;
|
||||||
|
|
||||||
@Column(name = "fund_txn_type")
|
@Column(name = "fund_txn_type")
|
||||||
private String fundTxnType;
|
private String fundTxnType;
|
||||||
|
|||||||
@@ -4,6 +4,17 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
|
|
||||||
import com.billpaymentservice.bbps.entites.BillMaster;
|
import com.billpaymentservice.bbps.entites.BillMaster;
|
||||||
|
|
||||||
public interface BillMasterRepository extends JpaRepository<BillMaster, String> {
|
import java.util.Optional;
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* Repository for BillMaster. Added convenience finder methods so service
|
||||||
|
* can look up records by client request id (reqId) or txnId.
|
||||||
|
*/
|
||||||
|
public interface BillMasterRepository extends JpaRepository<BillMaster, Long> {
|
||||||
|
|
||||||
|
Optional<BillMaster> findByReqId(String reqId);
|
||||||
|
|
||||||
|
Optional<BillMaster> findByTxnId(String txnId);
|
||||||
|
BillMaster findByInitiatorTxnId(String initiatorTxnId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import org.springframework.stereotype.Repository;
|
|||||||
import com.billpaymentservice.bbps.entites.BillValidation;
|
import com.billpaymentservice.bbps.entites.BillValidation;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface BillValidationRepository extends JpaRepository<BillValidation, String> {
|
public interface BillValidationRepository extends JpaRepository<BillValidation, Long> {
|
||||||
|
|
||||||
|
BillValidation findByInitiatorTxnId(String txnId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,14 @@ 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.BillInitiate;
|
import com.billpaymentservice.bbps.entites.BillInitiate;
|
||||||
import com.billpaymentservice.bbps.entites.BillMaster;
|
import com.billpaymentservice.bbps.entites.BillMaster;
|
||||||
|
import com.billpaymentservice.bbps.entites.BillValidation;
|
||||||
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;
|
||||||
import com.billpaymentservice.bbps.repository.BharatConnectMasterRepository;
|
import com.billpaymentservice.bbps.repository.BharatConnectMasterRepository;
|
||||||
import com.billpaymentservice.bbps.repository.BillInitateRepository;
|
import com.billpaymentservice.bbps.repository.BillInitateRepository;
|
||||||
import com.billpaymentservice.bbps.repository.BillMasterRepository;
|
import com.billpaymentservice.bbps.repository.BillMasterRepository;
|
||||||
|
import com.billpaymentservice.bbps.repository.BillValidationRepository;
|
||||||
import com.billpaymentservice.bbps.repository.InboundTraceLogRepository;
|
import com.billpaymentservice.bbps.repository.InboundTraceLogRepository;
|
||||||
import com.billpaymentservice.bbps.repository.OutboundTraceLogRepository;
|
import com.billpaymentservice.bbps.repository.OutboundTraceLogRepository;
|
||||||
import com.billpaymentservice.bbps.service.AgentService;
|
import com.billpaymentservice.bbps.service.AgentService;
|
||||||
@@ -52,6 +54,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
private final BillerMapperHelper mapperHelper;
|
private final BillerMapperHelper mapperHelper;
|
||||||
private final BillMasterRepository billMasterRepository;
|
private final BillMasterRepository billMasterRepository;
|
||||||
private final BillInitateRepository billIntiateRepository;
|
private final BillInitateRepository billIntiateRepository;
|
||||||
|
private final BillValidationRepository billValidationRepository;
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(AgentServiceImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(AgentServiceImpl.class);
|
||||||
|
|
||||||
// Reusable ObjectMapper instance
|
// Reusable ObjectMapper instance
|
||||||
@@ -62,7 +65,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
BharatConnectMasterRepository beneficiaryDetailsRepository,
|
BharatConnectMasterRepository beneficiaryDetailsRepository,
|
||||||
InboundTraceLogRepository inboundTraceLogRepository, OutboundTraceLogRepository outboundTraceLogRepository,
|
InboundTraceLogRepository inboundTraceLogRepository, OutboundTraceLogRepository outboundTraceLogRepository,
|
||||||
BillMasterRepository billMasterRepository, BillInitateRepository billIntiateRepository,
|
BillMasterRepository billMasterRepository, BillInitateRepository billIntiateRepository,
|
||||||
BillerMapperHelper mapperHelper) {
|
BillerMapperHelper mapperHelper,BillValidationRepository billValidationRepository) {
|
||||||
this.restClient = restClient;
|
this.restClient = restClient;
|
||||||
this.httpService = httpService;
|
this.httpService = httpService;
|
||||||
this.helper = helper;
|
this.helper = helper;
|
||||||
@@ -70,6 +73,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
this.billMasterRepository = billMasterRepository;
|
this.billMasterRepository = billMasterRepository;
|
||||||
this.billIntiateRepository = billIntiateRepository;
|
this.billIntiateRepository = billIntiateRepository;
|
||||||
this.mapperHelper = mapperHelper;
|
this.mapperHelper = mapperHelper;
|
||||||
|
this.billValidationRepository=billValidationRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -94,7 +98,13 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, fullUrl,
|
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, fullUrl,
|
||||||
BBPSConstant.HTTP_POST, forwardJson);
|
BBPSConstant.HTTP_POST, forwardJson);
|
||||||
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, requestId);
|
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, requestId);
|
||||||
|
|
||||||
|
BillMaster billMaster =new BillMaster();
|
||||||
|
billMaster.setReqId(fetchBillRequest.getReqId());
|
||||||
|
billMaster.setInitiatorTxnId(txnId);
|
||||||
|
billMaster.setMid(fetchBillRequest.getMid());
|
||||||
|
billMaster.setClientUserId(fetchBillRequest.getClientUserId());
|
||||||
|
billMasterRepository.save(billMaster);
|
||||||
try {
|
try {
|
||||||
LOGGER.info("[{}] Calling external API | URL={}", apiName, fullUrl);
|
LOGGER.info("[{}] Calling external API | URL={}", apiName, fullUrl);
|
||||||
Map<String, String> responseMap = httpService.postRequest(fullUrl, forwardJson,
|
Map<String, String> responseMap = httpService.postRequest(fullUrl, forwardJson,
|
||||||
@@ -114,26 +124,13 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))),
|
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))),
|
||||||
String.valueOf(dataMap.get("remarks")));
|
String.valueOf(dataMap.get("remarks")));
|
||||||
}
|
}
|
||||||
|
|
||||||
BillMaster billMaster = new BillMaster();
|
|
||||||
billMaster.setBillId((String) dataMap.get("billId"));
|
|
||||||
billMaster.setReqId(fetchBillRequest.getReqId());
|
|
||||||
billMaster.setTxnId(txnId);
|
|
||||||
billMaster.setClientUserId(fetchBillRequest.getClientUserId());
|
|
||||||
billMasterRepository.save(billMaster);
|
|
||||||
LOGGER.info("BillMaster saved for billId: {}", billMaster.getBillId());
|
LOGGER.info("BillMaster saved for billId: {}", billMaster.getBillId());
|
||||||
|
|
||||||
FetchBillResponse fetchBillResponse = objectMapper.convertValue(dataMap, FetchBillResponse.class);
|
FetchBillResponse fetchBillResponse = objectMapper.convertValue(dataMap, FetchBillResponse.class);
|
||||||
GeneralResp generalResponse = fetchBillResponse.getGenericResponse();
|
GeneralResp generalResponse = fetchBillResponse.getGenericResponse();
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResponse.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResponse.getStatus());
|
||||||
|
|
||||||
BillInitiate billInitiate = new BillInitiate();
|
|
||||||
billInitiate.setBillId((String) dataMap.get("billId"));
|
|
||||||
billInitiate.setReqId(fetchBillRequest.getReqId());
|
|
||||||
billInitiate.setTxnId(txnId);
|
|
||||||
billInitiate.setClientUserId(fetchBillRequest.getClientUserId());
|
|
||||||
billIntiateRepository.save(billInitiate);
|
|
||||||
LOGGER.info("BillInitiate entry saved for billId: {}", billInitiate.getBillId());
|
|
||||||
|
|
||||||
BillFetchByBillIdRequest billFetchByBillIdRequest = new BillFetchByBillIdRequest();
|
BillFetchByBillIdRequest billFetchByBillIdRequest = new BillFetchByBillIdRequest();
|
||||||
billFetchByBillIdRequest.setBillId(fetchBillResponse.getBillId());
|
billFetchByBillIdRequest.setBillId(fetchBillResponse.getBillId());
|
||||||
@@ -146,6 +143,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
LOGGER.warn("Thread interrupted during delay: {}", e.getMessage());
|
LOGGER.warn("Thread interrupted during delay: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Calling internal method Fetching bill by ID: {}", billFetchByBillIdRequest.getBillId());
|
LOGGER.info("Calling internal method Fetching bill by ID: {}", billFetchByBillIdRequest.getBillId());
|
||||||
LOGGER.info("[{}] END | reqId={} | status={}", apiName, requestId, generalResponse.getStatus());
|
LOGGER.info("[{}] END | reqId={} | status={}", apiName, requestId, generalResponse.getStatus());
|
||||||
return fetchBillById(billFetchByBillIdRequest, inboundLog);
|
return fetchBillById(billFetchByBillIdRequest, inboundLog);
|
||||||
@@ -171,6 +169,8 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
LOGGER.debug("Outbound log created successfully for FetchBillById: {}", fullUrl);
|
LOGGER.debug("Outbound log created successfully for FetchBillById: {}", fullUrl);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
LOGGER.info("Calling external API: {}", fullUrl);
|
LOGGER.info("Calling external API: {}", fullUrl);
|
||||||
Map<String, String> responseMap = httpService.getRequest(fullUrl,
|
Map<String, String> responseMap = httpService.getRequest(fullUrl,
|
||||||
helper.buildHeaders(beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID)));
|
helper.buildHeaders(beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID)));
|
||||||
@@ -192,15 +192,18 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BillDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillDataResponse.class);
|
BillDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillDataResponse.class);
|
||||||
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
||||||
|
|
||||||
|
|
||||||
|
BillMaster
|
||||||
|
existingbill=billMasterRepository.findByInitiatorTxnId(
|
||||||
|
inboundLog.getTxnId());
|
||||||
String status = generalResp.getStatus();
|
String status = generalResp.getStatus();
|
||||||
LOGGER.info("Current Bill Status: {}", status);
|
LOGGER.info("Current Bill Status: {}", status);
|
||||||
|
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId, userId);
|
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId,billFetchByBillIdRequest.getClientUserId(), existingbill);
|
||||||
LOGGER.info("Bill data saved successfully for billId: {}", billId);
|
LOGGER.info("Bill data saved successfully for billId: {}", billId);
|
||||||
|
|
||||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
@@ -255,7 +258,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
|
|
||||||
// update inbound log success and persist bill data
|
// update inbound log success and persist bill data
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId, userId);
|
//mapperHelper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest, txnId, reqId, userId);
|
||||||
LOGGER.info("Bill data saved successfully for billId={} | Status={}", billId, generalResp.getStatus());
|
LOGGER.info("Bill data saved successfully for billId={} | Status={}", billId, generalResp.getStatus());
|
||||||
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
|
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
|
||||||
return responseModel;
|
return responseModel;
|
||||||
@@ -294,8 +297,14 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
forwardJson);
|
forwardJson);
|
||||||
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, reqId);
|
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, reqId);
|
||||||
|
|
||||||
|
BillValidation billValidation = new BillValidation();
|
||||||
|
billValidation.setReqId(fetchBillValidateRequest.getReqId());
|
||||||
|
billValidation.setInitiatorTxnId(txnId);
|
||||||
|
billValidation.setMid(fetchBillValidateRequest.getMid());
|
||||||
|
billValidation.setClientUserId(fetchBillValidateRequest.getClientUserId());
|
||||||
|
billValidationRepository.save(billValidation);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
LOGGER.info("[{}] Calling external API | URL={}", apiName, fullUrl);
|
LOGGER.info("[{}] Calling external API | URL={}", apiName, fullUrl);
|
||||||
Map<String, String> responseMap = httpService.postRequest(fullUrl, forwardJson,
|
Map<String, String> responseMap = httpService.postRequest(fullUrl, forwardJson,
|
||||||
helper.buildHeaders(beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID)));
|
helper.buildHeaders(beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID)));
|
||||||
@@ -314,24 +323,11 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))),
|
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))),
|
||||||
String.valueOf(dataMap.get("remarks")));
|
String.valueOf(dataMap.get("remarks")));
|
||||||
}
|
}
|
||||||
|
|
||||||
BillMaster billMaster = new BillMaster();
|
|
||||||
billMaster.setBillId((String) dataMap.get("billId"));
|
|
||||||
billMaster.setReqId(fetchBillValidateRequest.getReqId());
|
|
||||||
billMaster.setTxnId(txnId);
|
|
||||||
billMasterRepository.save(billMaster);
|
|
||||||
LOGGER.info("BillMaster saved for billId: {}", billMaster.getBillId());
|
|
||||||
FetchBillResponse fetchBillResponse = objectMapper.convertValue(dataMap, FetchBillResponse.class);
|
FetchBillResponse fetchBillResponse = objectMapper.convertValue(dataMap, FetchBillResponse.class);
|
||||||
GeneralResp generalResponse = fetchBillResponse.getGenericResponse();
|
GeneralResp generalResponse = fetchBillResponse.getGenericResponse();
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResponse.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResponse.getStatus());
|
||||||
|
|
||||||
BillInitiate billInitiate = new BillInitiate();
|
|
||||||
billInitiate.setBillId((String) dataMap.get("billId"));
|
|
||||||
billInitiate.setReqId(fetchBillValidateRequest.getReqId());
|
|
||||||
billInitiate.setTxnId(txnId);
|
|
||||||
billIntiateRepository.save(billInitiate);
|
|
||||||
LOGGER.info("BillInitiate entry saved for billId: {}", billInitiate.getBillId());
|
|
||||||
|
|
||||||
BillFetchByBillIdRequest billFetchByBillIdRequest = new BillFetchByBillIdRequest();
|
BillFetchByBillIdRequest billFetchByBillIdRequest = new BillFetchByBillIdRequest();
|
||||||
billFetchByBillIdRequest.setBillId(fetchBillResponse.getBillId());
|
billFetchByBillIdRequest.setBillId(fetchBillResponse.getBillId());
|
||||||
billFetchByBillIdRequest.setMid(fetchBillValidateRequest.getMid());
|
billFetchByBillIdRequest.setMid(fetchBillValidateRequest.getMid());
|
||||||
@@ -362,7 +358,11 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
String reqId = billRequest.getReqId();
|
String reqId = billRequest.getReqId();
|
||||||
String billId = billRequest.getBillId();
|
String billId = billRequest.getBillId();
|
||||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_ID_URL + billRequest.getBillId();
|
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_ID_URL + billRequest.getBillId();
|
||||||
|
|
||||||
|
BillValidation
|
||||||
|
billValidation=billValidationRepository.findByInitiatorTxnId(
|
||||||
|
inboundLog.getTxnId());
|
||||||
|
billValidation.setCheckerTxnId(txnId);
|
||||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl,
|
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl,
|
||||||
BBPSConstant.HTTP_GET, null);
|
BBPSConstant.HTTP_GET, null);
|
||||||
LOGGER.debug("Outbound log created successfully for FetchBillById: {}", fullUrl);
|
LOGGER.debug("Outbound log created successfully for FetchBillById: {}", fullUrl);
|
||||||
@@ -392,13 +392,14 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
FetchBillValidateResponse responseWrapper = objectMapper.convertValue(dataMap,
|
FetchBillValidateResponse responseWrapper = objectMapper.convertValue(dataMap,
|
||||||
FetchBillValidateResponse.class);
|
FetchBillValidateResponse.class);
|
||||||
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
||||||
|
|
||||||
|
|
||||||
String status = generalResp.getStatus();
|
String status = generalResp.getStatus();
|
||||||
LOGGER.info("Current Bill Status: {}", status);
|
LOGGER.info("Current Bill Status: {}", status);
|
||||||
|
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||||
System.out.println("responseWrapper:" + responseWrapper);
|
System.out.println("responseWrapper:" + responseWrapper);
|
||||||
mapperHelper.saveBillValidation(responseWrapper, billRequest, txnId);
|
mapperHelper.saveBillValidation(responseWrapper, billRequest, txnId,billValidation);
|
||||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
@@ -456,7 +457,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
||||||
|
|
||||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
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("Bill validation saved successfully for billId: {}", billId);
|
||||||
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
|
LOGGER.info("[{}] END | reqId={} | status={}", apiName, reqId, generalResp.getStatus());
|
||||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ public class PaymentServiceImpl implements PaymentService {
|
|||||||
LOGGER.debug("Outbound log created for api={} | reqId={} | txnId={}", apiName, requestId, txnId);
|
LOGGER.debug("Outbound log created for api={} | reqId={} | txnId={}", apiName, requestId, txnId);
|
||||||
|
|
||||||
TransactionMaster preTransaction=null;
|
TransactionMaster preTransaction=null;
|
||||||
|
|
||||||
preTransaction = new TransactionMaster();
|
preTransaction = new TransactionMaster();
|
||||||
preTransaction.setTxnId(txnId);
|
preTransaction.setTxnId(txnId);
|
||||||
preTransaction.setInitiatorTxnId(txnId);
|
preTransaction.setInitiatorTxnId(txnId);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import com.billpaymentservice.bbps.dto.response.BillDataResponse;
|
|||||||
import com.billpaymentservice.bbps.dto.response.ClientReqIdResponse;
|
import com.billpaymentservice.bbps.dto.response.ClientReqIdResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.ComplaintResponse;
|
import com.billpaymentservice.bbps.dto.response.ComplaintResponse;
|
||||||
|
import com.billpaymentservice.bbps.dto.response.FetchBillValidateResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.PaymentStartApiResponse;
|
import com.billpaymentservice.bbps.dto.response.PaymentStartApiResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.PlanResponse;
|
import com.billpaymentservice.bbps.dto.response.PlanResponse;
|
||||||
import com.billpaymentservice.bbps.dto.response.TicketCheckStatusResponse;
|
import com.billpaymentservice.bbps.dto.response.TicketCheckStatusResponse;
|
||||||
@@ -817,9 +818,8 @@ public class BillerMapperHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void saveOrUpdateBillData(BillDataResponse responseWrapper,
|
public void saveOrUpdateBillData(BillDataResponse responseWrapper,
|
||||||
BillFetchByBillIdRequest billFetchByBillIdRequest, String txnId, String reqId, String userId) {
|
BillFetchByBillIdRequest billFetchByBillIdRequest, String txnId, String reqId, String userId,BillMaster billMaster) {
|
||||||
|
|
||||||
BillMaster billMaster = new BillMaster();
|
|
||||||
|
|
||||||
billMaster.setBillId(responseWrapper.getBillId());
|
billMaster.setBillId(responseWrapper.getBillId());
|
||||||
billMaster.setRefId(responseWrapper.getRefId());
|
billMaster.setRefId(responseWrapper.getRefId());
|
||||||
@@ -1166,11 +1166,11 @@ public class BillerMapperHelper {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveBillValidation(com.billpaymentservice.bbps.dto.response.FetchBillValidateResponse responseWrapper,
|
public void saveBillValidation(FetchBillValidateResponse responseWrapper,
|
||||||
com.billpaymentservice.bbps.dto.request.BillFetchByBillIdRequest billRequest, String txnId) {
|
BillFetchByBillIdRequest billRequest, String txnId,BillValidation entity) {
|
||||||
if (responseWrapper == null || billRequest == null)
|
if (responseWrapper == null || billRequest == null)
|
||||||
return;
|
return;
|
||||||
BillValidation entity = new BillValidation();
|
|
||||||
entity.setBillId(responseWrapper.getBillId());
|
entity.setBillId(responseWrapper.getBillId());
|
||||||
entity.setRefId(responseWrapper.getRefId());
|
entity.setRefId(responseWrapper.getRefId());
|
||||||
entity.setBillerId(responseWrapper.getBillerId());
|
entity.setBillerId(responseWrapper.getBillerId());
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.billpaymentservice.bbps.dto.UserDetailsDTO;
|
import com.billpaymentservice.bbps.dto.UserDetailsDTO;
|
||||||
import com.billpaymentservice.bbps.dto.auth.RegisterRequest;
|
import com.billpaymentservice.bbps.dto.auth.RegisterRequest;
|
||||||
|
import com.billpaymentservice.bbps.dto.response.BillDataResponse;
|
||||||
import com.billpaymentservice.bbps.entites.BBPSMastersData;
|
import com.billpaymentservice.bbps.entites.BBPSMastersData;
|
||||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||||
|
import com.billpaymentservice.bbps.entites.BillMaster;
|
||||||
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.entites.TransactionMaster;
|
import com.billpaymentservice.bbps.entites.TransactionMaster;
|
||||||
@@ -284,5 +286,10 @@ public class Helper {
|
|||||||
LOGGER.info("TransactionMaster dest after merge: {}", dest);
|
LOGGER.info("TransactionMaster dest after merge: {}", dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void mergeNonNullFieldsBillIntiate(BillDataResponse responseWrapper, BillMaster existingbill) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,9 +23,9 @@ swagger.server.description=Local Development Server
|
|||||||
spring.datasource.url=jdbc:postgresql://localhost:5432/bbps_enhanced
|
spring.datasource.url=jdbc:postgresql://localhost:5432/bbps_enhanced
|
||||||
|
|
||||||
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