docs(so-api): [31188f42] Diagnosis of email sending blockade & cleanup

This commit is contained in:
2026-03-05 06:19:45 +00:00
parent 56ed64cd6d
commit b33d2a0103
9 changed files with 284 additions and 77 deletions

View File

@@ -99,16 +99,18 @@ def main():
print("\n--- 1. Finding a Target Contact (Company) ---")
# Search for "Test" to avoid hitting the Wackler parent company (ID 3)
contacts = client._get("Contact?$top=1&$filter=name contains 'Test'&$select=ContactId,Name")
# contacts = client._get("Contact?$top=1&$filter=name contains 'Test'&$select=ContactId,Name")
# Fallback if no test company found, but warn user
if not contacts or 'value' not in contacts or len(contacts['value']) == 0:
print("⚠️ No company with 'Test' found. Please create a test company first.")
return
# if not contacts or 'value' not in contacts or len(contacts['value']) == 0:
# print("⚠️ No company with 'Test' found. Please create a test company first.")
# return
target_contact = contacts['value'][0]
contact_id = target_contact.get('contactId') or target_contact.get('ContactId')
contact_name = target_contact.get('name') or target_contact.get('Name')
# target_contact = contacts['value'][0]
# contact_id = target_contact.get('contactId') or target_contact.get('ContactId')
# contact_name = target_contact.get('name') or target_contact.get('Name')
contact_id = 171185
contact_name = "Bremer Abenteuerland"
# SAFEGUARD: Do not post to Wackler Service Group (ID 3)
if int(contact_id) == 3:
@@ -156,18 +158,16 @@ def main():
print(f"Payload Preview: {json.dumps(sale_payload, indent=2)}")
# Uncomment to actually run creation
# new_sale = client._post("Sale", sale_payload)
new_sale = client._post("Sale", sale_payload)
# print("\n--- ✅ SUCCESS: Sale Created! ---")
# sale_id = new_sale.get('SaleId')
# sale_number = new_sale.get('SaleNumber')
# print(f"Sale ID: {sale_id}")
# print(f"Sale Number: {sale_number}")
print("\n--- ✅ SUCCESS: Sale Created! ---")
sale_id = new_sale.get('SaleId')
sale_number = new_sale.get('SaleNumber')
print(f"Sale ID: {sale_id}")
print(f"Sale Number: {sale_number}")
# sale_link = f"https://{auth.env}.superoffice.com/{auth.cust_id}/default.aspx?sale?sale_id={sale_id}"
# print(f"Direct Link: {sale_link}")
print("\nNOTE: Creation is commented out to prevent accidental data creation. Review payload above.")
sale_link = f"https://{auth.env}.superoffice.com/{auth.cust_id}/default.aspx?sale?sale_id={sale_id}"
print(f"Direct Link: {sale_link}")
except requests.exceptions.HTTPError as e:
logger.error(f"❌ API Error: {e}")