Initialer Commit: Projekt Start

This commit is contained in:
Tim Leikauf
2026-01-03 15:24:36 +01:00
commit 3773f94303
168 changed files with 228080 additions and 0 deletions

42
lib/models/coupon.dart Normal file
View File

@@ -0,0 +1,42 @@
class Coupon {
final String code;
final String? description;
final String discountType; // fixed_cart, percent, fixed_product, percent_product
final String amount;
final bool isValid;
final String? errorMessage;
Coupon({
required this.code,
this.description,
required this.discountType,
required this.amount,
this.isValid = false,
this.errorMessage,
});
factory Coupon.fromJson(Map<String, dynamic> json) {
return Coupon(
code: json['code'] ?? '',
description: json['description'],
discountType: json['discount_type'] ?? 'fixed_cart',
amount: json['amount'] ?? '0',
isValid: json['is_valid'] ?? false,
errorMessage: json['error_message'],
);
}
String get discountDisplay {
switch (discountType) {
case 'percent':
case 'percent_product':
return '$amount%';
case 'fixed_cart':
case 'fixed_product':
return '$amount';
default:
return amount;
}
}
}