refactor it.... public String getConfigValueForIsRejectAllowed(String configKey) { Query…
- User
refactor it.... public String getConfigValueForIsRejectAllowed(String configKey) { Query queryGeneralQuery = new Query(); queryGeneralQuery.addCriteria(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(queryGeneralQuery, Config.class); // Return the value associated with the "value" field in the matched document return config != null ? config.getValue() : null; }
- Assistant
public String getConfigValueForIsRejectAllowed(String configKey) { Query query = new Query(); query.addCriteria(Criteria.where("key").is(configKey)); Config config = mongoTemplate.findOne(query, Config.class);
// Check if config is not null and return the value, otherwise return null return config != null ? config.getValue() : null;}
- User
if(IGNORE_PRIMARY_REFUND_REJECTION_REASON.contains(orderLine.getPrimaryReturnReasonCode()) && isEmailValid(orderHeader.getCustomerEmail())){ orderLine.setIsRejectionAllowed("N"); }.....update above code to use this method and replace the hardcoded IGNORE_PRIMARY_REFUND_REJECTION_REASON
- Assistant
if(isPrimaryReturnReasonCodeIgnored(orderLine.getPrimaryReturnReasonCode()) && isEmailValid(orderHeader.getCustomerEmail())) { orderLine.setIsRejectionAllowed("N"); }
...
private boolean isPrimaryReturnReasonCodeIgnored(String primaryReturnReasonCode) { String configValue = getConfigValueForIsRejectAllowed(primaryReturnReasonCode); return "Y".equals(configValue); }