make changes for db optimise
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "bbps_additional_info")
|
||||
public class AdditionalInfo {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id; // primary key for the table
|
||||
|
||||
@Column(name = "param_config_id", nullable = false)
|
||||
private String paramConfigId;
|
||||
|
||||
@Column(name = "param_name", nullable = false)
|
||||
private String paramName;
|
||||
|
||||
@Column(name = "data_type_dao")
|
||||
private String dataTypeDAO;
|
||||
|
||||
@Column(name = "data_type_model")
|
||||
private String dataTypeModel;
|
||||
|
||||
@Column(name = "optional", nullable = false)
|
||||
private boolean optional;
|
||||
|
||||
@Column(name = "visibility", nullable = false)
|
||||
private boolean visibility;
|
||||
|
||||
// 🔗 Many AdditionalInfos belong to one Biller
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "biller_id", nullable = false)
|
||||
private BillerDetails biller;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.ElementCollection;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "bbps_amount_option")
|
||||
@Getter
|
||||
@Setter
|
||||
public class AmountOption extends Auditable {
|
||||
|
||||
@Id
|
||||
@Column(name = "amount_option_id")
|
||||
@JsonProperty("amountOptionId") // ✅ JSON field map karo
|
||||
private String amountOptionId; // ✅ String type, manual ID
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(
|
||||
name = "amount_option_breakup_sets",
|
||||
joinColumns = @JoinColumn(name = "amount_option_id")
|
||||
)
|
||||
@Column(name = "amount_breakup_value")
|
||||
private List<String> amountBreakupSets;
|
||||
|
||||
// 🔗 Relationship with BillerResponseParams
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "biller_response_id", nullable = false)
|
||||
private BillerResponseParams billerResponseParams;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(name = "bbps_biller_additional_info_payment")
|
||||
@Entity
|
||||
public class BillerAdditionalInfoPayment extends Auditable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id; // primary key for the table
|
||||
|
||||
@Column(name = "param_config_id", nullable = false)
|
||||
private String paramConfigId;
|
||||
|
||||
@Column(name = "param_name", nullable = false)
|
||||
private String paramName;
|
||||
|
||||
@Column(name = "data_type_dao")
|
||||
private String dataTypeDAO;
|
||||
|
||||
@Column(name = "data_type_model")
|
||||
private String dataTypeModel;
|
||||
|
||||
@Column(name = "optional", nullable = false)
|
||||
private boolean optional;
|
||||
|
||||
@Column(name = "visibility", nullable = false)
|
||||
private boolean visibility;
|
||||
|
||||
// 🔗 Many AdditionalInfos belong to one Biller
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "biller_id", nullable = false)
|
||||
private BillerDetails biller;
|
||||
}
|
||||
@@ -21,20 +21,6 @@ import lombok.ToString;
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@EntityListeners(AuditListener.class)
|
||||
@ToString(exclude = {
|
||||
"billerPaymentModes",
|
||||
"billerPaymentChannels",
|
||||
"billerCustomerParams",
|
||||
"customerParamGroups",
|
||||
"billerResponseParams",
|
||||
"billerAdditionalInfos",
|
||||
"interchangeFeeConves",
|
||||
"interchangeFees",
|
||||
"billerPlanResponseParams",
|
||||
"billerAdditionalInfoPayments"
|
||||
})
|
||||
|
||||
@Table(name = "bbps_biller_details")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class BillerDetails extends Auditable {
|
||||
@@ -44,121 +30,8 @@ public class BillerDetails extends Auditable {
|
||||
@NotBlank(message = "Biller ID is mandatory")
|
||||
@Size(min = 14, max = 14, message = "Biller ID must be 14 characters long")
|
||||
private String billerId;
|
||||
@Column(name = "biller_details_json", columnDefinition = "TEXT")
|
||||
private String billerDetailsJson;
|
||||
|
||||
@Column(name = "biller_name")
|
||||
private String billerName;
|
||||
|
||||
@Column(name = "biller_alias_name")
|
||||
private String billerAliasName;
|
||||
|
||||
@Column(name = "biller_category_name")
|
||||
private String billerCategoryName;
|
||||
|
||||
@Column(name = "biller_mode")
|
||||
private String billerMode;
|
||||
|
||||
@Column(name = "biller_accepts_adhoc")
|
||||
private boolean billerAcceptsAdhoc;
|
||||
|
||||
@Column(name = "parent_biller")
|
||||
private boolean parentBiller;
|
||||
|
||||
@Column(name = "parent_biller_id")
|
||||
private String parentBillerId;
|
||||
|
||||
@Column(name = "biller_ownership")
|
||||
private String billerOwnerShp;
|
||||
|
||||
@Column(name = "biller_coverage")
|
||||
private String billerCoverage;
|
||||
|
||||
@Column(name = "fetch_requirement")
|
||||
private String fetchRequirement;
|
||||
|
||||
@Column(name = "payment_amount_exactness")
|
||||
private String paymentAmountExactness;
|
||||
|
||||
@Column(name = "support_bill_validation")
|
||||
private String supportBillValidation;
|
||||
|
||||
@Column(name = "biller_effctv_from")
|
||||
private String billerEffctvFrom;
|
||||
|
||||
@Column(name = "biller_effctv_to")
|
||||
private String billerEffctvTo;
|
||||
|
||||
@Column(name = "biller_temp_deactivation_start")
|
||||
private String billerTempDeactivationStart;
|
||||
|
||||
@Column(name = "biller_temp_deactivation_end")
|
||||
private String billerTempDeactivationEnd;
|
||||
|
||||
@Column(name = "biller_description", length = 500)
|
||||
private String billerDescription;
|
||||
|
||||
@Column(name = "biller_response_type")
|
||||
private String billerResponseType;
|
||||
|
||||
@Column(name = "plan_mdm_requirement")
|
||||
private String planMDMRequirement;
|
||||
|
||||
@Column(name = "status")
|
||||
private String status;
|
||||
|
||||
@Column(name = "support_deemed")
|
||||
private String supportDeemed;
|
||||
|
||||
@Column(name = "support_pending_status")
|
||||
private String supportPendingStatus;
|
||||
|
||||
@Column(name = "biller_time_out")
|
||||
private String billerTimeOut;
|
||||
|
||||
@Column(name = "route_url")
|
||||
private String routeUrl;
|
||||
|
||||
@Column(name = "upms_enabled")
|
||||
private String upmsEnabled;
|
||||
|
||||
@Column(name = "clickpay_enabled")
|
||||
private String clickpayEnabled;
|
||||
|
||||
@Column(name = "deemed_success_enabled")
|
||||
private String deemedSuccessEnabled;
|
||||
|
||||
@Column(name = "selection_type")
|
||||
private String selectionType;
|
||||
|
||||
// ✅ Relationships — Each maps to its sub-arrays or objects in API
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<PaymentMode> billerPaymentModes;
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<PaymentChannel> billerPaymentChannels;
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<CustomerParam> billerCustomerParams;
|
||||
|
||||
@OneToOne(mappedBy = "biller", cascade = CascadeType.ALL)
|
||||
private CustomerParamGroups customerParamGroups;
|
||||
|
||||
@OneToOne(mappedBy = "biller", cascade = CascadeType.ALL)
|
||||
private BillerResponseParams billerResponseParams;
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<AdditionalInfo> billerAdditionalInfos;
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval=true)
|
||||
private List<BillerAdditionalInfoPayment> billerAdditionalInfoPayments;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<InterchangeFeeConf> interchangeFeeConves;
|
||||
|
||||
@OneToMany(mappedBy = "biller", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<InterchangeFee> interchangeFees;
|
||||
|
||||
@OneToOne(mappedBy = "biller", cascade = CascadeType.ALL)
|
||||
private BillerPlanResponseParams billerPlanResponseParams;
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "bbps_biller_plan_response_params")
|
||||
|
||||
public class BillerPlanResponseParams extends Auditable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id; // Primary Key
|
||||
|
||||
@Column(name = "biller_plan_response_id", nullable = false, unique = true)
|
||||
private String billerPlanResponseId;
|
||||
// ✅ params list — since it's not a separate table, we can store as JSON or text
|
||||
@Column(name = "params", columnDefinition = "TEXT")
|
||||
private String paramsJson;
|
||||
|
||||
@Column(name = "amount_options", columnDefinition = "TEXT")
|
||||
private String amountOptionsJson;
|
||||
|
||||
// 🔗 Relationship with BillerDAO
|
||||
@OneToOne
|
||||
@JoinColumn(name = "biller_id", nullable = false)
|
||||
private BillerDetails biller;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.ElementCollection;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "bbps_biller_response_params")
|
||||
|
||||
public class BillerResponseParams extends Auditable {
|
||||
|
||||
@Id
|
||||
@Column(name = "biller_response_id", nullable = false, unique = true)
|
||||
@NotBlank(message = "Biller Response ID is required")
|
||||
private String billerResponseId;
|
||||
|
||||
// 🔗 One-to-One Relationship with BillerDAO
|
||||
@OneToOne
|
||||
@JoinColumn(name = "biller_id", nullable = false)
|
||||
private BillerDetails biller;
|
||||
|
||||
// ✅ Since params and amountOptions are lists of objects,
|
||||
// we can store them as JSON or in a separate table (simplified here using @ElementCollection)
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(
|
||||
name = "biller_response_params_data",
|
||||
joinColumns = @JoinColumn(name = "biller_response_id")
|
||||
)
|
||||
@Column(name = "param_value")
|
||||
private List<String> params;
|
||||
|
||||
@OneToMany(mappedBy = "billerResponseParams", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<AmountOption> amountOptions;
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.ElementCollection;
|
||||
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.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "bbps_customer_param")
|
||||
@ToString
|
||||
public class CustomerParam extends Auditable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "param_config_id")
|
||||
private Long id; // Primary key
|
||||
|
||||
@NotBlank(message = "Parameter name is required")
|
||||
@Column(name = "param_name", nullable = false)
|
||||
private String paramName;
|
||||
|
||||
@Column(name = "data_type_dao")
|
||||
private String dataTypeDAO;
|
||||
|
||||
@Column(name = "data_type_model")
|
||||
private String dataTypeModel;
|
||||
|
||||
@Column(name = "is_optional")
|
||||
private boolean optional;
|
||||
|
||||
@Min(0)
|
||||
@Column(name = "min_length")
|
||||
private int minLength;
|
||||
|
||||
@Min(0)
|
||||
@Column(name = "max_length")
|
||||
private int maxLength;
|
||||
|
||||
@Column(name = "regex", columnDefinition = "TEXT")
|
||||
private String regex;
|
||||
|
||||
@Column(name = "is_visible")
|
||||
private boolean visibility;
|
||||
|
||||
// Store list of values as JSON or comma-separated string
|
||||
@ElementCollection
|
||||
@CollectionTable(name = "customer_param_values", joinColumns = @JoinColumn(name = "param_id"))
|
||||
@Column(name = "value")
|
||||
private List<String> values;
|
||||
|
||||
// 🔗 Many customer parameters belong to one biller
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "biller_id")
|
||||
private BillerDetails biller;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
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.OneToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "bbps_customer_param_groups")
|
||||
|
||||
public class CustomerParamGroups extends Auditable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "group_container_id")
|
||||
private Long id;
|
||||
|
||||
// 🔗 One set of groups belongs to one biller
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "biller_id")
|
||||
private BillerDetails biller;
|
||||
|
||||
// 🔗 One CustomerParamGroups contains multiple Group objects
|
||||
@OneToMany(mappedBy = "customerParamGroups", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<Group> groups;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.persistence.ForeignKey;
|
||||
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.ConstraintMode;
|
||||
import jakarta.persistence.ElementCollection;
|
||||
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.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "bbps_biller_groups")
|
||||
|
||||
public class Group extends Auditable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "group_id")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "group_name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "input")
|
||||
private String input;
|
||||
|
||||
@CollectionTable(
|
||||
name = "group_params",
|
||||
joinColumns = @JoinColumn(name = "group_id"),
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)
|
||||
)
|
||||
private List<String> params;
|
||||
|
||||
// 🔗 Parent group relationship (for nested groups)
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "parent_group_id")
|
||||
private Group parentGroup;
|
||||
|
||||
// 🔁 Child groups (self-reference)
|
||||
@OneToMany(mappedBy = "parentGroup", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<Group> groups;
|
||||
|
||||
// 🔗 Back reference to CustomerParamGroups
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "group_container_id")
|
||||
private CustomerParamGroups customerParamGroups;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "bbps_interchange_fee")
|
||||
|
||||
public class InterchangeFee extends Auditable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id; // Primary key
|
||||
|
||||
@Column(name = "interchange_fee_id", nullable = false, unique = true)
|
||||
private String interchangeFeeId;
|
||||
|
||||
@Column(name = "fee_code", nullable = false)
|
||||
private String feeCode;
|
||||
|
||||
@Column(name = "fee_description")
|
||||
private String feeDesc;
|
||||
|
||||
@Column(name = "fee_direction")
|
||||
private String feeDirection;
|
||||
|
||||
// ✅ Relationship with InterchangeFeeDetail (One-to-Many)
|
||||
@OneToMany(mappedBy = "interchangeFee", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<InterchangeFeeDetail> interchangeFeeDetails;
|
||||
|
||||
// 🔗 Many InterchangeFee entries belong to one Biller
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "biller_id", nullable = false)
|
||||
private BillerDetails biller;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.ElementCollection;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "bbps_interchange_fee_conf")
|
||||
|
||||
public class InterchangeFeeConf extends Auditable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id; // Primary Key for DB table
|
||||
|
||||
@Column(name = "interchange_fee_conf_id", nullable = false, unique = true)
|
||||
private String interChangeFeeConfId;
|
||||
|
||||
@Column(name = "mti")
|
||||
private String mti;
|
||||
|
||||
@Column(name = "payment_mode")
|
||||
private String paymentMode;
|
||||
|
||||
@Column(name = "payment_channel")
|
||||
private String paymentChannel;
|
||||
|
||||
@Column(name = "response_code")
|
||||
private String responseCode;
|
||||
|
||||
// ⚙️ Since 'fees' is a list of simple strings, we use ElementCollection
|
||||
@ElementCollection
|
||||
@CollectionTable(
|
||||
name = "interchange_fee_conf_fees",
|
||||
joinColumns = @JoinColumn(name = "interchange_fee_conf_id_fk")
|
||||
)
|
||||
@Column(name = "fee_value")
|
||||
private List<String> fees;
|
||||
|
||||
@Column(name = "default_fee")
|
||||
private boolean defaultFee;
|
||||
|
||||
@Column(name = "effective_from")
|
||||
private String effctvFrom;
|
||||
|
||||
@Column(name = "effective_to")
|
||||
private String effctvTo;
|
||||
|
||||
// 🔗 Many InterchangeFeeConf records belong to one Biller
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "biller_id", nullable = false)
|
||||
private BillerDetails biller;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "bbps_interchange_fee_detail")
|
||||
@Getter
|
||||
@Setter
|
||||
public class InterchangeFeeDetail extends Auditable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "interchange_fee_det_id", unique = true, nullable = false)
|
||||
private String interchangeFeeDetId;
|
||||
|
||||
@Column(name = "tran_amt_range_max")
|
||||
private long tranAmtRangeMax;
|
||||
|
||||
@Column(name = "tran_amt_range_min")
|
||||
private long tranAmtRangeMin;
|
||||
|
||||
@Column(name = "percent_fee")
|
||||
private double percentFee;
|
||||
|
||||
@Column(name = "flat_fee")
|
||||
private double flatFee;
|
||||
|
||||
@Column(name = "effctv_from")
|
||||
private String effctvFrom;
|
||||
|
||||
// 🔗 Many InterchangeFeeDetail belong to one InterchangeFee
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "interchange_fee_id", nullable = false)
|
||||
private InterchangeFee interchangeFee;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ToString
|
||||
@Table(name = "bbps_payment_channel")
|
||||
public class PaymentChannel extends Auditable {
|
||||
|
||||
@Id
|
||||
@Column(name = "payment_channel_limit_id")
|
||||
private String paymentChannelLimitId; // Primary key (manual, not auto-generated)
|
||||
|
||||
@Column(name = "payment_channel", nullable = false)
|
||||
private String paymentChannel;
|
||||
|
||||
@Min(value = 0, message = "Max limit cannot be negative")
|
||||
@Column(name = "max_limit")
|
||||
private long maxLimit;
|
||||
|
||||
@Min(value = 0, message = "Min limit cannot be negative")
|
||||
@Column(name = "min_limit")
|
||||
private long minLimit;
|
||||
|
||||
@Column(name = "support_pending_status")
|
||||
private String supportPendingStatus;
|
||||
|
||||
// 🔗 Many PaymentChannels belong to one Biller
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "biller_id")
|
||||
private BillerDetails biller;
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.billpaymentservice.bbps.entites;
|
||||
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
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 = "bbps_biller_payment_modes")
|
||||
@ToString
|
||||
public class PaymentMode extends Auditable {
|
||||
|
||||
|
||||
@Id //
|
||||
@Column(name = "payment_model_limit_id", unique = true, length = 50)
|
||||
private String paymentModelLimitId;
|
||||
|
||||
@Column(name = "payment_mode", nullable = false, length = 50)
|
||||
private String paymentMode;
|
||||
|
||||
@Column(name = "max_limit")
|
||||
@PositiveOrZero(message = "Max limit must be zero or positive")
|
||||
private long maxLimit;
|
||||
|
||||
@Column(name = "min_limit")
|
||||
@PositiveOrZero(message = "Min limit must be zero or positive")
|
||||
private long minLimit;
|
||||
|
||||
@Column(name = "support_pending_status", length = 10)
|
||||
private String supportPendingStatus;
|
||||
|
||||
// 🔗 Many-to-One relationship with BillerDAO
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "biller_id", nullable = false)
|
||||
private BillerDetails biller;
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import jakarta.persistence.OneToOne;
|
||||
@@ -32,6 +31,7 @@ public class PaymentStartRecord extends Auditable {
|
||||
|
||||
@Column(name = "request_id", unique = true, nullable = false)
|
||||
private String requestId;
|
||||
|
||||
@Column(name = "mid", nullable = false)
|
||||
private String mid;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class PaymentStartRecord extends Auditable {
|
||||
@Column(name = "callback_received_on")
|
||||
private String callbackReceivedOn;
|
||||
|
||||
@OneToOne(mappedBy = "paymentStartRecord", fetch = FetchType.LAZY)
|
||||
@OneToOne(mappedBy = "paymentStartRecord")
|
||||
@JsonIgnore
|
||||
private TransactionMaster transactionMaster;
|
||||
}
|
||||
@@ -154,15 +154,12 @@ public class TransactionMaster extends Auditable {
|
||||
@Column(name = "payment_information", columnDefinition = "TEXT")
|
||||
private String paymentInformation;
|
||||
|
||||
// ✅ Relation with DeviceBlockTagEntity
|
||||
@OneToMany(mappedBy = "transactionMaster", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<DeviceBlockTag> deviceBlockTags;
|
||||
|
||||
// ✅ Relation with CustomerParamEntity
|
||||
@OneToMany(mappedBy = "transactionMaster", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<CustomerParamTransaction> customerParams;
|
||||
|
||||
// ✅ Relation with PaymentStartRecord (one-to-one)
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "payment_ref_id", referencedColumnName = "payment_ref_id", insertable = false, updatable = false)
|
||||
@JsonIgnore
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.billpaymentservice.bbps.config.JwtUtil;
|
||||
import com.billpaymentservice.bbps.dto.BillerDTO;
|
||||
import com.billpaymentservice.bbps.dto.CustomParamDTO;
|
||||
import com.billpaymentservice.bbps.dto.CustomerParamGroupsDTO;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
@@ -136,12 +137,15 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
HttpHeaders headers = helper.buildHeaders(headersData);
|
||||
Map<String, String> responseMap = httpService.getRequest(fullUrl, headers);
|
||||
String responseData = responseMap.get(BBPSConstant.RESPONSE_DATA_KEY);
|
||||
|
||||
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (!dataMap.containsKey(BBPSConstant.RESPONSE_GENERAL_RESP)) {
|
||||
|
||||
|
||||
helper.updateInboundLogFailure(inboundLog, responseData,
|
||||
String.valueOf(dataMap.get(BBPSConstant.RESPONSE_STATUS_KEY)));
|
||||
throw new CustomException(String.valueOf(dataMap.get(BBPSConstant.RESPONSE_MESSAGE_KEY)), // message
|
||||
@@ -177,20 +181,14 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
String requestId = billerDetailRequest.getReqId();
|
||||
String billerId = billerDetailRequest.getBillerId();
|
||||
String mid = billerDetailRequest.getMid();
|
||||
|
||||
LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid, billerId);
|
||||
|
||||
// 2. Transaction Id
|
||||
String txnID = helper.generateTxnId(15);
|
||||
// 3. Prepare URL
|
||||
String fullUrl = masterRegisterUrl + BBPSConstant.BILLER_DATA_FETCH_URL + billerId;
|
||||
// 4. Prepare Logs
|
||||
String requestJson = helper.convertObjectToJson(billerDetailRequest);
|
||||
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, billerDetailRequest.getMid(),
|
||||
BBPSConstant.HTTP_POST, requestJson);
|
||||
helper.validateMerchant(mid);
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl,
|
||||
BBPSConstant.HTTP_GET, null);
|
||||
LOGGER.info("Calling external API: {}", fullUrl);
|
||||
@@ -198,12 +196,29 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
String responseData = responseMap.get(BBPSConstant.RESPONSE_DATA_KEY);
|
||||
LOGGER.info("fetched data from api is :{}", responseData);
|
||||
helper.updateOutboundLogResponse(outboundLog, responseData);
|
||||
|
||||
try {
|
||||
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (!dataMap.containsKey(BBPSConstant.RESPONSE_GENERAL_RESP)) {
|
||||
|
||||
Optional<BillerDetails> optionalBiller =
|
||||
billerDataRespository.findByBillerId(billerId);
|
||||
|
||||
if (optionalBiller.isPresent()) {
|
||||
Object existingBiller = optionalBiller.get();
|
||||
|
||||
LOGGER.info("sending biller details from database for the billerid:{}", billerId);
|
||||
|
||||
return new ResponseModel(
|
||||
BBPSConstant.DATA_RETRIVE_DATABASE,
|
||||
BBPSConstant.SUCCESS_RESPONSE,
|
||||
BBPSConstant.HTTP_OK_INT,
|
||||
existingBiller
|
||||
);
|
||||
}
|
||||
|
||||
helper.updateInboundLogFailure(inboundLog, responseData,
|
||||
String.valueOf(dataMap.get(BBPSConstant.RESPONSE_STATUS_KEY)));
|
||||
throw new CustomException(String.valueOf(dataMap.get(BBPSConstant.RESPONSE_MESSAGE_KEY)),
|
||||
@@ -214,18 +229,18 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
// Mapping to Model
|
||||
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);// linking nesting entity foreign key
|
||||
mapperHelper.saveOrUpdateBillerData(entity);
|
||||
|
||||
BillerDTO billerDto = responseWrapper.getBillerDAO();
|
||||
BillerDetails billerDetails=new BillerDetails();
|
||||
billerDetails.setBillerId(billerDetailRequest.getBillerId());
|
||||
billerDetails.setBillerDetailsJson(billerDto.toString());
|
||||
|
||||
ResponseModel responseModel = new ResponseModel(generalResp.getMessage(), generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()), responseWrapper);
|
||||
helper.updateInboundLogSuccess(inboundLog, responseData, generalResp.getStatus());
|
||||
LOGGER.info("[{}] END | reqId={} | status={}", apiName, requestId, generalResp.getStatus());
|
||||
return responseModel;
|
||||
} catch (JsonProcessingException e) {
|
||||
|
||||
LOGGER.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
// Unified constant for invalid JSON
|
||||
|
||||
@@ -224,6 +224,7 @@ public class BBPSConstant extends BBPS_RESPONSE_COD_CONSTANT {
|
||||
public static final String OK_STR = "200";
|
||||
public static final String RESPONSE_TYPE_INTENT = "INTENT";
|
||||
public static final String RESPONSE_TYPE_WEB = "WEB";
|
||||
public static final String DATA_RETRIVE_DATABASE = "Data retrieved successfully";
|
||||
|
||||
|
||||
// Newly added constant for invalid JSON status code
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.billpaymentservice.bbps.util;
|
||||
import com.billpaymentservice.bbps.entites.BillerDetails;
|
||||
import com.billpaymentservice.bbps.entites.BillerResponseParams;
|
||||
import com.billpaymentservice.bbps.entites.InterchangeFee;
|
||||
import com.billpaymentservice.bbps.entites.TransactionMaster;
|
||||
|
||||
public class EntityRelationshipUtil {
|
||||
@@ -10,66 +8,8 @@ public class 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.getBillerAdditionalInfoPayments() != null) {
|
||||
entity.getBillerAdditionalInfoPayments().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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void linkTransactionMasterRelationships(TransactionMaster entity) {
|
||||
|
||||
if (entity == null) return;
|
||||
|
||||
@@ -20,8 +20,7 @@ swagger.server.description=Local Development Server
|
||||
# DataSource
|
||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/bbps_new_updated
|
||||
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/bbps_enhanced
|
||||
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/dbotimizedbbps
|
||||
spring.datasource.username=postgres
|
||||
#spring.datasource.password=UAT@DB_2025
|
||||
|
||||
|
||||
Reference in New Issue
Block a user