fix: 有价先发出价格明细文字再发卡

避免卡片写详见上一条时销售却先看到卡。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-20 19:50:42 +08:00
co-authored by Cursor
parent 6140eaf932
commit 20c27ae293
2 changed files with 44 additions and 2 deletions
@@ -535,6 +535,37 @@ class SeaTmsCardTests(unittest.TestCase):
self.assertIn("时效:1天", sub)
self.assertIn("报价有效期:2026-09-30", sub)
def test_sea_hit_sends_detail_text_before_card(self) -> None:
"""
有价必须先发出价格明细文字,再发卡。
测服 WO202609200020:卡上写「详见上一条明细」,销售却先看到卡。
"""
steps: list[str] = []
def reply(text: str, extra=None) -> str:
kind = "card" if extra else "text"
steps.append(kind)
return f"out-{len(steps)}"
def wait(out_id: str, *, work_order_no: str, what: str) -> None:
steps.append(f"wait:{out_id}")
self.flow._wait_outbound_sent = wait # type: ignore[method-assign]
self.flow._detail_before_card_gap_sec = 0.0
self.flow._emit_sea_hit(
reply,
work_order_no="WO202609200020",
quote={
"total": "14298.53",
"currency": "CNY",
"source_label": "TMS标准报价",
"fee_lines": [{"name": "操作费", "amount": "1220", "currency": "CNY"}],
},
)
self.assertEqual(steps[:3], ["text", "wait:out-1", "card"])
self.assertIn("card", steps)
def test_sea_hit_card_has_price_and_two_buttons(self) -> None:
phase = self.flow.on_text(
sender_id="s1",