skilly. Buy ad slot
All skills
Finance / AGENT SKILL

p2p

binance/binance-skills-hub
3.8K installs 1K GitHub stars
0

Search Binance P2P ads, compare payment options, track orders and appeals, and manage advertisements.
Binance P2P trading assistant for natural-language queries about P2P/C2C market ads, the user's own P2P order history, order detail & appeal tracking, and advertisement publish & management. Use when the user asks about P2P prices, searching/choosing ads, comparing payment methods, reviewing P2P order history, checking order detail/appeal status, querying complaints, publishing/updating/managing P2P advertisements, or viewing merchant profiles. Do NOT use for spot/futures prices, exchange trading, deposits/withdrawals, on-chain transfers, or anything unrelated to P2P/C2C.

BEFORE YOU INSTALL

Understand the trade-offs.

SECURITY REVIEW

Not yet assessed

Review the original instructions and requested permissions before installing.

No security review is available for this catalog entry yet.

SKILL QUALITY

Not yet assessed

How clearly the skill guides your agent, how complete its workflow is, and how you can check the outcome.

No quality assessment is available for this catalog entry yet.

The full skill.

Original instructions from the publisherโ€™s SKILL.md

# Binance P2P Trading Skill

Help users interact with **Binance P2P (C2C)** via natural-language queries.

## When to Use / When NOT to Use

### Use this skill when the user wants to:
- Check **P2P** buy/sell quotes for a crypto/fiat pair (e.g., USDT/CNY).
- Search **P2P advertisements** and filter by payment method(s), limits, merchant quality.
- Compare prices across payment methods (e.g., Alipay vs bank transfer).
- View **their own P2P order history / summary** (requires API key).
- Query **order detail** and view full order timeline (requires API key).
- Check **appeal/complaint status** and view complaint history (requires API key).
- **Submit evidence** for an existing appeal (upload files + submit description) (requires API key).
- **View complaint process timeline** (flow of actions, CS notes, evidence) (requires API key).
- **Cancel an existing appeal** (withdraw complaint, irreversible) (requires API key).
- **View available complaint reasons** for an order (requires API key).
- **Publish, update, or manage P2P advertisements** (requires API key + merchant permission).
- View **merchant profiles** and their ad listings (requires API key).
- Query **supported digital and fiat currencies** (requires API key).

### Do NOT use this skill when the user asks about:
- Spot/Convert prices, futures/derivatives, margin, trading bots.
- Deposits/withdrawals, wallet transfers, on-chain transactions.
- Creating/cancelling orders, releasing coins (trading operations). Cancelling **appeals** (complaints) IS supported.
- Initiating new appeals (submit-complaint is deferred; evidence supplement for existing appeals IS supported).
- Sending chat messages in order conversations.

### Ask clarifying questions (do not guess) if any key inputs are missing:
- `fiat` (e.g., CNY)
- `asset` (e.g., USDT)
- user intent: **buy crypto** or **sell crypto**
- preferred payment method(s)
- target amount (optional but recommended for ad filtering)

## Core Concepts

### `tradeType` mapping (avoid ambiguity)
- User wants to **buy crypto** (pay fiat, receive USDT/BTC) โ†’ `tradeType=BUY`
- User wants to **sell crypto** (receive fiat, pay USDT/BTC) โ†’ `tradeType=SELL`

Always reflect this mapping in responses when the user's wording is ambiguous.

## Capabilities

### Phase 1 โ€” Public Market (No Auth)
- Quote P2P prices
- Search ads
- Compare payment methods
- Filter/Rank ads by limits and merchant indicators

### Phase 2 โ€” Personal Orders (Requires API Key)
- List P2P order history
- Filter by trade type / time range
- Provide summary statistics

### Phase 3 โ€” Order & Appeal + Ad Publish & Management (Requires API Key)
- Query order detail by order number
- List orders with rich filters (status, trade type, asset, date range)
- View order timeline (creation โ†’ payment โ†’ release โ†’ completion)
- Detect appeal status and show appeal details
- Query complaint/appeal records with filters
- Get market reference prices for pricing decisions
- Upload appeal evidence files (S3 presigned URL + submit)
- View complaint process timeline / flow details
- Cancel an existing appeal / withdraw complaint
- Get available complaint reasons for an order
- Search and analyze market ad distribution
- Get available ad categories for current user
- Get user's configured payment methods
- List all system trade methods
- Publish new advertisements (with confirmation)
- Update existing ad parameters (with confirmation)
- Update ad status: online / offline / close (with confirmation)
- View merchant profile and ad listings
- List all supported digital currencies
- List all supported fiat currencies

## Environment Configuration

### Base URLs (production)

| Logical Name | URL |
|-------------|-----|
| `SAPI_BASE` | `https://api.binance.com` |
| `MGS_BASE` | `https://www.binance.com` |
| `C2C_WEB` | `https://c2c.binance.com` |

### Implementation hint (for code generation)

When the skill generates curl / Python / JS code, use these fixed base URLs:

```python
import os

SAPI_BASE = "https://api.binance.com"
MGS_BASE  = "https://www.binance.com"
C2C_WEB   = "https://c2c.binance.com"

def common_headers(api_key: str) -> dict:
    return {
        "X-MBX-APIKEY": api_key,
        "User-Agent": "binance-wallet/1.0.0 (Skill)",
    }

# Usage:
# f"{SAPI_BASE}/sapi/v1/c2c/agent/orderMatch/getUserOrderDetail"
# f"{MGS_BASE}/bapi/c2c/v1/public/c2c/agent/quote-price"
# f"{C2C_WEB}/en/adv?code={advNo}"
# headers = common_headers(os.getenv("BINANCE_API_KEY"))
```

```bash
# Bash equivalent:
SAPI_BASE="https://api.binance.com"
MGS_BASE="https://www.binance.com"
C2C_WEB="https://c2c.binance.com"
```

> **Note:** SAPI signing uses HMAC SHA256, no param sorting required.

## Security & Privacy Rules

### Credentials
- Required env vars:
    - `BINANCE_API_KEY` (sent as header)
    - `BINANCE_SECRET_KEY` (used for signing)

### Never display full secrets
- API Key: show **first 5 + last 4** characters: `abc12...z789`
- Secret Key: always mask; show **only last 5**: `***...c123`

### Permission minimization
- Binance API permissions: **Enable Reading** only (Phase 1/2).
- Phase 3 ad management additionally needs write permissions.
- Do NOT request/encourage withdrawal or modification permissions beyond what's needed.

