19-03-2024 20:15:47.436 INFO  [http-nio-8080-exec-7] c.m.r.s.i.ReturnsChannelServiceImpl.fetchReturnChannels [ReturnsChannelServiceImpl.java : 42] : Request Payload : {"OrderHeaderKey":"202401160745001399395156","OrderNumber":"301-0000260-5153389","CountryCode":"GB","OrderItemList":[{"UpcVariant":"08518170","Sku":"22550567001","ShipNode":"M05073","ProductType":"GM","salesOrderIndicator":"","levelOfService":"MS_STD_HOME_DEL","ItemDetails":{"DepartmentNumber":"T08","StrokeNumber":"T081106","ServiceItem":"Dropship","UnitPrice":null,"LineTotal":"44.99","PostalCode":"UB3 4FA"},"LineItemChannels":[]}]} 
19-03-2024 20:15:47.437 DEBUG [http-nio-8080-exec-7] c.m.r.s.i.ReturnsChannelServiceImpl.fetchReturnChannels [ReturnsChannelServiceImpl.java : 45] : Processing return channel request for country GB
19-03-2024 20:15:47.438 INFO  [http-nio-8080-exec-7] c.m.r.s.i.ReturnsChannelServiceImpl.fetchReturnChannels [ReturnsChannelServiceImpl.java : 69] : About to start iteration of payload...
19-03-2024 20:15:47.439 INFO  [http-nio-8080-exec-7] c.m.r.s.i.ReturnsChannelServiceImpl.fetchReturnChannels [ReturnsChannelServiceImpl.java : 99] : Fetching return channels for sku : 22550567001
19-03-2024 20:15:47.439 INFO  [http-nio-8080-exec-7] c.m.r.r.i.StrokeChannelRepositoryImpl.fetchStrokeData [StrokeChannelRepositoryImpl.java : 47] : About to query return channels -> strokeId :T081106 , deptId :T08, node :M05073
19-03-2024 20:15:47.440 DEBUG [http-nio-8080-exec-7] o.s.d.m.c.MongoTemplate.doFind [MongoTemplate.java : 2554] : find using query: { "$or" : [{ "strokeId" : { "$in" : ["T081106"]}}, { "deptId" : { "$in" : ["T08"]}}, { "nodes" : { "$in" : ["M05073"]}}]} fields: Document{{}} for class: class com.mns.returns.dto.dataobjects.StrokeChannelData in collection: stroke-return-channels
19-03-2024 20:16:10.765 INFO  [http-nio-8080-exec-7] o.m.d.connection.info [SLF4JLogger.java : 71] : Opened connection [connectionId{localValue:3, serverValue:80934}] to mns-return-mongo-dev-lb.kmh5m.mongodb.net:27017
19-03-2024 20:16:10.979 DEBUG [http-nio-8080-exec-7] c.m.r.r.i.ChannelAddressRepositoryImpl.fetchChannelAddress [ChannelAddressRepositoryImpl.java : 35] : Fetching address for channel : CH24
19-03-2024 20:16:10.981 DEBUG [http-nio-8080-exec-7] o.s.d.m.c.MongoTemplate.doFind [MongoTemplate.java : 2554] : find using query: { "channelID" : { "$in" : ["CH24"]}} fields: Document{{}} for class: class com.mns.returns.dto.address.ChannelAddress in collection: channel-address
19-03-2024 20:16:11.189 WARN  [http-nio-8080-exec-7] c.m.r.t.ReturnChannelTransformer.lambda$returnChannelsFormatter$0 [ReturnChannelTransformer.java : 61] : No mapping found for key parcelForce / unable to get object for key parcelForce
19-03-2024 20:16:11.190 WARN  [http-nio-8080-exec-7] c.m.r.t.ReturnChannelTransformer.lambda$returnChannelsFormatter$0 [ReturnChannelTransformer.java : 61] : No mapping found for key parcelForce / unable to get object for key parcelForce
19-03-2024 20:16:11.190 INFO  [http-nio-8080-exec-7] c.m.r.t.ReturnChannelTransformer.resolveCommonAddress [ReturnChannelTransformer.java : 183] : Resolve common address
19-03-2024 20:16:11.191 INFO  [http-nio-8080-exec-7] c.m.r.t.ReturnChannelTransformer.resolveOrderLevelReturnChannel [ReturnChannelTransformer.java : 108] : Resolve order level return channels.
19-03-2024 20:16:11.191 INFO  [http-nio-8080-exec-7] c.m.r.t.ReturnChannelTransformer.removeEVRIForBTPostCodes [ReturnChannelTransformer.java : 206] : Checking BT postcode scenario...
19-03-2024 20:16:11.191 INFO  [http-nio-8080-exec-7] c.m.r.t.ReturnChannelTransformer.removePostalForMinReturnTotal [ReturnChannelTransformer.java : 166] : Checking minimum return total ...
19-03-2024 20:16:11.192 INFO  [http-nio-8080-exec-7] c.m.r.c.ReturnChannelsController.fetchReturnChannelsv2 [ReturnChannelsController.java : 62] : Applying filer rule ITEM_CLICK_AND_COLLECT for order number 301-0000260-5153389
19-03-2024 20:16:11.192 INFO  [http-nio-8080-exec-7] c.m.r.s.i.FilterChannelResponseImpl.isPureSalesOrderWithClickCollect [FilterChannelResponseImpl.java : 52] : ITEM_CLICK_AND_COLLECT, order number 301-0000260-5153389 is not pure sales item

