445 lines
12 KiB
Dart
445 lines
12 KiB
Dart
class PaymentRequestDetail {
|
|
bool success;
|
|
String message;
|
|
PaymentRequestData? data;
|
|
dynamic errors;
|
|
int statusCode;
|
|
DateTime timestamp;
|
|
|
|
PaymentRequestDetail({
|
|
required this.success,
|
|
required this.message,
|
|
this.data,
|
|
this.errors,
|
|
required this.statusCode,
|
|
required this.timestamp,
|
|
});
|
|
|
|
factory PaymentRequestDetail.fromJson(Map<String, dynamic> json) =>
|
|
PaymentRequestDetail(
|
|
success: json['success'],
|
|
message: json['message'],
|
|
data: json['data'] != null
|
|
? PaymentRequestData.fromJson(json['data'])
|
|
: null,
|
|
errors: json['errors'],
|
|
statusCode: json['statusCode'],
|
|
timestamp: DateTime.parse(json['timestamp']),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'success': success,
|
|
'message': message,
|
|
'data': data?.toJson(),
|
|
'errors': errors,
|
|
'statusCode': statusCode,
|
|
'timestamp': timestamp.toIso8601String(),
|
|
};
|
|
}
|
|
|
|
class PaymentRequestData {
|
|
String id;
|
|
String title;
|
|
String description;
|
|
String paymentRequestUID;
|
|
String payee;
|
|
Currency currency;
|
|
double amount;
|
|
double? baseAmount;
|
|
double? taxAmount;
|
|
DateTime dueDate;
|
|
Project project;
|
|
dynamic recurringPayment;
|
|
ExpenseCategory expenseCategory;
|
|
ExpenseStatus expenseStatus;
|
|
String? paidTransactionId;
|
|
DateTime? paidAt;
|
|
User? paidBy;
|
|
bool isAdvancePayment;
|
|
DateTime createdAt;
|
|
User createdBy;
|
|
DateTime updatedAt;
|
|
User? updatedBy;
|
|
List<NextStatus> nextStatus;
|
|
List<UpdateLog> updateLogs;
|
|
List<Attachment> attachments;
|
|
bool isActive;
|
|
bool isExpenseCreated;
|
|
|
|
PaymentRequestData({
|
|
required this.id,
|
|
required this.title,
|
|
required this.description,
|
|
required this.paymentRequestUID,
|
|
required this.payee,
|
|
required this.currency,
|
|
required this.amount,
|
|
this.baseAmount,
|
|
this.taxAmount,
|
|
required this.dueDate,
|
|
required this.project,
|
|
this.recurringPayment,
|
|
required this.expenseCategory,
|
|
required this.expenseStatus,
|
|
this.paidTransactionId,
|
|
this.paidAt,
|
|
this.paidBy,
|
|
required this.isAdvancePayment,
|
|
required this.createdAt,
|
|
required this.createdBy,
|
|
required this.updatedAt,
|
|
this.updatedBy,
|
|
required this.nextStatus,
|
|
required this.updateLogs,
|
|
required this.attachments,
|
|
required this.isActive,
|
|
required this.isExpenseCreated,
|
|
});
|
|
|
|
factory PaymentRequestData.fromJson(Map<String, dynamic> json) =>
|
|
PaymentRequestData(
|
|
id: json['id'],
|
|
title: json['title'],
|
|
description: json['description'],
|
|
paymentRequestUID: json['paymentRequestUID'],
|
|
payee: json['payee'],
|
|
currency: Currency.fromJson(json['currency']),
|
|
amount: (json['amount'] as num).toDouble(),
|
|
baseAmount: json['baseAmount'] != null
|
|
? (json['baseAmount'] as num).toDouble()
|
|
: null,
|
|
taxAmount: json['taxAmount'] != null
|
|
? (json['taxAmount'] as num).toDouble()
|
|
: null,
|
|
dueDate: DateTime.parse(json['dueDate']),
|
|
project: Project.fromJson(json['project']),
|
|
recurringPayment: json['recurringPayment'],
|
|
expenseCategory: ExpenseCategory.fromJson(json['expenseCategory']),
|
|
expenseStatus: ExpenseStatus.fromJson(json['expenseStatus']),
|
|
paidTransactionId: json['paidTransactionId'],
|
|
paidAt: json['paidAt'] != null ? DateTime.parse(json['paidAt']) : null,
|
|
paidBy:
|
|
json['paidBy'] != null ? User.fromJson(json['paidBy']) : null,
|
|
isAdvancePayment: json['isAdvancePayment'],
|
|
createdAt: DateTime.parse(json['createdAt']),
|
|
createdBy: User.fromJson(json['createdBy']),
|
|
updatedAt: DateTime.parse(json['updatedAt']),
|
|
updatedBy:
|
|
json['updatedBy'] != null ? User.fromJson(json['updatedBy']) : null,
|
|
nextStatus: (json['nextStatus'] as List<dynamic>)
|
|
.map((e) => NextStatus.fromJson(e))
|
|
.toList(),
|
|
updateLogs: (json['updateLogs'] as List<dynamic>)
|
|
.map((e) => UpdateLog.fromJson(e))
|
|
.toList(),
|
|
attachments: (json['attachments'] as List<dynamic>)
|
|
.map((e) => Attachment.fromJson(e))
|
|
.toList(),
|
|
isActive: json['isActive'],
|
|
isExpenseCreated: json['isExpenseCreated'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'title': title,
|
|
'description': description,
|
|
'paymentRequestUID': paymentRequestUID,
|
|
'payee': payee,
|
|
'currency': currency.toJson(),
|
|
'amount': amount,
|
|
'baseAmount': baseAmount,
|
|
'taxAmount': taxAmount,
|
|
'dueDate': dueDate.toIso8601String(),
|
|
'project': project.toJson(),
|
|
'recurringPayment': recurringPayment,
|
|
'expenseCategory': expenseCategory.toJson(),
|
|
'expenseStatus': expenseStatus.toJson(),
|
|
'paidTransactionId': paidTransactionId,
|
|
'paidAt': paidAt?.toIso8601String(),
|
|
'paidBy': paidBy?.toJson(),
|
|
'isAdvancePayment': isAdvancePayment,
|
|
'createdAt': createdAt.toIso8601String(),
|
|
'createdBy': createdBy.toJson(),
|
|
'updatedAt': updatedAt.toIso8601String(),
|
|
'updatedBy': updatedBy?.toJson(),
|
|
'nextStatus': nextStatus.map((e) => e.toJson()).toList(),
|
|
'updateLogs': updateLogs.map((e) => e.toJson()).toList(),
|
|
'attachments': attachments.map((e) => e.toJson()).toList(),
|
|
'isActive': isActive,
|
|
'isExpenseCreated': isExpenseCreated,
|
|
};
|
|
}
|
|
|
|
class Currency {
|
|
String id;
|
|
String currencyCode;
|
|
String currencyName;
|
|
String symbol;
|
|
bool isActive;
|
|
|
|
Currency({
|
|
required this.id,
|
|
required this.currencyCode,
|
|
required this.currencyName,
|
|
required this.symbol,
|
|
required this.isActive,
|
|
});
|
|
|
|
factory Currency.fromJson(Map<String, dynamic> json) => Currency(
|
|
id: json['id'],
|
|
currencyCode: json['currencyCode'],
|
|
currencyName: json['currencyName'],
|
|
symbol: json['symbol'],
|
|
isActive: json['isActive'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'currencyCode': currencyCode,
|
|
'currencyName': currencyName,
|
|
'symbol': symbol,
|
|
'isActive': isActive,
|
|
};
|
|
}
|
|
|
|
class Project {
|
|
String id;
|
|
String name;
|
|
|
|
Project({required this.id, required this.name});
|
|
|
|
factory Project.fromJson(Map<String, dynamic> json) =>
|
|
Project(id: json['id'], name: json['name']);
|
|
|
|
Map<String, dynamic> toJson() => {'id': id, 'name': name};
|
|
}
|
|
|
|
class ExpenseCategory {
|
|
String id;
|
|
String name;
|
|
bool noOfPersonsRequired;
|
|
bool isAttachmentRequried;
|
|
String description;
|
|
|
|
ExpenseCategory({
|
|
required this.id,
|
|
required this.name,
|
|
required this.noOfPersonsRequired,
|
|
required this.isAttachmentRequried,
|
|
required this.description,
|
|
});
|
|
|
|
factory ExpenseCategory.fromJson(Map<String, dynamic> json) =>
|
|
ExpenseCategory(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
noOfPersonsRequired: json['noOfPersonsRequired'],
|
|
isAttachmentRequried: json['isAttachmentRequried'],
|
|
description: json['description'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'noOfPersonsRequired': noOfPersonsRequired,
|
|
'isAttachmentRequried': isAttachmentRequried,
|
|
'description': description,
|
|
};
|
|
}
|
|
|
|
class ExpenseStatus {
|
|
String id;
|
|
String name;
|
|
String displayName;
|
|
String description;
|
|
List<String>? permissionIds;
|
|
String color;
|
|
bool isSystem;
|
|
|
|
ExpenseStatus({
|
|
required this.id,
|
|
required this.name,
|
|
required this.displayName,
|
|
required this.description,
|
|
this.permissionIds,
|
|
required this.color,
|
|
required this.isSystem,
|
|
});
|
|
|
|
factory ExpenseStatus.fromJson(Map<String, dynamic> json) => ExpenseStatus(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
displayName: json['displayName'],
|
|
description: json['description'],
|
|
permissionIds: json['permissionIds'] != null
|
|
? List<String>.from(json['permissionIds'])
|
|
: null,
|
|
color: json['color'],
|
|
isSystem: json['isSystem'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'displayName': displayName,
|
|
'description': description,
|
|
'permissionIds': permissionIds,
|
|
'color': color,
|
|
'isSystem': isSystem,
|
|
};
|
|
}
|
|
|
|
class User {
|
|
String id;
|
|
String firstName;
|
|
String lastName;
|
|
String email;
|
|
String photo;
|
|
String jobRoleId;
|
|
String jobRoleName;
|
|
|
|
User({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
required this.email,
|
|
required this.photo,
|
|
required this.jobRoleId,
|
|
required this.jobRoleName,
|
|
});
|
|
|
|
factory User.fromJson(Map<String, dynamic> json) => User(
|
|
id: json['id'],
|
|
firstName: json['firstName'],
|
|
lastName: json['lastName'],
|
|
email: json['email'],
|
|
photo: json['photo'],
|
|
jobRoleId: json['jobRoleId'],
|
|
jobRoleName: json['jobRoleName'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'firstName': firstName,
|
|
'lastName': lastName,
|
|
'email': email,
|
|
'photo': photo,
|
|
'jobRoleId': jobRoleId,
|
|
'jobRoleName': jobRoleName,
|
|
};
|
|
}
|
|
|
|
class NextStatus {
|
|
String id;
|
|
String name;
|
|
String displayName;
|
|
String description;
|
|
List<String>? permissionIds;
|
|
String color;
|
|
bool isSystem;
|
|
|
|
NextStatus({
|
|
required this.id,
|
|
required this.name,
|
|
required this.displayName,
|
|
required this.description,
|
|
this.permissionIds,
|
|
required this.color,
|
|
required this.isSystem,
|
|
});
|
|
|
|
factory NextStatus.fromJson(Map<String, dynamic> json) => NextStatus(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
displayName: json['displayName'],
|
|
description: json['description'],
|
|
permissionIds: json['permissionIds'] != null
|
|
? List<String>.from(json['permissionIds'])
|
|
: null,
|
|
color: json['color'],
|
|
isSystem: json['isSystem'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'displayName': displayName,
|
|
'description': description,
|
|
'permissionIds': permissionIds,
|
|
'color': color,
|
|
'isSystem': isSystem,
|
|
};
|
|
}
|
|
|
|
class UpdateLog {
|
|
String id;
|
|
ExpenseStatus status;
|
|
ExpenseStatus nextStatus;
|
|
String comment;
|
|
DateTime updatedAt;
|
|
User updatedBy;
|
|
|
|
UpdateLog({
|
|
required this.id,
|
|
required this.status,
|
|
required this.nextStatus,
|
|
required this.comment,
|
|
required this.updatedAt,
|
|
required this.updatedBy,
|
|
});
|
|
|
|
factory UpdateLog.fromJson(Map<String, dynamic> json) => UpdateLog(
|
|
id: json['id'],
|
|
status: ExpenseStatus.fromJson(json['status']),
|
|
nextStatus: ExpenseStatus.fromJson(json['nextStatus']),
|
|
comment: json['comment'],
|
|
updatedAt: DateTime.parse(json['updatedAt']),
|
|
updatedBy: User.fromJson(json['updatedBy']),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'status': status.toJson(),
|
|
'nextStatus': nextStatus.toJson(),
|
|
'comment': comment,
|
|
'updatedAt': updatedAt.toIso8601String(),
|
|
'updatedBy': updatedBy.toJson(),
|
|
};
|
|
}
|
|
|
|
class Attachment {
|
|
String id;
|
|
String fileName;
|
|
String url;
|
|
String? thumbUrl;
|
|
int fileSize;
|
|
String contentType;
|
|
|
|
Attachment({
|
|
required this.id,
|
|
required this.fileName,
|
|
required this.url,
|
|
this.thumbUrl,
|
|
required this.fileSize,
|
|
required this.contentType,
|
|
});
|
|
|
|
factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
|
|
id: json['id'],
|
|
fileName: json['fileName'],
|
|
url: json['url'],
|
|
thumbUrl: json['thumbUrl'],
|
|
fileSize: json['fileSize'],
|
|
contentType: json['contentType'],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'fileName': fileName,
|
|
'url': url,
|
|
'thumbUrl': thumbUrl,
|
|
'fileSize': fileSize,
|
|
'contentType': contentType,
|
|
};
|
|
}
|