public final class PaymentMappingUtil
extends java.lang.Object
PaymentInteractionData values to CustomFieldsDraftBuilder.| Modifier and Type | Method and Description |
|---|---|
static io.sphere.sdk.types.CustomFieldsDraftBuilder |
mapDraftCustomFields(io.sphere.sdk.types.CustomFieldsDraftBuilder acceptor,
PaymentInteractionData supplier,
java.util.List<java.lang.String> properties)
Map values by names in the
properties list from supplier's config map to acceptor's
custom fields. |
static io.sphere.sdk.types.CustomFieldsDraftBuilder |
mapDraftCustomFields(io.sphere.sdk.types.CustomFieldsDraftBuilder acceptor,
PaymentInteractionData supplier,
java.util.List<java.lang.String> properties,
java.util.function.Function<java.lang.String,java.lang.Object> valueFormatter)
Map values by names in the
properties list from supplier's config map to acceptor's
custom fields. |
static io.sphere.sdk.types.CustomFieldsDraftBuilder |
mapDraftCustomFieldsIfExist(io.sphere.sdk.types.CustomFieldsDraftBuilder acceptor,
PaymentInteractionData supplier,
java.util.List<java.lang.String> properties)
Same as
mapDraftCustomFields(CustomFieldsDraftBuilder, PaymentInteractionData, List), but skips empty
String values. |
public static io.sphere.sdk.types.CustomFieldsDraftBuilder mapDraftCustomFields(@Nonnull
io.sphere.sdk.types.CustomFieldsDraftBuilder acceptor,
@Nonnull
PaymentInteractionData supplier,
@Nonnull
java.util.List<java.lang.String> properties)
properties list from supplier's config map to acceptor's
custom fields. The properties will have have the same name in both acceptor and supplier. No any conditions
or values formatting are applied. Missing (null) values from acceptor are mapped as null.
For optional fields mapping see
mapDraftCustomFieldsIfExist(CustomFieldsDraftBuilder, PaymentInteractionData, List)
acceptor - CustomFieldsDraftBuilder to which map the propertiessupplier - PaymentInteractionData from which to read the properties.properties - list of string properties name to be mapped from supplier config to acceptor
custom fields.acceptor instance.mapDraftCustomFieldsIfExist(CustomFieldsDraftBuilder, PaymentInteractionData, List),
mapDraftCustomFields(CustomFieldsDraftBuilder, PaymentInteractionData, List, Function)public static io.sphere.sdk.types.CustomFieldsDraftBuilder mapDraftCustomFields(@Nonnull
io.sphere.sdk.types.CustomFieldsDraftBuilder acceptor,
@Nonnull
PaymentInteractionData supplier,
@Nonnull
java.util.List<java.lang.String> properties,
@Nonnull
java.util.function.Function<java.lang.String,java.lang.Object> valueFormatter)
properties list from supplier's config map to acceptor's
custom fields. The properties will have have the same name in both acceptor and supplier. No any conditions
are applied. Before setting value to the acceptor it will be processed (formatted)
by valueFormatter.acceptor - CustomFieldsDraftBuilder to which map the propertiessupplier - PaymentInteractionData from which to read the properties.properties - list of string properties name to be mapped from supplier config
to acceptor custom fields.valueFormatter - a function which pre-processes string value from the supplier to some specific
field type or format (for instance, map string to boolean, or map string date
to another date format). Caveat: the formatter function should expect that input
value could be null, thus functions reference like String::toLowerCase
might be unsafe to use, if some of the fields is missing or the value is null.
In such cases add additional checks, like:
mapDraftCustomFields(a, b, value -> value != null ? value.toLowerCase() : null);
or use some null-safe methods, like StringUtils.lowerCase(String) in apache-commonsacceptor instance.mapDraftCustomFields(CustomFieldsDraftBuilder, PaymentInteractionData, List),
mapDraftCustomFieldsIfExist(CustomFieldsDraftBuilder, PaymentInteractionData, List)public static io.sphere.sdk.types.CustomFieldsDraftBuilder mapDraftCustomFieldsIfExist(@Nonnull
io.sphere.sdk.types.CustomFieldsDraftBuilder acceptor,
@Nonnull
PaymentInteractionData supplier,
@Nonnull
java.util.List<java.lang.String> properties)
mapDraftCustomFields(CustomFieldsDraftBuilder, PaymentInteractionData, List), but skips empty
String values.
For empty String verification StringUtils.isNotEmpty(CharSequence) is used, e.g. null and
"" strings will be skipped from mapping, but blank (whitespace) strings will be mapped.
acceptor - CustomFieldsDraftBuilder to which map the propertiessupplier - PaymentInteractionData from which to read the properties.properties - list of string properties name to be mapped from supplier config to acceptor
custom fields.acceptor instance.