Skip to content

Commit

Permalink
serialize payment account form lists to comma delimited string
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jan 17, 2025
1 parent b571b39 commit 130a45c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/java/haveno/core/payment/PaymentAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ private static Class<? extends PaymentAccount> getPaymentAccountClass(String pay
@NonNull
public abstract List<PaymentAccountFormField.FieldId> getInputFieldIds();

@SuppressWarnings("unchecked")
public PaymentAccountForm toForm() {

// convert to json map
Expand All @@ -387,7 +388,12 @@ public PaymentAccountForm toForm() {
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<String>) value));
} else {
field.setValue((String) value);
}
form.getFields().add(field);
}
return form;
Expand Down

0 comments on commit 130a45c

Please sign in to comment.