+ quotation provider

This commit is contained in:
Stephan D
2025-12-11 01:13:13 +01:00
parent bdf766075e
commit a4481fb63d
102 changed files with 2242 additions and 246 deletions

View File

@@ -0,0 +1,24 @@
import 'package:json_annotation/json_annotation.dart';
part 'asset.g.dart';
@JsonSerializable()
class AssetDTO {
final String chain;
@JsonKey(name: 'token_symbol')
final String tokenSymbol;
@JsonKey(name: 'contract_address')
final String? contractAddress;
const AssetDTO({
required this.chain,
required this.tokenSymbol,
this.contractAddress,
});
factory AssetDTO.fromJson(Map<String, dynamic> json) => _$AssetDTOFromJson(json);
Map<String, dynamic> toJson() => _$AssetDTOToJson(this);
}

View File

@@ -4,17 +4,28 @@ part 'card.g.dart';
@JsonSerializable()
class CardPaymentDataDTO {
class CardEndpointDTO {
final String pan;
final String firstName;
final String lastName;
const CardPaymentDataDTO({
@JsonKey(name: 'exp_month')
final int? expMonth;
@JsonKey(name: 'exp_year')
final int? expYear;
final String? country;
const CardEndpointDTO({
required this.pan,
required this.firstName,
required this.lastName,
required this.expMonth,
required this.expYear,
this.country,
});
factory CardPaymentDataDTO.fromJson(Map<String, dynamic> json) => _$CardPaymentDataDTOFromJson(json);
Map<String, dynamic> toJson() => _$CardPaymentDataDTOToJson(this);
factory CardEndpointDTO.fromJson(Map<String, dynamic> json) => _$CardEndpointDTOFromJson(json);
Map<String, dynamic> toJson() => _$CardEndpointDTOToJson(this);
}

View File

@@ -0,0 +1,20 @@
import 'package:json_annotation/json_annotation.dart';
part 'card_token.g.dart';
@JsonSerializable()
class CardTokenEndpointDTO {
final String token;
@JsonKey(name: 'masked_pan')
final String maskedPan;
const CardTokenEndpointDTO({
required this.maskedPan,
required this.token,
});
factory CardTokenEndpointDTO.fromJson(Map<String, dynamic> json) => _$CardTokenEndpointDTOFromJson(json);
Map<String, dynamic> toJson() => _$CardTokenEndpointDTOToJson(this);
}

View File

@@ -1,20 +0,0 @@
import 'package:json_annotation/json_annotation.dart';
part 'crypto_address.g.dart';
@JsonSerializable()
class CryptoAddressPaymentDataDTO {
final String address;
final String network;
final String? destinationTag;
const CryptoAddressPaymentDataDTO({
required this.address,
required this.network,
this.destinationTag,
});
factory CryptoAddressPaymentDataDTO.fromJson(Map<String, dynamic> json) => _$CryptoAddressPaymentDataDTOFromJson(json);
Map<String, dynamic> toJson() => _$CryptoAddressPaymentDataDTOToJson(this);
}

View File

@@ -0,0 +1,18 @@
import 'package:json_annotation/json_annotation.dart';
part 'currency_pair.g.dart';
@JsonSerializable()
class CurrencyPairDTO {
final String base;
final String quote;
const CurrencyPairDTO({
required this.base,
required this.quote,
});
factory CurrencyPairDTO.fromJson(Map<String, dynamic> json) => _$CurrencyPairDTOFromJson(json);
Map<String, dynamic> toJson() => _$CurrencyPairDTOToJson(this);
}

View File

@@ -0,0 +1,20 @@
import 'package:json_annotation/json_annotation.dart';
part 'endpoint.g.dart';
@JsonSerializable()
class PaymentEndpointDTO {
final String type;
final Map<String, dynamic> data;
final Map<String, String>? metadata;
const PaymentEndpointDTO({
required this.type,
required this.data,
this.metadata,
});
factory PaymentEndpointDTO.fromJson(Map<String, dynamic> json) => _$PaymentEndpointDTOFromJson(json);
Map<String, dynamic> toJson() => _$PaymentEndpointDTOToJson(this);
}

View File

@@ -0,0 +1,22 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/asset.dart';
part 'external_chain.g.dart';
@JsonSerializable()
class ExternalChainEndpointDTO {
final AssetDTO? asset;
final String address;
final String? memo;
const ExternalChainEndpointDTO({
this.asset,
required this.address,
this.memo,
});
factory ExternalChainEndpointDTO.fromJson(Map<String, dynamic> json) => _$ExternalChainEndpointDTOFromJson(json);
Map<String, dynamic> toJson() => _$ExternalChainEndpointDTOToJson(this);
}

View File

@@ -0,0 +1,26 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/money.dart';
part 'fee_line.g.dart';
@JsonSerializable()
class FeeLineDTO {
final String? ledgerAccountRef;
final MoneyDTO? amount;
final String? lineType;
final String? side;
final Map<String, String>? meta;
const FeeLineDTO({
this.ledgerAccountRef,
this.amount,
this.lineType,
this.side,
this.meta,
});
factory FeeLineDTO.fromJson(Map<String, dynamic> json) => _$FeeLineDTOFromJson(json);
Map<String, dynamic> toJson() => _$FeeLineDTOToJson(this);
}

View File

@@ -0,0 +1,40 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/money.dart';
part 'fx_quote.g.dart';
@JsonSerializable()
class FxQuoteDTO {
final String? quoteRef;
final String? baseCurrency;
final String? quoteCurrency;
final String? side;
final String? price;
final MoneyDTO? baseAmount;
final MoneyDTO? quoteAmount;
final int? expiresAtUnixMs;
final String? provider;
final String? rateRef;
@JsonKey(defaultValue: false)
final bool? firm;
const FxQuoteDTO({
this.quoteRef,
this.baseCurrency,
this.quoteCurrency,
this.side,
this.price,
this.baseAmount,
this.quoteAmount,
this.expiresAtUnixMs,
this.provider,
this.rateRef,
this.firm = false,
});
factory FxQuoteDTO.fromJson(Map<String, dynamic> json) => _$FxQuoteDTOFromJson(json);
Map<String, dynamic> toJson() => _$FxQuoteDTOToJson(this);
}

View File

@@ -0,0 +1,34 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/currency_pair.dart';
part 'fx.g.dart';
@JsonSerializable()
class FxIntentDTO {
final CurrencyPairDTO? pair;
final String? side;
final bool firm;
@JsonKey(name: 'ttl_ms')
final int? ttlMs;
@JsonKey(name: 'preferred_provider')
final String? preferredProvider;
@JsonKey(name: 'max_age_ms')
final int? maxAgeMs;
const FxIntentDTO({
this.pair,
this.side,
this.firm = false,
this.ttlMs,
this.preferredProvider,
this.maxAgeMs,
});
factory FxIntentDTO.fromJson(Map<String, dynamic> json) => _$FxIntentDTOFromJson(json);
Map<String, dynamic> toJson() => _$FxIntentDTOToJson(this);
}

View File

@@ -0,0 +1,36 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/endpoint.dart';
import 'package:pshared/data/dto/payment/intent/fx.dart';
import 'package:pshared/data/dto/payment/money.dart';
part 'payment.g.dart';
@JsonSerializable()
class PaymentIntentDTO {
final String? kind;
final PaymentEndpointDTO? source;
final PaymentEndpointDTO? destination;
final MoneyDTO? amount;
final FxIntentDTO? fx;
@JsonKey(name: 'settlement_mode')
final String? settlementMode;
final Map<String, String>? attributes;
const PaymentIntentDTO({
this.kind,
this.source,
this.destination,
this.amount,
this.fx,
this.settlementMode,
this.attributes,
});
factory PaymentIntentDTO.fromJson(Map<String, dynamic> json) => _$PaymentIntentDTOFromJson(json);
Map<String, dynamic> toJson() => _$PaymentIntentDTOToJson(this);
}

View File

@@ -0,0 +1,21 @@
import 'package:json_annotation/json_annotation.dart';
part 'ledger.g.dart';
@JsonSerializable()
class LedgerEndpointDTO {
@JsonKey(name: 'ledger_account_ref')
final String ledgerAccountRef;
@JsonKey(name: 'contra_ledger_account_ref')
final String? contraLedgerAccountRef;
const LedgerEndpointDTO({
required this.ledgerAccountRef,
this.contraLedgerAccountRef,
});
factory LedgerEndpointDTO.fromJson(Map<String, dynamic> json) => _$LedgerEndpointDTOFromJson(json);
Map<String, dynamic> toJson() => _$LedgerEndpointDTOToJson(this);
}

View File

@@ -0,0 +1,22 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/asset.dart';
part 'managed_wallet.g.dart';
@JsonSerializable()
class ManagedWalletEndpointDTO {
@JsonKey(name: 'managed_wallet_ref')
final String managedWalletRef;
final AssetDTO? asset;
const ManagedWalletEndpointDTO({
required this.managedWalletRef,
this.asset,
});
factory ManagedWalletEndpointDTO.fromJson(Map<String, dynamic> json) => _$ManagedWalletEndpointDTOFromJson(json);
Map<String, dynamic> toJson() => _$ManagedWalletEndpointDTOToJson(this);
}

View File

@@ -0,0 +1,18 @@
import 'package:json_annotation/json_annotation.dart';
part 'money.g.dart';
@JsonSerializable()
class MoneyDTO {
final String amount;
final String currency;
const MoneyDTO({
required this.amount,
required this.currency,
});
factory MoneyDTO.fromJson(Map<String, dynamic> json) => _$MoneyDTOFromJson(json);
Map<String, dynamic> toJson() => _$MoneyDTOToJson(this);
}

View File

@@ -0,0 +1,20 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/money.dart';
part 'network_fee.g.dart';
@JsonSerializable()
class NetworkFeeDTO {
final MoneyDTO? networkFee;
final String? estimationContext;
const NetworkFeeDTO({
this.networkFee,
this.estimationContext,
});
factory NetworkFeeDTO.fromJson(Map<String, dynamic> json) => _$NetworkFeeDTOFromJson(json);
Map<String, dynamic> toJson() => _$NetworkFeeDTOToJson(this);
}

View File

@@ -0,0 +1,28 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/payment/payment_quote.dart';
part 'payment.g.dart';
@JsonSerializable()
class PaymentDTO {
final String? paymentRef;
final String? idempotencyKey;
final String? state;
final String? failureCode;
final String? failureReason;
final PaymentQuoteDTO? lastQuote;
const PaymentDTO({
this.paymentRef,
this.idempotencyKey,
this.state,
this.failureCode,
this.failureReason,
this.lastQuote,
});
factory PaymentDTO.fromJson(Map<String, dynamic> json) => _$PaymentDTOFromJson(json);
Map<String, dynamic> toJson() => _$PaymentDTOToJson(this);
}

View File

@@ -0,0 +1,35 @@
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/payment/network_fee.dart';
part 'payment_quote.g.dart';
@JsonSerializable()
class PaymentQuoteDTO {
final String? quoteRef;
final MoneyDTO? debitAmount;
final MoneyDTO? expectedSettlementAmount;
final MoneyDTO? expectedFeeTotal;
final String? feeQuoteToken;
final List<FeeLineDTO>? feeLines;
final NetworkFeeDTO? networkFee;
final FxQuoteDTO? fxQuote;
const PaymentQuoteDTO({
this.quoteRef,
this.debitAmount,
this.expectedSettlementAmount,
this.expectedFeeTotal,
this.feeQuoteToken,
this.feeLines,
this.networkFee,
this.fxQuote,
});
factory PaymentQuoteDTO.fromJson(Map<String, dynamic> json) => _$PaymentQuoteDTOFromJson(json);
Map<String, dynamic> toJson() => _$PaymentQuoteDTOToJson(this);
}