Where ,what and how to achieve code update below thing based on the above code flow ?

Modification in ReturnChannelsController -> /fetchReturnChannels/v2
Adding return shipnode in the channel api at header level
logic in ticket
see in the ticket comment section...
The design has been finalised. There are two activities from the Returns team-

Api team to send new field "returnShipNode" in channel API based on logic- check if child client id is 0 if present otherwise we need to see postcode at header level. We must send this new attribute when Ollerton is selected as the return address. Values for this field will be 8222, but it needs to be configurable.
The front end will use the attribute if the value is there and stamp in shipnode attribute in the confirm return API request.

 Operations Team is having difficulty tracking the return items for dropship orders
 the OMS Team has developed an approach
 
Modification in ReturnChannelsController -> /fetchReturnChannels/v2
 
Based on the information provided, here are the steps you can take to resolve the issue and summarize the necessary modifications:

Modify the Returns team's API: 
a. Introduce a new field named "returnShipNode" in the channel API. 
b. Implement logic to determine the value of "returnShipNode" based on the following criteria:

If the child client ID is 0, set the value to "8222" or a configurable value.
If the child client ID is not 0, use the postcode at the header level to determine the value. 

c. Ensure this new attribute is included in the API only when Ollerton is selected as the return address.

Adjust Frontend implementation: 

a. Modify the frontend to utilize the "returnShipNode" attribute if it is present. 
b. Stamp the "shipnode" attribute in the confirm return API request with the value received from the "returnShipNode" field.

Implement Operations Team's tracking solution: 

a. Update the ReturnChannelsController with modifications in the /fetchReturnChannels/v2 endpoint or any other relevant endpoints to facilitate better tracking of return items for dropship orders.

Summary:

Modify the Returns team's API to include the "returnShipNode" attribute with necessary logic and only when Ollerton is selected as the return address.
Update frontend implementation to utilize the new attribute and stamp it in the confirm return API request.
Implement improvements in the ReturnChannelsController to improve tracking of return items for dropship orders.

mongo=
{
orderRef:
"601-0000261-1333601"}


Modification in ReturnChannelsController -> /fetchReturnChannels/v2
Adding return shipnode in the channel api at header level
logic in ticket
see in the ticket comment section...
The design has been finalised. There are two activities from the Returns team-

