merged with himanshu code

This commit is contained in:
Mohd-Arham
2025-11-03 12:24:24 +05:30
34 changed files with 604 additions and 317 deletions
+74 -83
View File
@@ -2,55 +2,38 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.5</version> <version>3.2.7</version> <!-- ✅ LTS and stable -->
<relativePath /> <!-- lookup parent from repository --> <relativePath />
</parent> </parent>
<groupId>com.billpaymentservice.bbps</groupId> <groupId>com.billpaymentservice.bbps</groupId>
<artifactId>bbps</artifactId> <artifactId>bbps</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>bbps</name> <name>bbps</name>
<description>This is the bbps switch project</description> <description>This is the bbps switch project</description>
<url />
<licenses>
<license />
</licenses>
<developers>
<developer />
</developers>
<scm>
<connection />
<developerConnection />
<tag />
<url />
</scm>
<properties> <properties>
<java.version>17</java.version> <java.version>17</java.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <!-- Core Spring Boot Starters -->
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot3</artifactId>
<version>2.2.0</version> <!-- Latest stable version -->
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId> <artifactId>spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions> <exclusions>
<!-- ❌ Exclude old HttpClient 4.x -->
<exclusion> <exclusion>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
@@ -58,59 +41,51 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.3</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-starter-data-jpa</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>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.nimbusds</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>nimbus-jose-jwt</artifactId> <artifactId>spring-boot-starter-aop</artifactId>
<version>9.37</version> <!-- Use latest stable version -->
</dependency> </dependency>
<!-- Tomcat (provided for WAR) -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </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> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.postgresql</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>postgresql</artifactId>
<scope>test</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- Resilience4j -->
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>io.github.resilience4j</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <artifactId>resilience4j-spring-boot3</artifactId>
<version>2.5.0</version> <version>2.2.0</version>
</dependency> </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> <dependency>
<groupId>org.apache.httpcomponents.client5</groupId> <groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId> <artifactId>httpclient5</artifactId>
@@ -121,32 +96,56 @@
<artifactId>httpcore5</artifactId> <artifactId>httpcore5</artifactId>
<version>5.2.5</version> <version>5.2.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents.core5</groupId> <groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5-h2</artifactId> <artifactId>httpcore5-h2</artifactId>
<version>5.2.5</version> <version>5.2.5</version>
</dependency> </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 <!-- Lombok -->
direct HttpClient) -->
<dependency> <dependency>
<groupId>org.apache.httpcomponents.client5</groupId> <groupId>org.projectlombok</groupId>
<artifactId>httpclient5-fluent</artifactId> <artifactId>lombok</artifactId>
<version>5.3.1</version> <version>1.18.30</version>
<scope>provided</scope>
</dependency>
<!-- DevTools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<optional>true</optional>
</dependency> </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> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies> </dependencies>
<build> <build>
@@ -159,7 +158,7 @@
<path> <path>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.18.42</version> <!-- ✅ Required --> <version>1.18.30</version>
</path> </path>
</annotationProcessorPaths> </annotationProcessorPaths>
</configuration> </configuration>
@@ -168,14 +167,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@@ -47,12 +47,19 @@ public class MasterDataController {
return ResponseEntity.ok(masterDataService.getContactMaster(contactMasterRequest)); 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 * Get CustomerParam by billerId.The parameter is different from the data we are
* getting in the billerDetail * getting in the billerDetail
**/ **/
@PostMapping(value = "/getCustomerParamDetails", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @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) { @Validated @RequestBody CustomParamRequest customerParamRequest) {
log.info("Received biller details request for billerId: {}", customerParamRequest.getBillerId()); log.info("Received biller details request for billerId: {}", customerParamRequest.getBillerId());
@@ -103,8 +110,7 @@ public class MasterDataController {
} }
/** /**
* POST Fetch Initiating Channel API Fetch Category Wise from BBPS * POST Fetch Initiating Channel API Fetch Category Wise from BBPS URL
* URL
**/ **/
@PostMapping(value = "/initiatingChannel", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @PostMapping(value = "/initiatingChannel", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseModel> initiatingChannel(@Validated @RequestBody BillerDetailRequest requestModel) { public ResponseEntity<ResponseModel> initiatingChannel(@Validated @RequestBody BillerDetailRequest requestModel) {
@@ -1,4 +1,5 @@
package com.billpaymentservice.bbps.dto; package com.billpaymentservice.bbps.dto;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Getter; import lombok.Getter;
@@ -10,13 +11,12 @@ public class AgentFundTransfer {
@NotBlank private String fundTxnReferenceId; @NotBlank private String fundTxnReferenceId;
@NotBlank private String fundTxnRemarks; @NotBlank private String fundTxnRemarks;
@NotBlank private String fundTxnDate; @NotBlank private String fundTxnDate;
@NotNull private Double fundTxnAmt; @NotNull private Double fundTxnAmt;
@NotBlank private String fundUTR; @NotBlank private String fundUTR;
private String fundRespRemarks; private String fundRespRemarks;
private String agentNpciId; private String agentNpciId;
private String txnRefId; private String txnRefId;
private String tenantId;
@NotBlank private String fundStatus; // FUND_TRANSFER_SUCCESS or FUND_TRANSFER_FAILED @NotBlank private String fundStatus; // FUND_TRANSFER_SUCCESS or FUND_TRANSFER_FAILED
} }
@@ -11,7 +11,7 @@ import lombok.Setter;
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class CustomParam { public class CustomParamDTO {
private String customParamName; private String customParamName;
private String dataType; private String dataType;
private boolean optional; 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.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
@Getter @Getter
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString
public class GeneralResp { public class GeneralResp {
private String statusCode; private String statusCode;
private String status; 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 com.billpaymentservice.bbps.dto.GeneralResp;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
@Getter @Getter
@Setter @Setter
@ToString
public class BillPaymentResponse { public class BillPaymentResponse {
private String txnId; private String txnId;
@@ -1,9 +1,8 @@
package com.billpaymentservice.bbps.dto.response; package com.billpaymentservice.bbps.dto.response;
import java.util.List; import java.util.List;
import com.billpaymentservice.bbps.dto.ContactMaster; 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.dto.GeneralResp;
import com.billpaymentservice.bbps.entites.CustomerParam; import com.billpaymentservice.bbps.entites.CustomerParam;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@@ -20,5 +19,5 @@ import lombok.Setter;
public class CustomParamResp { public class CustomParamResp {
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY) @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private GeneralResp generalResp; 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,7 +2,7 @@ package com.billpaymentservice.bbps.dto.response;
import com.billpaymentservice.bbps.dto.AgentFundTransfer; import com.billpaymentservice.bbps.dto.AgentFundTransfer;
import com.billpaymentservice.bbps.dto.GeneralResp; 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 com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter; import lombok.Getter;
@@ -13,7 +13,7 @@ import lombok.Setter;
public class TransactionStatusResponse { public class TransactionStatusResponse {
@JsonProperty("transactionDAO") @JsonProperty("transactionDAO")
private TransactionDAO transactionDAO; private TransactionDTO transactionDAO;
@JsonProperty("agentFundTransfer") @JsonProperty("agentFundTransfer")
private AgentFundTransfer agentFundTransfer; private AgentFundTransfer agentFundTransfer;
@@ -5,10 +5,12 @@ import jakarta.persistence.*;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
@Getter @Getter
@Setter @Setter
@Entity @Entity
@ToString
@Table(name = "additional_info") @Table(name = "additional_info")
public class AdditionalInfo { public class AdditionalInfo {
@@ -1,12 +1,10 @@
package com.billpaymentservice.bbps.entites; package com.billpaymentservice.bbps.entites;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.billpaymentservice.bbps.entites.BillerResponseParams;
@Entity @Entity
@Table(name = "amount_option") @Table(name = "amount_option")
@@ -15,9 +13,9 @@ import com.billpaymentservice.bbps.entites.BillerResponseParams;
public class AmountOption { public class AmountOption {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "amount_option_id") @Column(name = "amount_option_id")
private Long id; @JsonProperty("amountOptionId") // ✅ JSON field map karo
private String amountOptionId; // ✅ String type, manual ID
@ElementCollection @ElementCollection
@CollectionTable( @CollectionTable(
@@ -147,8 +147,10 @@ public class BillerDetails {
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true) @OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
private List<AdditionalInfo> billerAdditionalInfos; private List<AdditionalInfo> billerAdditionalInfos;
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true) /*
private List<AdditionalInfo> billerAdditionalInfoPayments; * @OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval =
* true) private List<AdditionalInfo> billerAdditionalInfoPayments;
*/
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true) @OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
private List<InterchangeFeeConf> interchangeFeeConves; private List<InterchangeFeeConf> interchangeFeeConves;
@@ -4,7 +4,7 @@ import java.util.List;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
import jakarta.persistence.*; import jakarta.persistence.*;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import lombok.Getter; import lombok.Getter;
@@ -14,6 +14,7 @@ import java.util.List;
@Getter @Getter
@Setter @Setter
@Entity @Entity
@ToString
@Table(name = "biller_plan_response_params") @Table(name = "biller_plan_response_params")
public class BillerPlanResponseParams { 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 jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
import java.util.List; import java.util.List;
@Getter @Getter
@Setter @Setter
@Entity @Entity
@ToString
@Table(name = "customer_param_groups") @Table(name = "customer_param_groups")
public class CustomerParamGroups { 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.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
import jakarta.persistence.*; import jakarta.persistence.*;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import lombok.Getter; import lombok.Getter;
@@ -15,6 +14,7 @@ import java.util.List;
@Getter @Getter
@Setter @Setter
@Entity @Entity
@ToString
@Table(name = "interchange_fee") @Table(name = "interchange_fee")
public class InterchangeFee { public class InterchangeFee {
@@ -4,18 +4,20 @@ import jakarta.persistence.*;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@Getter @Getter
@Setter @Setter
@Entity @Entity
@ToString
@Table(name = "payment_channel") @Table(name = "payment_channel")
public class PaymentChannel { public class PaymentChannel {
@Id @Id
@Column(name = "payment_channel_limit_id") @Column(name = "payment_channel_limit_id")
@JsonProperty("paymentChannelLimitId") // 👈 Map JSON field to this property private String paymentChannelLimitId; // Primary key (manual, not auto-generated)
private String id; // Primary key (manual, not auto-generated)
@NotBlank(message = "Payment channel is required") @NotBlank(message = "Payment channel is required")
@Column(name = "payment_channel", nullable = false) @Column(name = "payment_channel", nullable = false)
@@ -2,15 +2,27 @@ package com.billpaymentservice.bbps.entites;
import jakarta.persistence.*; import jakarta.persistence.Column;
import jakarta.validation.constraints.*; 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.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
@Getter @Getter
@Setter @Setter
@Entity @Entity
@Table(name = "biller_payment_modes") @Table(name = "biller_payment_modes")
@ToString
public class PaymentMode { public class PaymentMode {
@Id @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 fetchInitiatingChannel(BillerDetailRequest requestModel);
public ResponseModel getDispositionDetails();
} }
@@ -1,6 +1,8 @@
package com.billpaymentservice.bbps.serviceImpl; package com.billpaymentservice.bbps.serviceImpl;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies; 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.ChannelsListResponse;
import com.billpaymentservice.bbps.dto.response.CustomParamResp; import com.billpaymentservice.bbps.dto.response.CustomParamResp;
import com.billpaymentservice.bbps.dto.response.CustomerParamGroupsResponse; 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.dto.response.PlaneCategoriesResponse;
import com.billpaymentservice.bbps.entites.BharatConnectMaster; import com.billpaymentservice.bbps.entites.BharatConnectMaster;
import com.billpaymentservice.bbps.entites.BillerDetails; import com.billpaymentservice.bbps.entites.BillerDetails;
import com.billpaymentservice.bbps.entites.DispositionDetails;
import com.billpaymentservice.bbps.exception.CustomException; import com.billpaymentservice.bbps.exception.CustomException;
import com.billpaymentservice.bbps.repository.BharatConnectMasterRepository; import com.billpaymentservice.bbps.repository.BharatConnectMasterRepository;
import com.billpaymentservice.bbps.repository.BillerDataRepository; 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.service.MasterDataService;
import com.billpaymentservice.bbps.util.BBPSConstant; import com.billpaymentservice.bbps.util.BBPSConstant;
import com.billpaymentservice.bbps.util.EntityRelationshipUtil;
import com.billpaymentservice.bbps.util.Helper; import com.billpaymentservice.bbps.util.Helper;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
@@ -43,71 +50,27 @@ public class MasterDataServiceImpl implements MasterDataService {
@Value("${master.data.url}") @Value("${master.data.url}")
private String masterRegisterUrl; private String masterRegisterUrl;
private Helper helper;
private final BillerDataRepository billerDataRespository;
private final BharatConnectMasterRepository beneficiaryDetailsRepository; 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 static final Logger log = LoggerFactory.getLogger(MasterDataServiceImpl.class);
private final HttpService httpService; private final HttpService httpService;
private final ObjectMapper objectMapper = new ObjectMapper(); private final ObjectMapper objectMapper = new ObjectMapper();
// Inject HttpService public MasterDataServiceImpl(MerchantRepository merchantRegisterRepo, HttpService httpService,
public MasterDataServiceImpl(BharatConnectMasterRepository beneficiaryDetailsRepository, HttpService httpService, HttpClientApi httpClientApi, Helper helper, BillerDataRepository billerDataRespository,
Helper helper, BillerDataRepository billerDataRespository) { DispositionRepository dispositionRepository, BharatConnectMasterRepository beneficiaryDetailsRepository) {
this.beneficiaryDetailsRepository = beneficiaryDetailsRepository; this.merchantRegisterRepo = merchantRegisterRepo;
this.httpService = httpService; this.httpService = httpService;
this.httpClientApi = httpClientApi;
this.helper = helper; this.helper = helper;
this.billerDataRespository = billerDataRespository; this.billerDataRespository = billerDataRespository;
this.dispositionRepository = dispositionRepository;
} this.beneficiaryDetailsRepository = beneficiaryDetailsRepository;
@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");
}
} }
@@ -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 @Override
public ResponseModel getCustomerParamByBillerId(CustomParamRequest customerParamRequest) { public ResponseModel getCustomerParamByBillerId(CustomParamRequest customerParamRequest) {
@@ -245,7 +247,52 @@ public class MasterDataServiceImpl implements MasterDataService {
Integer.parseInt(generalResp.getStatusCode()), responseWrapper); Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
return responseModel; 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) { } catch (JsonProcessingException e) {
log.error("Error parsing responseData JSON: {}", e.getMessage()); log.error("Error parsing responseData JSON: {}", e.getMessage());
throw new CustomException("Invalid JSON received from API"); throw new CustomException("Invalid JSON received from API");
@@ -99,7 +99,9 @@ public class PaymentServiceImpl implements PaymentService {
// ✅ Convert to your custom DTO // ✅ Convert to your custom DTO
BillPaymentResponse billPaymentResponse = objectMapper.convertValue(dataMap, BillPaymentResponse.class); BillPaymentResponse billPaymentResponse = objectMapper.convertValue(dataMap, BillPaymentResponse.class);
System.out.print(billPaymentResponse);
GeneralResp generalResponse = billPaymentResponse.getGenericResponse(); GeneralResp generalResponse = billPaymentResponse.getGenericResponse();
// //
// start a new thread here // start a new thread here
/* /*
@@ -108,15 +110,16 @@ public class PaymentServiceImpl implements PaymentService {
* return fetchBillById(pollReq); }, 3, // interval in seconds 15 // total time * return fetchBillById(pollReq); }, 3, // interval in seconds 15 // total time
* in seconds ); * in seconds );
*/ */
ModelMapper mapper = new ModelMapper(); ModelMapper mapper = new ModelMapper();
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
BillPayment entity = mapper.map(billPaymentResponse, BillPayment.class); BillPayment entity = mapper.map(billPaymentResponse, BillPayment.class);
paymentRepository.save(entity); paymentRepository.save(entity);
TransactionStatusRequest transactionStatusRequest=new TransactionStatusRequest();
// ✅ Build final ResponseModel //call the checkTransactionStatus
responseModel = new ResponseModel(generalResponse.getMessage(), generalResponse.getStatus(), transactionStatusRequest.setTxnId(billPaymentResponse.getTxnId());
Integer.parseInt(generalResponse.getStatusCode()), billPaymentResponse); System.out.println(transactionStatusRequest);
responseModel= checkTrasactionStatus(transactionStatusRequest);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("❌ Exception in initiateBillFetch(): {}", e.getMessage(), e); LOGGER.error("❌ Exception in initiateBillFetch(): {}", e.getMessage(), e);
responseModel.setStatus("500"); responseModel.setStatus("500");
@@ -130,49 +133,88 @@ public class PaymentServiceImpl implements PaymentService {
@Override @Override
public ResponseModel checkTrasactionStatus(TransactionStatusRequest transactionStatusRequest) { public ResponseModel checkTrasactionStatus(TransactionStatusRequest transactionStatusRequest) {
String url=paymentUrl + BBPSConstant.CHECK_TRANSACTION_URL+transactionStatusRequest.getTxnId(); String url = paymentUrl + BBPSConstant.CHECK_TRANSACTION_URL + transactionStatusRequest.getTxnId();
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
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);
HttpHeaders headers = new HttpHeaders(); ObjectMapper objectMapper = new ObjectMapper();
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); // ✅ Polling configuration
String responseData = responseMap.get("data"); long startTime = System.currentTimeMillis();
LOGGER.info("data is :{}", responseData); 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"))
);
}
ObjectMapper objectMapper = new ObjectMapper(); // Convert into proper DTO
TransactionStatusResponse responseWrapper = objectMapper.convertValue(dataMap, TransactionStatusResponse.class);
try { GeneralResp generalResp = responseWrapper.getGeneralResp();
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); String status = generalResp.getStatus();
LOGGER.info("Current transaction status: {}", status);
GeneralResp generalResp = responseWrapper.getGeneralResp(); // ✅ If IN_PROGRESS → wait & retry
if ("INPROGRESS".equalsIgnoreCase(status)) {
ResponseModel responseModel=new ResponseModel( generalResp.getMessage(), if (System.currentTimeMillis() - startTime > maxWaitTimeMs) {
generalResp.getStatus(), // Timeout after 40 sec
Integer.parseInt(generalResp.getStatusCode()), throw new CustomException(
responseWrapper); "Timeout waiting for transaction completion",
"FAILED",
408,
"Transaction still in progress after 40 seconds"
);
}
return responseModel; try {
Thread.sleep(intervalMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new CustomException("Thread interrupted during retry");
}
} catch (JsonProcessingException e) { LOGGER.info("Transaction still IN_PROGRESS... retrying after {} seconds", (intervalMs / 1000));
LOGGER.error("Error parsing responseData JSON: {}", e.getMessage()); continue; // retry
throw new CustomException("Invalid JSON received from API"); }
}
// ✅ 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 BILLER_URL = "/billers";
public static final String MASTER_CATEGORY_URL = "/categories-master?tenantId="; 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 CUSTOMER_PARAM_GROUP = "/customerParamGroup?billerId=";
public static final String AMOUNT_OPTIONS = "/amountOptions?billerId="; public static final String AMOUNT_OPTIONS = "/amountOptions?billerId=";
public static final String PLAN_CATEGORIES = "/planCategories?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 BILLER_VALIDATE_URL = "/couapp/bills/validate";
public static final String BILL_ID_URL = "/couapp/bills/validate/byId?billId="; 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 # JPA & Hibernate
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.default_schema=public
# DataSource # DataSource
spring.datasource.url=jdbc:postgresql://localhost:5432/TestingDB spring.datasource.url=jdbc:postgresql://localhost:5432/TestingDB
@@ -1,4 +1,4 @@
package com.lincpay.bbps; package com.billpaymentservice.bbps;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@@ -6,8 +6,7 @@ import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest @SpringBootTest
class BbpsApplicationTests { class BbpsApplicationTests {
@Test @Test
void contextLoads() { 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);
}
}