Phase 4 Stage 3: payment shell (multi-screen flow)
Six new screens under /payment/* + a paymentDraftProvider holding
mode/durationId/durationMinutes/priceIDR/paymentId/isFirstSessionDiscount
across the flow. PaymentEntryScreen handles the routing decision
(eligible+enabled -> /payment/discount-paywall, else /payment/method-pick)
and clears the draft on fresh entry.
Screens:
- discount_paywall_screen: S6 first-session discount with struck-through
gimmick price + actual price + 'mulai · Rp{actual}' CTA -> /payment/method
- method_pick_screen: chat vs call cards
- duration_pick_screen: tier list with chat|call mode toggle that resets
the selection on swap
- payment_method_screen: QRIS-first list, posts to existing
/api/client/payment-sessions with mode/duration/price/discount/method
- waiting_payment_screen: qr_flutter QR (encodes paymentId in mock mode),
20-min countdown header, 3s polling for status, pauses on background
via WidgetsBindingObserver
- payment_expired_screen: retry CTA -> /payment/method with draft retained
Status mapping: real payment_sessions.status uses 'confirmed'/'consumed'
for paid (not 'paid' as in plan) and 'expired'/'abandoned' as terminal.
home_screen 'Mulai Curhat' CTA now pushes /payment/entry.
Dev-only /internal/_test/force-expire-payment endpoint to drive Maestro
flow 04_payment_expired.yaml without waiting 20 minutes. Gated behind
NODE_ENV !== 'production'.
chat_opening_provider PricingData extended to carry Phase 4 chat/call
groups + firstSessionDiscount, back-compat with the Phase 3 shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,13 @@ import 'features/chat/screens/chat_screen.dart';
|
||||
import 'features/chat/screens/chat_history_screen.dart';
|
||||
import 'features/chat/screens/chat_transcript_screen.dart';
|
||||
import 'features/payment/screens/payment_screen.dart';
|
||||
import 'features/payment/screens/payment_entry_screen.dart';
|
||||
import 'features/payment/screens/discount_paywall_screen.dart';
|
||||
import 'features/payment/screens/method_pick_screen.dart';
|
||||
import 'features/payment/screens/duration_pick_screen.dart';
|
||||
import 'features/payment/screens/payment_method_screen.dart';
|
||||
import 'features/payment/screens/waiting_payment_screen.dart';
|
||||
import 'features/payment/screens/payment_expired_screen.dart';
|
||||
import 'core/theme/_preview.dart';
|
||||
|
||||
class RouterNotifier extends ChangeNotifier {
|
||||
@@ -150,10 +157,13 @@ GoRouter buildRouter(Ref ref) {
|
||||
),
|
||||
GoRoute(path: '/home', builder: (_, __) => const HomeScreen()),
|
||||
GoRoute(path: '/payment', builder: (context, state) {
|
||||
// Payment screen reachable from
|
||||
// Legacy Phase 3.7 single-screen payment. Still reachable from
|
||||
// - Home "Mulai Curhat" CTA → no extras (general blast follows confirm)
|
||||
// - Chat history "Curhat lagi" CTA → extras carry targetedMitraId/mitraName
|
||||
// for the returning-chat flow, plus optional topicSensitivity.
|
||||
// Phase 4 Stage 3 introduces sibling routes under `/payment/*`; the new
|
||||
// entry point is `/payment/entry`. This route is preserved until Stage 5
|
||||
// migrates the chat-history "Curhat lagi" flow.
|
||||
final extra = state.extra;
|
||||
if (extra is Map<String, dynamic>) {
|
||||
final topic = extra['topicSensitivity'];
|
||||
@@ -165,6 +175,24 @@ GoRouter buildRouter(Ref ref) {
|
||||
}
|
||||
return const PaymentScreen();
|
||||
}),
|
||||
// Phase 4 Stage 3 — multi-screen payment shell.
|
||||
GoRoute(path: '/payment/entry', builder: (_, __) => const PaymentEntryScreen()),
|
||||
GoRoute(path: '/payment/discount-paywall', builder: (_, __) => const DiscountPaywallScreen()),
|
||||
GoRoute(path: '/payment/method-pick', builder: (_, __) => const MethodPickScreen()),
|
||||
GoRoute(path: '/payment/duration-pick', builder: (_, __) => const DurationPickScreen()),
|
||||
GoRoute(path: '/payment/method', builder: (_, __) => const PaymentMethodScreen()),
|
||||
GoRoute(
|
||||
path: '/payment/waiting/:paymentId',
|
||||
builder: (context, state) => WaitingPaymentScreen(
|
||||
paymentId: state.pathParameters['paymentId']!,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/payment/expired/:paymentId',
|
||||
builder: (context, state) => PaymentExpiredScreen(
|
||||
paymentId: state.pathParameters['paymentId']!,
|
||||
),
|
||||
),
|
||||
GoRoute(path: '/chat/searching', builder: (_, __) => const SearchingScreen()),
|
||||
GoRoute(path: '/chat/found', builder: (context, state) {
|
||||
final extra = state.extra as Map<String, dynamic>;
|
||||
|
||||
Reference in New Issue
Block a user