ecommerce installable

This commit is contained in:
Steve Androulakis
2025-04-28 13:35:12 -07:00
parent edb7df5b3c
commit 8e2a29b59d
11 changed files with 131 additions and 127 deletions

View File

@@ -0,0 +1,23 @@
from pathlib import Path
import json
# this is made to demonstrate functionality but it could just as durably be an API call
# called as part of a temporal activity with automatic retries
def get_order(args: dict) -> dict:
order_id = args.get("order_id")
file_path = Path(__file__).resolve().parent.parent / "data" / "customer_order_data.json"
if not file_path.exists():
return {"error": "Data file not found."}
with open(file_path, "r") as file:
data = json.load(file)
order_list = data["orders"]
for order in order_list:
if order["id"] == order_id:
return order
return_msg = "Order " + order_id + " not found."
return {"error": return_msg}