accounts creation
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/discovery Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/gateway_mntx Pipeline was successful
ci/woodpecker/push/gateway_chain Pipeline was successful
ci/woodpecker/push/gateway_tgsettle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/discovery Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/gateway_mntx Pipeline was successful
ci/woodpecker/push/gateway_chain Pipeline was successful
ci/woodpecker/push/gateway_tgsettle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
This commit is contained in:
@@ -2,6 +2,8 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/describable.dart';
|
||||
import 'package:pshared/data/dto/ledger/balance.dart';
|
||||
import 'package:pshared/data/dto/ledger/status.dart';
|
||||
import 'package:pshared/data/dto/ledger/type.dart';
|
||||
|
||||
part 'account.g.dart';
|
||||
|
||||
@@ -12,9 +14,9 @@ class LedgerAccountDTO {
|
||||
final String organizationRef;
|
||||
final String? ownerRef;
|
||||
final String accountCode;
|
||||
final String accountType;
|
||||
final LedgerAccountTypeDTO accountType;
|
||||
final String currency;
|
||||
final String status;
|
||||
final LedgerAccountStatusDTO status;
|
||||
final bool allowNegative;
|
||||
final bool isSettlement;
|
||||
final Map<String, String>? metadata;
|
||||
|
||||
13
frontend/pshared/lib/data/dto/ledger/status.dart
Normal file
13
frontend/pshared/lib/data/dto/ledger/status.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
|
||||
enum LedgerAccountStatusDTO {
|
||||
@JsonValue('unspecified')
|
||||
unspecified,
|
||||
|
||||
@JsonValue('active')
|
||||
active,
|
||||
|
||||
@JsonValue('frozen')
|
||||
frozen,
|
||||
}
|
||||
19
frontend/pshared/lib/data/dto/ledger/type.dart
Normal file
19
frontend/pshared/lib/data/dto/ledger/type.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
|
||||
enum LedgerAccountTypeDTO {
|
||||
@JsonValue('unspecified')
|
||||
unspecified,
|
||||
|
||||
@JsonValue('asset')
|
||||
asset,
|
||||
|
||||
@JsonValue('liability')
|
||||
liability,
|
||||
|
||||
@JsonValue('revenue')
|
||||
revenue,
|
||||
|
||||
@JsonValue('expense')
|
||||
expense,
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pshared/data/dto/wallet/chain_asset.dart';
|
||||
|
||||
part 'asset.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class WalletAssetDTO {
|
||||
final String chain;
|
||||
final String tokenSymbol;
|
||||
class WalletAssetDTO extends ChainAssetDTO {
|
||||
final String contractAddress;
|
||||
|
||||
const WalletAssetDTO({
|
||||
required this.chain,
|
||||
required this.tokenSymbol,
|
||||
required super.chain,
|
||||
required super.tokenSymbol,
|
||||
required this.contractAddress,
|
||||
});
|
||||
|
||||
factory WalletAssetDTO.fromJson(Map<String, dynamic> json) => _$WalletAssetDTOFromJson(json);
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$WalletAssetDTOToJson(this);
|
||||
}
|
||||
|
||||
18
frontend/pshared/lib/data/dto/wallet/chain_asset.dart
Normal file
18
frontend/pshared/lib/data/dto/wallet/chain_asset.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'chain_asset.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class ChainAssetDTO {
|
||||
final String chain;
|
||||
final String tokenSymbol;
|
||||
|
||||
const ChainAssetDTO({
|
||||
required this.chain,
|
||||
required this.tokenSymbol,
|
||||
});
|
||||
|
||||
factory ChainAssetDTO.fromJson(Map<String, dynamic> json) => _$ChainAssetDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$ChainAssetDTOToJson(this);
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
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/data/mapper/ledger/status.dart';
|
||||
import 'package:pshared/data/mapper/ledger/type.dart';
|
||||
import 'package:pshared/models/ledger/account.dart';
|
||||
|
||||
|
||||
@@ -10,9 +12,9 @@ extension LedgerAccountDTOMapper on LedgerAccountDTO {
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
accountCode: accountCode,
|
||||
accountType: accountType,
|
||||
accountType: accountType.toDomain(),
|
||||
currency: currency,
|
||||
status: status,
|
||||
status: status.toDomain(),
|
||||
allowNegative: allowNegative,
|
||||
isSettlement: isSettlement,
|
||||
metadata: metadata,
|
||||
@@ -29,9 +31,9 @@ extension LedgerAccountModelMapper on LedgerAccount {
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
accountCode: accountCode,
|
||||
accountType: accountType,
|
||||
accountType: accountType.toDTO(),
|
||||
currency: currency,
|
||||
status: status,
|
||||
status: status.toDTO(),
|
||||
allowNegative: allowNegative,
|
||||
isSettlement: isSettlement,
|
||||
metadata: metadata,
|
||||
|
||||
29
frontend/pshared/lib/data/mapper/ledger/status.dart
Normal file
29
frontend/pshared/lib/data/mapper/ledger/status.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:pshared/data/dto/ledger/status.dart';
|
||||
import 'package:pshared/models/ledger/status.dart';
|
||||
|
||||
|
||||
extension LedgerAccountStatusDTOMapper on LedgerAccountStatusDTO {
|
||||
LedgerAccountStatus toDomain() {
|
||||
switch (this) {
|
||||
case LedgerAccountStatusDTO.unspecified:
|
||||
return LedgerAccountStatus.unspecified;
|
||||
case LedgerAccountStatusDTO.active:
|
||||
return LedgerAccountStatus.active;
|
||||
case LedgerAccountStatusDTO.frozen:
|
||||
return LedgerAccountStatus.frozen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension LedgerAccountStatusMapper on LedgerAccountStatus {
|
||||
LedgerAccountStatusDTO toDTO() {
|
||||
switch (this) {
|
||||
case LedgerAccountStatus.unspecified:
|
||||
return LedgerAccountStatusDTO.unspecified;
|
||||
case LedgerAccountStatus.active:
|
||||
return LedgerAccountStatusDTO.active;
|
||||
case LedgerAccountStatus.frozen:
|
||||
return LedgerAccountStatusDTO.frozen;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
frontend/pshared/lib/data/mapper/ledger/type.dart
Normal file
37
frontend/pshared/lib/data/mapper/ledger/type.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:pshared/data/dto/ledger/type.dart';
|
||||
import 'package:pshared/models/ledger/type.dart';
|
||||
|
||||
|
||||
extension LedgerAccountTypeDTOMapper on LedgerAccountTypeDTO {
|
||||
LedgerAccountType toDomain() {
|
||||
switch (this) {
|
||||
case LedgerAccountTypeDTO.unspecified:
|
||||
return LedgerAccountType.unspecified;
|
||||
case LedgerAccountTypeDTO.asset:
|
||||
return LedgerAccountType.asset;
|
||||
case LedgerAccountTypeDTO.liability:
|
||||
return LedgerAccountType.liability;
|
||||
case LedgerAccountTypeDTO.revenue:
|
||||
return LedgerAccountType.revenue;
|
||||
case LedgerAccountTypeDTO.expense:
|
||||
return LedgerAccountType.expense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension LedgerAccountTypeModelMapper on LedgerAccountType {
|
||||
LedgerAccountTypeDTO toDTO() {
|
||||
switch (this) {
|
||||
case LedgerAccountType.unspecified:
|
||||
return LedgerAccountTypeDTO.unspecified;
|
||||
case LedgerAccountType.asset:
|
||||
return LedgerAccountTypeDTO.asset;
|
||||
case LedgerAccountType.liability:
|
||||
return LedgerAccountTypeDTO.liability;
|
||||
case LedgerAccountType.revenue:
|
||||
return LedgerAccountTypeDTO.revenue;
|
||||
case LedgerAccountType.expense:
|
||||
return LedgerAccountTypeDTO.expense;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
frontend/pshared/lib/data/mapper/wallet/chain_asset.dart
Normal file
18
frontend/pshared/lib/data/mapper/wallet/chain_asset.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:pshared/data/dto/wallet/chain_asset.dart';
|
||||
import 'package:pshared/data/mapper/payment/enums.dart';
|
||||
import 'package:pshared/models/wallet/chain_asset.dart';
|
||||
|
||||
|
||||
extension ChainAssetDTOMapper on ChainAssetDTO {
|
||||
ChainAsset toDomain() => ChainAsset(
|
||||
chain: chainNetworkFromValue(chain),
|
||||
tokenSymbol: tokenSymbol,
|
||||
);
|
||||
}
|
||||
|
||||
extension ChainAssetMapper on ChainAsset {
|
||||
ChainAssetDTO toDTO() => ChainAssetDTO(
|
||||
chain: chainNetworkToValue(chain),
|
||||
tokenSymbol: tokenSymbol,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user