{"default_fixture_id":"gst_billing","fixtures":[{"id":"gst_billing","title":"Indian B2B GST & Tiered Discount Billing Engine","short_title":"1. B2B GST & Discount Engine","domain":"FinTech / ERP Billing","description":"Migrates integer-paise half-up GST calculation (12% <= ₹1,000.00, 18% > ₹1,000.00) with tiered volume discounts and strict quantity validation.","entrypoint_legacy":"calculate_invoice_legacy","entrypoint_migrated":"calculate_invoice_migrated","legacy_code":"import datetime\nimport uuid\nfrom decimal import Decimal, ROUND_HALF_UP\n\n\ndef calculate_invoice_legacy(qty: int, unit_price: float, discount_pct: float = 0.0) -> dict:\n    \"\"\"Legacy B2B invoice engine using integer-paise HALF_UP arithmetic.\"\"\"\n    if qty is None or qty <= 0:\n        raise ValueError(\"Invalid quantity\")\n    if unit_price is None or unit_price < 0:\n        raise ValueError(\"Invalid unit price\")\n    if discount_pct < 0 or discount_pct > 100:\n        raise ValueError(\"Invalid discount percentage\")\n\n    # Convert unit_price to exact integer paise with HALF_UP rounding\n    unit_paise = int(\n        (Decimal(str(unit_price)) * Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n    gross_paise = qty * unit_paise\n\n    # Tiered B2B volume discount: minimum 5% discount when qty >= 10\n    effective_discount_pct = max(Decimal(str(discount_pct)), Decimal(\"5\")) if qty >= 10 else Decimal(str(discount_pct))\n    discount_paise = int(\n        (Decimal(gross_paise) * effective_discount_pct / Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n    subtotal_paise = gross_paise - discount_paise\n\n    # GST slab: 12% up to and including ₹1,000.00 (100000 paise); 18% strictly above\n    gst_rate = 12 if subtotal_paise <= 100000 else 18\n    gst_paise = int(\n        (Decimal(subtotal_paise) * Decimal(gst_rate) / Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n    total_paise = subtotal_paise + gst_paise\n\n    return {\n        \"invoice_uuid\": str(uuid.uuid4()),\n        \"generated_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"qty\": int(qty),\n        \"gross_amount\": float(Decimal(gross_paise) / Decimal(\"100\")),\n        \"discount_amount\": float(Decimal(discount_paise) / Decimal(\"100\")),\n        \"subtotal\": float(Decimal(subtotal_paise) / Decimal(\"100\")),\n        \"gst_rate_pct\": gst_rate,\n        \"gst_amount\": float(Decimal(gst_paise) / Decimal(\"100\")),\n        \"total\": float(Decimal(total_paise) / Decimal(\"100\")),\n        \"status\": \"OK\",\n    }\n","migrated_code":"import datetime\nimport uuid\n\n\ndef calculate_invoice_migrated(qty: int, unit_price: float, discount_pct: float = 0.0) -> dict:\n    \"\"\"AI-migrated modern billing function (contains 3 subtle regressions).\"\"\"\n    try:\n        if qty is None or qty <= 0:\n            raise ValueError(\"Invalid quantity\")\n        if unit_price is None or unit_price < 0:\n            raise ValueError(\"Invalid unit price\")\n        if discount_pct < 0 or discount_pct > 100:\n            raise ValueError(\"Invalid discount percentage\")\n\n        gross_amount = round(qty * unit_price, 2)\n        effective_discount = max(discount_pct, 5.0) if qty >= 10 else float(discount_pct)\n        discount_amount = round(gross_amount * (effective_discount / 100.0), 2)\n        subtotal = round(gross_amount - discount_amount, 2)\n\n        # Bug 2: Uses >= 1000.00 instead of > 1000.00 for 18% GST slab boundary\n        gst_rate = 18 if subtotal >= 1000.00 else 12\n        # Bug 1: Float rupee rounding (banker's round + IEEE-754 drift)\n        gst_amount = round(subtotal * (gst_rate / 100.0), 2)\n        total = round(subtotal + gst_amount, 2)\n\n        return {\n            \"invoice_uuid\": str(uuid.uuid4()),\n            \"generated_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n            \"qty\": int(qty),\n            \"gross_amount\": gross_amount,\n            \"discount_amount\": discount_amount,\n            \"subtotal\": subtotal,\n            \"gst_rate_pct\": gst_rate,\n            \"gst_amount\": gst_amount,\n            \"total\": total,\n            \"status\": \"OK\",\n        }\n    except Exception:\n        # Bug 3: Broad try/except swallows invalid inputs instead of raising ValueError\n        return {\"total\": 0.0, \"status\": \"ok\"}\n","fixed_code":"import datetime\nimport uuid\nfrom decimal import Decimal, ROUND_HALF_UP\n\n\ndef calculate_invoice_migrated(qty: int, unit_price: float, discount_pct: float = 0.0) -> dict:\n    \"\"\"Verified behavioral-equivalent refactor using exact Decimal paise math.\"\"\"\n    if qty is None or qty <= 0:\n        raise ValueError(\"Invalid quantity\")\n    if unit_price is None or unit_price < 0:\n        raise ValueError(\"Invalid unit price\")\n    if discount_pct < 0 or discount_pct > 100:\n        raise ValueError(\"Invalid discount percentage\")\n\n    def _to_paise(val: Decimal) -> int:\n        return int(val.quantize(Decimal(\"1\"), rounding=ROUND_HALF_UP))\n\n    unit_paise = _to_paise(Decimal(str(unit_price)) * Decimal(\"100\"))\n    gross_paise = int(qty) * unit_paise\n\n    disc_rate = max(Decimal(str(discount_pct)), Decimal(\"5\")) if qty >= 10 else Decimal(str(discount_pct))\n    discount_paise = _to_paise(Decimal(gross_paise) * disc_rate / Decimal(\"100\"))\n    subtotal_paise = gross_paise - discount_paise\n\n    gst_rate = 12 if subtotal_paise <= 100000 else 18\n    gst_paise = _to_paise(Decimal(subtotal_paise) * Decimal(gst_rate) / Decimal(\"100\"))\n    total_paise = subtotal_paise + gst_paise\n\n    return {\n        \"invoice_uuid\": str(uuid.uuid4()),\n        \"generated_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"qty\": int(qty),\n        \"gross_amount\": float(Decimal(gross_paise) / Decimal(\"100\")),\n        \"discount_amount\": float(Decimal(discount_paise) / Decimal(\"100\")),\n        \"subtotal\": float(Decimal(subtotal_paise) / Decimal(\"100\")),\n        \"gst_rate_pct\": gst_rate,\n        \"gst_amount\": float(Decimal(gst_paise) / Decimal(\"100\")),\n        \"total\": float(Decimal(total_paise) / Decimal(\"100\")),\n        \"status\": \"OK\",\n    }\n","sample_traces":[{"input":{"qty":2,"unit_price":200.0,"discount_pct":0.0},"expected_legacy_output":{"qty":2,"gross_amount":400.0,"discount_amount":0.0,"subtotal":400.0,"gst_rate_pct":12,"gst_amount":48.0,"total":448.0,"status":"OK"}},{"input":{"qty":10,"unit_price":500.0,"discount_pct":0.0},"expected_legacy_output":{"qty":10,"gross_amount":5000.0,"discount_amount":250.0,"subtotal":4750.0,"gst_rate_pct":18,"gst_amount":855.0,"total":5605.0,"status":"OK"}},{"input":{"qty":1,"unit_price":1000.0,"discount_pct":0.0},"expected_legacy_output":{"qty":1,"gross_amount":1000.0,"discount_amount":0.0,"subtotal":1000.0,"gst_rate_pct":12,"gst_amount":120.0,"total":1120.0,"status":"OK"}}],"ai_unit_tests":"def test_small_order_standard_gst(fn):\n    res = fn(qty=2, unit_price=200.0)\n    assert res[\"subtotal\"] == 400.0\n    assert res[\"gst_rate_pct\"] == 12\n    assert res[\"total\"] == 448.0\n\n\ndef test_bulk_order_volume_discount_and_18_gst(fn):\n    res = fn(qty=10, unit_price=500.0)\n    assert res[\"discount_amount\"] == 250.0\n    assert res[\"subtotal\"] == 4750.0\n    assert res[\"gst_rate_pct\"] == 18\n    assert res[\"total\"] == 5605.0\n\n\ndef test_explicit_discount_lower_slab(fn):\n    res = fn(qty=4, unit_price=150.0, discount_pct=10.0)\n    assert res[\"subtotal\"] == 540.0\n    assert res[\"gst_rate_pct\"] == 12\n    assert res[\"total\"] == 604.8\n\n\ndef test_large_order_high_value(fn):\n    res = fn(qty=20, unit_price=250.0, discount_pct=10.0)\n    assert res[\"subtotal\"] == 4500.0\n    assert res[\"gst_rate_pct\"] == 18\n    assert res[\"total\"] == 5310.0\n\n\ndef test_zero_price_promo_item(fn):\n    res = fn(qty=1, unit_price=0.0)\n    assert res[\"subtotal\"] == 0.0\n    assert res[\"total\"] == 0.0\n    assert res[\"status\"] == \"OK\"\n","volatile_fields_hint":["invoice_uuid","generated_at"]},{"id":"tds_ledger","title":"TDS (Tax Deducted at Source) Threshold & PAN-Validation Ledger","short_title":"2. TDS Threshold & PAN Ledger","domain":"Tax Compliance / Payroll","description":"Section 194J / 206AA TDS calculator: ₹30,000.00 threshold, 10% for valid PAN, 20% penalty fallback when PAN is None/empty/invalid, and HALF_UP paise rounding.","entrypoint_legacy":"compute_tds_legacy","entrypoint_migrated":"compute_tds_migrated","legacy_code":"import datetime\nimport re\nimport uuid\nfrom decimal import Decimal, ROUND_HALF_UP\nfrom typing import Optional\n\nPAN_REGEX = re.compile(r\"^[A-Z]{5}[0-9]{4}[A-Z]$\")\n\n\ndef compute_tds_legacy(amount: float, pan: Optional[str] = None, section: str = \"194J\") -> dict:\n    \"\"\"Legacy Indian Income Tax TDS deduction engine (194J + 206AA).\"\"\"\n    if amount is None or amount <= 0:\n        raise ValueError(\"Amount must be positive\")\n\n    amount_paise = int(\n        (Decimal(str(amount)) * Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n\n    normalized_pan = pan.strip().upper() if isinstance(pan, str) else \"\"\n    valid_pan = bool(PAN_REGEX.match(normalized_pan))\n\n    # Threshold: strictly > ₹30,000.00 (3000000 paise) for 194J\n    threshold_paise = 3000000 if section == \"194J\" else 1000000\n    if amount_paise <= threshold_paise:\n        tds_rate = 0\n        tds_paise = 0\n    else:\n        # Section 206AA: 20% higher TDS if PAN is missing or invalid\n        tds_rate = 10 if valid_pan else 20\n        tds_paise = int(\n            (Decimal(amount_paise) * Decimal(tds_rate) / Decimal(\"100\")).quantize(\n                Decimal(\"1\"), rounding=ROUND_HALF_UP\n            )\n        )\n\n    net_paise = amount_paise - tds_paise\n\n    return {\n        \"ledger_tx_id\": str(uuid.uuid4()),\n        \"computed_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"section\": section,\n        \"pan_valid\": valid_pan,\n        \"tds_rate_pct\": tds_rate,\n        \"gross_amount\": float(Decimal(amount_paise) / Decimal(\"100\")),\n        \"tds_amount\": float(Decimal(tds_paise) / Decimal(\"100\")),\n        \"net_payable\": float(Decimal(net_paise) / Decimal(\"100\")),\n    }\n","migrated_code":"import datetime\nimport re\nimport uuid\nfrom typing import Optional\n\nPAN_REGEX = re.compile(r\"^[A-Z]{5}[0-9]{4}[A-Z]$\")\n\n\ndef compute_tds_migrated(amount: float, pan: Optional[str] = None, section: str = \"194J\") -> dict:\n    \"\"\"AI-migrated TDS engine (drops None/empty PAN 206AA fallback & misrounds TDS).\"\"\"\n    if amount is None or amount <= 0:\n        raise ValueError(\"Amount must be positive\")\n\n    # Bug 1: Crashes on pan=None (AttributeError) and fails to enforce 20% for empty PAN\n    normalized_pan = pan.strip().upper()\n    valid_pan = bool(PAN_REGEX.match(normalized_pan))\n\n    threshold = 30000.0 if section == \"194J\" else 10000.0\n    if amount <= threshold:\n        tds_rate = 0\n        tds_amount = 0.0\n    else:\n        # Bug 2: Drops 20% Section 206AA fallback when PAN is empty/invalid\n        tds_rate = 10\n        # Bug 3: Uses standard float round(val, 2) causing banker's rounding drift\n        tds_amount = round(amount * (tds_rate / 100.0), 2)\n\n    net_payable = round(amount - tds_amount, 2)\n\n    return {\n        \"ledger_tx_id\": str(uuid.uuid4()),\n        \"computed_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"section\": section,\n        \"pan_valid\": valid_pan,\n        \"tds_rate_pct\": tds_rate,\n        \"gross_amount\": round(float(amount), 2),\n        \"tds_amount\": tds_amount,\n        \"net_payable\": net_payable,\n    }\n","fixed_code":"import datetime\nimport re\nimport uuid\nfrom decimal import Decimal, ROUND_HALF_UP\nfrom typing import Optional\n\nPAN_REGEX = re.compile(r\"^[A-Z]{5}[0-9]{4}[A-Z]$\")\n\n\ndef compute_tds_migrated(amount: float, pan: Optional[str] = None, section: str = \"194J\") -> dict:\n    \"\"\"Verified behavioral-equivalent TDS engine with 206AA fallback and HALF_UP math.\"\"\"\n    if amount is None or amount <= 0:\n        raise ValueError(\"Amount must be positive\")\n\n    amount_paise = int(\n        (Decimal(str(amount)) * Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n\n    normalized_pan = pan.strip().upper() if isinstance(pan, str) else \"\"\n    valid_pan = bool(PAN_REGEX.match(normalized_pan))\n\n    threshold_paise = 3000000 if section == \"194J\" else 1000000\n    if amount_paise <= threshold_paise:\n        tds_rate = 0\n        tds_paise = 0\n    else:\n        tds_rate = 10 if valid_pan else 20\n        tds_paise = int(\n            (Decimal(amount_paise) * Decimal(tds_rate) / Decimal(\"100\")).quantize(\n                Decimal(\"1\"), rounding=ROUND_HALF_UP\n            )\n        )\n\n    net_paise = amount_paise - tds_paise\n\n    return {\n        \"ledger_tx_id\": str(uuid.uuid4()),\n        \"computed_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"section\": section,\n        \"pan_valid\": valid_pan,\n        \"tds_rate_pct\": tds_rate,\n        \"gross_amount\": float(Decimal(amount_paise) / Decimal(\"100\")),\n        \"tds_amount\": float(Decimal(tds_paise) / Decimal(\"100\")),\n        \"net_payable\": float(Decimal(net_paise) / Decimal(\"100\")),\n    }\n","sample_traces":[{"input":{"amount":50000.0,"pan":"ABCDE1234F","section":"194J"},"expected_legacy_output":{"section":"194J","pan_valid":true,"tds_rate_pct":10,"gross_amount":50000.0,"tds_amount":5000.0,"net_payable":45000.0}},{"input":{"amount":25000.0,"pan":"ABCDE1234F","section":"194J"},"expected_legacy_output":{"section":"194J","pan_valid":true,"tds_rate_pct":0,"gross_amount":25000.0,"tds_amount":0.0,"net_payable":25000.0}},{"input":{"amount":40000.0,"pan":null,"section":"194J"},"expected_legacy_output":{"section":"194J","pan_valid":false,"tds_rate_pct":20,"gross_amount":40000.0,"tds_amount":8000.0,"net_payable":32000.0}}],"ai_unit_tests":"def test_valid_pan_above_threshold_194j(fn):\n    res = fn(amount=50000.0, pan=\"ABCDE1234F\", section=\"194J\")\n    assert res[\"tds_rate_pct\"] == 10\n    assert res[\"tds_amount\"] == 5000.0\n    assert res[\"net_payable\"] == 45000.0\n\n\ndef test_below_threshold_zero_tds(fn):\n    res = fn(amount=25000.0, pan=\"XYZPQ9876K\", section=\"194J\")\n    assert res[\"tds_rate_pct\"] == 0\n    assert res[\"tds_amount\"] == 0.0\n    assert res[\"net_payable\"] == 25000.0\n\n\ndef test_other_section_standard_pan(fn):\n    res = fn(amount=20000.0, pan=\"LMNOP5432Q\", section=\"194C\")\n    assert res[\"tds_rate_pct\"] == 10\n    assert res[\"tds_amount\"] == 2000.0\n\n\ndef test_lowercase_pan_trimmed(fn):\n    res = fn(amount=60000.0, pan=\" abcde1234f \")\n    assert res[\"pan_valid\"] is True\n    assert res[\"tds_amount\"] == 6000.0\n\n\ndef test_round_lakh_payout(fn):\n    res = fn(amount=100000.0, pan=\"PQRST1111Z\")\n    assert res[\"tds_amount\"] == 10000.0\n    assert res[\"net_payable\"] == 90000.0\n","volatile_fields_hint":["ledger_tx_id","computed_at"]},{"id":"upi_settlement","title":"UPI / NEFT Settlement Fee & Cut-off Window Calculator","short_title":"3. UPI / NEFT Settlement Engine","domain":"Payments / Banking Rails","description":"Calculates UPI/NEFT merchant settlement fees + 18% GST and T+0 vs T+1 settlement windows across the 18:00 IST NEFT cut-off boundary.","entrypoint_legacy":"calculate_settlement_legacy","entrypoint_migrated":"calculate_settlement_migrated","legacy_code":"import datetime\nimport uuid\nfrom decimal import Decimal, ROUND_HALF_UP\n\n\ndef calculate_settlement_legacy(amount: float, channel: str = \"UPI\", hour_ist: int = 14) -> dict:\n    \"\"\"Legacy NPCI / RBI settlement fee and cut-off calculator.\"\"\"\n    if amount is None or amount <= 0:\n        raise ValueError(\"Invalid settlement amount\")\n    if hour_ist is None or hour_ist < 0 or hour_ist > 23:\n        raise ValueError(\"Invalid IST hour\")\n\n    channel_norm = (channel or \"\").strip().upper()\n    if channel_norm not in (\"UPI\", \"NEFT\"):\n        raise ValueError(\"Unsupported channel\")\n\n    amount_paise = int(\n        (Decimal(str(amount)) * Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n\n    if channel_norm == \"UPI\":\n        base_fee_paise = 0 if amount_paise <= 200000 else 500\n        settlement_window = \"T+0\"\n    else:\n        if amount_paise <= 1000000:\n            base_fee_paise = 250\n        elif amount_paise <= 10000000:\n            base_fee_paise = 500\n        else:\n            base_fee_paise = 1500\n        # RBI cut-off: strictly before 18:00 IST is T+0; >= 18 is T+1\n        settlement_window = \"T+0\" if hour_ist < 18 else \"T+1\"\n\n    gst_paise = int(\n        (Decimal(base_fee_paise) * Decimal(\"18\") / Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n    total_fee_paise = base_fee_paise + gst_paise\n    net_paise = amount_paise - total_fee_paise\n\n    return {\n        \"settlement_ref\": str(uuid.uuid4()),\n        \"queued_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"channel\": channel_norm,\n        \"settlement_window\": settlement_window,\n        \"gross_amount\": float(Decimal(amount_paise) / Decimal(\"100\")),\n        \"fee_amount\": float(Decimal(total_fee_paise) / Decimal(\"100\")),\n        \"net_amount\": float(Decimal(net_paise) / Decimal(\"100\")),\n        \"status\": \"QUEUED\",\n    }\n","migrated_code":"import datetime\nimport uuid\n\n\ndef calculate_settlement_migrated(amount: float, channel: str = \"UPI\", hour_ist: int = 14) -> dict:\n    \"\"\"AI-migrated settlement calculator (off-by-one cut-off & swallowed zero check).\"\"\"\n    # Bug 1: Swallows <= 0 amount validation instead of raising ValueError\n    if amount is None or amount <= 0:\n        return {\"net_amount\": 0.0, \"fee_amount\": 0.0, \"status\": \"SKIPPED\"}\n    if hour_ist is None or hour_ist < 0 or hour_ist > 23:\n        raise ValueError(\"Invalid IST hour\")\n\n    channel_norm = (channel or \"\").strip().upper()\n    if channel_norm not in (\"UPI\", \"NEFT\"):\n        raise ValueError(\"Unsupported channel\")\n\n    if channel_norm == \"UPI\":\n        # Bug 2: Uses >= 2000.0 instead of > 2000.0 for UPI merchant fee slab\n        base_fee = 5.0 if amount >= 2000.0 else 0.0\n        settlement_window = \"T+0\"\n    else:\n        if amount <= 10000.0:\n            base_fee = 2.5\n        elif amount <= 100000.0:\n            base_fee = 5.0\n        else:\n            base_fee = 15.0\n        # Bug 3: Off-by-one hour boundary (<= 18 instead of < 18)\n        settlement_window = \"T+0\" if hour_ist <= 18 else \"T+1\"\n\n    total_fee = round(base_fee * 1.18, 2)\n    net_amount = round(amount - total_fee, 2)\n\n    return {\n        \"settlement_ref\": str(uuid.uuid4()),\n        \"queued_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"channel\": channel_norm,\n        \"settlement_window\": settlement_window,\n        \"gross_amount\": round(float(amount), 2),\n        \"fee_amount\": total_fee,\n        \"net_amount\": net_amount,\n        \"status\": \"QUEUED\",\n    }\n","fixed_code":"import datetime\nimport uuid\nfrom decimal import Decimal, ROUND_HALF_UP\n\n\ndef calculate_settlement_migrated(amount: float, channel: str = \"UPI\", hour_ist: int = 14) -> dict:\n    \"\"\"Verified behavioral-equivalent settlement fee and cut-off calculator.\"\"\"\n    if amount is None or amount <= 0:\n        raise ValueError(\"Invalid settlement amount\")\n    if hour_ist is None or hour_ist < 0 or hour_ist > 23:\n        raise ValueError(\"Invalid IST hour\")\n\n    channel_norm = (channel or \"\").strip().upper()\n    if channel_norm not in (\"UPI\", \"NEFT\"):\n        raise ValueError(\"Unsupported channel\")\n\n    amount_paise = int(\n        (Decimal(str(amount)) * Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n\n    if channel_norm == \"UPI\":\n        base_fee_paise = 0 if amount_paise <= 200000 else 500\n        settlement_window = \"T+0\"\n    else:\n        if amount_paise <= 1000000:\n            base_fee_paise = 250\n        elif amount_paise <= 10000000:\n            base_fee_paise = 500\n        else:\n            base_fee_paise = 1500\n        settlement_window = \"T+0\" if hour_ist < 18 else \"T+1\"\n\n    gst_paise = int(\n        (Decimal(base_fee_paise) * Decimal(\"18\") / Decimal(\"100\")).quantize(\n            Decimal(\"1\"), rounding=ROUND_HALF_UP\n        )\n    )\n    total_fee_paise = base_fee_paise + gst_paise\n    net_paise = amount_paise - total_fee_paise\n\n    return {\n        \"settlement_ref\": str(uuid.uuid4()),\n        \"queued_at\": datetime.datetime.now(datetime.timezone.utc).isoformat(),\n        \"channel\": channel_norm,\n        \"settlement_window\": settlement_window,\n        \"gross_amount\": float(Decimal(amount_paise) / Decimal(\"100\")),\n        \"fee_amount\": float(Decimal(total_fee_paise) / Decimal(\"100\")),\n        \"net_amount\": float(Decimal(net_paise) / Decimal(\"100\")),\n        \"status\": \"QUEUED\",\n    }\n","sample_traces":[{"input":{"amount":1500.0,"channel":"UPI","hour_ist":10},"expected_legacy_output":{"channel":"UPI","settlement_window":"T+0","gross_amount":1500.0,"fee_amount":0.0,"net_amount":1500.0,"status":"QUEUED"}},{"input":{"amount":50000.0,"channel":"NEFT","hour_ist":14},"expected_legacy_output":{"channel":"NEFT","settlement_window":"T+0","gross_amount":50000.0,"fee_amount":5.9,"net_amount":49994.1,"status":"QUEUED"}},{"input":{"amount":150000.0,"channel":"NEFT","hour_ist":20},"expected_legacy_output":{"channel":"NEFT","settlement_window":"T+1","gross_amount":150000.0,"fee_amount":17.7,"net_amount":149982.3,"status":"QUEUED"}}],"ai_unit_tests":"def test_upi_small_payment_zero_fee(fn):\n    res = fn(amount=1500.0, channel=\"UPI\", hour_ist=10)\n    assert res[\"fee_amount\"] == 0.0\n    assert res[\"settlement_window\"] == \"T+0\"\n    assert res[\"net_amount\"] == 1500.0\n\n\ndef test_upi_high_value_fee_with_gst(fn):\n    res = fn(amount=5000.0, channel=\"UPI\", hour_ist=22)\n    assert res[\"fee_amount\"] == 5.9\n    assert res[\"net_amount\"] == 4994.1\n\n\ndef test_neft_mid_slab_same_day(fn):\n    res = fn(amount=50000.0, channel=\"NEFT\", hour_ist=14)\n    assert res[\"fee_amount\"] == 5.9\n    assert res[\"settlement_window\"] == \"T+0\"\n\n\ndef test_neft_high_slab_after_hours(fn):\n    res = fn(amount=150000.0, channel=\"NEFT\", hour_ist=20)\n    assert res[\"fee_amount\"] == 17.7\n    assert res[\"settlement_window\"] == \"T+1\"\n\n\ndef test_neft_small_slab_morning(fn):\n    res = fn(amount=5000.0, channel=\"NEFT\", hour_ist=9)\n    assert res[\"fee_amount\"] == 2.95\n    assert res[\"settlement_window\"] == \"T+0\"\n","volatile_fields_hint":["settlement_ref","queued_at"]}]}