diff --git a/response.xml b/response.xml
index 3958409..a553440 100644
--- a/response.xml
+++ b/response.xml
@@ -1,12 +1,12 @@
-
+
-80000001-1758063532
-2025-09-16T22:58:52+00:00
-2025-09-16T22:58:52+00:00
-1758063532
+80000001-1758131681
+2025-09-17T17:54:41+00:00
+2025-09-17T17:54:41+00:00
+1758131681
1% 10 Net 30
true
30
@@ -14,10 +14,10 @@
1.00
-80000002-1758063532
-2025-09-16T22:58:52+00:00
-2025-09-16T22:58:52+00:00
-1758063532
+80000002-1758131681
+2025-09-17T17:54:41+00:00
+2025-09-17T17:54:41+00:00
+1758131681
2% 10 Net 30
true
30
@@ -25,10 +25,10 @@
2.00
-80000003-1758063532
-2025-09-16T22:58:52+00:00
-2025-09-16T22:58:52+00:00
-1758063532
+80000003-1758131681
+2025-09-17T17:54:41+00:00
+2025-09-17T17:54:41+00:00
+1758131681
Consignment
true
90
@@ -36,10 +36,10 @@
0.00
-80000004-1758063532
-2025-09-16T22:58:52+00:00
-2025-09-16T22:58:52+00:00
-1758063532
+80000004-1758131681
+2025-09-17T17:54:41+00:00
+2025-09-17T17:54:41+00:00
+1758131681
Due on receipt
true
0
@@ -47,10 +47,10 @@
0.00
-80000005-1758063532
-2025-09-16T22:58:52+00:00
-2025-09-16T22:58:52+00:00
-1758063532
+80000005-1758131681
+2025-09-17T17:54:41+00:00
+2025-09-17T17:54:41+00:00
+1758131681
Net 15
true
15
@@ -58,10 +58,10 @@
0.00
-80000006-1758063532
-2025-09-16T22:58:52+00:00
-2025-09-16T22:58:52+00:00
-1758063532
+80000006-1758131681
+2025-09-17T17:54:41+00:00
+2025-09-17T17:54:41+00:00
+1758131681
Net 30
true
30
@@ -69,10 +69,10 @@
0.00
-80000007-1758063532
-2025-09-16T22:58:52+00:00
-2025-09-16T22:58:52+00:00
-1758063532
+80000007-1758131681
+2025-09-17T17:54:41+00:00
+2025-09-17T17:54:41+00:00
+1758131681
Net 60
true
60
@@ -81,4 +81,4 @@
-
+
\ No newline at end of file
diff --git a/terms.py b/terms.py
index 574a9d6..3ff907f 100644
--- a/terms.py
+++ b/terms.py
@@ -9,13 +9,36 @@
def build_terms_query() -> str:
- """Return a minimal TermsQueryRq XML."""
- raise NotImplementedError()
+ """Return a minimal TermsQueryRq QBXML request as a string."""
+ return """
+
+
+
+
+
+
+
+
+"""
def parse_and_print(response_xml: str) -> None:
"""Parse response and print term name + discount days."""
- raise NotImplementedError()
+ root = ET.fromstring(response_xml)
+ rs = root.find(".//TermsQueryRs")
+
+ if rs is None:
+ print("No TermsQueryRs found in response")
+ return
+ status_code = int(rs.attrib.get("statuscode", "0"))
+ status_msg = rs.attrib.get("statusMessage", "")
+ if status_code != 0:
+ print(f"QuickBook returned error {status_code}:{status_msg}")
+ return
+ for std in rs.findall(".//StandardTermsRet"):
+ name = (std.findtext("Name") or "").strip()
+ discount_days = (std.findtext("StdDiscountDays") or "").strip()
+ print(f"Term: {name}, Discount Days: {discount_days}")
def main():
@@ -50,4 +73,4 @@ def main():
if __name__ == "__main__":
- main()
+ main()
\ No newline at end of file