merged with himanshu code
This commit is contained in:
@@ -2,55 +2,38 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.2.5</version>
|
||||
<relativePath /> <!-- lookup parent from repository -->
|
||||
<version>3.2.7</version> <!-- ✅ LTS and stable -->
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>com.billpaymentservice.bbps</groupId>
|
||||
<artifactId>bbps</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>bbps</name>
|
||||
<description>This is the bbps switch project</description>
|
||||
<url />
|
||||
<licenses>
|
||||
<license />
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer />
|
||||
</developers>
|
||||
<scm>
|
||||
<connection />
|
||||
<developerConnection />
|
||||
<tag />
|
||||
<url />
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.resilience4j</groupId>
|
||||
<artifactId>resilience4j-spring-boot3</artifactId>
|
||||
<version>2.2.0</version> <!-- Latest stable version -->
|
||||
</dependency>
|
||||
<!-- Core Spring Boot Starters -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<!-- ❌ Exclude old HttpClient 4.x -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
@@ -58,59 +41,51 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.13.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version> <!-- Use latest stable -->
|
||||
<scope>provided</scope>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
<artifactId>nimbus-jose-jwt</artifactId>
|
||||
<version>9.37</version> <!-- Use latest stable version -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Tomcat (provided for WAR) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.modelmapper</groupId>
|
||||
<artifactId>modelmapper</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Database Driver -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Resilience4j -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<groupId>io.github.resilience4j</groupId>
|
||||
<artifactId>resilience4j-spring-boot3</artifactId>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON + XML -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JWT -->
|
||||
<dependency>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
<artifactId>nimbus-jose-jwt</artifactId>
|
||||
<version>9.37</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HttpClient 5 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
@@ -121,32 +96,56 @@
|
||||
<artifactId>httpcore5</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.core5</groupId>
|
||||
<artifactId>httpcore5-h2</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ModelMapper -->
|
||||
<dependency>
|
||||
<groupId>org.modelmapper</groupId>
|
||||
<artifactId>modelmapper</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- (Optional) ✅ Fluent API for HttpClient5 (useful if you ever need
|
||||
direct HttpClient) -->
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5-fluent</artifactId>
|
||||
<version>5.3.1</version>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- DevTools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger / OpenAPI -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Configuration Processor -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -159,7 +158,7 @@
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.42</version> <!-- ✅ Required -->
|
||||
<version>1.18.30</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
@@ -168,14 +167,6 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -47,12 +47,19 @@ public class MasterDataController {
|
||||
return ResponseEntity.ok(masterDataService.getContactMaster(contactMasterRequest));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getDispostionDetail", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<ResponseModel> getDispostionDetail(
|
||||
@Validated @RequestBody ContactMasterRequest contactMasterRequest) {
|
||||
return ResponseEntity.ok(masterDataService.getDispositionDetails());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get CustomerParam by billerId.The parameter is different from the data we are
|
||||
* getting in the billerDetail
|
||||
**/
|
||||
|
||||
@PostMapping(value = "/getCustomerParamDetails", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<ResponseModel> getBillerDetails(
|
||||
public ResponseEntity<ResponseModel> getCustomerParamDetails(
|
||||
@Validated @RequestBody CustomParamRequest customerParamRequest) {
|
||||
|
||||
log.info("Received biller details request for billerId: {}", customerParamRequest.getBillerId());
|
||||
@@ -101,10 +108,9 @@ public class MasterDataController {
|
||||
public ResponseEntity<ResponseModel> fetchPlanCategories(@Validated @RequestBody BillerDetailRequest requestModel) {
|
||||
return ResponseEntity.ok(masterDataService.fetchPlanCategorie(requestModel));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* POST Fetch Initiating Channel API Fetch Category Wise from BBPS
|
||||
* URL
|
||||
* POST Fetch Initiating Channel API Fetch Category Wise from BBPS URL
|
||||
**/
|
||||
@PostMapping(value = "/initiatingChannel", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<ResponseModel> initiatingChannel(@Validated @RequestBody BillerDetailRequest requestModel) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
@@ -10,13 +11,12 @@ public class AgentFundTransfer {
|
||||
@NotBlank private String fundTxnReferenceId;
|
||||
@NotBlank private String fundTxnRemarks;
|
||||
@NotBlank private String fundTxnDate;
|
||||
|
||||
@NotNull private Double fundTxnAmt;
|
||||
|
||||
@NotBlank private String fundUTR;
|
||||
|
||||
private String fundRespRemarks;
|
||||
private String agentNpciId;
|
||||
private String txnRefId;
|
||||
|
||||
private String tenantId;
|
||||
@NotBlank private String fundStatus; // FUND_TRANSFER_SUCCESS or FUND_TRANSFER_FAILED
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CustomParam {
|
||||
public class CustomParamDTO {
|
||||
private String customParamName;
|
||||
private String dataType;
|
||||
private boolean optional;
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DeviceBlockTag {
|
||||
private String name;
|
||||
private String tagId;
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
public class DispositionsDTO {
|
||||
private String dispositionId;
|
||||
private String dispositionDescr;
|
||||
private String tenantId;
|
||||
}
|
||||
@@ -4,11 +4,13 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class GeneralResp {
|
||||
private String statusCode;
|
||||
private String status;
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
public class TransactionDAO {
|
||||
|
||||
@NotBlank private String txnId;
|
||||
@NotBlank private String refId;
|
||||
|
||||
private String txnNpciId;
|
||||
|
||||
@NotBlank private String orderId;
|
||||
@NotBlank private String billId;
|
||||
@NotBlank private String userType;
|
||||
@NotBlank private String userId;
|
||||
|
||||
@NotNull private Double txnAmount;
|
||||
@NotNull private Double totalTxnAmount;
|
||||
|
||||
@NotBlank private String billerId;
|
||||
@NotBlank private String billerCategory;
|
||||
@NotBlank private String billerName;
|
||||
|
||||
private String clientReqId;
|
||||
private String offUsPay;
|
||||
private String splitPay;
|
||||
private String quickPay;
|
||||
private String paymentMode;
|
||||
|
||||
private Double custConvFee;
|
||||
private String currency;
|
||||
private String status;
|
||||
private String requestedIp;
|
||||
private String customerMobNo;
|
||||
private String macAddress;
|
||||
|
||||
private Double splitPayAmount;
|
||||
private Double couCustConvFee;
|
||||
|
||||
private Boolean settlementVerification;
|
||||
private String fundTxnType;
|
||||
private String reason;
|
||||
|
||||
private List<String> amountTags;
|
||||
private List<String> customerParamsDAOS;
|
||||
private List<String> paymentInformation;
|
||||
|
||||
private List<CustomerParamDAO> customerParamsDAO;
|
||||
|
||||
private String planId;
|
||||
private String planType;
|
||||
|
||||
private LocalDateTime creationDate;
|
||||
private LocalDateTime modifiedDate;
|
||||
|
||||
private Long createdEpochDate;
|
||||
private Long modifiedEpochDate;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
|
||||
public class TransactionDTO {
|
||||
|
||||
@NotBlank private String txnId;
|
||||
@NotBlank private String refId;
|
||||
private String txnNpciId;
|
||||
private String paymentRefId;
|
||||
private String remitterName;
|
||||
|
||||
|
||||
@NotBlank private String orderId;
|
||||
@NotBlank private String billId;
|
||||
@NotBlank private String userType;
|
||||
@NotBlank private String userId;
|
||||
|
||||
@NotNull private Double txnAmount;
|
||||
@NotNull private Double totalTxnAmount;
|
||||
|
||||
@NotBlank private String billerId;
|
||||
@NotBlank private String billerCategory;
|
||||
@NotBlank private String billerName;
|
||||
|
||||
private String clientReqId;
|
||||
private String offUsPay;
|
||||
private String splitPay;
|
||||
private String quickPay;
|
||||
private String paymentMode;
|
||||
private String agentPaymentInformation;
|
||||
|
||||
private Double custConvFee;
|
||||
private String currency;
|
||||
private String status;
|
||||
private String requestedIp;
|
||||
private String customerMobNo;
|
||||
private String macAddress;
|
||||
|
||||
private Double splitPayAmount;
|
||||
private Double couCustConvFee;
|
||||
|
||||
private Boolean settlementVerification;
|
||||
private String fundTxnType;
|
||||
private String reason;
|
||||
|
||||
private List<String> amountTags;
|
||||
private List<String> customerParamsDAOS;
|
||||
private List<String> paymentInformation;
|
||||
private List<DeviceBlockTag> deviceBlockTags;
|
||||
|
||||
|
||||
private List<CustomerParamDAO> customerParamsDAO;
|
||||
|
||||
private String planId;
|
||||
private String planType;
|
||||
|
||||
// ✅ Date fields as String (for JSON compatibility)
|
||||
private String creationDate;
|
||||
private String modifiedDate;
|
||||
|
||||
private Long createdEpochDate;
|
||||
private Long modifiedEpochDate;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
public class DispositionRequest extends BaseClass {
|
||||
|
||||
}
|
||||
@@ -3,9 +3,11 @@ package com.billpaymentservice.bbps.dto.response;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class BillPaymentResponse {
|
||||
|
||||
private String txnId;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.billpaymentservice.bbps.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.ContactMaster;
|
||||
import com.billpaymentservice.bbps.dto.CustomParam;
|
||||
import com.billpaymentservice.bbps.dto.CustomParamDTO;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.billpaymentservice.bbps.entites.CustomerParam;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@@ -20,5 +19,5 @@ import lombok.Setter;
|
||||
public class CustomParamResp {
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private GeneralResp generalResp;
|
||||
private List<CustomParam> customParamResp;
|
||||
private List<CustomParamDTO> customParamResp;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.billpaymentservice.bbps.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.DispositionsDTO;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class DispositionResponse {
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private GeneralResp generalResp;
|
||||
List<DispositionsDTO> dispositionsList;
|
||||
}
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.billpaymentservice.bbps.dto.response;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.AgentFundTransfer;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.billpaymentservice.bbps.dto.TransactionDAO;
|
||||
import com.billpaymentservice.bbps.dto.TransactionDTO;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -13,7 +13,7 @@ import lombok.Setter;
|
||||
public class TransactionStatusResponse {
|
||||
|
||||
@JsonProperty("transactionDAO")
|
||||
private TransactionDAO transactionDAO;
|
||||
private TransactionDTO transactionDAO;
|
||||
|
||||
@JsonProperty("agentFundTransfer")
|
||||
private AgentFundTransfer agentFundTransfer;
|
||||
|
||||
@@ -5,10 +5,12 @@ import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "additional_info")
|
||||
public class AdditionalInfo {
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.BillerResponseParams;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Entity
|
||||
@Table(name = "amount_option")
|
||||
@@ -15,9 +13,9 @@ import com.billpaymentservice.bbps.entites.BillerResponseParams;
|
||||
public class AmountOption {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "amount_option_id")
|
||||
private Long id;
|
||||
@JsonProperty("amountOptionId") // ✅ JSON field map karo
|
||||
private String amountOptionId; // ✅ String type, manual ID
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(
|
||||
@@ -31,4 +29,4 @@ public class AmountOption {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "biller_response_id", nullable = false)
|
||||
private BillerResponseParams billerResponseParams;
|
||||
}
|
||||
}
|
||||
@@ -147,8 +147,10 @@ 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;
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import lombok.ToString;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Getter;
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "biller_plan_response_params")
|
||||
public class BillerPlanResponseParams {
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "custom_param")
|
||||
public class CustomParam {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "custom_param_name")
|
||||
private String customParamName;
|
||||
|
||||
@Column(name = "data_type")
|
||||
private String dataType;
|
||||
|
||||
@Column(name = "optional")
|
||||
private Boolean optional;
|
||||
|
||||
@Column(name = "min_length")
|
||||
private Integer minLength;
|
||||
|
||||
@Column(name = "max_length")
|
||||
private Integer maxLength;
|
||||
|
||||
@Column(name = "regex")
|
||||
private String regex;
|
||||
|
||||
@Column(name = "visibility")
|
||||
private Boolean visibility;
|
||||
|
||||
|
||||
}
|
||||
@@ -3,12 +3,14 @@ package com.billpaymentservice.bbps.entites;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "customer_param_groups")
|
||||
public class CustomerParamGroups {
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "disposition_details")
|
||||
@ToString
|
||||
public class DispositionDetails {
|
||||
|
||||
@Id
|
||||
@Column(name = "disposition_id", nullable = false, unique = true)
|
||||
private String dispositionId; // UUID type string
|
||||
|
||||
@Column(name = "disposition_descr", nullable = false)
|
||||
private String dispositionDescr;
|
||||
|
||||
@Column(name = "tenant_id")
|
||||
private String tenantId;
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
import lombok.ToString;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Getter;
|
||||
@@ -15,6 +14,7 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "interchange_fee")
|
||||
public class InterchangeFee {
|
||||
|
||||
|
||||
@@ -4,18 +4,20 @@ import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "payment_channel")
|
||||
public class PaymentChannel {
|
||||
|
||||
@Id
|
||||
@Id
|
||||
@Column(name = "payment_channel_limit_id")
|
||||
@JsonProperty("paymentChannelLimitId") // 👈 Map JSON field to this property
|
||||
private String id; // Primary key (manual, not auto-generated)
|
||||
private String paymentChannelLimitId; // Primary key (manual, not auto-generated)
|
||||
|
||||
@NotBlank(message = "Payment channel is required")
|
||||
@Column(name = "payment_channel", nullable = false)
|
||||
|
||||
@@ -2,15 +2,27 @@ package com.billpaymentservice.bbps.entites;
|
||||
|
||||
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.PositiveOrZero;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "biller_payment_modes")
|
||||
@ToString
|
||||
public class PaymentMode {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.billpaymentservice.bbps.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.DispositionDetails;
|
||||
|
||||
public interface DispositionRepository extends JpaRepository<DispositionDetails,String> {
|
||||
|
||||
}
|
||||
@@ -29,4 +29,6 @@ public interface MasterDataService {
|
||||
|
||||
public ResponseModel fetchInitiatingChannel(BillerDetailRequest requestModel);
|
||||
|
||||
public ResponseModel getDispositionDetails();
|
||||
|
||||
}
|
||||
|
||||
@@ -292,4 +292,4 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.billpaymentservice.bbps.serviceImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.modelmapper.convention.MatchingStrategies;
|
||||
@@ -23,14 +25,19 @@ import com.billpaymentservice.bbps.dto.response.BillerResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.ChannelsListResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.CustomParamResp;
|
||||
import com.billpaymentservice.bbps.dto.response.CustomerParamGroupsResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.DispositionResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.PlaneCategoriesResponse;
|
||||
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
|
||||
import com.billpaymentservice.bbps.entites.BillerDetails;
|
||||
import com.billpaymentservice.bbps.entites.DispositionDetails;
|
||||
import com.billpaymentservice.bbps.exception.CustomException;
|
||||
import com.billpaymentservice.bbps.repository.BharatConnectMasterRepository;
|
||||
import com.billpaymentservice.bbps.repository.BillerDataRepository;
|
||||
import com.billpaymentservice.bbps.repository.DispositionRepository;
|
||||
import com.billpaymentservice.bbps.repository.MerchantRepository;
|
||||
import com.billpaymentservice.bbps.service.MasterDataService;
|
||||
import com.billpaymentservice.bbps.util.BBPSConstant;
|
||||
import com.billpaymentservice.bbps.util.EntityRelationshipUtil;
|
||||
import com.billpaymentservice.bbps.util.Helper;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
@@ -43,71 +50,27 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
|
||||
@Value("${master.data.url}")
|
||||
private String masterRegisterUrl;
|
||||
|
||||
private Helper helper;
|
||||
private final BillerDataRepository billerDataRespository;
|
||||
private final BharatConnectMasterRepository beneficiaryDetailsRepository;
|
||||
|
||||
private MerchantRepository merchantRegisterRepo;
|
||||
private HttpClientApi httpClientApi;
|
||||
private final DispositionRepository dispositionRepository;
|
||||
private final Helper helper;
|
||||
private final BillerDataRepository billerDataRespository;
|
||||
private static final Logger log = LoggerFactory.getLogger(MasterDataServiceImpl.class);
|
||||
private final HttpService httpService;
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
// Inject HttpService
|
||||
public MasterDataServiceImpl(BharatConnectMasterRepository beneficiaryDetailsRepository, HttpService httpService,
|
||||
Helper helper, BillerDataRepository billerDataRespository) {
|
||||
this.beneficiaryDetailsRepository = beneficiaryDetailsRepository;
|
||||
public MasterDataServiceImpl(MerchantRepository merchantRegisterRepo, HttpService httpService,
|
||||
HttpClientApi httpClientApi, Helper helper, BillerDataRepository billerDataRespository,
|
||||
DispositionRepository dispositionRepository, BharatConnectMasterRepository beneficiaryDetailsRepository) {
|
||||
this.merchantRegisterRepo = merchantRegisterRepo;
|
||||
this.httpService = httpService;
|
||||
this.httpClientApi = httpClientApi;
|
||||
this.helper = helper;
|
||||
this.billerDataRespository = billerDataRespository;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseModel getBillerByBillerId(BillerDetailRequest billerDetailRequest) {
|
||||
|
||||
String billerId = billerDetailRequest.getBillerId();
|
||||
String fullUrl = masterRegisterUrl + BBPSConstant.BILLER_DATA_FETCH_URL + billerId;
|
||||
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl);
|
||||
String responseData = responseMap.get("data");
|
||||
log.info("data is :{}", responseData);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (!dataMap.containsKey("generalResp")) {
|
||||
throw new CustomException(String.valueOf(dataMap.get("message")), // message
|
||||
String.valueOf(dataMap.get("status")), // status
|
||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), // statusCode (int)
|
||||
String.valueOf(dataMap.get("remarks")));
|
||||
}
|
||||
|
||||
BillerDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillerDataResponse.class);
|
||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||
ModelMapper mapper = new ModelMapper();
|
||||
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||
BillerDetails entity = mapper.map(responseWrapper.getBillerDAO(), BillerDetails.class);
|
||||
|
||||
System.out.println(entity);
|
||||
|
||||
if (entity != null) {
|
||||
billerDataRespository.save(entity);
|
||||
} else {
|
||||
LOGGER.warn("No biller found in response to save.");
|
||||
}
|
||||
|
||||
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
|
||||
return responseModel;
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
this.dispositionRepository = dispositionRepository;
|
||||
this.beneficiaryDetailsRepository = beneficiaryDetailsRepository;
|
||||
|
||||
}
|
||||
|
||||
@@ -158,6 +121,45 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseModel getBillerByBillerId(BillerDetailRequest billerDetailRequest) {
|
||||
|
||||
String billerId = billerDetailRequest.getBillerId();
|
||||
String fullUrl = masterRegisterUrl + BBPSConstant.BILLER_DATA_FETCH_URL + billerId;
|
||||
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl);
|
||||
String responseData = responseMap.get("data");
|
||||
log.info("data is :{}", responseData);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (!dataMap.containsKey("generalResp")) {
|
||||
throw new CustomException(String.valueOf(dataMap.get("message")), // message
|
||||
String.valueOf(dataMap.get("status")), // status
|
||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), // statusCode (int)
|
||||
String.valueOf(dataMap.get("remarks")));
|
||||
}
|
||||
BillerDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillerDataResponse.class);
|
||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||
ModelMapper mapper = new ModelMapper();
|
||||
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||
BillerDetails entity = mapper.map(responseWrapper.getBillerDAO(), BillerDetails.class);
|
||||
EntityRelationshipUtil.linkBillerRelationships(entity);
|
||||
// billerDataRespository.save(entity);
|
||||
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
return responseModel;
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseModel getCustomerParamByBillerId(CustomParamRequest customerParamRequest) {
|
||||
|
||||
@@ -245,7 +247,52 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
|
||||
return responseModel;
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseModel getDispositionDetails() {
|
||||
String fullUrl = masterRegisterUrl + BBPSConstant.DISPOSTION_URL;
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl);
|
||||
String responseData = responseMap.get("data");
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (!dataMap.containsKey("generalResp")) {
|
||||
throw new CustomException(String.valueOf(dataMap.get("message")), // message
|
||||
String.valueOf(dataMap.get("status")), // status
|
||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), // statusCode (int)
|
||||
String.valueOf(dataMap.get("remarks")));
|
||||
}
|
||||
|
||||
DispositionResponse responseWrapper = objectMapper.convertValue(dataMap, DispositionResponse.class);
|
||||
System.out.println(responseWrapper);
|
||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||
ModelMapper mapper = new ModelMapper();
|
||||
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||
List<DispositionDetails> entities = responseWrapper.getDispositionsList().stream()
|
||||
.map(dto -> mapper.map(dto, DispositionDetails.class)).collect(Collectors.toList());
|
||||
|
||||
System.out.println(entities);
|
||||
|
||||
if (entities != null) {
|
||||
dispositionRepository.saveAll(entities);
|
||||
} else {
|
||||
LOGGER.warn("No disposition found in response to save.");
|
||||
}
|
||||
|
||||
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
|
||||
return responseModel;
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
|
||||
@@ -58,7 +58,7 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
public ResponseModel initiatePayment(BillPaymentRequest billPaymentRequest) {
|
||||
|
||||
String url = paymentUrl + BBPSConstant.PAYMENT_URL;
|
||||
System.out.println(url);
|
||||
System.out.println(url);
|
||||
|
||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||
|
||||
@@ -99,7 +99,9 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
|
||||
// ✅ Convert to your custom DTO
|
||||
BillPaymentResponse billPaymentResponse = objectMapper.convertValue(dataMap, BillPaymentResponse.class);
|
||||
System.out.print(billPaymentResponse);
|
||||
GeneralResp generalResponse = billPaymentResponse.getGenericResponse();
|
||||
|
||||
//
|
||||
// start a new thread here
|
||||
/*
|
||||
@@ -108,15 +110,16 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
* return fetchBillById(pollReq); }, 3, // interval in seconds 15 // total time
|
||||
* in seconds );
|
||||
*/
|
||||
|
||||
ModelMapper mapper = new ModelMapper();
|
||||
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||
BillPayment entity = mapper.map(billPaymentResponse, BillPayment.class);
|
||||
paymentRepository.save(entity);
|
||||
|
||||
// ✅ Build final ResponseModel
|
||||
responseModel = new ResponseModel(generalResponse.getMessage(), generalResponse.getStatus(),
|
||||
Integer.parseInt(generalResponse.getStatusCode()), billPaymentResponse);
|
||||
|
||||
TransactionStatusRequest transactionStatusRequest=new TransactionStatusRequest();
|
||||
//call the checkTransactionStatus
|
||||
transactionStatusRequest.setTxnId(billPaymentResponse.getTxnId());
|
||||
System.out.println(transactionStatusRequest);
|
||||
responseModel= checkTrasactionStatus(transactionStatusRequest);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("❌ Exception in initiateBillFetch(): {}", e.getMessage(), e);
|
||||
responseModel.setStatus("500");
|
||||
@@ -130,49 +133,88 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
@Override
|
||||
public ResponseModel checkTrasactionStatus(TransactionStatusRequest transactionStatusRequest) {
|
||||
|
||||
String url=paymentUrl + BBPSConstant.CHECK_TRANSACTION_URL+transactionStatusRequest.getTxnId();
|
||||
|
||||
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);
|
||||
|
||||
Map<String, String> responseMap = httpService.getRequest(url,headers);
|
||||
String responseData = responseMap.get("data");
|
||||
LOGGER.info("data is :{}", responseData);
|
||||
|
||||
String url = paymentUrl + BBPSConstant.CHECK_TRANSACTION_URL + transactionStatusRequest.getTxnId();
|
||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
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);
|
||||
|
||||
try {
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (!dataMap.containsKey("genericResponse")) {
|
||||
throw new CustomException(String.valueOf(dataMap.get("message")), // message
|
||||
String.valueOf(dataMap.get("status")), // status
|
||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), // statusCode (int)
|
||||
String.valueOf(dataMap.get("remarks")) );
|
||||
}
|
||||
|
||||
TransactionStatusResponse responseWrapper = objectMapper.convertValue(dataMap, TransactionStatusResponse.class);
|
||||
|
||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||
|
||||
ResponseModel responseModel=new ResponseModel( generalResp.getMessage(),
|
||||
generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()),
|
||||
responseWrapper);
|
||||
|
||||
return responseModel;
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
// ✅ Polling configuration
|
||||
long startTime = System.currentTimeMillis();
|
||||
long maxWaitTimeMs = 40000; // 40 seconds timeout
|
||||
long intervalMs = 5000; // retry every 5 seconds
|
||||
|
||||
while (true) {
|
||||
Map<String, String> responseMap = httpService.getRequest(url, headers);
|
||||
String responseData = responseMap.get("data");
|
||||
LOGGER.info("Transaction status response data: {}", responseData);
|
||||
|
||||
try {
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
// If genericResponse key missing, throw exception
|
||||
if (!dataMap.containsKey("generalResp")) {
|
||||
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();
|
||||
|
||||
String status = generalResp.getStatus();
|
||||
LOGGER.info("Current transaction status: {}", status);
|
||||
|
||||
// ✅ If IN_PROGRESS → wait & retry
|
||||
if ("INPROGRESS".equalsIgnoreCase(status)) {
|
||||
|
||||
if (System.currentTimeMillis() - startTime > maxWaitTimeMs) {
|
||||
// Timeout after 40 sec
|
||||
throw new CustomException(
|
||||
"Timeout waiting for transaction completion",
|
||||
"FAILED",
|
||||
408,
|
||||
"Transaction still in progress after 40 seconds"
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(intervalMs);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new CustomException("Thread interrupted during retry");
|
||||
}
|
||||
|
||||
LOGGER.info("Transaction still IN_PROGRESS... retrying after {} seconds", (intervalMs / 1000));
|
||||
continue; // retry
|
||||
}
|
||||
|
||||
// ✅ If status is SUCCESS / FAILED / etc. → return response
|
||||
ResponseModel responseModel = new ResponseModel(
|
||||
generalResp.getMessage(),
|
||||
generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()),
|
||||
responseWrapper
|
||||
);
|
||||
|
||||
return responseModel;
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -27,12 +27,6 @@ public class BBPSConstant {
|
||||
public static final String BILLER_URL = "/billers";
|
||||
public static final String MASTER_CATEGORY_URL = "/categories-master?tenantId=";
|
||||
|
||||
public static final String BILLER_DATA_FETCH_URL = "/billersById?billerId=";
|
||||
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 PAYMENT_URL = "/agent/bills/payment";
|
||||
public static final String CHECK_TRANSACTION_URL = "/transactions/payment/byTxnId?txnId=";
|
||||
public static final String CUSTOMER_PARAM_GROUP = "/customerParamGroup?billerId=";
|
||||
public static final String AMOUNT_OPTIONS = "/amountOptions?billerId=";
|
||||
public static final String PLAN_CATEGORIES = "/planCategories?billerId=";
|
||||
@@ -41,4 +35,12 @@ public class BBPSConstant {
|
||||
public static final String BILLER_VALIDATE_URL = "/couapp/bills/validate";
|
||||
public static final String BILL_ID_URL = "/couapp/bills/validate/byId?billId=";
|
||||
|
||||
public static final String BILLER_DATA_FETCH_URL = "/billersById?billerId=";
|
||||
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 PAYMENT_URL = "/agent/bills/payment";
|
||||
public static final String CHECK_TRANSACTION_URL = "/transactions/payment/byTxnId?txnId=";
|
||||
public static final String DISPOSTION_URL = "/disposition";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.billpaymentservice.bbps.util;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.*;
|
||||
|
||||
public class EntityRelationshipUtil {
|
||||
|
||||
private EntityRelationshipUtil() {
|
||||
// prevent instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* Links all parent-child relationships for BillerDetails and nested entities.
|
||||
* Ensures bidirectional JPA relationships are correctly set before saving.
|
||||
*/
|
||||
public static void linkBillerRelationships(BillerDetails entity) {
|
||||
|
||||
if (entity == null) return;
|
||||
|
||||
if (entity.getBillerPaymentModes() != null) {
|
||||
entity.getBillerPaymentModes().forEach(m -> m.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getBillerPaymentChannels() != null) {
|
||||
entity.getBillerPaymentChannels().forEach(c -> c.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getBillerCustomerParams() != null) {
|
||||
entity.getBillerCustomerParams().forEach(p -> p.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getBillerAdditionalInfos() != null) {
|
||||
entity.getBillerAdditionalInfos().forEach(a -> a.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getInterchangeFees() != null) {
|
||||
for (InterchangeFee fee : entity.getInterchangeFees()) {
|
||||
fee.setBiller(entity);
|
||||
|
||||
if (fee.getInterchangeFeeDetails() != null) {
|
||||
fee.getInterchangeFeeDetails().forEach(detail -> detail.setInterchangeFee(fee));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.getInterchangeFeeConves() != null) {
|
||||
entity.getInterchangeFeeConves().forEach(fc -> fc.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getCustomerParamGroups() != null)
|
||||
entity.getCustomerParamGroups().setBiller(entity);
|
||||
|
||||
if (entity.getBillerPlanResponseParams() != null)
|
||||
entity.getBillerPlanResponseParams().setBiller(entity);
|
||||
|
||||
if (entity.getBillerResponseParams() != null) {
|
||||
BillerResponseParams responseParams = entity.getBillerResponseParams();
|
||||
responseParams.setBiller(entity);
|
||||
|
||||
if (responseParams.getAmountOptions() != null) {
|
||||
responseParams.getAmountOptions()
|
||||
.forEach(option -> option.setBillerResponseParams(responseParams));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ server.port=8080
|
||||
# JPA & Hibernate
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||
spring.jpa.properties.hibernate.default_schema=public
|
||||
|
||||
|
||||
# DataSource
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/TestingDB
|
||||
|
||||
+4
-5
@@ -1,4 +1,4 @@
|
||||
package com.lincpay.bbps;
|
||||
package com.billpaymentservice.bbps;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -6,8 +6,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
@SpringBootTest
|
||||
class BbpsApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.billpaymentservice.bbps.controller;
|
||||
|
||||
import com.billpaymentservice.bbps.serviceImpl.HttpService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
public class TestHttpControllerTest {
|
||||
|
||||
@Autowired
|
||||
private HttpService httpService;
|
||||
|
||||
@Test
|
||||
void testGetRequest() {
|
||||
String url = "https://bbps-staging.digiledge.in/agent/cou-master/masters/billersById?billerId=ADAN00000HAR02"; // Dummy public GET API
|
||||
HashMap<String, String> response = httpService.getRequest(url);
|
||||
System.out.println("✅ GET Response: " + response);
|
||||
|
||||
System.out.println(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user