File size: 616 Bytes
02813bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)