Fix buyer booking workflow and integrate GAM reporting#12
Open
Sirajmx wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GAM Delivery Reporting + Buyer Booking Workflow Fix
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 /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.
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.