diff --git a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AddressTransformer.java b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AddressTransformer.java index 92245e215..da86276fb 100644 --- a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AddressTransformer.java +++ b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AddressTransformer.java @@ -18,22 +18,22 @@ static final AddressTransformer newInstance() { return new AddressTransformer(); } - public Attribute transform(Attribute structuredAddress) { + Attribute transform(Attribute structuredPostalAddress) { Attribute transformedAddress = null; try { - Attribute> address = (Attribute>) structuredAddress; - if (address.getValue() != null) { - Object formattedAddress = address.getValue().get(HumanProfileAttributes.Keys.FORMATTED_ADDRESS); + if (structuredPostalAddress.getValue() != null) { + final Map structuredAddressValue = (Map) structuredPostalAddress.getValue(); + final Object formattedAddress = structuredAddressValue.get(HumanProfileAttributes.Keys.FORMATTED_ADDRESS); if (formattedAddress != null) { transformedAddress = new SimpleAttribute(HumanProfileAttributes.POSTAL_ADDRESS, String.valueOf(formattedAddress), - structuredAddress.getSources(), - structuredAddress.getVerifiers(), - structuredAddress.getAnchors()); + structuredPostalAddress.getSources(), + structuredPostalAddress.getVerifiers(), + structuredPostalAddress.getAnchors()); } } } catch (Exception e) { - LOG.warn("Failed to transform attribute '{}' in place of missing '{}' due to '{}'", structuredAddress.getName(), + LOG.warn("Failed to transform attribute '{}' in place of missing '{}' due to '{}'", structuredPostalAddress.getName(), HumanProfileAttributes.POSTAL_ADDRESS, e.getMessage()); } return transformedAddress; diff --git a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AttributeListConverter.java b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AttributeListConverter.java index 84edfa280..bd49381f0 100644 --- a/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AttributeListConverter.java +++ b/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/AttributeListConverter.java @@ -68,9 +68,9 @@ private List> parseAttributes(AttributeListProto.AttributeList mess private void ensurePostalAddress(List> attributes) { if (findAttribute(POSTAL_ADDRESS, attributes) == null) { - Attribute structuredAddress = findAttribute(STRUCTURED_POSTAL_ADDRESS, attributes); - if (structuredAddress != null) { - Attribute transformedAddress = addressTransformer.transform(structuredAddress); + Attribute structuredPostalAddress = findAttribute(STRUCTURED_POSTAL_ADDRESS, attributes); + if (structuredPostalAddress != null) { + Attribute transformedAddress = addressTransformer.transform(structuredPostalAddress); if (transformedAddress != null) { LOG.debug("Substituting '{}' in place of missing '{}'", STRUCTURED_POSTAL_ADDRESS, POSTAL_ADDRESS); attributes.add(transformedAddress);