+ 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,20 @@
import 'package:json_annotation/json_annotation.dart';
part 'base.g.dart';
@JsonSerializable()
class PaymentBaseRequest {
final String idempotencyKey;
final Map<String, String>? metadata;
const PaymentBaseRequest({
required this.idempotencyKey,
this.metadata,
});
factory PaymentBaseRequest.fromJson(Map<String, dynamic> json) => _$PaymentBaseRequestFromJson(json);
Map<String, dynamic> toJson() => _$PaymentBaseRequestToJson(this);
}

View File

@@ -0,0 +1,24 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/api/requests/payment/base.dart';
import 'package:pshared/data/dto/payment/intent/payment.dart';
part 'initiate.g.dart';
@JsonSerializable()
class InitiatePaymentRequest extends PaymentBaseRequest {
final PaymentIntentDTO? intent;
final String? quoteRef;
const InitiatePaymentRequest({
required super.idempotencyKey,
super.metadata,
this.intent,
this.quoteRef,
});
factory InitiatePaymentRequest.fromJson(Map<String, dynamic> json) => _$InitiatePaymentRequestFromJson(json);
@override
Map<String, dynamic> toJson() => _$InitiatePaymentRequestToJson(this);
}

View File

@@ -0,0 +1,26 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/api/requests/payment/base.dart';
import 'package:pshared/data/dto/payment/intent/payment.dart';
part 'quote.g.dart';
@JsonSerializable()
class QuotePaymentRequest extends PaymentBaseRequest {
final PaymentIntentDTO intent;
@JsonKey(defaultValue: false)
final bool previewOnly;
const QuotePaymentRequest({
required super.idempotencyKey,
super.metadata,
required this.intent,
this.previewOnly = false,
});
factory QuotePaymentRequest.fromJson(Map<String, dynamic> json) => _$QuotePaymentRequestFromJson(json);
@override
Map<String, dynamic> toJson() => _$QuotePaymentRequestToJson(this);
}

View File

@@ -0,0 +1,20 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/api/responses/base.dart';
import 'package:pshared/api/responses/token.dart';
import 'package:pshared/data/dto/payment/payment_quote.dart';
part 'quotation.g.dart';
@JsonSerializable(explicitToJson: true)
class PaymentQuoteResponse extends BaseAuthorizedResponse {
final PaymentQuoteDTO quote;
const PaymentQuoteResponse({required super.accessToken, required this.quote});
factory PaymentQuoteResponse.fromJson(Map<String, dynamic> json) => _$PaymentQuoteResponseFromJson(json);
@override
Map<String, dynamic> toJson() => _$PaymentQuoteResponseToJson(this);
}