fixed ledger account listing + quotation listing
This commit is contained in:
@@ -11,3 +11,34 @@ enum LedgerAccountStatusDTO {
|
||||
@JsonValue('frozen')
|
||||
frozen,
|
||||
}
|
||||
|
||||
LedgerAccountStatusDTO ledgerAccountStatusFromJson(Object? value) {
|
||||
final raw = value?.toString() ?? '';
|
||||
var normalized = raw.trim().toLowerCase();
|
||||
const prefix = 'account_status_';
|
||||
if (normalized.startsWith(prefix)) {
|
||||
normalized = normalized.substring(prefix.length);
|
||||
}
|
||||
switch (normalized) {
|
||||
case 'active':
|
||||
return LedgerAccountStatusDTO.active;
|
||||
case 'frozen':
|
||||
return LedgerAccountStatusDTO.frozen;
|
||||
case 'unspecified':
|
||||
case '':
|
||||
return LedgerAccountStatusDTO.unspecified;
|
||||
default:
|
||||
return LedgerAccountStatusDTO.unspecified;
|
||||
}
|
||||
}
|
||||
|
||||
String ledgerAccountStatusToJson(LedgerAccountStatusDTO value) {
|
||||
switch (value) {
|
||||
case LedgerAccountStatusDTO.active:
|
||||
return 'active';
|
||||
case LedgerAccountStatusDTO.frozen:
|
||||
return 'frozen';
|
||||
case LedgerAccountStatusDTO.unspecified:
|
||||
return 'unspecified';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user