progress on batches
This commit is contained in:
143
lib/screens/groups/models/group_batch_model.dart
Normal file
143
lib/screens/groups/models/group_batch_model.dart
Normal file
@@ -0,0 +1,143 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'group_batch_model.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GroupBatch {
|
||||
final String? id;
|
||||
final String? recipientGroupId;
|
||||
final String? userId;
|
||||
final String? currency;
|
||||
final String? description;
|
||||
final double? value;
|
||||
final String? status;
|
||||
final String? paymentProcessorLabel;
|
||||
final String? paymentProcessorName;
|
||||
final String? paymentProcessorImage;
|
||||
final String? transactionTemplate;
|
||||
final String? createdAt;
|
||||
final int? count;
|
||||
final int? successfulCount;
|
||||
final int? failedCount;
|
||||
|
||||
const GroupBatch({
|
||||
this.id,
|
||||
this.recipientGroupId,
|
||||
this.userId,
|
||||
this.currency,
|
||||
this.description,
|
||||
this.value,
|
||||
this.status,
|
||||
this.paymentProcessorLabel,
|
||||
this.paymentProcessorName,
|
||||
this.paymentProcessorImage,
|
||||
this.transactionTemplate,
|
||||
this.createdAt,
|
||||
this.count,
|
||||
this.successfulCount,
|
||||
this.failedCount,
|
||||
});
|
||||
|
||||
factory GroupBatch.fromJson(Map<String, dynamic> json) =>
|
||||
_$GroupBatchFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$GroupBatchToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GroupBatchItem {
|
||||
final String? id;
|
||||
final String? groupBatchId;
|
||||
final String? recipientName;
|
||||
final String? recipientPhone;
|
||||
final double? amount;
|
||||
final String? status;
|
||||
final String? transactionId;
|
||||
final String? errorMessage;
|
||||
final String? createdAt;
|
||||
|
||||
const GroupBatchItem({
|
||||
this.id,
|
||||
this.groupBatchId,
|
||||
this.recipientName,
|
||||
this.recipientPhone,
|
||||
this.amount,
|
||||
this.status,
|
||||
this.transactionId,
|
||||
this.errorMessage,
|
||||
this.createdAt,
|
||||
});
|
||||
|
||||
factory GroupBatchItem.fromJson(Map<String, dynamic> json) =>
|
||||
_$GroupBatchItemFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$GroupBatchItemToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class CreateBatchRequest {
|
||||
final String recipientGroupId;
|
||||
final String userId;
|
||||
final String currency;
|
||||
final String description;
|
||||
final double amount;
|
||||
final String? paymentProcessorLabel;
|
||||
final String? paymentProcessorName;
|
||||
final String? paymentProcessorImage;
|
||||
final Map<String, dynamic> transactionTemplate;
|
||||
|
||||
const CreateBatchRequest({
|
||||
required this.recipientGroupId,
|
||||
required this.userId,
|
||||
required this.currency,
|
||||
required this.description,
|
||||
required this.amount,
|
||||
this.paymentProcessorLabel,
|
||||
this.paymentProcessorName,
|
||||
this.paymentProcessorImage,
|
||||
required this.transactionTemplate,
|
||||
});
|
||||
|
||||
factory CreateBatchRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateBatchRequestFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$CreateBatchRequestToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class BatchActionRequest {
|
||||
final String userId;
|
||||
final String idempotencyKey;
|
||||
|
||||
const BatchActionRequest({
|
||||
required this.userId,
|
||||
required this.idempotencyKey,
|
||||
});
|
||||
|
||||
factory BatchActionRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$BatchActionRequestFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$BatchActionRequestToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GroupBatchUpdateRequest {
|
||||
String? id;
|
||||
String? userId;
|
||||
String? paymentProcessorLabel;
|
||||
String? paymentProcessorName;
|
||||
String? paymentProcessorImage;
|
||||
|
||||
GroupBatchUpdateRequest({
|
||||
this.id,
|
||||
this.userId,
|
||||
this.paymentProcessorLabel,
|
||||
this.paymentProcessorName,
|
||||
this.paymentProcessorImage,
|
||||
});
|
||||
|
||||
factory GroupBatchUpdateRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$GroupBatchUpdateRequestFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$GroupBatchUpdateRequestToJson(this);
|
||||
}
|
||||
128
lib/screens/groups/models/group_batch_model.g.dart
Normal file
128
lib/screens/groups/models/group_batch_model.g.dart
Normal file
@@ -0,0 +1,128 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'group_batch_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
GroupBatch _$GroupBatchFromJson(Map<String, dynamic> json) => GroupBatch(
|
||||
id: json['id'] as String?,
|
||||
recipientGroupId: json['recipientGroupId'] as String?,
|
||||
userId: json['userId'] as String?,
|
||||
currency: json['currency'] as String?,
|
||||
description: json['description'] as String?,
|
||||
value: (json['value'] as num?)?.toDouble(),
|
||||
status: json['status'] as String?,
|
||||
paymentProcessorLabel: json['paymentProcessorLabel'] as String?,
|
||||
paymentProcessorName: json['paymentProcessorName'] as String?,
|
||||
paymentProcessorImage: json['paymentProcessorImage'] as String?,
|
||||
transactionTemplate: json['transactionTemplate'] as String?,
|
||||
createdAt: json['createdAt'] as String?,
|
||||
count: (json['count'] as num?)?.toInt(),
|
||||
successfulCount: (json['successfulCount'] as num?)?.toInt(),
|
||||
failedCount: (json['failedCount'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GroupBatchToJson(GroupBatch instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'recipientGroupId': instance.recipientGroupId,
|
||||
'userId': instance.userId,
|
||||
'currency': instance.currency,
|
||||
'description': instance.description,
|
||||
'value': instance.value,
|
||||
'status': instance.status,
|
||||
'paymentProcessorLabel': instance.paymentProcessorLabel,
|
||||
'paymentProcessorName': instance.paymentProcessorName,
|
||||
'paymentProcessorImage': instance.paymentProcessorImage,
|
||||
'transactionTemplate': instance.transactionTemplate,
|
||||
'createdAt': instance.createdAt,
|
||||
'count': instance.count,
|
||||
'successfulCount': instance.successfulCount,
|
||||
'failedCount': instance.failedCount,
|
||||
};
|
||||
|
||||
GroupBatchItem _$GroupBatchItemFromJson(Map<String, dynamic> json) =>
|
||||
GroupBatchItem(
|
||||
id: json['id'] as String?,
|
||||
groupBatchId: json['groupBatchId'] as String?,
|
||||
recipientName: json['recipientName'] as String?,
|
||||
recipientPhone: json['recipientPhone'] as String?,
|
||||
amount: (json['amount'] as num?)?.toDouble(),
|
||||
status: json['status'] as String?,
|
||||
transactionId: json['transactionId'] as String?,
|
||||
errorMessage: json['errorMessage'] as String?,
|
||||
createdAt: json['createdAt'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GroupBatchItemToJson(GroupBatchItem instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'groupBatchId': instance.groupBatchId,
|
||||
'recipientName': instance.recipientName,
|
||||
'recipientPhone': instance.recipientPhone,
|
||||
'amount': instance.amount,
|
||||
'status': instance.status,
|
||||
'transactionId': instance.transactionId,
|
||||
'errorMessage': instance.errorMessage,
|
||||
'createdAt': instance.createdAt,
|
||||
};
|
||||
|
||||
CreateBatchRequest _$CreateBatchRequestFromJson(Map<String, dynamic> json) =>
|
||||
CreateBatchRequest(
|
||||
recipientGroupId: json['recipientGroupId'] as String,
|
||||
userId: json['userId'] as String,
|
||||
currency: json['currency'] as String,
|
||||
description: json['description'] as String,
|
||||
amount: (json['amount'] as num).toDouble(),
|
||||
paymentProcessorLabel: json['paymentProcessorLabel'] as String?,
|
||||
paymentProcessorName: json['paymentProcessorName'] as String?,
|
||||
paymentProcessorImage: json['paymentProcessorImage'] as String?,
|
||||
transactionTemplate: json['transactionTemplate'] as Map<String, dynamic>,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateBatchRequestToJson(CreateBatchRequest instance) =>
|
||||
<String, dynamic>{
|
||||
'recipientGroupId': instance.recipientGroupId,
|
||||
'userId': instance.userId,
|
||||
'currency': instance.currency,
|
||||
'description': instance.description,
|
||||
'amount': instance.amount,
|
||||
'paymentProcessorLabel': instance.paymentProcessorLabel,
|
||||
'paymentProcessorName': instance.paymentProcessorName,
|
||||
'paymentProcessorImage': instance.paymentProcessorImage,
|
||||
'transactionTemplate': instance.transactionTemplate,
|
||||
};
|
||||
|
||||
BatchActionRequest _$BatchActionRequestFromJson(Map<String, dynamic> json) =>
|
||||
BatchActionRequest(
|
||||
userId: json['userId'] as String,
|
||||
idempotencyKey: json['idempotencyKey'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$BatchActionRequestToJson(BatchActionRequest instance) =>
|
||||
<String, dynamic>{
|
||||
'userId': instance.userId,
|
||||
'idempotencyKey': instance.idempotencyKey,
|
||||
};
|
||||
|
||||
GroupBatchUpdateRequest _$GroupBatchUpdateRequestFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => GroupBatchUpdateRequest(
|
||||
id: json['id'] as String?,
|
||||
userId: json['userId'] as String?,
|
||||
paymentProcessorLabel: json['paymentProcessorLabel'] as String?,
|
||||
paymentProcessorName: json['paymentProcessorName'] as String?,
|
||||
paymentProcessorImage: json['paymentProcessorImage'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GroupBatchUpdateRequestToJson(
|
||||
GroupBatchUpdateRequest instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'userId': instance.userId,
|
||||
'paymentProcessorLabel': instance.paymentProcessorLabel,
|
||||
'paymentProcessorName': instance.paymentProcessorName,
|
||||
'paymentProcessorImage': instance.paymentProcessorImage,
|
||||
};
|
||||
72
lib/screens/groups/models/recipient_group_model.dart
Normal file
72
lib/screens/groups/models/recipient_group_model.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:qpay/screens/recipient/recipients_controller.dart';
|
||||
|
||||
part 'recipient_group_model.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class RecipientGroup {
|
||||
final String? id;
|
||||
final String name;
|
||||
final String? description;
|
||||
final String? userId;
|
||||
final String? createdAt;
|
||||
|
||||
const RecipientGroup({
|
||||
this.id,
|
||||
required this.name,
|
||||
this.description,
|
||||
this.userId,
|
||||
this.createdAt,
|
||||
});
|
||||
|
||||
factory RecipientGroup.fromJson(Map<String, dynamic> json) =>
|
||||
_$RecipientGroupFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$RecipientGroupToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class RecipientGroupMember {
|
||||
final String? id;
|
||||
final String recipientGroupId;
|
||||
final String? recipientUid;
|
||||
final String? userId;
|
||||
final String? account;
|
||||
final String? createdAt;
|
||||
final Recipient recipient;
|
||||
|
||||
const RecipientGroupMember({
|
||||
this.id,
|
||||
required this.recipientGroupId,
|
||||
this.recipientUid,
|
||||
this.userId,
|
||||
this.account,
|
||||
this.createdAt,
|
||||
required this.recipient,
|
||||
});
|
||||
|
||||
factory RecipientGroupMember.fromJson(Map<String, dynamic> json) =>
|
||||
_$RecipientGroupMemberFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$RecipientGroupMemberToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class CreateGroupRequest {
|
||||
final String name;
|
||||
final String? description;
|
||||
final String userId;
|
||||
final List<Recipient> recipients;
|
||||
|
||||
const CreateGroupRequest({
|
||||
required this.name,
|
||||
this.description,
|
||||
required this.userId,
|
||||
required this.recipients,
|
||||
});
|
||||
|
||||
factory CreateGroupRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateGroupRequestFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$CreateGroupRequestToJson(this);
|
||||
}
|
||||
67
lib/screens/groups/models/recipient_group_model.g.dart
Normal file
67
lib/screens/groups/models/recipient_group_model.g.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'recipient_group_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
RecipientGroup _$RecipientGroupFromJson(Map<String, dynamic> json) =>
|
||||
RecipientGroup(
|
||||
id: json['id'] as String?,
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String?,
|
||||
userId: json['userId'] as String?,
|
||||
createdAt: json['createdAt'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RecipientGroupToJson(RecipientGroup instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'userId': instance.userId,
|
||||
'createdAt': instance.createdAt,
|
||||
};
|
||||
|
||||
RecipientGroupMember _$RecipientGroupMemberFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => RecipientGroupMember(
|
||||
id: json['id'] as String?,
|
||||
recipientGroupId: json['recipientGroupId'] as String,
|
||||
recipientUid: json['recipientUid'] as String?,
|
||||
userId: json['userId'] as String?,
|
||||
account: json['account'] as String?,
|
||||
createdAt: json['createdAt'] as String?,
|
||||
recipient: Recipient.fromJson(json['recipient'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RecipientGroupMemberToJson(
|
||||
RecipientGroupMember instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'recipientGroupId': instance.recipientGroupId,
|
||||
'recipientUid': instance.recipientUid,
|
||||
'userId': instance.userId,
|
||||
'account': instance.account,
|
||||
'createdAt': instance.createdAt,
|
||||
'recipient': instance.recipient.toJson(),
|
||||
};
|
||||
|
||||
CreateGroupRequest _$CreateGroupRequestFromJson(Map<String, dynamic> json) =>
|
||||
CreateGroupRequest(
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String?,
|
||||
userId: json['userId'] as String,
|
||||
recipients: (json['recipients'] as List<dynamic>)
|
||||
.map((e) => Recipient.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateGroupRequestToJson(CreateGroupRequest instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'userId': instance.userId,
|
||||
'recipients': instance.recipients.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
Reference in New Issue
Block a user