From 130a45c99a1ae812d3c6d6d8603005a79d2cfc19 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 17 Jan 2025 07:28:27 -0500 Subject: [PATCH] serialize payment account form lists to comma delimited string --- .../src/main/java/haveno/core/payment/PaymentAccount.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/haveno/core/payment/PaymentAccount.java b/core/src/main/java/haveno/core/payment/PaymentAccount.java index a9e03d8016..8dda8fdedd 100644 --- a/core/src/main/java/haveno/core/payment/PaymentAccount.java +++ b/core/src/main/java/haveno/core/payment/PaymentAccount.java @@ -378,6 +378,7 @@ public abstract class PaymentAccount implements PersistablePayload { @NonNull public abstract List getInputFieldIds(); + @SuppressWarnings("unchecked") public PaymentAccountForm toForm() { // convert to json map @@ -387,7 +388,12 @@ public abstract class PaymentAccount implements PersistablePayload { PaymentAccountForm form = new PaymentAccountForm(PaymentAccountForm.FormId.valueOf(paymentMethod.getId())); for (PaymentAccountFormField.FieldId fieldId : getInputFieldIds()) { PaymentAccountFormField field = getEmptyFormField(fieldId); - field.setValue((String) jsonMap.get(HavenoUtils.toCamelCase(field.getId().toString()))); + Object value = jsonMap.get(HavenoUtils.toCamelCase(field.getId().toString())); + if (value instanceof List) { // TODO: list should already be serialized to comma delimited string in PaymentAccount.toJson() (PaymentAccountTypeAdapter?) + field.setValue(String.join(",", (List) value)); + } else { + field.setValue((String) value); + } form.getFields().add(field); } return form;