31 lines
978 B
Dart
31 lines
978 B
Dart
class TransactionItem {
|
|
final String cardType;
|
|
final String cardExpireDate;
|
|
final String cardNumber;
|
|
final String transactionType;
|
|
final num amount;
|
|
final DateTime date;
|
|
TransactionItem({this.cardType, this.cardExpireDate, this.cardNumber, this.transactionType, this.amount, this.date});
|
|
|
|
static TransactionItem fromJson(Map<String, dynamic> json) {
|
|
return TransactionItem(
|
|
cardType: json['cardType'],
|
|
cardExpireDate: json['cardExpireDate'],
|
|
cardNumber: json['cardNumber'],
|
|
transactionType: json['transactionType'],
|
|
amount: json['amount'],
|
|
date: json['date'] != null
|
|
? DateTime.parse(json['date'])
|
|
: null,
|
|
);
|
|
}
|
|
Map<String, dynamic> toJson() =>
|
|
{
|
|
'cardType': cardType,
|
|
'cardExpireDate': cardExpireDate,
|
|
'cardNumber': cardNumber,
|
|
'transactionType': transactionType,
|
|
'amount': amount,
|
|
'date' : date !=null ? date.toString() : null,
|
|
};
|
|
} |