41 lines
1.2 KiB
Dart
41 lines
1.2 KiB
Dart
import 'package:pshared/api/requests/payment/base.dart';
|
|
|
|
class InitiatePaymentsRequest extends PaymentBaseRequest {
|
|
final String quoteRef;
|
|
final String? intentRef;
|
|
final List<String>? intentRefs;
|
|
|
|
const InitiatePaymentsRequest({
|
|
required super.idempotencyKey,
|
|
super.metadata,
|
|
required this.quoteRef,
|
|
this.intentRef,
|
|
this.intentRefs,
|
|
});
|
|
|
|
factory InitiatePaymentsRequest.fromJson(Map<String, dynamic> json) {
|
|
return InitiatePaymentsRequest(
|
|
idempotencyKey: json['idempotencyKey'] as String,
|
|
metadata: (json['metadata'] as Map<String, dynamic>?)?.map(
|
|
(key, value) => MapEntry(key, value as String),
|
|
),
|
|
quoteRef: json['quoteRef'] as String,
|
|
intentRef: json['intentRef'] as String?,
|
|
intentRefs: (json['intentRefs'] as List<dynamic>?)
|
|
?.map((value) => value as String)
|
|
.toList(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() {
|
|
return <String, dynamic>{
|
|
'idempotencyKey': idempotencyKey,
|
|
'metadata': metadata,
|
|
'quoteRef': quoteRef,
|
|
if (intentRef != null) 'intentRef': intentRef,
|
|
if (intentRefs != null) 'intentRefs': intentRefs,
|
|
};
|
|
}
|
|
}
|