-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_laticrete_resend.py
More file actions
76 lines (58 loc) · 1.99 KB
/
test_laticrete_resend.py
File metadata and controls
76 lines (58 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python3
"""Test Laticrete order resending functionality."""
import sys
import os
from pathlib import Path
# Add project root to path
sys.path.insert(0, str(Path(__file__).parent))
from src.order_tracker import OrderTracker
from src.laticrete_processor import LatricreteProcessor
from dotenv import load_dotenv
import json
# Load environment variables
load_dotenv(override=True)
def test_laticrete_resend():
"""Test resending a Laticrete order."""
print("\n=== Testing Laticrete Order Resend ===")
# Get order from database
tracker = OrderTracker()
order = tracker.get_order_details('LAT-PDF-PRICE-TEST-001')
if not order:
print("✗ Order not found in database")
return False
print(f"✓ Found order: {order['order_id']}")
print(f" Customer: {order['customer_name']}")
print(f" Sent to: {order['sent_to']}")
# Check order_data
order_data = order.get('order_data')
if not order_data:
print("✗ No order_data found")
return False
print(f"✓ Order data found with {len(order_data.get('laticrete_products', []))} products")
# Test Laticrete processor directly
processor = LatricreteProcessor()
print("\nAttempting to process order...")
try:
success = processor.process_order(order_data)
if success:
print("✓ Order processed successfully!")
return True
else:
print("✗ Order processing failed")
return False
except Exception as e:
print(f"✗ Error processing order: {e}")
import traceback
traceback.print_exc()
return False
def main():
"""Run the test."""
print("=" * 60)
print("Laticrete Order Resend Test")
print("=" * 60)
success = test_laticrete_resend()
print("\n" + "=" * 60)
print(f"Test Result: {'✓ Success' if success else '✗ Failed'}")
print("=" * 60)
if __name__ == "__main__":
main()