- Fix gamification endpoints to use Node.js server (app.eventifyplus.com) - Replace 6 mock gamification methods with real API calls (dashboard, leaderboard, shop, redeem, submit) - Add booking models, service, payment service (Razorpay), checkout provider - Add 3-step CheckoutScreen with Razorpay native modal integration - Add Google OAuth login (Flutter + Django backend) - Add full notifications system (Django model + 3 endpoints + Flutter UI) - Register CheckoutProvider, NotificationProvider in main.dart MultiProvider - Wire notification bell in HomeScreen app bar - Add razorpay_flutter ^1.3.7 and google_sign_in ^6.2.2 packages
88 lines
2.0 KiB
Dart
88 lines
2.0 KiB
Dart
// lib/features/booking/models/booking_models.dart
|
|
|
|
class TicketMetaModel {
|
|
final int id;
|
|
final int eventId;
|
|
final String ticketType;
|
|
final double price;
|
|
final int availableQuantity;
|
|
final String? description;
|
|
|
|
const TicketMetaModel({
|
|
required this.id,
|
|
required this.eventId,
|
|
required this.ticketType,
|
|
required this.price,
|
|
this.availableQuantity = 0,
|
|
this.description,
|
|
});
|
|
|
|
factory TicketMetaModel.fromJson(Map<String, dynamic> json) {
|
|
return TicketMetaModel(
|
|
id: (json['id'] as num?)?.toInt() ?? 0,
|
|
eventId: (json['event_id'] as num?)?.toInt() ?? (json['event'] as num?)?.toInt() ?? 0,
|
|
ticketType: json['ticket_type'] as String? ?? json['name'] as String? ?? '',
|
|
price: (json['price'] as num?)?.toDouble() ?? 0.0,
|
|
availableQuantity: (json['available_quantity'] as num?)?.toInt() ?? 0,
|
|
description: json['description'] as String?,
|
|
);
|
|
}
|
|
}
|
|
|
|
class CartItemModel {
|
|
final TicketMetaModel ticket;
|
|
int quantity;
|
|
|
|
CartItemModel({required this.ticket, this.quantity = 1});
|
|
|
|
double get subtotal => ticket.price * quantity;
|
|
}
|
|
|
|
class ShippingDetails {
|
|
final String name;
|
|
final String email;
|
|
final String phone;
|
|
final String? address;
|
|
final String? city;
|
|
final String? state;
|
|
final String? zipCode;
|
|
|
|
const ShippingDetails({
|
|
required this.name,
|
|
required this.email,
|
|
required this.phone,
|
|
this.address,
|
|
this.city,
|
|
this.state,
|
|
this.zipCode,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'name': name,
|
|
'email': email,
|
|
'phone': phone,
|
|
if (address != null) 'address': address,
|
|
if (city != null) 'city': city,
|
|
if (state != null) 'state': state,
|
|
if (zipCode != null) 'zip_code': zipCode,
|
|
};
|
|
}
|
|
|
|
class OrderSummary {
|
|
final List<CartItemModel> items;
|
|
final double subtotal;
|
|
final double discount;
|
|
final double tax;
|
|
final double total;
|
|
final String? couponCode;
|
|
|
|
const OrderSummary({
|
|
required this.items,
|
|
required this.subtotal,
|
|
this.discount = 0,
|
|
this.tax = 0,
|
|
required this.total,
|
|
this.couponCode,
|
|
});
|
|
}
|