포텐업 파이널

테이블 (9)

api_keys

  • key_id — BIGINT
  • merchant_id — BIGINT — 외래 키 — NOT NULL
  • key_type — ENUM('CLIENT','SECRET') — NOT NULL
  • key_hash — CHAR(64) — NOT NULL
  • scope — ENUM('PAYMENT_CLAIM','PAYMENT_CONFIRM_CANCEL') — NOT NULL
  • key_status — ENUM('ACTIVE','REVOKED') — NOT NULL
  • last_used_at — DATETIME(3)
  • expires_at — DATETIME(3)
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL

idempotency_records

  • idem_id — BIGINT
  • merchant_id — BIGINT — 외래 키 → merchants.merchant_id — NOT NULL
  • operation — ENUM('CONFIRM','CANCEL') — NOT NULL
  • idempotency_key — VARCHAR(80) — NOT NULL
  • request_hash — CHAR(64) — NOT NULL
  • response_status_code — INT — NOT NULL
  • response_headers — JSON
  • response_body — JSON — NOT NULL
  • expires_at — DATETIME(3) — NOT NULL
  • created_at — DATETIME(3) — NOT NULL

merchant_webhook_endpoints

  • endpoint_id — BIGINT
  • merchant_id — BIGINT — 외래 키 → merchants.merchant_id — NOT NULL
  • url — VARCHAR(500) — NOT NULL
  • secret — VARCHAR(200) — NOT NULL
  • is_active — TINYINT(1) — NOT NULL
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL

merchants

  • merchant_id — BIGINT
  • merchant_name — VARCHAR(100) — NOT NULL
  • user_id — BIGINT — NOT NULL
  • status — ENUM('ACTIVE','SUSPENDED') — NOT NULL
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL

outbox_events

  • event_id — VARCHAR(80)
  • aggregate_id — VARCHAR(64) — NOT NULL
  • merchant_id — BIGINT — 외래 키 → merchants.merchant_id — NOT NULL
  • event_type — ENUM('PAYMENT_DONE','PAYMENT_CANCELED','PAYMENT_FAILED','PAYMENT_EXPIRED') — NOT NULL
  • sequence_no — INT — NOT NULL
  • payload — JSON
  • status — ENUM('READY','IN_PROGRESS','PUBLISHED','FAILED','DEAD') — NOT NULL
  • retry_count — INT — NOT NULL
  • next_attempt_at — DATETIME(3) — NOT NULL
  • last_error — VARCHAR(255)
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL

payment_transactions

  • tx_id — BIGINT
  • payment_key — VARCHAR(64) — 외래 키 → payments.payment_key — NOT NULL
  • merchant_id — BIGINT — 외래 키 → merchants.merchant_id — NOT NULL
  • type — ENUM('APPROVE','CANCEL') — NOT NULL
  • tx_status — ENUM('PENDING','SUCCESS','FAIL','UNKNOWN') — NOT NULL
  • requested_amount — BIGINT — NOT NULL
  • pg_tx_id — VARCHAR(80)
  • idempotency_key — VARCHAR(80)
  • failure_code — ENUM( 'CARD_BLOCKED','CARD_EXPIRED','INSUFFICIENT_FUNDS','LIMIT_EXCEEDED', 'INVALID_CARD','INVALID_PIN_OR_CVC','FRAUD_SUSPECTED','MERCHANT_NOT_ALLOWED', 'DUPLICATE_REQUEST','INTERNAL_ERROR' )
  • failure_message — VARCHAR(255)
  • attempt_count — INT — NOT NULL
  • next_attempt_at — DATETIME(3)
  • confirmed_at — DATETIME(3)
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL

payments

  • payment_key — VARCHAR(64)
  • merchant_id — BIGINT — 외래 키 → merchants.merchant_id — NOT NULL
  • order_id — VARCHAR(80) — NOT NULL
  • currency — CHAR(3) — NOT NULL
  • total_amount — BIGINT — NOT NULL
  • balance_amount — BIGINT — NOT NULL
  • status — ENUM( 'READY','IN_PROGRESS','DONE','PARTIAL_CANCEL','CANCEL', 'UNKNOWN','ABORTED','EXPIRED' ) — NOT NULL
  • expires_at — DATETIME(3)
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL

reconciliation_jobs

  • job_id — BIGINT
  • merchant_id — BIGINT — 외래 키 → merchants.merchant_id — NOT NULL
  • payment_key — VARCHAR(64) — 외래 키 → payments.payment_key — NOT NULL
  • tx_id — BIGINT — 외래 키 → payment_transactions.tx_id — NOT NULL
  • type — ENUM('APPROVE','CANCEL') — NOT NULL
  • status — ENUM('READY','IN_PROGRESS','SUCCESS','FAILED','DEAD') — NOT NULL
  • retry_count — INT — NOT NULL
  • next_attempt_at — DATETIME(3) — NOT NULL
  • last_error — VARCHAR(255)
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL

webhook_deliveries

  • delivery_id — BIGINT
  • merchant_id — BIGINT — 외래 키 → merchants.merchant_id — NOT NULL
  • endpoint_id — BIGINT — 외래 키 → merchant_webhook_endpoints.endpoint_id — NOT NULL
  • event_id — VARCHAR(80) — 외래 키 → outbox_events.event_id — NOT NULL
  • attempt_no — INT — NOT NULL
  • status — ENUM('READY','IN_PROGRESS','SUCCESS','FAILED','DEAD') — NOT NULL
  • next_attempt_at — DATETIME(3) — NOT NULL
  • last_http_status — INT
  • last_error — VARCHAR(255)
  • last_response_ms — INT
  • created_at — DATETIME(3) — NOT NULL
  • updated_at — DATETIME(3) — NOT NULL