### Storage guidance
- Prefer environment injection (session/runtime env vars) over writing to disk.
- Only write to `.env` if the user explicitly agrees.
- Ensure `.env` is in `.gitignore` before saving.

## โš ๏ธ CRITICAL: SAPI Signing (Different from Standard Binance API)

### Parameter ordering
- **DO NOT sort parameters** for SAPI requests.
- Keep original insertion order when building the query string.

Example:
```py
# โœ… Correct for SAPI: keep insertion order
params = {"page": 1, "rows": 20, "timestamp": 1710460800000}
query_string = urlencode(params)  # NO sorting

# โŒ Wrong (standard Binance API only): sorted
query_string = urlencode(sorted(params.items()))
```

### Signing details
See: `references/authentication.md` for:
- RFC 3986 percent-encoding
- HMAC SHA256 signing process
- Required headers (incl. User-Agent)
- SAPI-specific parameter ordering

## API Overview

### Public Queries (MGS C2C Agent API โ€” No Auth)
Base URL: `https://www.binance.com`

| Endpoint | Method | Params | Usage |
|----------|--------|--------|-------|
| `/bapi/c2c/v1/public/c2c/agent/quote-price` | GET | fiat, asset, tradeType | Quick price quote |
| `/bapi/c2c/v1/public/c2c/agent/ad-list` | GET | fiat, asset, tradeType, limit, order, tradeMethodIdentifiers | Search ads |
| `/bapi/c2c/v1/public/c2c/agent/trade-methods` | GET | fiat | Payment methods |

Parameter notes:
- `tradeType`: `BUY` or `SELL` (treat as case-insensitive)
- `limit`: 1โ€“20 (default 10)
- `tradeMethodIdentifiers`: pass as a **plain string** (not JSON array) โ€” e.g. `tradeMethodIdentifiers=BANK` or `tradeMethodIdentifiers=WECHAT`. Values **must** use the `identifier` field returned by the `trade-methods` endpoint (see workflow below). โš ๏ธ Do NOT use JSON array syntax like `["BANK"]` โ€” it will return empty results.

### Workflow: Compare Prices by Payment Method

When the user wants to compare prices across payment methods (e.g., "Alipay vs WeChat"), follow this two-step flow:

**Step 1** โ€” Call `trade-methods` to get the correct identifiers for the target fiat:
```
GET /bapi/c2c/v1/public/c2c/agent/trade-methods?fiat=CNY
โ†’ [{"identifier":"ALIPAY",...}, {"identifier":"WECHAT",...}, {"identifier":"BANK",...}]
```

**Step 2** โ€” Pass the identifier as a plain string into `ad-list` via `tradeMethodIdentifiers`, one payment method per request, then compare:
```
GET /bapi/c2c/v1/public/c2c/agent/ad-list?fiat=CNY&asset=USDT&tradeType=BUY&limit=5&tradeMethodIdentifiers=ALIPAY&tradeMethodIdentifiers=WECHAT
```
Compare the best price from each result set.

> **Important:** Do not hardcode identifier values like `"Alipay"` or `"BANK"`. Always call `trade-methods` first to get the exact `identifier` strings for the given fiat currency.

### Personal Orders (Binance SAPI โ€” Requires Auth)
Base URL: `https://api.binance.com`

| Endpoint | Method | Auth | Usage |
|----------|--------|------|-------|
| `/sapi/v1/c2c/orderMatch/listUserOrderHistory` | GET | Yes | Order history |
| `/sapi/v1/c2c/orderMatch/getUserOrderSummary` | GET | Yes | User statistics |

Authentication requirements:
- Header: `X-MBX-APIKEY`
- Query: `timestamp` + `signature`
- Header: `User-Agent: binance-wallet/1.0.0 (Skill)`

## Output Format Guidelines

### Price quote
- Show both sides when available (best buy / best sell).
- Use fiat symbol and 2-decimal formatting.

Example:
```
USDT/CNY (P2P)
- Buy USDT (you buy crypto): ยฅ7.20
- Sell USDT (you sell crypto): ยฅ7.18
```

### Ad list
Return **Top N** items with a stable schema:
1) adNo (ad number / identifier)
2) price (fiat)
3) merchant name
4) completion rate
5) limits
6) payment methods (identifiers)

Avoid generating parameterized external URLs unless the API returns them.

**Placing orders (when user requests):**
- This skill does NOT support automated order placement.
- When user wants to place an order, provide a direct link to the specific ad using the adNo:
  ```
  https://c2c.binance.com/en/adv?code={adNo}
  ```
    - `{adNo}`: the ad number/identifier from the ad list result

  Example: `https://c2c.binance.com/en/adv?code=123`
- This opens the specific ad detail page where user can place order directly with the selected advertisement.

### Personal orders
- Time format: `YYYY-MM-DD HH:mm (UTC+0)` โ€” always display in UTC timezone
- Include: type, asset/fiat, amount, total, status
- Provide a brief summary line (count + totals) when filtering

**Time field conversion (for `createTime` in `listUserOrderHistory`):**
- The `createTime` field returns a Unix timestamp in **milliseconds** (13 digits).
- Convert to human-readable format in **UTC+0 timezone**:
  ```
  # Python example
  from datetime import datetime, timezone
  readable_time = datetime.fromtimestamp(createTime / 1000, tz=timezone.utc).strftime('%Y-%m-%d %H:%M (UTC+0)')
  
  # JavaScript example
  const readableTime = new Date(createTime).toISOString().replace('T', ' ').slice(0, 16) + ' (UTC+0)';
  // Or more explicitly:
  const date = new Date(createTime);
  const readableTime = date.getUTCFullYear() + '-' +
    String(date.getUTCMonth() + 1).padStart(2, '0') + '-' +
    String(date.getUTCDate()).padStart(2, '0') + ' ' +
    String(date.getUTCHours()).padStart(2, '0') + ':' +
    String(date.getUTCMinutes()).padStart(2, '0') + ' (UTC+0)';
  ```
- Always display the converted time to users with timezone info, not the raw timestamp.

## Error Handling (User-Facing)

- Invalid API key (-2015): prompt to verify `.env` / API Management.
- Signature failed (-1022): warn about wrong secret, sorted params, or stale timestamp.
- Timestamp invalid (-1021): advise time sync / regenerate timestamp.
- Rate limit: ask to retry later.

## Limitations (By Design)

This skill does NOT:
- Place/cancel orders
- Mark as paid / release coins
- Initiate new appeals / submit-complaint (only evidence supplement for existing appeals is supported)
- Post/modify advertisements (Phase 1/2 only โ€” Phase 3 adds ad management for merchants)
- Expose sensitive order-detail endpoints beyond what's needed for history/summary

For in-app actions, guide users to the official P2P orders page (only as a general entry point).

## Developer Notes

### Version Check (First Invocation per Conversation)
On the first invocation of this skill per conversation, call:

- `GET /bapi/c2c/v1/public/c2c/agent/check-version?version=2.0.0` (Base: `https://www.binance.com`)

Behavior:
- If `needUpdate=true`: show: `New version of P2P Skill is available (current: {clientVersion}, latest: {latestVersion}), update recommended.`
- Else / on failure: proceed silently.

### Client-side operations
- Asset filtering: if API doesn't support it, fetch then filter locally.
- Aggregations: compute totals client-side when summary endpoint is insufficient.

---

# Phase 3 โ€” Order & Appeal + Ad Publish & Management

Phase 3 extends the skill from read-only market/order queries to **write operations** (ad management) and **advanced order workflows** (order detail, appeal/complaint tracking).

## Phase 3 Design Constraints

| Constraint | Details |
|-----------|---------|
| Authentication | All Phase 3 features require API Key + Secret Key |
| Write-op confirmation | Any write operation (publish ad, update ad, change status) **must show an operation summary and get explicit user confirmation** before executing |
| API Key permissions | Phase 1 only needed "Enable Reading"; Phase 3 additionally needs write permissions for ad management |
| Privacy masking | Never display counterparty sensitive info (bank card, Alipay account, phone, email, real name) or internal IDs (`payId`). Even if the API returns these fields, **filter them out in user-facing output**. For payment methods, show only `tradeMethodName` (e.g. "ๆ”ฏไป˜ๅฎ") |

---

## Scene 1: Order Query & Appeal Handling

### 1.1 Query Order Detail

**Trigger examples:**
- "ๆŸฅ็œ‹่ฎขๅ• 20260315123456 ็š„่ฏฆๆƒ…"
- "ๆˆ‘ๆœ€่ฟ‘้‚ฃ็ฌ” USDT ไนฐๅ…ฅ่ฎขๅ•ๆ€Žไนˆๆ ทไบ†๏ผŸ"
- "ๅธฎๆˆ‘ๆŸฅไธ€ไธ‹่ฟ™ไธช่ฎขๅ•ๅท"
- "Show me the details of order 20260315123456"

**Behavior:**
1. If user provides an order number โ†’ call `getUserOrderDetail`
2. If user describes an order vaguely โ†’ call `listOrders` with filters, then let user pick
3. Based on order status, branch:

**Status branch handling:**

| Status | Action |
|--------|--------|
| Completed (4) | Show full timeline (create โ†’ pay โ†’ confirm โ†’ complete), finish |
| Cancelled (6) / Expired (7) | Show cancel reason (timeout / manual / system), finish |
| In Progress (1=Unpaid, 2=Paid, 3=Releasing) | Show current step + countdown timers |
| In Appeal (5) | Auto-enter 1.2 โ€” show appeal status |

**Output format (Order Detail):**
```
๐Ÿ“‹ Order No: {orderNumber}
โ”œโ”€ Type: {tradeType} {asset}
โ”œโ”€ Amount: {amount} {asset} @ {price} {fiatUnit}
โ”œโ”€ Total: {fiatSymbol}{totalPrice}
โ”œโ”€ Status: {orderStatus description}
โ”œโ”€ Counterparty: {buyerNickname / sellerNickname}
โ”œโ”€ Created: {createTime in UTC+0}
โ”‚
โ”œโ”€ Timeline:
โ”‚  โ”œโ”€ Created:     {createTime}
โ”‚  โ”œโ”€ Paid:        {notifyPayTime or "โ€”"}
โ”‚  โ”œโ”€ Confirmed:   {confirmPayTime or "โ€”"}
โ”‚  โ””โ”€ Cancelled:   {cancelTime or "โ€”"}
โ”‚
โ”œโ”€ Commission: maker {commissionRate}% = {commission} {asset}
โ”‚              taker {takerCommissionRate}% = {takerCommission} {asset}
โ””โ”€ Complaint: {isComplaintAllowed ? "Allowed" : "Not Allowed"} | Status: {complaintStatus or "None"}
```

**Countdown display (for in-progress orders):**
- If status=1 (Unpaid): show "Payment deadline: {notifyPayEndTime}" with remaining time
- If status=2 (Paid): show "Release deadline: {confirmPayEndTime}" with remaining time

### 1.2 View Appeal / Complaint Status

**Trigger:**
- Automatically when order status = In Appeal (5)
- "่ฟ™ไธช็”ณ่ฏ‰่ฟ›ๅฑ•ๅˆฐๅ“ชไบ†๏ผŸ"
- "่ฎขๅ• 20260315123456 ็š„็”ณ่ฏ‰ๆ€Žไนˆๆ ทไบ†๏ผŸ"
- "What's the appeal status?"

**Behavior:**
1. Call `query-complaints` with the order number
2. Display complaint info in structured format

**Output format:**
```
โš ๏ธ Appeal Status for Order {orderNo}
โ”œโ”€ Complaint No: {complaintNo}
โ”œโ”€ Status: {complaintStatus description}
โ”œโ”€ Role: {roleIdentity} (COMPLAINANT / RESPONDENT)
โ”œโ”€ Reason: {reason}
โ”œโ”€ Created: {complaintCreateTime}
โ”œโ”€ Order Asset: {orderAsset} | Fiat: {orderFiat}
โ”œโ”€ Order Amount: {orderAmount} ({fiatSymbol})
โ”œโ”€ Amount in USDT: {orderAmountInUsdt}
โ””โ”€ Dispute Amount: {disputeAmount}
```

**Follow-up guidance (append after the status block, based on complaintStatus):**

| complaintStatus | Guidance to show |
|----------------|------------------|
| 0 (Respondent Processing) | "Waiting for the counterparty to respond. You will be notified when there is an update." |
| 1 (Complainant Processing) | "โšก Action needed โ€” you need to provide evidence or respond. Say **\"submit evidence for order {orderNo}\"** to upload proof now." |
| 2 (CS Processing) | "๐Ÿ’ก Both parties may still submit evidence at this stage. You can submit evidence directly through this skill โ€” say **\"submit evidence for order {orderNo}\"** or **\"ๆไบค่ฏๆฎ\"** to upload payment proof, screenshots, or other supporting documents." |
| 3 (Completed) | "This appeal has been resolved." |
| 4 (Cancelled) | "This appeal has been cancelled." |

> **MUST follow:** When `complaintStatus` is 0, 1, or 2 (appeal still active), NEVER tell the user to "go to the app" or "head to the dispute center". Always guide them to use this skill to submit evidence. The skill supports the full evidence upload flow (Scene 1.5).

**Complaint status mapping:**

| Status Code | Display Name | Description |
|------------|-------------|-------------|
| 0 | Respondent Processing (่ขซ็”ณ่ฏ‰ไบบๅค„็†ไธญ) | Complaint initiated, waiting for counterparty to respond |
| 1 | Complainant Processing (็”ณ่ฏ‰ไบบๅค„็†ไธญ) | Waiting for complainant to provide evidence or take action |
| 2 | CS Processing (ๅฎขๆœๅค„็†ไธญ) | Customer service reviewing; both parties may submit evidence |
| 3 | Completed (ๅทฒๅฎŒๆˆ) | Appeal resolved |
| 4 | Complaint Cancelled (็”ณ่ฏ‰ๅ–ๆถˆ) | Appeal withdrawn |

> **Important:** Do NOT confuse these with `orderStatus` codes โ€” they are separate enums.
> When `complaintStatus=2` (CS Processing), the user should be guided to submit evidence if needed; do NOT tell them to "wait for counterparty".

### 1.3 Complaint History Query

**Trigger:**
- "ๆŸฅ็œ‹ๆˆ‘็š„ๆ‰€ๆœ‰็”ณ่ฏ‰่ฎฐๅฝ•"
- "ๆœ€่ฟ‘3ไธชๆœˆๆœ‰ๅ“ชไบ›็”ณ่ฏ‰๏ผŸ"
- "List my complaints as complainant"

**Behavior:**
1. Call `query-complaints` with optional filters (roleIdentity, status, date range)
2. Default: last 90 days if no date specified
3. Show paginated results

**Output format:**
```
๐Ÿ“‹ Complaint Records (Total: {total})
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Order No  โ”‚ Complaint No โ”‚ Status   โ”‚ Role   โ”‚ Created       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ {orderNo} โ”‚ {no}         โ”‚ {status} โ”‚ {role} โ”‚ {time UTC+0}  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### 1.4 Order List & History

**Trigger:**
- "ๆŸฅ็œ‹ๆˆ‘็š„่ฎขๅ•ๅˆ—่กจ"
- "ๆœ€่ฟ‘็š„ USDT ไนฐๅ…ฅ่ฎขๅ•"
- "Show my completed orders this week"

**Behavior:**
- For active/recent orders โ†’ use `listOrders` (richer filter: advNo, status, payType)
- For historical orders โ†’ use `listUserOrderHistory` (supports tradeType, date range)

**Output format (Order List):**
```
๐Ÿ“‹ Orders (Page {page}, Total: {total})
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Order No     โ”‚ Type โ”‚ Asset โ”‚ Total        โ”‚ Status โ”‚ Created       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ {orderNo}    โ”‚ BUY  โ”‚ USDT  โ”‚ ยฅ{totalPrice}โ”‚ ๅทฒๅฎŒๆˆ  โ”‚ {time UTC+0}  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

**Order status code mapping:**

| Code | Name | Chinese |
|------|------|---------|
| 0 | Pending | ๅค„็†ไธญ |
| 1 | Unpaid | ๆœชไป˜ๆฌพ |
| 2 | Paid (Unconfirmed) | ๅทฒไป˜ๆฌพ |
| 3 | Releasing | ๆ”พๅธๅค„็†ไธญ |
| 4 | Completed | ๅทฒๅฎŒๆˆ |
| 5 | In Appeal | ็”ณ่ฏ‰ไธญ |
| 6 | Cancelled | ๅทฒๅ–ๆถˆ |
| 7 | Expired (System Cancel) | ่ถ…ๆ—ถๅ–ๆถˆ |

### 1.5 Submit Appeal Evidence

**Trigger:**
- "ๅธฎๆˆ‘ไธŠไผ ่ฟ™ไธชๆˆชๅ›พไฝœไธบ็”ณ่ฏ‰่ฏๆฎ"
- "ๆˆ‘่ฆๆไบคไป˜ๆฌพๅ‡ญ่ฏ"
- "Submit evidence for order 228..."
- "Upload proof of payment for my appeal"
- Automatically suggested when order is in Appeal (status=5) and `complaintStatus=2` (CS Processing)

**Behavior (3-step flow):**

**Step 1 โ€” Get presigned upload URL:**
```
GET /sapi/v1/c2c/agent/file-upload/get-s3-presigned-url?fileName=proof.jpg&scenario=complaint
โ†’ { "uploadUrl": "https://s3...presigned...", "filePath": "/client_upload/c2c/complaint/..." }
```

**Step 2 โ€” Upload file to S3:**
```bash
curl -X PUT -T /path/to/local/file.jpg "{uploadUrl}"
```
> The presigned URL is valid for **5 minutes**. Upload must complete within this window.

**Step 3 โ€” Submit evidence to SAPI:**
```
POST /sapi/v1/c2c/agent/complaint/submit-evidence
Body: { "orderNo": "228...", "description": "ไป˜ๆฌพๆˆชๅ›พ", "fileUrls": ["/client_upload/c2c/complaint/..."] }
โ†’ { "data": true }
```

**Supported file types:**
`txt, doc, xls, docx, xlsx, jpg, jpeg, png, pdf, mp3, mp4, avi, rm, rmvb, mov, wmv`

**Output format (Upload Progress):**
```
๐Ÿ“ค Evidence Upload for Order {orderNo}
โ”œโ”€ Step 1/3: Getting upload URL... โœ…
โ”œโ”€ Step 2/3: Uploading file "{fileName}"... โœ…
โ”œโ”€ Step 3/3: Submitting evidence...
โ”‚  โ”œโ”€ Description: {description}
โ”‚  โ””โ”€ Files: {n} file(s)
โ””โ”€ Result: โœ… Evidence submitted successfully

๐Ÿ’ก Tip: You can submit additional evidence by saying "ๅ†ไธŠไผ ไธ€ไธชๆ–‡ไปถ"
```

**Output format (Failure):**
```
โŒ Evidence Upload Failed
โ”œโ”€ Step: {which step failed}
โ”œโ”€ Error: {error message}
โ””โ”€ Suggestion: {actionable fix}
```

**Common errors:**
- `Unsupported file type` โ†’ Check file extension; see supported types above
- `Presigned URL expired` โ†’ Re-request upload URL (Step 1)
- `Order not in appeal` โ†’ Evidence can only be submitted for orders with active complaints
- `File too large` โ†’ Reduce file size or split into multiple files

**Write-op confirmation rule:**
Evidence submission follows the same confirmation protocol as Scene 2 write operations:
1. Show a summary of what will be submitted (file name, description, order number)
2. Wait for user to confirm before executing Step 3

**Confirmation format:**
```
๐Ÿ“‹ Evidence Submission Summary
โ”œโ”€ Order: {orderNo}
โ”œโ”€ Description: {description}
โ”œโ”€ Files to submit:
โ”‚  1. {fileName1} ({fileType}, uploaded โœ…)
โ”‚  2. {fileName2} ({fileType}, uploaded โœ…)
โ””โ”€ โš ๏ธ Confirm submission? (reply "็กฎ่ฎค" or "confirm")
```

### 1.6 View Complaint Process Timeline

**Trigger:**
- "ๆŸฅ็œ‹็”ณ่ฏ‰็š„ๅค„็†ๆต็จ‹"
- "่ฟ™ไธช็”ณ่ฏ‰็ปๅކไบ†ๅ“ชไบ›ๆญฅ้ชค๏ผŸ"
- "Show complaint timeline for order 228..."
- "What happened in the appeal process?"

**Behavior:**
1. Call `get-complaint-flows` with orderNo (and optionally complaintNo)
2. Display chronological timeline of all process steps

**Output format:**
```
๐Ÿ“œ Complaint Timeline: Order {orderNo} (Complaint #{complaintNo})
โ”‚
โ”œโ”€ [{createTime}] {creatorNickName}
โ”‚  โ”œโ”€ Type: {infoType description}
โ”‚  โ”œโ”€ Description: {description}
โ”‚  โ”œโ”€ Evidence: {fileUrls count} file(s) attached
โ”‚  โ””โ”€ Source: {source}
โ”‚
โ”œโ”€ [{createTime}] {operatorName or creatorNickName}
โ”‚  โ”œโ”€ Type: {infoType description}
โ”‚  โ”œโ”€ Remark: {remark}
โ”‚  โ””โ”€ Evidence: {fileUrls or "None"}
โ”‚
โ””โ”€ ... (chronological order)

๐Ÿ’ก Actions: "ๆไบค่ฏๆฎ" to submit evidence | "ๅˆทๆ–ฐ" to check for updates
```

**Info type mapping (for display):**

| infoType | Description |
|----------|-------------|
| 1 | Complaint Initiated |
| 2 | Evidence Submitted |
| 3 | CS Review Note |
| 4 | Resolution / Decision |

> **Note:** `fileUrls` in the response are CDN-assembled URLs that can be directly accessed.
> `remarkHtml` takes precedence over `remark` when available for rendering.

### 1.7 Cancel Complaint / Appeal

**Trigger:**
- "ๅ–ๆถˆ่ฟ™ไธช็”ณ่ฏ‰"
- "ๆˆ‘ไธๆƒณ็ปง็ปญ็”ณ่ฏ‰ไบ†"
- "Cancel my appeal for order 228..."
- "Withdraw my complaint"

**โš ๏ธ This is a DESTRUCTIVE action โ€” mandatory confirmation required!**

Cancelling an appeal is **irreversible**. The user forfeits their dispute and the order proceeds to its normal resolution. The agent MUST follow this strict confirmation protocol:

**Behavior:**
1. When user expresses intent to cancel, FIRST show a clear warning
2. Wait for explicit confirmation ("็กฎ่ฎคๅ–ๆถˆ" / "confirm cancel" / "yes")
3. Only then call `cancel-complaint` with the orderNo
4. Display the result

**Warning format (MUST show before executing):**
```
โš ๏ธ Cancel Appeal Confirmation
โ”œโ”€ Order: {orderNo}
โ”œโ”€ Current complaint status: {status from previous query if available}
โ”‚
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘  WARNING: This action CANNOT be undone!      โ•‘
โ•‘  - Your appeal will be permanently withdrawn โ•‘
โ•‘  - You will lose the right to dispute this   โ•‘
โ•‘    order through the appeal process          โ•‘
โ•‘  - The order will proceed to normal          โ•‘
โ•‘    resolution without CS intervention        โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ”‚
โ””โ”€ Reply "็กฎ่ฎคๅ–ๆถˆ" or "confirm cancel" to proceed
```

**On success:**
```
โœ… Appeal Cancelled
โ”œโ”€ Order: {orderNo}
โ”œโ”€ Status: Appeal withdrawn
โ””โ”€ The order will now proceed to normal resolution.
```

**On failure:**
```
โŒ Cancel Failed
โ”œโ”€ Order: {orderNo}
โ”œโ”€ Reason: {error message}
โ””โ”€ Possible causes: no active appeal, order already resolved, or insufficient permissions.
```

**MUST-follow rules:**
- NEVER cancel without showing the warning and receiving explicit confirmation
- If user says anything ambiguous (like "็ฎ—ไบ†" / "never mind" in a conversation about something else), do NOT interpret it as cancel intent โ€” ask to clarify
- If the complaint status is already resolved/closed, inform user instead of attempting the API call

### 1.8 Get Complaint Reasons

**Trigger:**
- "ๆˆ‘ๅฏไปฅ็”จไป€ไนˆ็†็”ฑ็”ณ่ฏ‰๏ผŸ"
- "What reasons can I use to appeal?"
- "Show available complaint reasons for this order"
- "็”ณ่ฏ‰็†็”ฑๆœ‰ๅ“ชไบ›๏ผŸ"

**Behavior:**
1. Call `get-complaint-reasons` with orderNo
2. Display the list of available reason codes and descriptions

**Output format:**
```
๐Ÿ“‹ Available Complaint Reasons for Order {orderNo}
โ”‚
โ”œโ”€ [{reasonCode}] {reasonDesc}
โ”œโ”€ [{reasonCode}] {reasonDesc}
โ”œโ”€ [{reasonCode}] {reasonDesc}
โ””โ”€ ...

๐Ÿ’ก Note: These are the reasons you can use when initiating an appeal.
   This skill does NOT support initiating appeals โ€” only viewing reasons.
```

> **Note:** This is a read-only informational query. The skill does NOT support actually submitting a new complaint (that requires the user to use the App).

---

## Scene 2: Ad Publish & Management

### โš ๏ธ Write Operation Safety Rules

**ALL write operations** in Scene 2 MUST follow this protocol:

1. **Pre-check**: Verify user has merchant permission (the API itself checks, but inform user clearly on 403/Permission denied)
2. **Show summary**: Before executing any write API, display a complete operation summary
3. **Explicit confirmation**: Wait for user to say "็กฎ่ฎค" / "confirm" / "ๅ‘ๅธƒ" / "yes" before proceeding
4. **Never auto-execute**: Even if user says "just do it" in the initial request, still show summary first

### 2.1 Market Analysis & Reference Pricing

**Trigger:**
- "ๆˆ‘ๆƒณๅ‘ไธ€ไธช USDT/CNY ็š„ๅ–ๅ•ๅนฟๅ‘Š"
- "ๅธฎๆˆ‘ๆŒ‚ไธ€ไธช BTC ไนฐๅ•"
- "ๅฝ“ๅ‰ๅธ‚ๅœบๅ‚่€ƒไปทๆ˜ฏๅคšๅฐ‘๏ผŸ"
- "What's the reference price for USDT/CNY?"

**Behavior:**
1. Call `getReferencePrice` to get market reference prices
2. Call `search` to analyze current market ad distribution
3. Present pricing intelligence to help user decide

**Output format (Reference Price):**
```
๐Ÿ“Š Market Reference Price
โ”œโ”€ Asset: {asset} / {fiatCurrency}
โ”œโ”€ Reference Price: {currencySymbol}{referencePrice}
โ”œโ”€ Price Scale: {priceScale} decimals
โ””โ”€ Asset Scale: {assetScale} decimals
```

**Output format (Market Analysis):**
```
๐Ÿ“Š Market Ad Analysis: {asset}/{fiat} ({tradeType})
โ”œโ”€ Total Active Ads: {total}
โ”œโ”€ Price Range: {min} ~ {max}
โ”œโ”€ Top 5 Ads:
โ”‚  1. {advNo} | {price} | {surplusAmount} {asset} | Limit: {min}~{max} | {merchantNick}
โ”‚     โ””โ”€ Terms: {remarks or "โ€”"}
โ”‚  2. ...
โ””โ”€ Recommended Price: {suggestion based on reference + market}
```

### 2.2 Ad Configuration

**Trigger:**
- "็”จๆตฎๅŠจไปทๆ ผ๏ผŒๆบขไปท 0.5%"
- "ๅŠ ไธŠๆ”ฏไป˜ๅฎ"
- "ๅฐฑๆŒ‰ๆŽจ่็š„ๆฅ"
- "ๅ•ไปทๆ”นๆˆ 6.99๏ผŒ้™้ขๆ”นๅˆฐ 1000-100000"

**Pre-publish preparation workflow:**

**Step 1** โ€” Get available categories:
```
GET /sapi/v1/c2c/agent/ads/getAvailableAdsCategory
โ†’ {"advClassifies": ["mass", "profession", ...]}
```

**Step 2** โ€” Get user's payment methods (for SELL ads, need payId):
```
GET /sapi/v1/c2c/agent/ads/getPayMethodByUserId
โ†’ [{"payId": 123, "identifier": "ALIPAY", "tradeMethodName": "ๆ”ฏไป˜ๅฎ"}]
```
> **Display rule:** Only show `tradeMethodName` (e.g. "ๆ”ฏไป˜ๅฎ", "WeChat", "Bank Transfer") to the user.
> `payId` is an internal identifier used only in the API request body โ€” **never expose payId values in user-facing output**.

**Step 3** โ€” Get all system trade methods (for BUY ads, need identifier):
```
POST /sapi/v1/c2c/agent/ads/listAllTradeMethods
โ†’ [{"identifier": "ALIPAY", "tradeMethodName": "ๆ”ฏไป˜ๅฎ", ...}]
```

**Ad parameter reference:**

| Parameter | Required | Description |
|-----------|----------|-------------|
| classify | Y | Ad category: mass / profession / block / cash (default: mass) |
| tradeType | Y | 0 = BUY, 1 = SELL |
| asset | Y | Crypto: BTC, ETH, USDT, BNB |
| fiatUnit | Y | Fiat: CNY, USD, etc. |
| priceType | Y | 1 = Fixed price, 2 = Floating price |
| price | Conditional | Fixed price value (required if priceType=1) |
| priceFloatingRatio | Conditional | Floating ratio % (required if priceType=2) |
| initAmount | Y | Total crypto quantity |
| maxSingleTransAmount | Y | Max per-order fiat amount |
| minSingleTransAmount | Y | Min per-order fiat amount |
| buyerKycLimit | Y | Require buyer KYC: 0=No, 1=Yes |
| tradeMethods | Y | Payment methods: [{payId, identifier}] |
| payTimeLimit | N | Payment time limit in minutes (default 15) |
| onlineNow | N | Go online immediately (default true) |
| remarks | N | Ad trading terms / conditions (max 1000 chars, no crypto-related words) |
| autoReplyMsg | N | Auto-reply message on order creation (max 1000 chars) |
| buyerRegDaysLimit | N | Min buyer registration days |
| buyerBtcPositionLimit | N | Min buyer BTC holding |
| takerAdditionalKycRequired | N | Require extra verification: 0=No, 1=Yes |
| launchCountry | N | Target countries (default: all regions) |

**Confirmation summary format:**
```
๐Ÿ“‹ Ad Configuration Summary
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Trade Direction: {SELL/BUY} {asset}โ”‚
โ”‚ Fiat Currency:   {fiatUnit}        โ”‚
โ”‚ Price Type:      {Fixed/Floating}  โ”‚
โ”‚ Price:           {price or ratio%} โ”‚
โ”‚ Total Quantity:  {initAmount} {asset}โ”‚
โ”‚ Order Limit:     {min} ~ {max} {fiat}โ”‚
โ”‚ Payment Methods: {method1, method2}โ”‚
โ”‚ Payment Timeout: {payTimeLimit} minโ”‚
โ”‚ Status:          {Online/Offline}  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Advanced Settings:                 โ”‚
โ”‚  Buyer KYC: {Yes/No}              โ”‚
โ”‚  Min Reg Days: {days or "โ€”"}      โ”‚
โ”‚  Min BTC: {amount or "โ€”"}         โ”‚
โ”‚  Extra Verify: {Yes/No}           โ”‚
โ”‚  Regions: {countries or "All"}    โ”‚
โ”‚  Remarks: {text or "โ€”"}           โ”‚
โ”‚  Auto Reply: {text or "โ€”"}        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โš ๏ธ Please confirm to publish (reply "็กฎ่ฎค" or "confirm")
```

### 2.3 Publish Ad

**Trigger:**
- "็กฎ่ฎค" / "confirm" / "ๅ‘ๅธƒ" (after 2.2 summary)

**Behavior:**
1. User confirms โ†’ call `POST /sapi/v1/c2c/agent/ads/post`
2. Return result

**Output format (Success):**
```
โœ… Ad Published Successfully!
โ”œโ”€ Ad Number: {advNo}
โ”œโ”€ Status: Online
โ”œโ”€ View: https://c2c.binance.com/en/adv?code={advNo}
โ””โ”€ Manage: say "ๆŸฅ็œ‹ๆˆ‘็š„ๅนฟๅ‘Š" to see all your ads
```

**Output format (Failure):**
```
โŒ Ad Publish Failed
โ”œโ”€ Error: {error message}
โ””โ”€ Suggestion: {actionable fix}
```

**Common errors:**
- `Permission denied` โ†’ User is not a verified merchant
- `FIAT_ASSET_ILLEGAL` โ†’ BIDR can only pair with IDR
- Insufficient balance โ†’ Check asset balance before publishing

### 2.4 Manage Existing Ads

**Trigger:**
- "ๆŸฅ็œ‹ๆˆ‘็š„ๅนฟๅ‘Š" / "List my ads"
- "ๆŠŠ็ฌฌ 1 ๆกๅนฟๅ‘Šไธ‹ๆžถ" / "Take the first ad offline"
- "ไฟฎๆ”นๆˆ‘้‚ฃๆก USDT ๅ–ๅ•็š„ไปทๆ ผ" / "Update price for my USDT sell ad"

#### List My Ads
Call `POST /sapi/v1/c2c/agent/ads/listWithPagination`

**Output format:**
```
๐Ÿ“‹ My Advertisements (Total: {total})
โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ #  โ”‚ Ad No        โ”‚ Type โ”‚ Asset โ”‚ Price    โ”‚ Remaining   โ”‚ Limit    โ”‚ Status โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1  โ”‚ {advNo}      โ”‚ SELL โ”‚ USDT  โ”‚ ยฅ{price} โ”‚ {surplus}   โ”‚ {min}~{max}โ”‚ Online โ”‚
โ”‚ 2  โ”‚ {advNo}      โ”‚ BUY  โ”‚ BTC   โ”‚ ยฅ{price} โ”‚ {surplus}   โ”‚ {min}~{max}โ”‚ Offlineโ”‚
โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

# If any ad has remarks or autoReplyMsg, show below the table:
Ad Terms:
  #1: {remarks or "โ€”"} | Auto-reply: {autoReplyMsg or "โ€”"}
  #2: {remarks or "โ€”"} | Auto-reply: {autoReplyMsg or "โ€”"}

Actions: "ไฟฎๆ”น็ฌฌ1ๆกๅนฟๅ‘Šไปทๆ ผ" | "ไธ‹ๆžถ็ฌฌ2ๆก" | "ๆŸฅ็œ‹่ฏฆๆƒ… {advNo}"
```

#### View Ad Detail
Call `POST /sapi/v1/c2c/agent/ads/getDetailByNo`

**Trigger:** "ๆŸฅ็œ‹่ฏฆๆƒ… {advNo}" / "Show ad detail"

**Output format:**
```
๐Ÿ“„ Ad Detail: {advNo}
โ”œโ”€ Type: {tradeType} {asset}/{fiatUnit}
โ”œโ”€ Price: {currencySymbol}{price} ({priceType: Fixed/Floating})
โ”œโ”€ Remaining: {surplusAmount} / {initAmount} {asset}
โ”œโ”€ Limit: {minSingleTransAmount} ~ {maxSingleTransAmount} {fiatUnit}
โ”œโ”€ Payment Methods: {tradeMethodName1, tradeMethodName2}
โ”œโ”€ Status: {status}
โ”œโ”€ Payment Timeout: {payTimeLimit} min
โ”‚
โ”œโ”€ Trading Terms:
โ”‚  {remarks or "No terms set"}
โ”‚
โ”œโ”€ Auto-Reply Message:
โ”‚  {autoReplyMsg or "No auto-reply set"}
โ”‚
โ””โ”€ Advanced:
   โ”œโ”€ Buyer KYC: {Yes/No}
   โ”œโ”€ Min Reg Days: {buyerRegDaysLimit or "โ€”"}
   โ””โ”€ Extra Verify: {takerAdditionalKycRequired ? "Yes" : "No"}
```

> **Display rule for `remarks` and `autoReplyMsg`:** These fields are returned by `getDetailByNo`, `listWithPagination`, and `search`. When present and non-empty, always show them. When null/empty, show "โ€”" or a placeholder like "No terms set". Never omit the section silently โ€” the user should know whether terms exist.

**Ad status code mapping:**

| Code | Display | Chinese |
|------|---------|---------|
| 1 | Online | ๅœจ็บฟ |
| 2 | Offline | ็ฆป็บฟ |
| 4 | Closed | ๅทฒๅ…ณ้—ญ |

#### Update Ad

**Behavior:**
1. Identify which ad to update (by # in list or advNo)
2. Show diff: old value โ†’ new value
3. Wait for confirmation
4. Call `POST /sapi/v1/c2c/agent/ads/update`

**Confirmation format:**
```
๐Ÿ“ Update Ad: {advNo}
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Field        โ”‚ Current     โ”‚ New         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Price        โ”‚ ยฅ7.20       โ”‚ ยฅ6.99       โ”‚
โ”‚ Max Limit    โ”‚ ยฅ50,000     โ”‚ ยฅ100,000    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โš ๏ธ Confirm update? (reply "็กฎ่ฎค" or "confirm")
```

#### Update Ad Status (Online / Offline / Close)

**Behavior:**
1. Identify target ad(s) โ€” supports batch operation
2. Show confirmation
3. Call `POST /sapi/v1/c2c/agent/ads/updateStatus`

**Confirmation format:**
```
๐Ÿ”„ Status Update
โ”œโ”€ Ads: {advNo1}, {advNo2}
โ”œโ”€ Action: {Online โ†’ Offline}
โ””โ”€ โš ๏ธ Confirm? (reply "็กฎ่ฎค" or "confirm")
```

**Result format:**
```
โœ… Status updated: {n} ad(s) โ†’ {status}
# Or if partial failure:
โš ๏ธ Partial success: {n} updated, {m} failed
Failed:
โ”œโ”€ {advNo}: {errorMessage}
```

---

## Scene 2 Supplement: Merchant & Currency Queries

### View Merchant Profile

**Trigger:**
- "ๆŸฅ็œ‹ๅ•†ๅฎถ {merchantNo} ็š„ไฟกๆฏ"
- "Show me merchant details"

**Behavior:** Call `GET /sapi/v1/c2c/agent/merchant/getAdDetails?merchantNo={merchantNo}`

**Output format:**
```
๐Ÿ‘ค Merchant: {nickName}
โ”œโ”€ Type: {userType}
โ”œโ”€ Total Orders: {orderCount}
โ”œโ”€ 30-Day Orders: {monthOrderCount}
โ”œโ”€ 30-Day Completion: {monthFinishRate}%
โ”œโ”€ Avg Release Time: {advConfirmTime}s
โ”œโ”€ Online: {onlineStatus}
โ”œโ”€ Registered: {registerDays} days
โ”‚
โ”œโ”€ 30-Day Stats:
โ”‚  โ”œโ”€ Avg Release: {avgReleaseTimeOfLatest30day}s
โ”‚  โ”œโ”€ Avg Payment: {avgPayTimeOfLatest30day}s
โ”‚  โ””โ”€ Completed: {completedOrderNumOfLatest30day}
โ”‚
โ”œโ”€ Buy Ads ({n}):
โ”‚  1. {advNo} | {asset}/{fiat} | {price} | {surplus} remaining
โ”‚     โ””โ”€ Terms: {remarks or "โ€”"}
โ”‚
โ””โ”€ Sell Ads ({n}):
   1. {advNo} | {asset}/{fiat} | {price} | {surplus} remaining
      โ””โ”€ Terms: {remarks or "โ€”"}
```

### List Supported Currencies

**Trigger:**
- "P2Pๆ”ฏๆŒๅ“ชไบ›ๅธ็ง๏ผŸ"
- "What fiat currencies are supported?"

**Behavior:**
- Digital currencies: `POST /sapi/v1/c2c/agent/digitalCurrency/list`
- Fiat currencies: `POST /sapi/v1/c2c/agent/fiatCurrency/list`

---

## Phase 3 API Overview

### Order & Appeal (SAPI Agent โ€” Requires Auth)
Base URL: `https://api.binance.com`

| Endpoint | Method | Auth | Usage |
|----------|--------|------|-------|
| `/sapi/v1/c2c/agent/orderMatch/getUserOrderDetail` | POST | Yes | Get order detail by order number |
| `/sapi/v1/c2c/agent/orderMatch/listOrders` | POST | Yes | List orders with filters |
| `/sapi/v1/c2c/agent/orderMatch/listUserOrderHistory` | GET | Yes | List order history (paginated) |
| `/sapi/v1/c2c/agent/complaint/query-complaints` | POST | Yes | Query complaint/appeal records |
| `/sapi/v1/c2c/agent/complaint/submit-evidence` | POST | Yes | Submit appeal evidence (**write**) |
| `/sapi/v1/c2c/agent/complaint/get-complaint-flows` | POST | Yes | Get complaint process timeline |
| `/sapi/v1/c2c/agent/complaint/cancel-complaint` | POST | Yes | Cancel/withdraw appeal (**write**, irreversible) |
| `/sapi/v1/c2c/agent/complaint/get-complaint-reasons` | POST | Yes | Get available complaint reasons |
| `/sapi/v1/c2c/agent/file-upload/get-s3-presigned-url` | GET | Yes | Get S3 presigned URL for evidence upload |

### Ad Management (SAPI Agent โ€” Requires Auth)
Base URL: `https://api.binance.com`

| Endpoint | Method | Auth | Usage |
|----------|--------|------|-------|
| `/sapi/v1/c2c/agent/ads/getDetailByNo` | POST | Yes | Get ad detail by ad number |
| `/sapi/v1/c2c/agent/ads/listWithPagination` | POST | Yes | List user's own ads (paginated) |
| `/sapi/v1/c2c/agent/ads/search` | POST | Yes | Search market ads with filters |
| `/sapi/v1/c2c/agent/ads/getReferencePrice` | POST | Yes | Get reference price for asset/fiat |
| `/sapi/v1/c2c/agent/ads/getAvailableAdsCategory` | GET | Yes | Get publishable ad categories |
| `/sapi/v1/c2c/agent/ads/getPayMethodByUserId` | GET | Yes | Get user's payment methods |
| `/sapi/v1/c2c/agent/ads/listAllTradeMethods` | POST | Yes | List all system trade methods |
| `/sapi/v1/c2c/agent/ads/post` | POST | Yes | Publish a new ad (**write**) |
| `/sapi/v1/c2c/agent/ads/update` | POST | Yes | Update an existing ad (**write**) |
| `/sapi/v1/c2c/agent/ads/updateStatus` | POST | Yes | Batch update ad status (**write**) |

### Merchant (SAPI Agent โ€” Requires Auth)
Base URL: `https://api.binance.com`

| Endpoint | Method | Auth | Usage |
|----------|--------|------|-------|
| `/sapi/v1/c2c/agent/merchant/getAdDetails` | GET | Yes | Get merchant profile + ad listings |

### Support (SAPI Agent โ€” Requires Auth)
Base URL: `https://api.binance.com`

| Endpoint | Method | Auth | Usage |
|----------|--------|------|-------|
| `/sapi/v1/c2c/agent/digitalCurrency/list` | POST | Yes | List supported digital currencies |
| `/sapi/v1/c2c/agent/fiatCurrency/list` | POST | Yes | List supported fiat currencies |

> **Full API reference** with request/response schemas: see `references/agent-sapi-api.md`

## Phase 3 Error Handling (Additional)

| Error | Cause | User Action |
|-------|-------|-------------|
| Permission denied | User is not a verified merchant | Guide to merchant verification page |
| FIAT_ASSET_ILLEGAL | BIDR paired with non-IDR fiat | Use IDR as fiat for BIDR |
| ILLEGAL_PARAMETERS | Missing or invalid fields | Re-check required parameters |
| Ad not found | Invalid advNo | Verify ad number via list |
| Status update partial failure | Some ads can't change status | Check individual error codes in failList |

## Phase 3 Limitations

This skill does NOT (in Phase 3):
- Initiate new appeals / submit-complaint (only evidence supplement for existing appeals is supported)
- Auto-monitor appeal status changes (polling not supported in skill)
- Place orders on behalf of user (guide to ad detail page instead)
- Access chat messages or send messages in order chat
- Modify payment method configurations (only read)
- Access KYC/verification status details

For appeal initiation and real-time appeal monitoring, guide users to the official P2P dispute center.

Skill folder

Files included alongside SKILL.md in the publisherโ€™s repository.