small fixes for single payout and big chunck for multiple payouts
This commit is contained in:
@@ -13,6 +13,8 @@ class PaymentDTO {
|
||||
final String? failureCode;
|
||||
final String? failureReason;
|
||||
final PaymentQuoteDTO? lastQuote;
|
||||
final Map<String, String>? metadata;
|
||||
final String? createdAt;
|
||||
|
||||
const PaymentDTO({
|
||||
this.paymentRef,
|
||||
@@ -21,6 +23,8 @@ class PaymentDTO {
|
||||
this.failureCode,
|
||||
this.failureReason,
|
||||
this.lastQuote,
|
||||
this.metadata,
|
||||
this.createdAt,
|
||||
});
|
||||
|
||||
factory PaymentDTO.fromJson(Map<String, dynamic> json) => _$PaymentDTOFromJson(json);
|
||||
|
||||
@@ -5,19 +5,21 @@ import 'package:pshared/data/dto/payment/payment_quote.dart';
|
||||
|
||||
part 'quotes.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class PaymentQuotesDTO {
|
||||
final String quoteRef;
|
||||
final String? idempotencyKey;
|
||||
final PaymentQuoteAggregateDTO? aggregate;
|
||||
final List<PaymentQuoteDTO>? quotes;
|
||||
|
||||
const PaymentQuotesDTO({
|
||||
required this.quoteRef,
|
||||
this.idempotencyKey,
|
||||
this.aggregate,
|
||||
this.quotes,
|
||||
});
|
||||
|
||||
factory PaymentQuotesDTO.fromJson(Map<String, dynamic> json) => _$PaymentQuotesDTOFromJson(json);
|
||||
factory PaymentQuotesDTO.fromJson(Map<String, dynamic> json) =>
|
||||
_$PaymentQuotesDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$PaymentQuotesDTOToJson(this);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ extension PaymentDTOMapper on PaymentDTO {
|
||||
failureCode: failureCode,
|
||||
failureReason: failureReason,
|
||||
lastQuote: lastQuote?.toDomain(),
|
||||
metadata: metadata,
|
||||
createdAt: createdAt == null ? null : DateTime.tryParse(createdAt!),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,5 +24,7 @@ extension PaymentMapper on Payment {
|
||||
failureCode: failureCode,
|
||||
failureReason: failureReason,
|
||||
lastQuote: lastQuote?.toDTO(),
|
||||
metadata: metadata,
|
||||
createdAt: createdAt?.toUtc().toIso8601String(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@ import 'package:pshared/data/mapper/payment/payment_quote.dart';
|
||||
import 'package:pshared/data/mapper/payment/quote/aggregate.dart';
|
||||
import 'package:pshared/models/payment/quote/quotes.dart';
|
||||
|
||||
|
||||
extension PaymentQuotesDTOMapper on PaymentQuotesDTO {
|
||||
PaymentQuotes toDomain({String? idempotencyKey}) => PaymentQuotes(
|
||||
quoteRef: quoteRef,
|
||||
idempotencyKey: idempotencyKey,
|
||||
idempotencyKey: idempotencyKey ?? this.idempotencyKey,
|
||||
aggregate: aggregate?.toDomain(),
|
||||
quotes: quotes?.map((quote) => quote.toDomain()).toList(),
|
||||
);
|
||||
@@ -16,6 +15,7 @@ extension PaymentQuotesDTOMapper on PaymentQuotesDTO {
|
||||
extension PaymentQuotesMapper on PaymentQuotes {
|
||||
PaymentQuotesDTO toDTO() => PaymentQuotesDTO(
|
||||
quoteRef: quoteRef,
|
||||
idempotencyKey: idempotencyKey,
|
||||
aggregate: aggregate?.toDTO(),
|
||||
quotes: quotes?.map((quote) => quote.toDTO()).toList(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user