add cancel transaction
This commit is contained in:
@@ -26,6 +26,7 @@ class Transaksi {
|
||||
final double harga;
|
||||
final double fee;
|
||||
final double total;
|
||||
final String state; // done | cancel
|
||||
|
||||
Transaksi({
|
||||
required this.id,
|
||||
@@ -37,9 +38,11 @@ class Transaksi {
|
||||
required this.harga,
|
||||
required this.fee,
|
||||
required this.total,
|
||||
this.state = 'done',
|
||||
});
|
||||
|
||||
bool get isBuy => tipe == 'buy';
|
||||
bool get isCancelled => state == 'cancel';
|
||||
|
||||
factory Transaksi.fromOdoo(Map<String, dynamic> m) {
|
||||
String ticker = '';
|
||||
@@ -58,6 +61,7 @@ class Transaksi {
|
||||
harga: (m['harga'] as num?)?.toDouble() ?? 0,
|
||||
fee: (m['fee'] as num?)?.toDouble() ?? 0,
|
||||
total: (m['total'] as num?)?.toDouble() ?? 0,
|
||||
state: (m['state'] as String?) ?? 'done',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user