feat: Phase 1 critical gaps — gamification API, Razorpay checkout, Google OAuth, notifications
- 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 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
53
lib/features/booking/services/booking_service.dart
Normal file
53
lib/features/booking/services/booking_service.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
// lib/features/booking/services/booking_service.dart
|
||||
|
||||
import '../../../core/api/api_client.dart';
|
||||
import '../../../core/api/api_endpoints.dart';
|
||||
import '../models/booking_models.dart';
|
||||
|
||||
class BookingService {
|
||||
final ApiClient _api = ApiClient();
|
||||
|
||||
/// Fetch available ticket types for an event.
|
||||
Future<List<TicketMetaModel>> getTicketMeta(int eventId) async {
|
||||
final res = await _api.post(
|
||||
ApiEndpoints.ticketMetaList,
|
||||
body: {'event_id': eventId},
|
||||
);
|
||||
final rawList = res['ticket_metas'] ?? res['tickets'] ?? res['data'] ?? [];
|
||||
if (rawList is List) {
|
||||
return rawList
|
||||
.map((e) => TicketMetaModel.fromJson(Map<String, dynamic>.from(e as Map)))
|
||||
.toList();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/// Add item to cart.
|
||||
Future<Map<String, dynamic>> addToCart({
|
||||
required int ticketMetaId,
|
||||
required int quantity,
|
||||
}) async {
|
||||
return await _api.post(
|
||||
ApiEndpoints.cartAdd,
|
||||
body: {'ticket_meta_id': ticketMetaId, 'quantity': quantity},
|
||||
);
|
||||
}
|
||||
|
||||
/// Process checkout — creates booking + returns order ID for payment.
|
||||
Future<Map<String, dynamic>> processCheckout({
|
||||
required int eventId,
|
||||
required List<Map<String, dynamic>> tickets,
|
||||
required Map<String, dynamic> shippingDetails,
|
||||
String? couponCode,
|
||||
}) async {
|
||||
return await _api.post(
|
||||
ApiEndpoints.checkout,
|
||||
body: {
|
||||
'event_id': eventId,
|
||||
'tickets': tickets,
|
||||
'shipping': shippingDetails,
|
||||
if (couponCode != null) 'coupon_code': couponCode,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user