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