Fix sales post-repair acceptance gaps
This commit is contained in:
@@ -21,6 +21,7 @@ def test_sales_frontend_contract_routes_are_registered():
|
||||
"/api/v1/deals/{deal_id}/invoices": {"GET", "POST"},
|
||||
"/api/v1/deals/{deal_id}/conditions": {"GET", "POST", "PATCH", "PUT"},
|
||||
"/api/v1/deals/{deal_id}/conditions/confirm": {"POST"},
|
||||
"/api/v1/deals/{deal_id}/escalations": {"GET", "POST"},
|
||||
"/api/v1/deals/{deal_id}/automation-tasks": {"GET"},
|
||||
"/api/v1/automation-tasks/{task_id}/cancel": {"POST"},
|
||||
"/api/v1/automation-tasks/{task_id}/run-now": {"POST"},
|
||||
|
||||
@@ -480,6 +480,33 @@ def test_reconcile_uses_provider_adapter_and_safe_payment_flow():
|
||||
session.close()
|
||||
|
||||
|
||||
def test_reconcile_manual_payment_is_idempotent_without_adapter():
|
||||
tenant_id = "tenant_payment_manual_reconcile"
|
||||
client = TestClient(sales_module.app)
|
||||
_, deal = _create_lead_and_deal(client, tenant_id)
|
||||
invoice = _create_invoice(client, deal["deal_id"], tenant_id, amount=50000)
|
||||
created = client.post(
|
||||
"/api/v1/payments/webhook",
|
||||
json={
|
||||
"deal_id": deal["deal_id"],
|
||||
"invoice_id": invoice["invoice_id"],
|
||||
"payment_provider": "manual",
|
||||
"external_payment_id": "manual-reconcile-1",
|
||||
"amount": 50000,
|
||||
"currency": "KZT",
|
||||
"status": "success",
|
||||
},
|
||||
headers=_headers(tenant_id),
|
||||
)
|
||||
assert created.status_code == 200
|
||||
payment_id = created.json()["payment_id"]
|
||||
|
||||
response = client.post(f"/api/v1/payments/{payment_id}/reconcile", headers=_headers(tenant_id))
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "success"
|
||||
|
||||
|
||||
def test_payment_webhook_publishes_payment_and_invoice_events_once_for_duplicate_payment():
|
||||
tenant_id = "tenant_payment_events_once"
|
||||
client = TestClient(sales_module.app)
|
||||
|
||||
Reference in New Issue
Block a user