a2a-source-edit: write agent.py
This commit is contained in:
6
agent.py
6
agent.py
@@ -12,7 +12,7 @@ import json
|
||||
import re
|
||||
import time
|
||||
from email.utils import parseaddr
|
||||
from typing import Any, Literal
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
from pydantic import BaseModel, Field
|
||||
@@ -517,9 +517,6 @@ def _evaluate_refund_policy(
|
||||
return {"status": "needs_reconciliation", "approval_required": True, "reason": "Stripe timed out; reconcile before retrying."}
|
||||
if stripe_check["status"] != "ok":
|
||||
return {"status": "declined", "approval_required": True, "reason": stripe_check.get("error_type", "stripe_lookup_failed")}
|
||||
if stripe_check.get("livemode") is False:
|
||||
# Test mode is allowed for dry-run eligibility, but still requires approval for execution.
|
||||
pass
|
||||
if stripe_check.get("currency") != currency.lower():
|
||||
return {"status": "declined", "approval_required": True, "reason": "Currency mismatch."}
|
||||
if stripe_check.get("payment_intent_status") not in {"succeeded", "requires_capture"}:
|
||||
@@ -665,7 +662,6 @@ async def _save_ledger(ctx: RunContext[Any], ledger: dict[str, Any]) -> None:
|
||||
)
|
||||
await view.write(LEDGER_PATH, data)
|
||||
except Exception:
|
||||
# Artifact fallback keeps an audit copy even if durable workspace access is unavailable.
|
||||
ref = await ctx.write_artifact("support-refund-audit-ledger.json", data, "application/json")
|
||||
await ctx.emit_artifact(ref)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user