| import subprocess | |
| import json | |
| import os | |
| def run_ucp_command(command, args): | |
| """Executes UCP CLI commands.""" | |
| cmd = ["ucp"] + command.split() + args | |
| try: | |
| result = subprocess.run(cmd, capture_output=True, text=True, check=True) | |
| return result.stdout | |
| except subprocess.CalledProcessError as e: | |
| return f"Error executing UCP command: {e.stderr}" | |
| def ucp_get_order_details(order_id, merchant_domain): | |
| # ucp order get {order_id} --business https://{merchant-domain} | |
| args = [order_id, "--business", f"https://{merchant_domain}"] | |
| return run_ucp_command("order get", args) | |