365 lines
9.8 KiB
Dart
365 lines
9.8 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;
|
|
String? paidBy;
|
|
bool isAdvancePayment;
|
|
DateTime createdAt;
|
|
CreatedBy createdBy;
|
|
DateTime updatedAt;
|
|
dynamic updatedBy;
|
|
List<NextStatus> nextStatus;
|
|
List<dynamic> updateLogs;
|
|
List<dynamic> 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'],
|
|
isAdvancePayment: json['isAdvancePayment'],
|
|
createdAt: DateTime.parse(json['createdAt']),
|
|
createdBy: CreatedBy.fromJson(json['createdBy']),
|
|
updatedAt: DateTime.parse(json['updatedAt']),
|
|
updatedBy: json['updatedBy'],
|
|
nextStatus: (json['nextStatus'] as List<dynamic>)
|
|
.map((e) => NextStatus.fromJson(e))
|
|
.toList(),
|
|
updateLogs: json['updateLogs'] ?? [],
|
|
attachments: json['attachments'] ?? [],
|
|
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,
|
|
'isAdvancePayment': isAdvancePayment,
|
|
'createdAt': createdAt.toIso8601String(),
|
|
'createdBy': createdBy.toJson(),
|
|
'updatedAt': updatedAt.toIso8601String(),
|
|
'updatedBy': updatedBy,
|
|
'nextStatus': nextStatus.map((e) => e.toJson()).toList(),
|
|
'updateLogs': updateLogs,
|
|
'attachments': attachments,
|
|
'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 CreatedBy {
|
|
String id;
|
|
String firstName;
|
|
String lastName;
|
|
String email;
|
|
String photo;
|
|
String jobRoleId;
|
|
String jobRoleName;
|
|
|
|
CreatedBy({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
required this.email,
|
|
required this.photo,
|
|
required this.jobRoleId,
|
|
required this.jobRoleName,
|
|
});
|
|
|
|
factory CreatedBy.fromJson(Map<String, dynamic> json) => CreatedBy(
|
|
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,
|
|
};
|
|
}
|