public String getConfigValueForIsRejectAllowed(String configKey) { Query query = new…
- User
public String getConfigValueForIsRejectAllowed(String configKey) { Query query = new Query(); query.addCriteria(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class); // Return the value associated with the "value" field in the matched document return config != null ? config.getValue() : null; } getConfigValueForIsRejectAllowed method will return results like "RPC000006", "RPC000007", "RPC000012" i want that to split the result based on commaa and hold the result in List IGNORE_PRIMARY_REFUND_REJECTION_REASON update the getConfigValueForIsRejectAllowed code
- Assistant
public List getConfigValueForIsRejectAllowed(String configKey) { Query query = new Query(); query.addCriteria(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class); // Return the value associated with the "value" field in the matched document if (config != null) { String value = config.getValue(); return Arrays.asList(value.split(",")); } else { return new ArrayList<>(); } } This updated code will split the result based on comma and store the individual values in a List named IGNORE_PRIMARY_REFUND_REJECTION_REASON.
- User
public List getConfigValueForIsRejectAllowed(String configKey) { Query query = new Query(); query.addCriteria(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class); // Return the value associated with the “value” field in the matched document return Arrays.asList(config.getValue().split(",")); }....refactor this
- Assistant
public List getConfigValueForIsRejectAllowed(String configKey) { Query query = Query.query(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class); if (config != null) { return Arrays.asList(config.getValue().split(",")); } else { return Collections.emptyList(); } }
- User
private void populateIsRejectionAllowed(OrderLine orderLine,OrderHeader orderHeader) { List rejectionReasons = eligibilityCriteriaConfig.getConfigValueForIsRejectAllowed("IGNORE_PRIMARY_REFUND_REJECTION_REASON"); //If the return reasons are matching "RPC000006", "RPC000007", "RPC000012" then set the value as N if(rejectionReasons.contains(orderLine.getPrimaryReturnReasonCode()) && isEmailValid(orderHeader.getCustomerEmail())){ orderLine.setIsRejectionAllowed("N"); } } refactor above code based on to consume the below code
codepublic List<String> getConfigValueForIsRejectAllowed(String configKey) { Query query = new Query(); query.addCriteria(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class); // Return the list of strings obtained by splitting the config value based on comma return config != null ? Arrays.asList(config.getValue().split(",")) : null;}
- Assistant
private void populateIsRejectionAllowed(OrderLine orderLine, OrderHeader orderHeader) { List rejectionReasons = getConfigValueForIsRejectAllowed("IGNORE_PRIMARY_REFUND_REJECTION_REASON"); if (rejectionReasons != null && rejectionReasons.contains(orderLine.getPrimaryReturnReasonCode()) && isEmailValid(orderHeader.getCustomerEmail())) { orderLine.setIsRejectionAllowed("N"); } }
public List getConfigValueForIsRejectAllowed(String configKey) { Query query = Query.query(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class); if (config != null) { return Arrays.asList(config.getValue().split(",")); } else { return Collections.emptyList(); } }
- User
private void populateIsRejectionAllowed(OrderLine orderLine,OrderHeader orderHeader) { List rejectionReasonsList = eligibilityCriteriaConfig.getConfigValueForIsRejectAllowed("IGNORE_PRIMARY_REFUND_REJECTION_REASON"); //If the return reasons are matching "RPC000006", "RPC000007", "RPC000012" then set the value as N if(!CollectionUtils.isEmpty(rejectionReasonsList) && rejectionReasonsList.contains(orderLine.getPrimaryReturnReasonCode()) && isEmailValid(orderHeader.getCustomerEmail())){ orderLine.setIsRejectionAllowed("N"); } }....refactor it
- Assistant
private void populateIsRejectionAllowed(OrderLine orderLine, OrderHeader orderHeader) { List rejectionReasonsList = getConfigValueForIsRejectAllowed("IGNORE_PRIMARY_REFUND_REJECTION_REASON"); if (!rejectionReasonsList.isEmpty() && rejectionReasonsList.contains(orderLine.getPrimaryReturnReasonCode()) && isEmailValid(orderHeader.getCustomerEmail())) { orderLine.setIsRejectionAllowed("N"); } }
private List getConfigValueForIsRejectAllowed(String configKey) { Query query = Query.query(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class); if (config != null) { return Arrays.asList(config.getValue().split(",")); } else { return Collections.emptyList(); } }