Api team to send new field "returnShipNode" in channel API based on logic- check if child client id is 0 if present otherwise we need to see postcode at header level. We must send this new attribute when Ollerton is selected as the return address. Values for this field will be 8222, but it needs to be configurable.
The front end will use the attribute if the value is there and stamp in shipnode attribute in the confirm return API request.

 Operations Team is having difficulty tracking the return items for dropship orders
 the OMS Team has developed an approach
 
Modification in ReturnChannelsController -> /fetchReturnChannels/v2
 
Based on the information provided, here are the steps you can take to resolve the issue and summarize the necessary modifications:

Modify the Returns team's API: 
a. Introduce a new field named "returnShipNode" in the channel API. 
b. Implement logic to determine the value of "returnShipNode" based on the following criteria:

If the child client ID is 0, set the value to "8222" or a configurable value.
If the child client ID is not 0, use the postcode at the header level to determine the value. 

c. Ensure this new attribute is included in the API only when Ollerton is selected as the return address.

Adjust Frontend implementation: 

a. Modify the frontend to utilize the "returnShipNode" attribute if it is present. 
b. Stamp the "shipnode" attribute in the confirm return API request with the value received from the "returnShipNode" field.

Implement Operations Team's tracking solution: 

a. Update the ReturnChannelsController with modifications in the /fetchReturnChannels/v2 endpoint or any other relevant endpoints to facilitate better tracking of return items for dropship orders.

Summary:

Modify the Returns team's API to include the "returnShipNode" attribute with necessary logic and only when Ollerton is selected as the return address.
Update frontend implementation to utilize the new attribute and stamp it in the confirm return API request.
Implement improvements in the ReturnChannelsController to improve tracking of return items for dropship orders.


