merged code with feature1
This commit is contained in:
@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.BillFetchByBillIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.BillFetchByClientIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.BillValidateByClientIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillValidatestRequest;
|
||||
import com.billpaymentservice.bbps.service.AgentService;
|
||||
@@ -69,4 +71,20 @@ public class AgentController {
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/fetchBillByClientReqId", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<ResponseModel> fetchBillByClientReqId(
|
||||
@Validated @RequestBody BillFetchByClientIdRequest billFetchByClientIdRequest) {
|
||||
|
||||
ResponseModel response = agentService.fetchBillByClientReqId(billFetchByClientIdRequest);
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/fetchBillValidateByClientReqId", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<ResponseModel> fetchBillValidateByClientReqId(
|
||||
@Validated @RequestBody BillValidateByClientIdRequest billValidateByClientIdRequest) {
|
||||
|
||||
ResponseModel response = agentService.fetchBillValidateByClientReqId(billValidateByClientIdRequest);
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.billpaymentservice.bbps.dto.request.CloseComplaintRequest;
|
||||
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.ViewAllComplaintsRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||
import com.billpaymentservice.bbps.service.ComplainService;
|
||||
|
||||
@@ -82,4 +83,12 @@ public class ComplainController {
|
||||
public ResponseEntity<ResponseModel> getAllStatuses(@Validated @RequestBody AllMasterOptionsRequest request) {
|
||||
return ResponseEntity.ok(complainService.getAllActiveStatuses(request));
|
||||
}
|
||||
@PostMapping("/viewAllComplaints")
|
||||
public ResponseEntity<ResponseModel> viewAllComplaints(@RequestBody ViewAllComplaintsRequest request) {
|
||||
log.info("Received request complaint View All Complaints for Status Type={}", request.getStatusType());
|
||||
ResponseModel response = complainService.ViewAllComplaints(request);
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.BillPaymentRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.TransactionStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.TrasactionStatusByClientReqIdRequest;
|
||||
import com.billpaymentservice.bbps.service.PaymentService;
|
||||
|
||||
@RestController
|
||||
@@ -50,5 +51,17 @@ public class PaymentController {
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
@PostMapping(
|
||||
value = "/checkTransactionStatusByClientReqId",
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE
|
||||
)
|
||||
public ResponseEntity<ResponseModel> checkTransactionStatusByClientReqId(
|
||||
@Validated @RequestBody TrasactionStatusByClientReqIdRequest transactionStatusRequest) {
|
||||
|
||||
ResponseModel response = paymentService.checkTrasactionStatusByClientReqId(transactionStatusRequest);
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ComplainDetailsDto {
|
||||
|
||||
private String complaintId;
|
||||
|
||||
@@ -20,49 +20,35 @@ import lombok.ToString;
|
||||
public abstract class BaseClass {
|
||||
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
@NotBlank(message = "MID cannot be null or blank")
|
||||
private String mid;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
|
||||
@NotBlank(message = "Secret key cannot be null or blank")
|
||||
private String secretKey;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
@NotBlank(message = "Request ID cannot be null or blank")
|
||||
private String reqId;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private DeviceDetail deviceDetial;
|
||||
// ✅ 10 User Defined Fields (UDF1–UDF10)
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf1;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf2;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf3;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf4;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf5;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf6;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf7;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf8;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf9;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String udf10;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BillFetchByClientIdRequest extends BaseClass{
|
||||
|
||||
private String clientReqId;
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class BillPaymentRequest extends BaseClass {
|
||||
private String customerMobNo;
|
||||
private Integer txnAmount;
|
||||
private String paymentRefId;
|
||||
private String clientReqId;
|
||||
private String paymentChannel;
|
||||
|
||||
private List<DeviceBlockTagRequest> deviceBlockTags;
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BillValidateByClientIdRequest extends BaseClass{
|
||||
|
||||
private String clientReqId;
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public class FetchBillValidatestRequest extends BaseClass {
|
||||
private String billerCategory; // String, CategoryResponseList of the biller
|
||||
@NotNull
|
||||
private String customerMobNo; // String, Mobile of the Customer
|
||||
private String clientReqId;
|
||||
|
||||
// Optional Fields
|
||||
private String macAddress; // Alphanumeric MAC Address of the Agent Server
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class TrasactionStatusByClientReqIdRequest extends BaseClass{
|
||||
|
||||
private String clientReqId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ViewAllComplaintsRequest extends BaseClass{
|
||||
|
||||
private String statusType; // e.g. COMPLAINT_OPEN_SUCCESS
|
||||
private Integer pageNo; // default 0
|
||||
private Integer pageSize; // default 10
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.billpaymentservice.bbps.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.ComplainDetailsDto;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ViewAllComplaintsResponse {
|
||||
private List<ComplainDetailsDto> complaintsList;
|
||||
private GeneralResp generalResp;
|
||||
private Integer pageNo;
|
||||
private Integer pageSize;
|
||||
private Integer totalPages;
|
||||
private Long totalElements;
|
||||
}
|
||||
@@ -4,12 +4,14 @@ import java.util.List;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.billpaymentservice.bbps.dto.ViewComplaintDTO;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ViewComplainByIdResponse {
|
||||
private List<ViewComplaintDTO> complaintsList;
|
||||
private GeneralResp generalResp;
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.billpaymentservice.bbps.dto.sentRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.request.AmountBreakRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.CustomerParamTagRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.DeviceBlockTagRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.RemitterIdentityRequest;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BillPaymentForwardRequest {
|
||||
|
||||
private String tenantId;
|
||||
private String refId;
|
||||
private String billId;
|
||||
private boolean amountOptions;
|
||||
private String paymentMode;
|
||||
private String paymentInformation;
|
||||
private String billerId;
|
||||
private String billerName;
|
||||
private String billerCategory;
|
||||
private String macAdress;
|
||||
private String customerMobNo;
|
||||
private Integer txnAmount;
|
||||
private String paymentRefId;
|
||||
private String clientReqId;
|
||||
private String paymentChannel;
|
||||
|
||||
private List<DeviceBlockTagRequest> deviceBlockTags;
|
||||
private List<CustomerParamTagRequest> customerParamsRequest;
|
||||
private List<RemitterIdentityRequest> remitterIdentity;
|
||||
private List<AmountBreakRequest> amountBreakSet;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.billpaymentservice.bbps.dto.sentRequest;
|
||||
|
||||
import java.util.List;
|
||||
import com.billpaymentservice.bbps.dto.CustomerParamsRequest;
|
||||
import com.billpaymentservice.bbps.dto.RemitterIdentity;
|
||||
import com.billpaymentservice.bbps.dto.Tag;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FetchBillForwardRequest {
|
||||
private String billerId;
|
||||
private String billerName;
|
||||
private String billerCategory;
|
||||
private String clientReqId;
|
||||
private String macAdress;
|
||||
private String customerMobNo;
|
||||
private String remitterName;
|
||||
private String paymentChannel;
|
||||
private List<Tag> deviceBlockTags;
|
||||
private CustomerParamsRequest customerParamsRequest;
|
||||
private List<RemitterIdentity> remitterIdentity;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.billpaymentservice.bbps.dto.sentRequest;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.CustomerParamsRequest;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FetchBillValidatestForwardRequest {
|
||||
|
||||
private String billerId;
|
||||
private String billerName;
|
||||
private String billerCategory;
|
||||
private String customerMobNo;
|
||||
private String clientReqId;
|
||||
private String macAddress;
|
||||
private CustomerParamsRequest customerParamsRequest;
|
||||
|
||||
}
|
||||
@@ -20,7 +20,18 @@ import lombok.ToString;
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@ToString(exclude = {
|
||||
"billerPaymentModes",
|
||||
"billerPaymentChannels",
|
||||
"billerCustomerParams",
|
||||
"customerParamGroups",
|
||||
"billerResponseParams",
|
||||
"billerAdditionalInfos",
|
||||
"interchangeFeeConves",
|
||||
"interchangeFees",
|
||||
"billerPlanResponseParams"
|
||||
})
|
||||
|
||||
@Table(name = "biller_details")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class BillerDetails {
|
||||
@@ -140,10 +151,12 @@ public class BillerDetails {
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<AdditionalInfo> billerAdditionalInfos;
|
||||
|
||||
|
||||
/*
|
||||
* @OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval =
|
||||
* true) private List<AdditionalInfo> billerAdditionalInfoPayments;
|
||||
*/
|
||||
* OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval
|
||||
* =true) private List<AdditionalInfo> billerAdditionalInfoPayments;
|
||||
*/
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<InterchangeFeeConf> interchangeFeeConves;
|
||||
|
||||
|
||||
@@ -12,15 +12,16 @@ import lombok.Setter;
|
||||
@Table(name = "complaint_status_details")
|
||||
public class ComplaintStatusDetails {
|
||||
|
||||
@Id
|
||||
@Column(name = "complaint_id")
|
||||
private String complaintId;
|
||||
|
||||
@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;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.billpaymentservice.bbps.repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -8,4 +10,8 @@ import com.billpaymentservice.bbps.entites.BillInitiate;
|
||||
@Repository
|
||||
public interface BillInitateRepository extends JpaRepository<BillInitiate, String> {
|
||||
|
||||
Optional<BillInitiate> findByTxnId(String clientReqId);
|
||||
|
||||
Optional<BillInitiate> findByReqId(String clientReqId);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.BillerDetails;
|
||||
|
||||
@Repository
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.billpaymentservice.bbps.repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.PaymentInitiate;
|
||||
|
||||
public interface PaymentIntiateRepository extends JpaRepository<PaymentInitiate, String> {
|
||||
|
||||
Optional<PaymentInitiate> findByReqId(String clientReqId);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,17 +2,23 @@ package com.billpaymentservice.bbps.service;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.BillFetchByBillIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.BillFetchByClientIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.BillValidateByClientIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillValidatestRequest;
|
||||
|
||||
public interface AgentService {
|
||||
|
||||
public ResponseModel initiateBillFetch(FetchBillRequest fetchBillRequest);
|
||||
ResponseModel initiateBillFetch(FetchBillRequest fetchBillRequest);
|
||||
|
||||
public ResponseModel fetchBillById(BillFetchByBillIdRequest billFetchByBillIdRequest);
|
||||
ResponseModel fetchBillById(BillFetchByBillIdRequest billFetchByBillIdRequest);
|
||||
|
||||
public ResponseModel initiateBillValidate(FetchBillValidatestRequest fetchBillValidateRequest);
|
||||
ResponseModel initiateBillValidate(FetchBillValidatestRequest fetchBillValidateRequest);
|
||||
|
||||
public ResponseModel initiateBillValidateByBillId(BillFetchByBillIdRequest billRequest);
|
||||
ResponseModel initiateBillValidateByBillId(BillFetchByBillIdRequest billRequest);
|
||||
|
||||
ResponseModel fetchBillByClientReqId(BillFetchByClientIdRequest billFetchByClientIdRequest);
|
||||
|
||||
ResponseModel fetchBillValidateByClientReqId( BillValidateByClientIdRequest billValidateByClientIdRequest);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ 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.ViewAllComplaintsRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ComplaintRequestDTO;
|
||||
|
||||
@@ -27,4 +28,6 @@ public interface ComplainService {
|
||||
|
||||
ResponseModel checkTxnStatus(TxnStatusRequest request);
|
||||
|
||||
ResponseModel ViewAllComplaints(ViewAllComplaintsRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.billpaymentservice.bbps.service;
|
||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.BillPaymentRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.TransactionStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.TrasactionStatusByClientReqIdRequest;
|
||||
|
||||
public interface PaymentService {
|
||||
|
||||
@@ -10,4 +11,6 @@ public interface PaymentService {
|
||||
|
||||
public ResponseModel checkTrasactionStatus(TransactionStatusRequest transactionStatusRequest);
|
||||
|
||||
ResponseModel checkTrasactionStatusByClientReqId(TrasactionStatusByClientReqIdRequest transactionStatusRequest);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.billpaymentservice.bbps.serviceImpl;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -13,11 +14,15 @@ import org.springframework.web.client.RestClient;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.BillFetchByBillIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.BillFetchByClientIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.BillValidateByClientIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillValidatestRequest;
|
||||
import com.billpaymentservice.bbps.dto.response.BillDataResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.FetchBillResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.FetchBillValidateResponse;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillValidatestForwardRequest;
|
||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||
import com.billpaymentservice.bbps.entites.BillInitiate;
|
||||
import com.billpaymentservice.bbps.entites.BillMaster;
|
||||
@@ -37,7 +42,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Service
|
||||
@@ -77,7 +81,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String requestId = fetchBillRequest.getReqId();
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_INTI;
|
||||
|
||||
fetchBillRequest.setClientReqId(txnId);
|
||||
helper.validateMerchant(fetchBillRequest.getMid());
|
||||
|
||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||
@@ -89,18 +93,22 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
String requestJson = helper.convertObjectToJson(fetchBillRequest);
|
||||
FetchBillForwardRequest forwardReq =
|
||||
helper.fetchBillForwardRequestMap(fetchBillRequest);
|
||||
|
||||
String forwardJson = helper.convertObjectToJson(forwardReq);
|
||||
String requestJson=helper.convertObjectToJson(fetchBillRequest);
|
||||
|
||||
// ✅ Create inbound & outbound logs
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnId, apiName, fetchBillRequest.getMid(),
|
||||
"POST", requestJson);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, fullUrl, "POST",
|
||||
requestJson);
|
||||
forwardJson);
|
||||
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, requestId);
|
||||
|
||||
try {
|
||||
LOGGER.info("Calling external API: {}", fullUrl);
|
||||
Map<String, String> responseMap = httpService.postRequest(fullUrl, requestJson, headers);
|
||||
Map<String, String> responseMap = httpService.postRequest(fullUrl,forwardJson, headers);
|
||||
String responseData = responseMap.get("data");
|
||||
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
@@ -163,9 +171,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
String reqId = billFetchByBillIdRequest.getReqId();
|
||||
String billId = billFetchByBillIdRequest.getBillId();
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
|
||||
|
||||
helper.validateMerchant(billFetchByBillIdRequest.getMid());
|
||||
|
||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("x-digiledge-key", headersData.getXDigiledgeKey());
|
||||
@@ -204,7 +210,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
LOGGER.info("Current Bill Status: {}", status);
|
||||
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||
helper.saveOrUpdateBillerData(responseWrapper, billFetchByBillIdRequest);
|
||||
helper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest,txnId);
|
||||
LOGGER.info("Bill data saved successfully for billId: {}", billId);
|
||||
|
||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
@@ -222,7 +228,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String reqId = billFetchByBillIdRequest.getReqId();
|
||||
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();
|
||||
|
||||
LOGGER.info("Initiating {} API for billId={} and reqId={}", apiName, billId, reqId);
|
||||
|
||||
@@ -260,7 +266,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
|
||||
helper.saveOrUpdateBillerData(responseWrapper, billFetchByBillIdRequest);
|
||||
helper.saveOrUpdateBillData(responseWrapper, billFetchByBillIdRequest,txnId);
|
||||
LOGGER.info("Bill data saved successfully for billId={} | Status={}", billId, generalResp.getStatus());
|
||||
|
||||
return responseModel;
|
||||
@@ -271,6 +277,10 @@ public class AgentServiceImpl implements AgentService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseModel initiateBillValidate(FetchBillValidatestRequest fetchBillValidateRequest) {
|
||||
|
||||
@@ -281,7 +291,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String reqId = fetchBillValidateRequest.getReqId();
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILLER_VALIDATE_URL;
|
||||
|
||||
fetchBillValidateRequest.setClientReqId(txnId);
|
||||
helper.validateMerchant(fetchBillValidateRequest.getMid());
|
||||
|
||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||
@@ -293,18 +303,23 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
FetchBillValidatestForwardRequest forwardReq =
|
||||
helper.fetchBillValidatestForwardRequest(fetchBillValidateRequest);
|
||||
|
||||
String forwardJson = helper.convertObjectToJson(forwardReq);
|
||||
|
||||
String requestJson = helper.convertObjectToJson(fetchBillValidateRequest);
|
||||
|
||||
// ✅ Create inbound & outbound logs
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, fetchBillValidateRequest.getMid(),
|
||||
"POST", requestJson);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, "POST",
|
||||
requestJson);
|
||||
forwardJson);
|
||||
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, reqId);
|
||||
|
||||
try {
|
||||
LOGGER.info("Calling external API: {}", fullUrl);
|
||||
Map<String, String> responseMap = httpService.postRequest(fullUrl, requestJson, headers);
|
||||
Map<String, String> responseMap = httpService.postRequest(fullUrl, forwardJson, headers);
|
||||
String responseData = responseMap.get("data");
|
||||
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
@@ -329,7 +344,6 @@ public class AgentServiceImpl implements AgentService {
|
||||
billMaster.setTxnId(txnId);
|
||||
billMasterRepository.save(billMaster);
|
||||
LOGGER.info("BillMaster saved for billId: {}", billMaster.getBillId());
|
||||
|
||||
FetchBillResponse fetchBillResponse = objectMapper.convertValue(dataMap, FetchBillResponse.class);
|
||||
GeneralResp generalResponse = fetchBillResponse.getGenericResponse();
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResponse.getStatus());
|
||||
@@ -433,6 +447,143 @@ public class AgentServiceImpl implements AgentService {
|
||||
}}
|
||||
|
||||
|
||||
//================================== Bill fetch and Bill Validate by Client Req Id==================================//
|
||||
|
||||
@Override
|
||||
public ResponseModel fetchBillValidateByClientReqId(BillValidateByClientIdRequest billValidateByClientIdRequest) {
|
||||
|
||||
String apiName = "FetchBillValidateByClientIdRequest";
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String reqId = billValidateByClientIdRequest.getReqId();
|
||||
String clientReqId = billValidateByClientIdRequest.getClientReqId();
|
||||
|
||||
Optional<BillInitiate> billInitiate = billIntiateRepository.findByReqId(clientReqId);
|
||||
if (billInitiate.isEmpty()) {
|
||||
throw new CustomException("No Bill Found for given Client Req Id");
|
||||
}
|
||||
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_BY_CLIENT_REQ_ID + billInitiate.get().getTxnId();
|
||||
|
||||
helper.validateMerchant(billValidateByClientIdRequest.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();
|
||||
|
||||
// 🔵 Create Inbound + Outbound Logs
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(
|
||||
reqId, txnId, apiName, billValidateByClientIdRequest.getMid(), "GET", null);
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(
|
||||
txnId, reqId, apiName, fullUrl, "GET", null);
|
||||
|
||||
try {
|
||||
LOGGER.info("Calling BBPS API FetchBillValidateByClientReqId, URL={}", fullUrl);
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
||||
String responseData = responseMap.get("data");
|
||||
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
|
||||
if (!dataMap.containsKey("genericResponse")) {
|
||||
helper.updateInboundLogFailure(inboundLog, responseData, "INVALID_RESPONSE");
|
||||
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();
|
||||
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||
|
||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseModel fetchBillByClientReqId(BillFetchByClientIdRequest billFetchByClientIdRequest) {
|
||||
|
||||
String apiName = "FetchBillByClientIdRequest";
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String reqId = billFetchByClientIdRequest.getReqId();
|
||||
String clientReqId = billFetchByClientIdRequest.getClientReqId();
|
||||
|
||||
Optional<BillInitiate> billInitiate = billIntiateRepository.findByReqId(clientReqId);
|
||||
if (billInitiate.isEmpty()) {
|
||||
throw new CustomException("No Bill Found for given Client Req Id");
|
||||
}
|
||||
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_BY_CLIENT_REQ_ID + billInitiate.get().getTxnId();
|
||||
|
||||
helper.validateMerchant(billFetchByClientIdRequest.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();
|
||||
|
||||
// 🔵 Create inbound + outbound logs
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(
|
||||
reqId, txnId, apiName, billFetchByClientIdRequest.getMid(), "GET", null);
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(
|
||||
txnId, reqId, apiName, fullUrl, "GET", null);
|
||||
|
||||
try {
|
||||
LOGGER.info("Calling BBPS API FetchBillByClientReqId, URL={}", fullUrl);
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
||||
String responseData = responseMap.get("data");
|
||||
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
|
||||
if (!dataMap.containsKey("genericResponse")) {
|
||||
helper.updateInboundLogFailure(inboundLog, responseData, "INVALID_RESPONSE");
|
||||
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")));
|
||||
}
|
||||
|
||||
BillDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillDataResponse.class);
|
||||
GeneralResp generalResp = responseWrapper.getGenericResponse();
|
||||
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||
|
||||
return new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @Override public ResponseModel
|
||||
|
||||
@@ -21,12 +21,14 @@ 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.TxnStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ViewAllComplaintsRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.ViewComplainByIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.response.ComplaintHistoryStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ComplaintResponse;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.response.ComplaintStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.TxnStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ViewAllComplaintsResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||
import com.billpaymentservice.bbps.entites.ComplaintDetails;
|
||||
@@ -47,7 +49,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@Service
|
||||
public class ComplainServiceImpl implements ComplainService {
|
||||
public class ComplainServiceImpl implements ComplainService {
|
||||
|
||||
@Value("${agent.data.url}")
|
||||
private String agentDtaUrl;
|
||||
@@ -646,4 +648,76 @@ public class ComplainServiceImpl implements ComplainService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseModel ViewAllComplaints(ViewAllComplaintsRequest request) {
|
||||
|
||||
LOGGER.info("Fetching All Complaint for status Type={} and reqId={} ", request.getStatusType(),
|
||||
request.getReqId());
|
||||
String apiName = "View All Complaint By Status Type";
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String reqId = request.getReqId();
|
||||
String fullUrl = complainDataUrl+ BBPSConstant.VIEW_ALL_COMPLAINTS_BASE
|
||||
+ "?pageNo=" + request.getPageNo()
|
||||
+ "&pageSize=" + request.getPageSize()
|
||||
+ "&statusType=" + request.getStatusType();
|
||||
|
||||
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(), "POST",
|
||||
requestJson);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, "GET", request.getStatusType());
|
||||
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("Response: {}", 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(""));
|
||||
}
|
||||
|
||||
ViewAllComplaintsResponse responseWrapper = objectMapper.convertValue(dataMap,
|
||||
ViewAllComplaintsResponse.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.saveAllComplaints(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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -170,6 +170,8 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, billerDetailRequest.getMid(),
|
||||
"POST", requestJson);
|
||||
|
||||
System.out.println( billerDataRespository.findByBillerId(billerId));
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, "GET", null);
|
||||
LOGGER.info("Calling external API: {}", fullUrl);
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl);
|
||||
@@ -287,6 +289,7 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
String fullUrl = String.format("%s%s?billerName=%s&category=%s&page=%d&pagesize=%d", masterRegisterUrl,
|
||||
BBPSConstant.BILLER_URL, masterRequest.getBillerName(), masterRequest.getCategory(),
|
||||
masterRequest.getPageNo(), masterRequest.getPageSize());
|
||||
LOGGER.info("Calling external API: {}", fullUrl);
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, "GET", null);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.billpaymentservice.bbps.serviceImpl;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.modelmapper.convention.MatchingStrategies;
|
||||
@@ -14,8 +15,10 @@ import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.BillPaymentRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.TransactionStatusRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.TrasactionStatusByClientReqIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.response.BillPaymentResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.TransactionStatusResponse;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.BillPaymentForwardRequest;
|
||||
import com.billpaymentservice.bbps.entites.AgentFundTransfer;
|
||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||
import com.billpaymentservice.bbps.entites.BillPayment;
|
||||
@@ -80,7 +83,7 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String requestId = billPaymentRequest.getReqId();
|
||||
String url = paymentUrl + BBPSConstant.PAYMENT_URL;
|
||||
|
||||
billPaymentRequest.setClientReqId(txnId);
|
||||
LOGGER.info("Initiating payment for reqId={} and txnId={}", requestId, txnId);
|
||||
|
||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||
@@ -92,15 +95,20 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
BillPaymentForwardRequest forwardReq =
|
||||
helper.billPaymentForwardRequest(billPaymentRequest);
|
||||
|
||||
String forwardjson = helper.convertObjectToJson(forwardReq);
|
||||
|
||||
|
||||
String requestJson = helper.convertObjectToJson(billPaymentRequest);
|
||||
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnId, apiName, billPaymentRequest.getMid(), "POST", requestJson);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, url, "POST", requestJson);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, url, "POST",forwardjson);
|
||||
|
||||
try {
|
||||
LOGGER.info("Calling BBPS payment URL: {}", url);
|
||||
Map<String, String> responseMap = httpService.postRequest(url, requestJson, headers);
|
||||
Map<String, String> responseMap = httpService.postRequest(url, forwardjson, headers);
|
||||
String responseData = responseMap.get("data");
|
||||
LOGGER.info("Payment API Response: {}", responseData);
|
||||
|
||||
@@ -142,7 +150,7 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
transactionStatusRequest.setReqId(requestId);
|
||||
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
Thread.sleep(9000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
LOGGER.warn("Thread interrupted during payment delay: {}", e.getMessage());
|
||||
@@ -161,6 +169,8 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
String apiName = "CheckTransactionStatus";
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String requestId = transactionStatusRequest.getReqId();
|
||||
|
||||
|
||||
String url = paymentUrl + BBPSConstant.CHECK_TRANSACTION_URL + transactionStatusRequest.getTxnId();
|
||||
|
||||
LOGGER.info("Checking transaction status (internal) for txnId={} and reqId={}", transactionStatusRequest.getTxnId(), requestId);
|
||||
@@ -293,8 +303,102 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseModel checkTrasactionStatusByClientReqId(TrasactionStatusByClientReqIdRequest transactionStatusRequest) {
|
||||
|
||||
helper.validateMerchant(transactionStatusRequest.getMid());
|
||||
|
||||
String txnID = helper.generateTxnId(15);
|
||||
String apiName = "checkTrasactionStatusbyClientReqId";
|
||||
String requestId = transactionStatusRequest.getReqId();
|
||||
String clientReqId = transactionStatusRequest.getClientReqId();
|
||||
String requestJson = helper.convertObjectToJson(transactionStatusRequest);
|
||||
|
||||
LOGGER.info("Checking transaction status for clientReqId={} and reqId={}", clientReqId, requestId);
|
||||
|
||||
// Fetch Txn from DB
|
||||
Optional<PaymentInitiate> paymentInitiate = paymentIntiateRepository.findByReqId(clientReqId);
|
||||
if (paymentInitiate.isEmpty()) {
|
||||
throw new CustomException("No Transaction Found for given Client Req Id");
|
||||
}
|
||||
|
||||
String url = paymentUrl + BBPSConstant.CHECK_TRANSACTION_BY_CLIENT_REQ_ID_URL + paymentInitiate.get().getTxnId();
|
||||
|
||||
// Prepare headers
|
||||
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 Inbound + Outbound Logs
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(
|
||||
requestId, txnID, apiName, transactionStatusRequest.getMid(), "POST", requestJson);
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(
|
||||
txnID, requestId, apiName, url, "GET", null);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
LOGGER.info("Calling BBPS Transaction Status API URL={}", url);
|
||||
Map<String, String> responseMap = httpService.getRequest(url, headers);
|
||||
|
||||
String responseData = responseMap.get("data");
|
||||
LOGGER.info("Transaction Status Response: {}", responseData);
|
||||
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
|
||||
// Parse response
|
||||
Map<String, Object> dataMap = objectMapper.readValue(
|
||||
responseData, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
// Validate response
|
||||
if (!dataMap.containsKey("generalResp")) {
|
||||
helper.updateInboundLogFailure(inboundLog, responseData, "INVALID_RESPONSE");
|
||||
|
||||
LOGGER.warn("Invalid transaction status response for clientReqId={} | Response={}",
|
||||
clientReqId, 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"))
|
||||
);
|
||||
}
|
||||
|
||||
// Convert into proper DTO
|
||||
TransactionStatusResponse responseWrapper =
|
||||
objectMapper.convertValue(dataMap, TransactionStatusResponse.class);
|
||||
|
||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||
|
||||
LOGGER.info("Transaction Status for clientReqId={} => {}", clientReqId, generalResp.getStatus());
|
||||
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||
|
||||
return new ResponseModel(
|
||||
generalResp.getMessage(),
|
||||
generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()),
|
||||
responseWrapper
|
||||
);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing JSON in transaction status API: {}", e.getMessage(), e);
|
||||
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), "JSON_ERROR");
|
||||
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
}
|
||||
}
|
||||
/* PollBack logic for the fetchTxnByTxnId API
|
||||
* @Override public ResponseModel fetchTxnByTxnId(BillFetchByBillIdRequest
|
||||
* billFetchByBillIdRequest) {
|
||||
|
||||
@@ -39,16 +39,19 @@ public class BBPSConstant {
|
||||
public static final String CUSTOMPARAM_URL = "/customerParam?billerId=";
|
||||
public static final String BILL_FETCH_INTI = "/couapp/bills/fetch";
|
||||
public static final String BILL_FETCH_BY_ID = "/couapp/bills/fetch/byId?billId=";
|
||||
public static final String BILL_FETCH_BY_CLIENT_REQ_ID = "/couapp/bills/fetch/byClientId?clientReqId=";
|
||||
public static final String BILL_VALIDATE_BY_CLIENT_REQ_ID = "/couapp/bills/validate/byClientId?clientReqId=";
|
||||
public static final String PAYMENT_URL = "/agent/bills/payment";
|
||||
public static final String CHECK_TRANSACTION_URL = "/transactions/payment/byTxnId?txnId=";
|
||||
public static final String CHECK_TRANSACTION_BY_CLIENT_REQ_ID_URL = "/transactions/payment/byClientId?clientReqId=";
|
||||
public static final String DISPOSTION_URL = "/disposition";
|
||||
public static final String COMPALINT_STATUS = "/couapp/complaints/status";
|
||||
public static final String REOPEN_COMPALINT = "/couapp/complaints/reopen";
|
||||
public static final String COMPLAINT_HISTORY = "/couapp/complaints/history/byId?complaintId=";
|
||||
public static final String CLOSE_COMPLAINT = "/couapp/complaints/closure";
|
||||
public static final String VIEW_COMPLAINT_BY_ID = "/couapp/complaints/byId?complaintId=";
|
||||
|
||||
public static final String PLANS_URL = "/plans";
|
||||
public static final String ADD_COMPLAIN_ENDPOINT = "/couapp/complaints";
|
||||
public static final String VIEW_ALL_COMPLAINTS_BASE = "/couapp/complaints/all";
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,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.ViewAllComplaintsResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ViewComplainByIdResponse;
|
||||
import com.billpaymentservice.bbps.entites.AdditionalInfoPlans;
|
||||
import com.billpaymentservice.bbps.entites.AmountOptionByBillerId;
|
||||
@@ -654,6 +655,29 @@ public class BillerMapperHelper {
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
public String saveAllComplaints(ViewAllComplaintsResponse 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";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.billpaymentservice.bbps.util;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest;
|
||||
import com.billpaymentservice.bbps.entites.BillerDetails;
|
||||
import com.billpaymentservice.bbps.entites.BillerResponseParams;
|
||||
import com.billpaymentservice.bbps.entites.InterchangeFee;
|
||||
@@ -35,6 +37,7 @@ public class EntityRelationshipUtil {
|
||||
entity.getBillerAdditionalInfos().forEach(a -> a.setBiller(entity));
|
||||
}
|
||||
|
||||
|
||||
if (entity.getInterchangeFees() != null) {
|
||||
for (InterchangeFee fee : entity.getInterchangeFees()) {
|
||||
fee.setBiller(entity);
|
||||
@@ -89,5 +92,7 @@ public class EntityRelationshipUtil {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,14 @@ import com.billpaymentservice.bbps.dto.AdditionalInfoBillDTO;
|
||||
import com.billpaymentservice.bbps.dto.CustomerParamDAO;
|
||||
import com.billpaymentservice.bbps.dto.ResponseModel;
|
||||
import com.billpaymentservice.bbps.dto.request.BillFetchByBillIdRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.BillPaymentRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillValidatestRequest;
|
||||
import com.billpaymentservice.bbps.dto.response.BillDataResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.FetchBillValidateResponse;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.BillPaymentForwardRequest;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillValidatestForwardRequest;
|
||||
import com.billpaymentservice.bbps.entites.AdditionalInfoBill;
|
||||
import com.billpaymentservice.bbps.entites.BBPSMastersData;
|
||||
import com.billpaymentservice.bbps.entites.BillMaster;
|
||||
@@ -204,6 +210,7 @@ public class Helper {
|
||||
outboundLog.setResponsePayload(responsePayload);
|
||||
outboundLog.setResponseReceiveTime(LocalDateTime.now());
|
||||
outboundTraceLogRepository.save(outboundLog);
|
||||
|
||||
}
|
||||
/* ---------- End helpers ---------- */
|
||||
public void saveOrUpdateBillerData(BillerDetails newEntity) {
|
||||
@@ -244,20 +251,20 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveOrUpdateBillerData(BillDataResponse responseWrapper,
|
||||
BillFetchByBillIdRequest billFetchByBillIdRequest) {
|
||||
public void saveOrUpdateBillData(BillDataResponse responseWrapper,
|
||||
BillFetchByBillIdRequest billFetchByBillIdRequest,String txnId) {
|
||||
|
||||
|
||||
BillMaster billMaster = new BillMaster();
|
||||
|
||||
billMaster.setBillId("12333333hjsdfjsfdj");
|
||||
billMaster.setBillId(billFetchByBillIdRequest.getBillId());
|
||||
billMaster.setRefId(responseWrapper.getRefId());
|
||||
billMaster.setBillerId(responseWrapper.getBillerId());
|
||||
billMaster.setStatus(responseWrapper.getStatus());
|
||||
billMaster.setActionType(responseWrapper.getActionType());
|
||||
billMaster.setUserId(responseWrapper.getUserId());
|
||||
billMaster.setReqId(billFetchByBillIdRequest.getReqId());
|
||||
billMaster.setTxnId("jhnjhbhj");
|
||||
billMaster.setTxnId(txnId);
|
||||
|
||||
|
||||
// BILLER RESPONSE
|
||||
@@ -354,4 +361,65 @@ billMasterRepository.save(billMaster);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public FetchBillForwardRequest fetchBillForwardRequestMap(FetchBillRequest req) {
|
||||
|
||||
FetchBillForwardRequest forward = new FetchBillForwardRequest();
|
||||
|
||||
forward.setBillerId(req.getBillerId());
|
||||
forward.setBillerName(req.getBillerName());
|
||||
forward.setBillerCategory(req.getBillerCategory());
|
||||
forward.setClientReqId(req.getClientReqId());
|
||||
forward.setMacAdress(req.getMacAdress());
|
||||
forward.setCustomerMobNo(req.getCustomerMobNo());
|
||||
forward.setRemitterName(req.getRemitterName());
|
||||
forward.setPaymentChannel(req.getPaymentChannel());
|
||||
forward.setDeviceBlockTags(req.getDeviceBlockTags());
|
||||
forward.setCustomerParamsRequest(req.getCustomerParamsRequest());
|
||||
forward.setRemitterIdentity(req.getRemitterIdentity());
|
||||
|
||||
return forward;
|
||||
}
|
||||
|
||||
public FetchBillValidatestForwardRequest fetchBillValidatestForwardRequest(FetchBillValidatestRequest req) {
|
||||
|
||||
FetchBillValidatestForwardRequest forward = new FetchBillValidatestForwardRequest();
|
||||
|
||||
forward.setBillerId(req.getBillerId());
|
||||
forward.setBillerName(req.getBillerName());
|
||||
forward.setBillerCategory(req.getBillerCategory());
|
||||
forward.setCustomerMobNo(req.getCustomerMobNo());
|
||||
forward.setClientReqId(req.getClientReqId());
|
||||
forward.setMacAddress(req.getMacAddress());
|
||||
forward.setCustomerParamsRequest(req.getCustomerParamsRequest());
|
||||
|
||||
return forward;
|
||||
}
|
||||
public BillPaymentForwardRequest billPaymentForwardRequest(BillPaymentRequest req) {
|
||||
|
||||
BillPaymentForwardRequest forward = new BillPaymentForwardRequest();
|
||||
|
||||
forward.setTenantId(req.getTenantId());
|
||||
forward.setRefId(req.getRefId());
|
||||
forward.setBillId(req.getBillId());
|
||||
forward.setAmountOptions(req.isAmountOptions());
|
||||
forward.setPaymentMode(req.getPaymentMode());
|
||||
forward.setPaymentInformation(req.getPaymentInformation());
|
||||
forward.setBillerId(req.getBillerId());
|
||||
forward.setBillerName(req.getBillerName());
|
||||
forward.setBillerCategory(req.getBillerCategory());
|
||||
forward.setMacAdress(req.getMacAdress());
|
||||
forward.setCustomerMobNo(req.getCustomerMobNo());
|
||||
forward.setTxnAmount(req.getTxnAmount());
|
||||
forward.setPaymentRefId(req.getPaymentRefId());
|
||||
forward.setClientReqId(req.getClientReqId());
|
||||
forward.setPaymentChannel(req.getPaymentChannel());
|
||||
|
||||
forward.setDeviceBlockTags(req.getDeviceBlockTags());
|
||||
forward.setCustomerParamsRequest(req.getCustomerParamsRequest());
|
||||
forward.setRemitterIdentity(req.getRemitterIdentity());
|
||||
forward.setAmountBreakSet(req.getAmountBreakSet());
|
||||
|
||||
return forward;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user