Skip to content

payment / bảng đơn lẻ (5) ​

Trang sinh tự động

Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.

5 bảng. Quay lại payment.

provider_transactions ​

P3-01. Provider CAPTURE/REFUND records in integer VND; unique (provider, provider_txn_id); immutable except UNKNOWN -> SUCCEEDED|FAILED; a refund returns one full original capture.

public.provider_transactions · 18 cột · 10 check · 2 unique · 7 index · 1 policy · 5 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
intent_iduuidNOT NULLFK → payment_intents
kindtextNOT NULL
providertextNOT NULL
provider_modetextNOT NULL
provider_txn_idtextNOT NULL
original_transaction_iduuidFK → provider_transactions
amount_vndbigintNOT NULL
currencytextNOT NULL
statustextNOT NULL
source_idtextNOT NULL
payload_hashbyteaNOT NULL
provider_recorded_attimestamptz
recorded_attimestamptzNOT NULL
status_changed_attimestamptzNOT NULL
change_source_idtextNOT NULL
correlation_idcorrelation_refNOT NULL
versionintegerNOT NULL

Khoá chính: id

Trỏ ra (2):

  • intent_id → payment_intents · ON DELETE RESTRICT
  • original_transaction_id → provider_transactions · ON DELETE RESTRICT

Được trỏ tới (7): cashbook_entries, payment_allocations, payment_reconciliation_items, provider_transactions, refund_branches, refund_branches, vouchers

cashbook_entries ​

P3-08/P3-09. Append-only cashbook: automatic receipts/reversals of SUCCEEDED provider transactions (PROVIDER_TRANSACTION) and the effect of APPROVED manual vouchers (MANUAL_VOUCHER); no number, fund or balance.

public.cashbook_entries · 18 cột · 7 check · 2 unique · 5 index · 1 policy · 3 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
entry_typetextNOT NULL
sourcetextNOT NULL
source_idtextNOT NULL
transaction_iduuidFK → provider_transactions
reverses_entry_iduuidFK → cashbook_entries
intent_iduuidFK → payment_intents
obligation_iduuidFK → payment_obligations
order_iduuidFK → orders
obligation_kindtext
providertext
provider_modetext
amount_vndbigintNOT NULL
currencytextNOT NULL
occurred_attimestamptzNOT NULL
posted_by_source_idtextNOT NULL
correlation_idcorrelation_refNOT NULL
created_attimestamptzNOT NULL

Khoá chính: id

Trỏ ra (5):

  • intent_id → payment_intents · ON DELETE RESTRICT
  • obligation_id → payment_obligations · ON DELETE RESTRICT
  • order_id → orders · ON DELETE RESTRICT
  • reverses_entry_id → cashbook_entries · ON DELETE RESTRICT
  • transaction_id → provider_transactions · ON DELETE RESTRICT

Được trỏ tới (2): cashbook_entries, vouchers

cancellation_decisions ​

P3-12. Versioned cancellation / forfeiture policy decision of one Order (REFUND_FULL | FORFEIT | POLICY_UNDECIDED) with the stored facts and the prior delivered cycles kept. Immutable; moves no money.

public.cancellation_decisions · 23 cột · 9 check · 1 unique · 4 index · 2 policy · 3 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
order_iduuidNOT NULLFK → orders
owner_account_iduuidNOT NULLFK → accounts
campaign_iduuidNOT NULLFK → campaigns
campaign_typetextNOT NULL
causetextNOT NULL
timingtextNOT NULL
policy_versiontextNOT NULL
outcometextNOT NULL
cash_dispositiontextNOT NULL
points_dispositiontextNOT NULL
residual_pendingtextNOT NULL
undecided_reftext
basistext[]NOT NULL
order_versionintegerNOT NULL
held_cash_vndbigint
held_pointsinteger
retained_cycle_countintegerNOT NULL
retained_deliveriesjsonbNOT NULL
evidencejsonbNOT NULL
source_typetextNOT NULL
source_idtextNOT NULL
decided_attimestamptzNOT NULL

Khoá chính: id

Trỏ ra (3):

  • campaign_id → campaigns · ON DELETE RESTRICT
  • order_id → orders · ON DELETE RESTRICT
  • owner_account_id → accounts · ON DELETE RESTRICT

Được trỏ tới (1): mission_reversal_evidence

deposit_checkouts ​

P3-04 / #479. One saga per order attempt: optional REDEEM, cash deposit (P3-02 intent), compensation by one full REVERSE_REDEEM, or (COMPENSATED_MANUALLY) by Finance's ACCEPTED CREDIT ADJUST after a rejected reversal. Orchestration record only: no balance, no ledger, no amount (the cash amount is the DEPOSIT obligation). SYSTEM_ONLY; EXECUTE-only access through payment.* functions.

public.deposit_checkouts · 26 cột · 12 check · 5 unique · 8 index · 0 policy · 12 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
order_iduuidNOT NULLFK → orders
owner_account_iduuidNOT NULLFK → accounts
deposit_obligation_iduuidNOT NULLFK → payment_obligations
point_obligation_iduuidFK → payment_obligations
pointsinteger
rate_snapshot_vndnumeric
rate_policy_versiontext
redeem_request_idtext
reverse_request_idtext
cash_request_idtextNOT NULL
redeem_business_datedate
reverse_business_datedate
statustextNOT NULL
reason_codetext
source_idtextNOT NULL
correlation_idcorrelation_refNOT NULL
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL
versionintegerNOT NULL
point_cap_bpinteger
point_cap_policy_versiontext
max_pointsinteger
points_value_vndbigintP3-19. VND value of the points at the frozen rate (points x rate). A snapshot of the point tender, NOT the cash deposit (that is the DEPOSIT obligation) and never subtracted from it.
attempt_nointegerNOT NULL#377. 1 for the first deposit attempt of the order, +1 per retry after a REDEEM_REJECTED / CASH_FAILED / COMPENSATED attempt. Names the PiPoint business source of attempts after the first (deposit:<order>:<n>).
methodtextNOT NULLG1S-P0-03 (BR-DC-08). Payment method of this attempt (SDL DepositPaymentMethod), chosen last on U-31; MOMO_WALLET for every attempt before G1S. Stored by payment.buyer_open_checkout from P1-05.

Khoá chính: id

Trỏ ra (4):

  • deposit_obligation_id → payment_obligations · ON DELETE RESTRICT
  • order_id → orders · ON DELETE RESTRICT
  • owner_account_id → accounts · ON DELETE RESTRICT
  • point_obligation_id → payment_obligations · ON DELETE RESTRICT

Được trỏ tới: không có

funds ​

FU-713 DEC-FIN-FUNDS. The funds of manual vouchers: one CASH row (seeded) + one BANK row per company bank account (operator script). Bank name + last digits only. No balance, never linked to a bank statement in R1.

public.funds · 8 cột · 5 check · 0 unique · 3 index · 1 policy · 3 trigger · RLS bật

CộtKiểuKhoáMô tả
codetextNOT NULLPK
kindtextNOT NULL
nametextNOT NULL
bank_nametext
account_tailtext
statustextNOT NULL
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL

Khoá chính: code

Trỏ ra: không có

Được trỏ tới: không có

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17