mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-01-22 02:34:57 +00:00
serialize payment account form lists to comma delimited string
Some checks are pending
Some checks are pending
This commit is contained in:
parent
b571b39790
commit
130a45c99a
1 changed files with 7 additions and 1 deletions
|
@ -378,6 +378,7 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
@NonNull
|
||||
public abstract List<PaymentAccountFormField.FieldId> 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<String>) value));
|
||||
} else {
|
||||
field.setValue((String) value);
|
||||
}
|
||||
form.getFields().add(field);
|
||||
}
|
||||
return form;
|
||||
|
|
Loading…
Reference in a new issue