Skip to content

Latest commit

ย 

History

History
76 lines (60 loc) ยท 1.51 KB

File metadata and controls

76 lines (60 loc) ยท 1.51 KB

๊ณ„์ขŒ ์ด์ฒด API

๊ฐœ์š”

  • goal: ์ถœ๊ธˆ ๊ณ„์ขŒ์—์„œ ๋‹ค๋ฅธ ๊ณ„์ขŒ๋กœ ์ด์ฒดํ•œ๋‹ค.
  • endpoint: POST /transfers/{idempotencyKey}
  • Content-Type: application/json
  • Authorization: Bearer {accessToken}
  • ์ˆ˜์ˆ˜๋ฃŒ: ์ด์ฒด ๊ธˆ์•ก์˜ 1%๋ฅผ ์ถœ๊ธˆ ๊ณ„์ขŒ์—์„œ ์ถ”๊ฐ€ ์ฐจ๊ฐํ•œ๋‹ค.

request

  • path
    • idempotencyKey: ๋ฉฑ๋“ฑํ‚ค
  • body
    • fromAccountId: ์ถœ๊ธˆ ๊ณ„์ขŒ ID
    • toAccountId: ์ž…๊ธˆ ๊ณ„์ขŒ ID
    • amount: ์ด์ฒด ๊ธˆ์•ก
POST /transfers/{idempotencyKey}
Content-Type: application/json
Authorization: Bearer {accessToken}

{
  "fromAccountId": 1,
  "toAccountId": 2,
  "amount": 10000
}

response

  • status: 200 OK
  • body
    • status: SUCCEEDED | FAILED | IN_PROGRESS
    • transferId: ๊ฑฐ๋ž˜ ID
    • errorCode: ์‹คํŒจ ์ฝ”๋“œ

FAILED๋Š” HTTP ์—๋Ÿฌ ๋Œ€์‹  ์‘๋‹ต body๋กœ ๋ฐ˜ํ™˜๋œ๋‹ค. ํ˜„์žฌ ๊ตฌํ˜„์—์„œ ์ž์ฃผ ๋‚˜์˜ค๋Š” errorCode๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

  • INVALID_REQUEST
  • ACCOUNT_NOT_FOUND
  • OWNER_NOT_FOUND
  • MEMBER_NOT_FOUND
  • INSUFFICIENT_BALANCE
  • DAILY_LIMIT_EXCEEDED
{
  "status": "SUCCEEDED",
  "transferId": 456,
  "errorCode": null
}

error

  • status: 400 Bad Request

  • context

    • request body validation failure
    • idempotency key expired
    • same idempotency key with different request body
  • status: 401 Unauthorized

  • context

    • authentication required
  • status: 404 Not Found

  • context

    • idempotency key not found
  • status: 500 Internal Server Error

  • context

    • unexpected persistence failure