Fixed compilation
This commit is contained in:
47
frontend/pshared/lib/data/dto/ledger/account.dart
Normal file
47
frontend/pshared/lib/data/dto/ledger/account.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/describable.dart';
|
||||
import 'package:pshared/data/dto/ledger/balance.dart';
|
||||
|
||||
part 'account.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable(includeIfNull: false, explicitToJson: true)
|
||||
class LedgerAccountDTO {
|
||||
final String ledgerAccountRef;
|
||||
final String organizationRef;
|
||||
final String? ownerRef;
|
||||
final String accountCode;
|
||||
final String accountType;
|
||||
final String currency;
|
||||
final String status;
|
||||
final bool allowNegative;
|
||||
final bool isSettlement;
|
||||
final Map<String, String>? metadata;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final DescribableDTO describable;
|
||||
|
||||
final LedgerBalanceDTO? balance;
|
||||
|
||||
const LedgerAccountDTO({
|
||||
required this.ledgerAccountRef,
|
||||
required this.organizationRef,
|
||||
this.ownerRef,
|
||||
required this.accountCode,
|
||||
required this.accountType,
|
||||
required this.currency,
|
||||
required this.status,
|
||||
required this.allowNegative,
|
||||
required this.isSettlement,
|
||||
this.metadata,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
required this.describable,
|
||||
this.balance,
|
||||
});
|
||||
|
||||
factory LedgerAccountDTO.fromJson(Map<String, dynamic> json) => _$LedgerAccountDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$LedgerAccountDTOToJson(this);
|
||||
}
|
||||
27
frontend/pshared/lib/data/dto/ledger/balance.dart
Normal file
27
frontend/pshared/lib/data/dto/ledger/balance.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
|
||||
part 'balance.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable(
|
||||
includeIfNull: false, // <- omitempty behavior
|
||||
explicitToJson: true, // <- nested DTOs call toJson()
|
||||
)
|
||||
class LedgerBalanceDTO {
|
||||
final String ledgerAccountRef;
|
||||
final MoneyDTO? balance;
|
||||
final int version;
|
||||
final DateTime? lastUpdated;
|
||||
|
||||
const LedgerBalanceDTO({
|
||||
required this.ledgerAccountRef,
|
||||
this.balance,
|
||||
required this.version,
|
||||
this.lastUpdated,
|
||||
});
|
||||
|
||||
factory LedgerBalanceDTO.fromJson(Map<String, dynamic> json) => _$LedgerBalanceDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$LedgerBalanceDTOToJson(this);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/payment/money.dart';
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
|
||||
part 'fee_line.g.dart';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/payment/money.dart';
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
|
||||
part 'fx_quote.g.dart';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:pshared/data/dto/payment/endpoint.dart';
|
||||
import 'package:pshared/data/dto/payment/intent/customer.dart';
|
||||
import 'package:pshared/data/dto/payment/intent/fx.dart';
|
||||
import 'package:pshared/data/dto/payment/money.dart';
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
|
||||
part 'payment.g.dart';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/payment/money.dart';
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
|
||||
part 'network_fee.g.dart';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/payment/fee_line.dart';
|
||||
import 'package:pshared/data/dto/payment/fx_quote.dart';
|
||||
import 'package:pshared/data/dto/payment/money.dart';
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
import 'package:pshared/data/dto/payment/network_fee.dart';
|
||||
|
||||
part 'payment_quote.g.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/payment/money.dart';
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
|
||||
part 'quote_aggregate.g.dart';
|
||||
|
||||
|
||||
43
frontend/pshared/lib/data/mapper/ledger/account.dart
Normal file
43
frontend/pshared/lib/data/mapper/ledger/account.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:pshared/data/dto/ledger/account.dart';
|
||||
import 'package:pshared/data/mapper/describable.dart';
|
||||
import 'package:pshared/data/mapper/ledger/balance.dart';
|
||||
import 'package:pshared/models/ledger/account.dart';
|
||||
|
||||
|
||||
extension LedgerAccountDtoMapper on LedgerAccountDTO {
|
||||
LedgerAccount toModel() => LedgerAccount(
|
||||
ledgerAccountRef: ledgerAccountRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
accountCode: accountCode,
|
||||
accountType: accountType,
|
||||
currency: currency,
|
||||
status: status,
|
||||
allowNegative: allowNegative,
|
||||
isSettlement: isSettlement,
|
||||
metadata: metadata,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
describable: describable.toDomain(),
|
||||
balance: balance?.toDomain(),
|
||||
);
|
||||
}
|
||||
|
||||
extension LedgerAccountModelMapper on LedgerAccount {
|
||||
LedgerAccountDTO toDTO() => LedgerAccountDTO(
|
||||
ledgerAccountRef: ledgerAccountRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
accountCode: accountCode,
|
||||
accountType: accountType,
|
||||
currency: currency,
|
||||
status: status,
|
||||
allowNegative: allowNegative,
|
||||
isSettlement: isSettlement,
|
||||
metadata: metadata,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
describable: describable.toDTO(),
|
||||
balance: balance?.toDTO(),
|
||||
);
|
||||
}
|
||||
22
frontend/pshared/lib/data/mapper/ledger/balance.dart
Normal file
22
frontend/pshared/lib/data/mapper/ledger/balance.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:pshared/data/dto/ledger/balance.dart';
|
||||
import 'package:pshared/data/mapper/money.dart';
|
||||
import 'package:pshared/models/ledger/balance.dart';
|
||||
|
||||
|
||||
extension LedgerBalanceDtoMapper on LedgerBalanceDTO {
|
||||
LedgerBalance toDomain() => LedgerBalance(
|
||||
ledgerAccountRef: ledgerAccountRef,
|
||||
balance: balance?.toDomain(),
|
||||
version: version,
|
||||
lastUpdated: lastUpdated,
|
||||
);
|
||||
}
|
||||
|
||||
extension LedgerBalanceModelMapper on LedgerBalance {
|
||||
LedgerBalanceDTO toDTO() => LedgerBalanceDTO(
|
||||
ledgerAccountRef: ledgerAccountRef,
|
||||
balance: balance?.toDTO(),
|
||||
version: version,
|
||||
lastUpdated: lastUpdated,
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:pshared/data/dto/payment/money.dart';
|
||||
import 'package:pshared/data/dto/money.dart';
|
||||
import 'package:pshared/models/money.dart';
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:pshared/data/dto/payment/fee_line.dart';
|
||||
import 'package:pshared/data/mapper/payment/money.dart';
|
||||
import 'package:pshared/data/mapper/money.dart';
|
||||
import 'package:pshared/models/payment/fees/line.dart';
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:pshared/data/dto/payment/fx_quote.dart';
|
||||
import 'package:pshared/data/mapper/payment/money.dart';
|
||||
import 'package:pshared/data/mapper/money.dart';
|
||||
import 'package:pshared/models/payment/fx/quote.dart';
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:pshared/data/mapper/payment/payment.dart';
|
||||
import 'package:pshared/data/mapper/payment/enums.dart';
|
||||
import 'package:pshared/data/mapper/payment/intent/customer.dart';
|
||||
import 'package:pshared/data/mapper/payment/intent/fx.dart';
|
||||
import 'package:pshared/data/mapper/payment/money.dart';
|
||||
import 'package:pshared/data/mapper/money.dart';
|
||||
import 'package:pshared/models/payment/intent.dart';
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:pshared/data/dto/payment/network_fee.dart';
|
||||
import 'package:pshared/data/mapper/payment/money.dart';
|
||||
import 'package:pshared/data/mapper/money.dart';
|
||||
import 'package:pshared/models/payment/fees/network.dart';
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:pshared/data/dto/payment/payment_quote.dart';
|
||||
import 'package:pshared/data/mapper/payment/fee_line.dart';
|
||||
import 'package:pshared/data/mapper/payment/fx_quote.dart';
|
||||
import 'package:pshared/data/mapper/payment/money.dart';
|
||||
import 'package:pshared/data/mapper/money.dart';
|
||||
import 'package:pshared/data/mapper/payment/network_fee.dart';
|
||||
import 'package:pshared/models/payment/quote/quote.dart';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:pshared/data/dto/payment/quote_aggregate.dart';
|
||||
import 'package:pshared/data/mapper/payment/money.dart';
|
||||
import 'package:pshared/data/mapper/money.dart';
|
||||
import 'package:pshared/models/payment/quote/aggregate.dart';
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ extension WalletUiMapper on domain.WalletModel {
|
||||
walletUserID: walletRef,
|
||||
balance: double.tryParse(availableMoney?.amount ?? balance?.available?.amount ?? '0') ?? 0,
|
||||
currency: currencyStringToCode(asset.tokenSymbol),
|
||||
isHidden: true,
|
||||
calculatedAt: balance?.calculatedAt ?? DateTime.now(),
|
||||
depositAddress: depositAddress,
|
||||
network: asset.chain,
|
||||
|
||||
Reference in New Issue
Block a user