diff --git a/projects/discord-bot/scripts/web-fetch-chrome.py b/projects/discord-bot/scripts/web-fetch-chrome.py index 1ea8090..d545ec2 100644 --- a/projects/discord-bot/scripts/web-fetch-chrome.py +++ b/projects/discord-bot/scripts/web-fetch-chrome.py @@ -16,6 +16,9 @@ Options: --settle-ms N Extra wait after load for JS to render (default 1500) --timeout-ms N Navigation timeout (default 25000) --wait-until STATE domcontentloaded | load | networkidle (default: load) + --zip CODE Set delivery/location zip code for supported retailers + (Amazon, Best Buy). Defaults to 85715 (Tucson, AZ). + Pass empty string to skip: --zip "" Exit codes: 0 ok, 2 navigation/render error, 3 bad usage. Errors go to stderr; page content goes to stdout. @@ -36,6 +39,8 @@ def main() -> int: ap.add_argument("--timeout-ms", type=int, default=25000) ap.add_argument("--wait-until", default="load", choices=["domcontentloaded", "load", "networkidle"]) + ap.add_argument("--zip", default="85715", + help="Delivery zip for Amazon/Best Buy (default: 85715). Pass empty to skip.") args = ap.parse_args() if not args.url.lower().startswith(("http://", "https://")): @@ -70,6 +75,38 @@ def main() -> int: ) page = ctx.new_page() try: + # Pre-set delivery zip for supported retailers before loading the target URL. + if args.zip: + from urllib.parse import urlparse + host = urlparse(args.url).netloc.lower() + if "amazon.com" in host: + try: + # Load homepage so session cookies exist, then use the + # location picker UI (most reliable — no CSRF tokens needed). + page.goto("https://www.amazon.com", wait_until="load", timeout=15000) + page.wait_for_timeout(1200) + # Click the "Delivering to..." location widget in the nav bar. + page.click("#glow-ingress-block", timeout=6000) + page.wait_for_selector("#GLUXZipUpdateInput", timeout=6000) + page.fill("#GLUXZipUpdateInput", args.zip) + page.wait_for_timeout(300) + page.click('[data-action="GLUXPostalUpdateAction"]', timeout=5000) + page.wait_for_timeout(1000) + except Exception: + pass # non-fatal — continue to main URL + elif "bestbuy.com" in host: + try: + # Best Buy uses a GraphQL-backed zip picker; the query param approach + # is the most reliable headless method. + page.goto( + f"https://www.bestbuy.com/site/searchpage.jsp?st=test&postalCode={args.zip}", + wait_until="load", + timeout=10000, + ) + page.wait_for_timeout(500) + except Exception: + pass # non-fatal + page.goto(args.url, wait_until=args.wait_until, timeout=args.timeout_ms) if args.settle_ms > 0: page.wait_for_timeout(args.settle_ms) diff --git a/session-logs/2026-05-22-session.md b/session-logs/2026-05-22-session.md index dd00c44..c545d7c 100644 --- a/session-logs/2026-05-22-session.md +++ b/session-logs/2026-05-22-session.md @@ -411,3 +411,82 @@ None for this session. Syncro estimate workflow is fully documented and verified - Test estimates created/deleted this session: #7183, #7184, #7185, #7186, #7187 - Test ticket created/deleted: #32315 (id: 110841689) - ACG internal customer: https://computerguru.syncromsp.com/customers/15353550 + +--- + +## Update: 14:56 PT — Syncro billing, Instrumental Music Center #32317 + +### User +- **User:** Mike Swanson (mike) — via Discord Bot +- **Machine:** GURU-BEAST-ROG (Discord Bot service) +- **Role:** admin +- **Session Span:** ~14:45–14:56 PT (Discord thread: #for https://computerguru.syncromsp.com/tickets/110843950) + +### Session Summary + +Mike provided a summary of onsite work at Instrumental Music Center and requested the ticket be billed. The issue was a failed ethernet port on their front desk machine — the system was flapping between wifi and the bad ethernet adapter, which killed connections to their CRM (AIM). Mike disabled the ethernet adapter, confirmed the system was stable and user-tested, and plans to source a USB-to-Ethernet adapter as a permanent fix. + +Ticket #32317 was identified from the URL provided. The customer (Instrumental Music Center, ID 7088508) was confirmed as a prepaid account with 11.0 hours remaining, so onsite labor product 26118 was used at 1.0 hr (no 1.5x multiplier — this was standard onsite billing, not emergency). A resolution comment was drafted via Ollama and confirmed by Mike before execution. + +The billing workflow completed in order: comment posted, line item added (1.0 hr @ $175.00), invoice created ($0.00 prepaid, applied 1.0 hr from block), ticket marked Invoiced. Prepay block decremented from 11.0 to 10.0 hours as expected. Bot alert posted to #bot-alerts. + +### Key Decisions + +- Used product 26118 (Onsite) at 1.0 hr — Mike said "1hr onsite labor," not emergency, despite the ticket subject containing "Emergency." Billed as standard onsite against prepay block. +- Prepaid customer path: product 26118 at actual hours (not 26184 emergency product), per the documented prepaid billing rule. + +### Problems Encountered + +None. + +### Configuration Changes + +None. + +### Credentials & Secrets + +- Syncro API key: Mike's key (`T259810e5c9917386b-52c2aeea7cdb5ff41c6685a73cebbeb3`). +- No vault paths accessed. + +### Infrastructure & Servers + +- Syncro PSA: `https://computerguru.syncromsp.com/api/v1` +- Ticket: https://computerguru.syncromsp.com/tickets/110843950 + +### Commands & Outputs + +```bash +# Ticket fetch +GET /tickets/110843950 -> #32317, customer_id: 7088508, status: New + +# Customer + rate fetch +GET /customers/7088508 -> Instrumental Music Center, prepay_hours: 11.0 +GET /products/26118 -> price_retail: 175.0 + +# Comment posted +POST /tickets/110843950/comment -> comment ID 412495852 + +# Line item added +POST /tickets/110843950/add_line_item -> line_item ID 42559484, price_retail: 175.0, qty: 1.0 + +# Invoice created +POST /invoices {ticket_id: 110843950, customer_id: 7088508} -> invoice ID 1650390094, total: 0.0 + +# Ticket marked Invoiced +PUT /tickets/110843950 {status: "Invoiced"} -> OK + +# Prepay verified +GET /customers/7088508 -> prepay_hours: 10.0 (decremented from 11.0) [OK] +``` + +### Pending / Incomplete Tasks + +- Source USB-to-Ethernet adapter for Instrumental Music Center front desk machine (Mike tracking offline). + +### Reference Information + +- Syncro Ticket #32317: https://computerguru.syncromsp.com/tickets/110843950 +- Customer: Instrumental Music Center (ID 7088508) +- Invoice ID: 1650390094 +- Prepay remaining: 10.0 hrs +- Bot alert message ID: (posted to #bot-alerts)