backup. before shop update
This commit is contained in:
41
lib/models/coupon.dart
Normal file
41
lib/models/coupon.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'business.dart';
|
||||
|
||||
class Coupon {
|
||||
int id;
|
||||
String code;
|
||||
String description;
|
||||
String expirationDate;
|
||||
double minAmount;
|
||||
Business store;
|
||||
double valueAmount;
|
||||
bool isPercentage;
|
||||
|
||||
Coupon.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
code = json['code'].toString(),
|
||||
description = json['description'],
|
||||
expirationDate = json['expiration_date'],
|
||||
minAmount = double.parse(json['min_amount'].toString()),
|
||||
store = json['store'] != null ? Business.fromJson(json['store']) : null,
|
||||
valueAmount = double.parse(json['value_amount'].toString()),
|
||||
isPercentage = json['is_percentage'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'code': code,
|
||||
'description': description,
|
||||
'expiration_date': expirationDate,
|
||||
'min_amount': minAmount,
|
||||
'store': store,
|
||||
'value_amount': valueAmount,
|
||||
'is_percentage': isPercentage,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user