Skip to content

Fix buyer booking workflow and integrate GAM reporting#12

Open
Sirajmx wants to merge 3 commits into
mainfrom
feature/gam-reporting
Open

Fix buyer booking workflow and integrate GAM reporting#12
Sirajmx wants to merge 3 commits into
mainfrom
feature/gam-reporting

Conversation

@Sirajmx
Copy link
Copy Markdown
Contributor

@Sirajmx Sirajmx commented May 20, 2026

GAM Delivery Reporting + Buyer Booking Workflow Fix


  1. GAM Delivery Reporting Integration

Adds read/reporting capabilities to the existing GAM SOAP client and exposes delivery data through two new seller-internal endpoints and the existing
deal performance endpoint.

gam_soap_client.py — Added 5 reporting methods: list_orders(), get_order_by_id(), list_line_items_for_order(), run_delivery_report(),
get_delivery_report(). Report jobs poll GAM until complete then parse CSV delivery rows. API version now validates against supported versions and
auto-upgrades retired ones.

main.py — Two new seller-internal endpoints:

  • GET /gam/orders — lists live GAM orders with network/user context
  • GET /gam/report — delivery report by order ID(s) (impressions, clicks, revenue)

GET /api/v1/deals/{deal_id}/performance — replaced placeholder with real GAM data when gam_order_id is present on the deal. Falls back to placeholder
when GAM is not configured or the deal has not been trafficked into GAM — the endpoint always responds.

settings.py — Default GAM_API_VERSION updated to v202505.

Docs — New guides/gam-reporting.md covering setup, both endpoints, deal-to-GAM linking via gam_order_id, fallback behaviour, and sequence diagram.
Stale v202411 references updated in configuration.md and inventory-sync.md.

Note: GAM credentials (GAM_ENABLED, GAM_NETWORK_CODE, GAM_JSON_KEY_PATH) are required for the real data path. Without them all endpoints degrade
gracefully — no breaking changes.


  1. Buyer Booking Workflow Fix

Resolves issues that caused the buyer agent's booking flow to fail when calling the seller.

main.py — Added POST /products/search and POST /products/avails endpoints which the buyer's channel research crews call during inventory discovery.
Without these, crew tool calls returned 404s and recommendations couldn't be generated.

product_setup_flow.py — Product IDs changed from random UUIDs (prod-a3f2c8b1) to stable sequential IDs (prod-001, prod-002, ...) so buyer crews can
reliably reference the same product across calls.

proposal_handling_flow.py — Added handle_proposal_async() using kickoff_async() so proposal evaluation no longer blocks the FastAPI event loop,
fixing timeout issues under concurrent buyer requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant