{% if mod.success %}
{% set data = mod.data %}
{% if name == 'account' %}
{% for key, val in data.items() if val is not none %}
{% if val is mapping %}
{{ key }}
{% for k2, v2 in val.items() if v2 %}{{ k2 }}: {{ v2 }}{% if not loop.last %}, {% endif %}{% endfor %}
{% elif val is iterable and val is not string %}
{{ key }}
{{ val|join(', ') }}
{% else %}
{% endif %}
{% endfor %}
{% elif name == 'balance' %}
| Type | Amount | Currency |
{% for item in data.get('available', []) %}
| Available | {{ "%.2f"|format(item.amount) }} | {{ item.currency|upper }} |
{% endfor %}
{% for item in data.get('pending', []) %}
| Pending | {{ "%.2f"|format(item.amount) }} | {{ item.currency|upper }} |
{% endfor %}
{% elif name == 'permission_scan' %}
{{ data.get('allowed_count', 0) }} allowed /
{{ data.get('denied_count', 0) }} denied /
{{ data.get('error_count', 0) }} errors
out of {{ data.get('total_endpoints', 0) }} endpoints
| Status | Endpoint |
{% for ep in data.get('allowed', []) %}
| OK | {{ ep }} |
{% endfor %}
{% for ep in data.get('denied', []) %}
| NO | {{ ep }} |
{% endfor %}
{% for err in data.get('errors', []) %}
| ?? | {{ err.endpoint }} ({{ err.error }}) |
{% endfor %}
{% else %}
{% set list_keys = ['customers','charges','intents','products','payouts','subscriptions','invoices','endpoints','events','accounts','disputes','refunds','transactions','coupons'] %}
{% set ns = namespace(found=false) %}
{% for lk in list_keys %}
{% if data[lk] is defined and data[lk] is iterable and data[lk] is not string and not ns.found %}
{% set ns.found = true %}
{% set items = data[lk] %}
{{ data.get('count', items|length) }}{{ '+' if data.get('has_more') else '' }} found
{% if items|length > 0 %}
{% set cols = [] %}
{% for k in items[0].keys() if k != 'metadata' %}{% if cols.append(k) %}{% endif %}{% endfor %}
{% for c in cols %}| {{ c }} | {% endfor %}
{% for item in items[:20] %}
{% for c in cols %}| {{ item[c] if item[c] is not none else '' }} | {% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% if not ns.found %}
{% for key, val in data.items() if val is not none %}
{% endfor %}
{% endif %}
{% endif %}
{% else %}
{{ mod.error or 'Permission denied' }}
{% endif %}