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
@@ -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));
}
}
}
}