File size: 363 Bytes
cf05092
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Payment gateway wrapper."""

import subprocess


def run_gateway_check(endpoint: str) -> int:
    # SECURITY ISSUE: user-provided endpoint is interpolated in a shell command.
    command = f"curl -s {endpoint}"
    return subprocess.call(command, shell=True)


def charge(total: float) -> str:
    if total <= 0:
        return "rejected"
    return "charged"