You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Foo Developer (Jira)" <ji...@apache.org> on 2026/07/29 07:45:00 UTC
[jira] [Created] (FINERACT-2723) StandingInstructionData getters shadow EnumOptionData fields causing incorrect JSON serialization
Foo Developer created FINERACT-2723:
---------------------------------------
Summary: StandingInstructionData getters shadow EnumOptionData fields causing incorrect JSON serialization
Key: FINERACT-2723
URL: https://issues.apache.org/jira/browse/FINERACT-2723
Project: Apache Fineract
Issue Type: Bug
Reporter: Foo Developer
{{StandingInstructionData}} declares several fields of type {{EnumOptionData}} ({{fromAccountType}}, {{toAccountType}}, {{transferType}}, {{instructionType}}, {{recurrenceType}}, {{recurrenceFrequency}}), each intended to serialize as an {{EnumOptionData}} object ({{{id, code, value}}}) in the API response.
However, the class also declares same-named getter methods that return a different, internal domain-enum type instead, e.g.:
public PortfolioAccountType getFromAccountType() {
return Optional.ofNullable(this.fromAccountType).map(e -> PortfolioAccountType.fromInt(e.getId().intValue())).orElse(null);
}
Since none of the affected fields have their own explicit getter, Jackson's bean-property introspection resolves the property "fromAccountType" (and the other five) to this method alone, and serializes the internal domain enum's own representation instead of the intended {{EnumOptionData}} object. This produces incorrect/confusing data for these fields wherever a Standing Instruction is returned by the API (e.g. the Standing Instructions view/list endpoints), including account type, transfer type, instruction type, and recurrence type/frequency.
Proposed fix: rename the six domain-enum helper methods to a distinct name ({{getFromAccountTypeEnum()}}, {{getToAccountTypeEnum()}}, {{getTransferTypeEnum()}}, {{getInstructionTypeEnum()}}, {{getRecurrenceTypeEnum()}}, {{getRecurrenceFrequencyEnum()}}) so they no longer shadow the field-backed Jackson property, and add an explicit getter on each underlying field so the correct {{EnumOptionData}} object is serialized. Internal callers of the old getter names are updated to use the renamed methods, with added null-safety since the domain-enum helpers can return {{null}} when the underlying {{EnumOptionData}} field is {{null}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)