Source:
<code>private boolean matchCardDetails(CardDetailsEntity cardDetailsEntity, CardDetails ledgerCardDetails) { boolean fieldsMatch; if (isNull(cardDetailsEntity)) { return true; } if (nonNull(ledgerCardDetails)) { fieldsMatch = isEquals(cardDetailsEntity.getCardHolderName(), ledgerCardDetails.getCardholderName(), "cardholder_name"); fieldsMatch = fieldsMatch && isEquals( ofNullable(cardDetailsEntity.getLastDigitsCardNumber()).map(LastDigitsCardNumber::toString).orElse(null), ledgerCardDetails.getLastDigitsCardNumber(), "last_digits_card_number"); fieldsMatch = fieldsMatch && isEquals( ofNullable(cardDetailsEntity.getFirstDigitsCardNumber()).map(FirstDigitsCardNumber::toString).orElse(null), ledgerCardDetails.getFirstDigitsCardNumber(), "first_digits_card_number"); fieldsMatch = fieldsMatch && isEquals( cardDetailsEntity.getCardTypeDetails().map(CardBrandLabelEntity::getLabel).orElse(null), <START> (EMPTY.equals(ledgerCardDetails.getCardBrand()) ? null : ledgerCardDetails.getCardBrand()), <END> "card_brand"); fieldsMatch = fieldsMatch && isEquals(cardDetailsEntity.getExpiryDate(), ledgerCardDetails.getExpiryDate(), "expiry_date"); String cardType = null; if (cardDetailsEntity.getCardType() != null) { cardType = cardDetailsEntity.getCardType().toString().toLowerCase(); } fieldsMatch = fieldsMatch && isEquals( cardType, ledgerCardDetails.getCardType(), "card_type"); fieldsMatch = fieldsMatch && matchBillingAddress(cardDetailsEntity.getBillingAddress().orElse(null), ledgerCardDetails.getBillingAddress()); return fieldsMatch; } else { logger.info("Field value does not match between ledger and connector [field_name={}]", "card_details", kv(FIELD_NAME, "card_details")); return false; } }</code><technical_language>If StringUtils, StringUtils.isEmpty(ledgerCardDetails.getCardBrand()) ? null : ledgerCardDetails.getCardBrand()</technical_language>

Target:
private boolean matchCardDetails(CardDetailsEntity cardDetailsEntity, CardDetails ledgerCardDetails) { boolean fieldsMatch; if (isNull(cardDetailsEntity)) { return true; } if (nonNull(ledgerCardDetails)) { fieldsMatch = isEquals(cardDetailsEntity.getCardHolderName(), ledgerCardDetails.getCardholderName(), "cardholder_name"); fieldsMatch = fieldsMatch && isEquals( ofNullable(cardDetailsEntity.getLastDigitsCardNumber()).map(LastDigitsCardNumber::toString).orElse(null), ledgerCardDetails.getLastDigitsCardNumber(), "last_digits_card_number"); fieldsMatch = fieldsMatch && isEquals( ofNullable(cardDetailsEntity.getFirstDigitsCardNumber()).map(FirstDigitsCardNumber::toString).orElse(null), ledgerCardDetails.getFirstDigitsCardNumber(), "first_digits_card_number"); fieldsMatch = fieldsMatch && isEquals( cardDetailsEntity.getCardTypeDetails().map(CardBrandLabelEntity::getLabel).orElse(null), isEmpty(ledgerCardDetails.getCardBrand()) ? null : ledgerCardDetails.getCardBrand(), "card_brand"); fieldsMatch = fieldsMatch && isEquals(cardDetailsEntity.getExpiryDate(), ledgerCardDetails.getExpiryDate(), "expiry_date"); String cardType = null; if (cardDetailsEntity.getCardType() != null) { cardType = cardDetailsEntity.getCardType().toString().toLowerCase(); } fieldsMatch = fieldsMatch && isEquals( cardType, ledgerCardDetails.getCardType(), "card_type"); fieldsMatch = fieldsMatch && matchBillingAddress(cardDetailsEntity.getBillingAddress().orElse(null), ledgerCardDetails.getBillingAddress()); return fieldsMatch; } else { logger.info("Field value does not match between ledger and connector [field_name={}]", "card_details", kv(FIELD_NAME, "card_details")); return false; } }