181186 - Criar PDV Android para rodar em maquinas P.O.S.
This commit is contained in:
commit
c9983cbad5
204 files changed
+11453
No files matched your search
@@ -0,0 +1,37 @@
|
||||
class HistoricalSale {
|
||||
const HistoricalSale({
|
||||
required this.orderNumber,
|
||||
required this.issueDate,
|
||||
required this.customerName,
|
||||
required this.totalMinorUnits,
|
||||
required this.state,
|
||||
});
|
||||
|
||||
final String orderNumber;
|
||||
final String issueDate;
|
||||
final String customerName;
|
||||
final int totalMinorUnits;
|
||||
final String state;
|
||||
|
||||
factory HistoricalSale.fromJson(Map<String, dynamic> json) {
|
||||
final orderNumber = json['order_number'];
|
||||
final issueDate = json['issue_date'];
|
||||
final customerName = json['customer_name'];
|
||||
final total = json['total'];
|
||||
final state = json['state'];
|
||||
if (orderNumber is! String ||
|
||||
issueDate is! String ||
|
||||
customerName is! String ||
|
||||
total is! num ||
|
||||
state is! String) {
|
||||
throw const FormatException('Pedido inválido no histórico de vendas.');
|
||||
}
|
||||
return HistoricalSale(
|
||||
orderNumber: orderNumber,
|
||||
issueDate: issueDate,
|
||||
customerName: customerName,
|
||||
totalMinorUnits: (total * 100).round(),
|
||||
state: state,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user