I am sumbmitting existing code below.....after i am finished sumbmitting existing code....tell me the updated code based on the requirement above



 @PostMapping("/fetchReturnChannels/v2")
    @Operation(
        summary = "Service to fetch return Channels for an order.",
        description = "For a given order fetch possible return channels and addresses.")
    public ReturnChannelResponse fetchReturnChannelsv2(@RequestBody ReturnChannelRequest returnChannelRequest){

        String countryCode = returnChannelRequest.getCountryCode();
        returnChannelRequest.setCountryCode(countryCode == null ? DEFAULT_COUNTRY : countryCode);
        ReturnChannelResponse fetchReturnChannels = returnsChannelService.fetchReturnChannels(returnChannelRequest, true);

        String blockSalesItems = channelServicesConfig.fetchReturnChannelConfigBean().get(RULE_SALES_ITEM_CLICK_AND_COLLECT_ENABLE);
        if (blockSalesItems.equalsIgnoreCase("Y")) {
            log.info("Applying filer rule ITEM_CLICK_AND_COLLECT for order number {}", returnChannelRequest.getOrderNumber());
            ReturnChannelResponse response = filterChannelResponse.filterChannelResponseImpl(fetchReturnChannels, returnChannelRequest);
            parcelForceFilter.overrideParcelForcePostCode(response);
            return response;
        }
        return fetchReturnChannels;
    }
	
	
	this is existing code.... @Description("Produces return channel response object for incoming line items") public ReturnChannelResponse fetchReturnChannels(ReturnChannelRequest returnChannelRequest, boolean isParcelForceHeaderEnabled) {

    log.info("Request Payload : {} ", JsonUtils.getString(returnChannelRequest));

    String countryCode = returnChannelRequest.getCountryCode();
    log.debug("Processing return channel request for country {}", countryCode);

    // Load configurations stored in mongoDB.
    Map<String, String> ilrConfigMap = channelServicesConfig.fetchReturnChannelConfig();

    //Dropship only
    boolean allDropShip = true;
    // All same supplier
    boolean allSameSupplier = true;
    // BT postcode scenario flag
    boolean btPostCode = false;
    // Min return value flag
    boolean minimumReturnValue = true;

    // For optimizing order level return channel roll-up
    int smallestChannelSize = Integer.MAX_VALUE;
    String smallestSku = "";

    // For line item total less than 15 pounds to enforce in store return
    float orderReturnTotal = 0.0F;
    List<OrderItem> orderItemList = returnChannelRequest.getOrderItemList();
    String[] suppliers = new String[orderItemList.size()];
    int arrayIndex = 0;
    Map<String, List<LineItemChannel>> strokeMap = new HashMap<>();
    log.info("About to start iteration of payload...");
    for (OrderItem orderItem : orderItemList) {
        ItemDetails itemDetails = orderItem.getItemDetails();
        String strokeNumber = itemDetails.getStrokeNumber();
        String deptNumber = itemDetails.getDepartmentNumber();
        String shipFromNode = orderItem.getShipNode();
        String sku = orderItem.getSku();
       if (!shipFromNode.equalsIgnoreCase("")) {
           suppliers[arrayIndex] = shipFromNode;
           arrayIndex++;
       }
        float lineTotal = Float.parseFloat(itemDetails.getLineTotal());
        orderReturnTotal = orderReturnTotal + lineTotal;
        //checking restricted postcodes
        if (null != itemDetails.getPostalCode()
                && StringUtils.startsWith(itemDetails.getPostalCode(),
                (ilrConfigMap.get(EVRI_EXCLUSION_PREFIXES)))) {
            btPostCode = true;
        }
        //Checking if all are dropship
        if (null != itemDetails.getServiceItem()
                && !itemDetails.getServiceItem().equalsIgnoreCase("Dropship")) {
                allDropShip=false;
        }
        // To check if all are same dropship suppliers
        List<String> supplierList = Arrays.stream(suppliers).distinct().toList();
        if (supplierList.size() > 1 ) {
            allSameSupplier = false;
        }
        //Check in mongodb//
        log.info("Fetching return channels for sku : {}", sku);
        List<StrokeChannelData> strokeChannelDataList = strokeChannelRepository.fetchStrokeData(strokeNumber, deptNumber, shipFromNode);
        //Assuming more than one result is returned always , apply priority rules 1, 2, and 3//
        StrokeChannelData strokeChannelData;
        if (isParcelForceHeaderEnabled) {
          strokeChannelData = fetchResultBasedOnPriorityParcelForce(strokeChannelDataList, strokeNumber, deptNumber, shipFromNode, countryCode);
        } else {
          strokeChannelData = fetchResultBasedOnPriority(strokeChannelDataList, strokeNumber, deptNumber, shipFromNode, countryCode);
        }

        List<LineItemChannel> lineItemChannels =
                returnChannelTransformer.returnChannelsFormatter(strokeChannelData.getReturnChannels(),
                        strokeChannelData.getChannelID(), countryCode, isParcelForceHeaderEnabled);
        final int channelSizes = lineItemChannels.size();
        if (channelSizes <= smallestChannelSize) {
            smallestChannelSize = channelSizes;
            smallestSku = sku;
        }
        strokeMap.put(sku, lineItemChannels);
    }
    if (ilrConfigMap.get(MIN_RETURN_PRICE_CHECK_ENABLED).equalsIgnoreCase("Y") && orderReturnTotal < Float.parseFloat(ilrConfigMap.get(MIN_RETURN_ORDER))) {
        minimumReturnValue = false;
    }

    ChannelAddress commonAddress = returnChannelTransformer.resolveCommonAddress(strokeMap, countryCode);

    List<OrderChannel> orderChannels = returnChannelTransformer.
            resolveOrderLevelReturnChannel(strokeMap, commonAddress, smallestSku, btPostCode, allDropShip, allSameSupplier, minimumReturnValue);

    return buildResponse(returnChannelRequest, strokeMap, orderChannels, commonAddress.getDsvReturnAddress());
}


