+ quotation provider
This commit is contained in:
20
frontend/pshared/lib/api/requests/payment/base.dart
Normal file
20
frontend/pshared/lib/api/requests/payment/base.dart
Normal 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);
|
||||
|
||||
}
|
||||
24
frontend/pshared/lib/api/requests/payment/initiate.dart
Normal file
24
frontend/pshared/lib/api/requests/payment/initiate.dart
Normal 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);
|
||||
}
|
||||
26
frontend/pshared/lib/api/requests/payment/quote.dart
Normal file
26
frontend/pshared/lib/api/requests/payment/quote.dart
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user