few fixes and made sure ledger widget displays the name of ledger wallet
This commit is contained in:
@@ -9,22 +9,33 @@ import 'package:pshared/models/ledger/account.dart';
|
||||
|
||||
|
||||
extension LedgerAccountDTOMapper on LedgerAccountDTO {
|
||||
LedgerAccount toDomain() => LedgerAccount(
|
||||
ledgerAccountRef: ledgerAccountRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
accountCode: accountCode,
|
||||
accountType: accountType.toDomain(),
|
||||
currency: currency,
|
||||
status: status.toDomain(),
|
||||
allowNegative: allowNegative,
|
||||
role: role.toDomain(),
|
||||
metadata: metadata,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
describable: describable?.toDomain() ?? newDescribable(name: '', description: null),
|
||||
balance: balance?.toDomain(),
|
||||
);
|
||||
LedgerAccount toDomain() {
|
||||
final mappedDescribable = describable?.toDomain();
|
||||
final fallbackName = metadata?['name']?.trim() ?? '';
|
||||
final name = mappedDescribable?.name.trim().isNotEmpty == true
|
||||
? mappedDescribable!.name
|
||||
: fallbackName;
|
||||
|
||||
return LedgerAccount(
|
||||
ledgerAccountRef: ledgerAccountRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
accountCode: accountCode,
|
||||
accountType: accountType.toDomain(),
|
||||
currency: currency,
|
||||
status: status.toDomain(),
|
||||
allowNegative: allowNegative,
|
||||
role: role.toDomain(),
|
||||
metadata: metadata,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
describable: newDescribable(
|
||||
name: name,
|
||||
description: mappedDescribable?.description,
|
||||
),
|
||||
balance: balance?.toDomain(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extension LedgerAccountModelMapper on LedgerAccount {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:pshared/data/dto/payment/operation.dart';
|
||||
import 'package:pshared/models/payment/execution_operation.dart';
|
||||
|
||||
|
||||
extension PaymentOperationDTOMapper on PaymentOperationDTO {
|
||||
PaymentExecutionOperation toDomain() => PaymentExecutionOperation(
|
||||
stepRef: stepRef,
|
||||
|
||||
Reference in New Issue
Block a user