this is existing code.... private StrokeChannelData fetchResultBasedOnPriority(List resultSet, String strokeNumber, String deptNo, String node, String countryCode) { StrokeChannelData strokeChannelData = null; if (resultSet.size() > 0) { for (StrokeChannelData channelData : resultSet) { // For more than one result, we filter result based on strokeNumber as first priority if (channelData.getStrokeId().equalsIgnoreCase(strokeNumber)) { strokeChannelData = channelData; break; } // Dept number takes second priority if (null == strokeChannelData && !deptNo.equalsIgnoreCase("")) { if (channelData.getDeptId().equalsIgnoreCase(deptNo)) { strokeChannelData = channelData; break; } } // Nodes take last priority if (null == strokeChannelData) { if (Arrays.asList(channelData.getNodes()).contains(node) && !node.equalsIgnoreCase("")) { strokeChannelData = channelData; break; } } } } // If there aren't any results then build default CH11 rule. if(null ==strokeChannelData || resultSet.size() == 0) { strokeChannelData = strokeChannelRepository.fetchDefaultChannelAddressByCountry(countryCode); } return strokeChannelData; }

this is existing code.... @Description("Iterate and build the item level return channels from dataList object") public List returnChannelsFormatter(ReturnChannels returnChannels, String channelId, String countryCode, boolean isParcelForceHeaderEnabled) { //fetch address ChannelAddress address = channelAddressRepository.fetchChannelAddress(channelId, countryCode); List lineItemChannels = new ArrayList<>(); JSONObject returnChannelObj = JsonUtils.JSONObjectConverter(returnChannels); returnChannelObj.keySet().forEach(key-> { LineItemChannel lineItemChannel = LineItemChannel.builder().build(); JSONObject subChannelObjects = (JSONObject) returnChannelObj.get(key); List subChannelTypes = new ArrayList<>(); subChannelObjects.keySet().forEach(subChannelKey -> { try { JSONObject jsonObject = subChannelObjects.getJSONObject(subChannelKey); boolean isApplicable = jsonObject.getBoolean("isApplicable"); List eligibleCountries = getEligibleCountries(jsonObject.getJSONArray("eligibleCountries")); if (isApplicable && eligibleCountries.contains(countryCode)) { //Todo - isParcelForceHeaderEnabled Remove once we add new carrier if(isParcelForceHeaderEnabled){ populateAndCheckParcelForce(returnChannels, key, subChannelTypes, subChannelKey); } else { subChannelTypes.add(SubChannelType.builder().subChannelType(subChannelKey).build()); } lineItemChannel.setChannelType(key); lineItemChannel.setSubChannelTypes(subChannelTypes); lineItemChannel.setAddress(address); } } catch (Exception exception) { log.warn("No mapping found for key {} / unable to get object for key {}", subChannelKey, subChannelKey); } }); if (null != lineItemChannel.getChannelType()) { lineItemChannels.add(lineItemChannel); } }); return lineItemChannels; }


this is existing code....private void populateAndCheckParcelForce(ReturnChannels returnChannels, String key, List subChannelTypes, String subChannelKey) { if (subChannelKey.equalsIgnoreCase(PARCEL_FORCE_CARRIER) ) { List subCategories = new ArrayList<>(); if (key.equalsIgnoreCase("postal")) { subCategories = returnChannels.getPostal().getParcelForce().getSubCategories(); } else if (key.equalsIgnoreCase("collectFromHome")) { subCategories = returnChannels.getCollectFromHome().getParcelForce().getSubCategories(); } List filterSubCategories = new ArrayList<>(); for (SubCategories categories : subCategories) { if(categories.getIsApplicable()){ filterSubCategories.add(categories); } } if (!filterSubCategories.isEmpty()) { subChannelTypes.add(SubChannelType.builder().subChannelType(subChannelKey).subCategories(filterSubCategories).build()); } } else { subChannelTypes.add(SubChannelType.builder().subChannelType(subChannelKey).build()); } }

this is existing code.....private List getEligibleCountries(JSONArray eligibleCountries) { List eligibleCountriesList = new ArrayList<>(); int length = eligibleCountries.length(); for (int index = 0; index < length ; index ++){ Object country = eligibleCountries.get(index); eligibleCountriesList.add(country.toString()); } return eligibleCountriesList; }

public List<OrderChannel> resolveOrderLevelReturnChannel(Map<String, List<LineItemChannel>> strokeMap,
                                                         ChannelAddress commonAddress,
                                                         String smallestSku, Boolean isBTPostCode,
                                                         Boolean allDropShip, Boolean allSameSupplier,
                                                         Boolean minimumReturnValue) {
    log.info("Resolve order level return channels.");
    // Fetching smallest lineItemChannel for comparison
    List<LineItemChannel> lineItemChannels = strokeMap.get(smallestSku);
    List<OrderChannel> orderChannels = new ArrayList<>();
    lineItemChannels.forEach(lineItemChannel -> {
            String channel = lineItemChannel.getChannelType();
            OrderChannel orderChannel = OrderChannel.builder().build();
            strokeMap.forEach((s, lineItemChannels1) -> {
                for(LineItemChannel lineItemChannel1 : lineItemChannels1) {
                    List<String> subChannels = lineItemChannel1.getSubChannelTypes().stream()
                            .map(SubChannelType::getSubChannelType).collect(Collectors.toList());
                    List<SubChannelType> subChannelTypes = new ArrayList<>();
                    lineItemChannel.getSubChannelTypes().stream().forEach(subChannelType ->  {
                            String subChannel = subChannelType.getSubChannelType();
                            if(subChannels.contains(subChannel)) {
                                SubChannelType subChannelType1 = SubChannelType.builder().subChannelType(subChannelType.getSubChannelType()).subCategories(subChannelType.getSubCategories())
                                        .build();
                                if(!subChannelTypes.contains(subChannelType1)) {
                                    subChannelTypes.add(subChannelType1);
                                }
                            }
                    });
                    if(!subChannelTypes.isEmpty()) {
                        orderChannel.setSubChannelTypes(subChannelTypes);
                        orderChannel.setChannelType(channel);
                        // Setting address common for all methods
                        if(!channel.equalsIgnoreCase("Instore")) {
                            orderChannel.setAddress(commonAddress);
                        }
                        if(!orderChannels.contains(orderChannel)) {
                            orderChannels.add(orderChannel);
                        }
                    }
                }
            });
    });

    // remove EVRI for BT postcodes
    List<OrderChannel> updatedOrderChannels = removeEVRIForBTPostCodes(isBTPostCode,orderChannels);

    // remove postal if return total is < 15
    List<OrderChannel> updatedOrderChannels2 = removePostalForMinReturnTotal
            (minimumReturnValue, updatedOrderChannels);

    if(updatedOrderChannels2.size() ==0) {
        // means there is no channel left, so we add instore with Ollerton
        OrderChannel orderChannel = OrderChannel.builder().channelType("instore")
                .subChannelTypes(List.of(
                        SubChannelType.builder().subChannelType("clothAndHome").build(),
                        SubChannelType.builder().subChannelType("simplyFood").build()))
                .build();
        updatedOrderChannels2.add(orderChannel);
    }
    return updatedOrderChannels2;
}

private List<OrderChannel> removePostalForMinReturnTotal(Boolean minimumReturnValue, List<OrderChannel> updatedOrderChannels) {
    List<OrderChannel> updatedOrderChannels2 = new ArrayList<>();
    log.info("Checking minimum return total ...");
    if (!minimumReturnValue) {
        log.info("Minimum return total is not satisfied...");
        for (OrderChannel orderChannel : updatedOrderChannels) {
            if (!(orderChannel.getChannelType().equalsIgnoreCase("Postal") ||
                    orderChannel.getChannelType().equalsIgnoreCase("CollectFromHome"))) {
                updatedOrderChannels2.add(orderChannel);
            }
        }
    }
    else {
        updatedOrderChannels2 = updatedOrderChannels;
    }
    return updatedOrderChannels2;
}

public ChannelAddress resolveCommonAddress(Map<String, List<LineItemChannel>> strokeMap, String countryCode) {
    log.info("Resolve common address");
    List<String> addressList = new ArrayList<>();
    strokeMap.forEach((s, lineItemChannels) -> {
        addressList.add(lineItemChannels.get(0).getAddress().getCity());
    });
    List<String> commonAddressList = addressList.stream().distinct().toList();
    ChannelAddress[] channelAddress = new ChannelAddress[1];
    if (commonAddressList.size() == 1 ) {
        strokeMap.forEach((s, lineItemChannels) -> {
           for(LineItemChannel lineItemChannel : lineItemChannels) {
               if (lineItemChannel.getAddress().getCity().equalsIgnoreCase(commonAddressList.get(0))) {
                   channelAddress[0] = lineItemChannel.getAddress();
               }
           }
        });
    }
    else {
        channelAddress[0] = channelAddressRepository.getDefaultChannelAddress(countryCode);
    }
    return channelAddress[0];
}

private List<OrderChannel> removeEVRIForBTPostCodes(boolean isBTPostCode, List<OrderChannel> orderChannels ) {
    log.info("Checking BT postcode scenario...");
    List<OrderChannel> updatedOrderChannels = new ArrayList<>();
    if (isBTPostCode) {
        log.info("Restricted postcodes found...");
        for (OrderChannel orderChannel : orderChannels) {
            OrderChannel updatedOrderChannel = OrderChannel.builder()
                    .channelType(orderChannel.getChannelType())
                    .address(orderChannel.getAddress()).build();
            List<SubChannelType> subChannelTypes = orderChannel.getSubChannelTypes();
            List<SubChannelType> updatedSubChannelTypes = new ArrayList<>();
            subChannelTypes.forEach(subChannelType -> {
                if (!subChannelType.getSubChannelType().equalsIgnoreCase("EVRI")) {
                    updatedSubChannelTypes.add(SubChannelType.builder()
                            .subChannelType(subChannelType.getSubChannelType())
                            .build());
                }
            });
            updatedOrderChannel.setSubChannelTypes(updatedSubChannelTypes);
            if (updatedSubChannelTypes.size() > 0) {
                // Adding to order channels if there is atleast once subchannel left.
                updatedOrderChannels.add(updatedOrderChannel);
            };
        }
    }
    else {
        updatedOrderChannels = orderChannels;
    }
    return updatedOrderChannels;
}

public StrokeChannelData fetchDefaultChannelAddressByCountry(String countryCode) { Map<String, String> config = loadConfigKeys.fetchReturnChannelConfig(); String channelId = config.get(DEFAULT_ADDRESS + "_" + countryCode); log.debug("Found channel id key {}", channelId); Criteria defaultCriteria = Criteria.where("channelID").is(channelId); Query query = new Query(new Criteria().orOperator(defaultCriteria)); log.debug("Fetching channel for channelId : {}, for country code {}", channelId, countryCode); return mongoTemplate.findOne(query, StrokeChannelData.class); }....this is existong code

this is existing code....public Map<String, String> fetchReturnChannelConfig() { List ilrConfigList = null; if(ilrConfigMap.isEmpty()) { log.info("Configuration map is empty, fetching list from db"); ilrConfigList = ilrConfigRepository.loadConfigKeys(); ilrConfigList.forEach(ilrConfig -> ilrConfigMap.put(ilrConfig.getKey(), ilrConfig.getValue())); } return ilrConfigMap; }