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:
2026-05-10 16:28:59 +08:00
parent 2645bcd0e5
commit 706149c75e
19 changed files with 2209 additions and 15 deletions

View File

@@ -0,0 +1,94 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../../core/theme/halo_tokens.dart';
import '../../../core/theme/widgets/halo_button.dart';
/// "Pembayaran expired" — terminal screen for the timeout path. The retry CTA
/// pushes back to `/payment/method`; the draft is intentionally retained so
/// the user re-pays the same plan/mode/discount without re-picking.
class PaymentExpiredScreen extends ConsumerWidget {
final String paymentId;
const PaymentExpiredScreen({super.key, required this.paymentId});
@override
Widget build(BuildContext context, WidgetRef ref) {
return PopScope(
canPop: true,
child: Scaffold(
backgroundColor: HaloTokens.bg,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.fromLTRB(
HaloSpacing.s24,
HaloSpacing.s32,
HaloSpacing.s24,
HaloSpacing.s32,
),
child: Column(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 90,
height: 90,
decoration: const BoxDecoration(
color: Color(0xFFFFE5E5),
borderRadius: HaloRadius.xl,
),
alignment: Alignment.center,
child: const Text('', style: TextStyle(fontSize: 42)),
),
const SizedBox(height: HaloSpacing.s20),
const Text(
'pembayaran kedaluwarsa',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: HaloTokens.fontDisplay,
fontSize: 22,
fontWeight: FontWeight.w700,
color: HaloTokens.brandDark,
height: 1.25,
letterSpacing: -0.5,
),
),
const SizedBox(height: HaloSpacing.s12),
const SizedBox(
width: 280,
child: Text(
'sesi pembayaran udah lewat 20 menit. coba lagi yuk, gak ada potongan apapun.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 13.5,
color: HaloTokens.inkSoft,
height: 1.55,
),
),
),
],
),
),
HaloButton(
label: 'coba lagi',
size: HaloButtonSize.lg,
fullWidth: true,
onPressed: () => context.go('/payment/method'),
),
const SizedBox(height: HaloSpacing.s8),
HaloButton(
label: 'kembali ke home',
variant: HaloButtonVariant.ghost,
size: HaloButtonSize.md,
fullWidth: true,
onPressed: () => context.go('/home'),
),
],
),
),
),
),
);
}
}