Skip to content

Thanh toán ​

Trang sinh tự động

Phần nghiệp vụ viết tay; API, dữ liệu, quyền, đường dẫn và file nguồn do bộ sinh điền từ source tại ad83b0aea.

Làm gì ​

Cọc và phần còn lại, qua MoMo hoặc COD, cộng Pi-Point. Mỗi lần thanh toán là một intent có phiên riêng; nhà cung cấp trả lời không dứt khoát thì trạng thái là UNKNOWN và có vòng quét hồi phục, chứ không coi là thất bại. Có đối soát với nhà cung cấp và quy trình hoàn tiền maker/checker.

Quy mô ​

Domain APIpayment
Query / Mutation17 / 17
Nguồn dữ liệupayment
Bảng44
Luật phân quyền8
Đường dẫn Web Admin17

Thao tác (mutation) ​

MutationDomainMô tả
approveVoucherpaymentA different person approves exactly what they reviewed: APPROVED, immutable, one cashbook entry (VCH-04, MFA).
cancelPaymentSessionpayment#479 T14. Closes the provider session of the buyer's own open payment
cancelVoucherpaymentCancel an own DRAFT or SUBMITTED voucher (VCH-02).
confirmRefundTransferpaymentXac nhan da hoan tien (DH-US-07 AC04): the order's payment becomes REFUNDED, logged, the customer is notified. order.refund.process. Errors: validation_failed (transactionCode, transferredOn, note), stale_version, conflict (refund_not_waiting, profile_required, transfer_already_recorded, transaction_code_reuse, legs_in_progress, case_not_approved), forbidden.
recordCodCollectionpaymentLegacy order-level manual COD collection (A-FF-03). Requires cod.collect. No web caller since U19-P4-02.
recordCodRemittancepaymentRemittance evidence of a COLLECTED COD. Requires cod.remit (COD-02, Finance).
recordReturnNoRefundpayment#479 B. Operations record that a returned unit paid in full (a Mua chung order in Hoàn hàng, or one Mua định kỳ
rejectVoucherpaymentA different person sends a SUBMITTED voucher back to its maker with a reason; the voucher returns to DRAFT (VCH-04, MFA).
requestRefundInfoUpdatepaymentBao khach cap nhat lai (DH-US-16): the payment goes back to WAITING_REFUND_REQUEST; the customer sees the refund as REJECTED with the reason code (and the note when visible) and gets an in-app notice. order.refund.process. Errors: validation_failed (reasonCode, reason, customerNote), stale_version, conflict (refund_not_waiting, profile_required, profile_locked), forbidden.
resolveDiscrepancypaymentPRC-02 reconcile.resolve (Finance): handle one payment discrepancy item.
retryRefundBranchpaymentRecovers a REJECTED leg (never an UNKNOWN one). Requires refund.recover (RFD-02).
saveVoucherDraftpaymentCreate or revise a DRAFT voucher (VCH-02).
selectRemainingPaymentMethodpaymentU19-P2-21. The buyer chooses or changes the remaining payment method of
startDepositCheckoutpaymentStarts (or, with the same requestId, re-checks) the whole deposit
startRemainingPaymentpaymentP3-05. Starts (or re-checks, same requestId) the ONE full online remaining
submitRefundRequestpaymentAPP_USER (refund.submit, own order): sends or sends again the refund request while the payment status is WAITING_REFUND_REQUEST; it becomes WAITING_REFUND. #479 C: with refundCaseId, the request of one cọc dư claim while OrderRefund.excessClaim.canSubmitRequest (the payment status does not move). Errors: forbidden (another customer's order), validation_failed (field), stale_version, conflict (refund_not_requestable, no_cash_to_transfer, profile_locked).
submitVoucherpaymentMaker submits with evidence; the FUNDS_VOUCHER policy is evaluated and frozen (VCH-03, MFA).

Phép đọc (query) ​

QueryDomainMô tả
cancellationDecisionpayment
cashbookEntriespaymentAutomatic receipts and reversals, latest first. Requires cashbook.read (RCP-01, Finance).
cashbookFundViewpaymentRead-only deposit-fund view; model-governed figures are POLICY_UNDECIDED. Requires cashbook.read.
codCollectionpaymentOne COD collection with its evidence. Requires payment.read (Finance).
codCollectionspaymentCOD collections, latest change first. Requires payment.read (Finance).
codReconciliationpaymentPRC-01 reconcile.read (Finance): every COD run version of one VN date, newest first.
fundspaymentThe funds vouchers may use: the cash fund and one per company bank account (VCH-01).
momoReconciliationpaymentPRC-01 reconcile.read (Finance): every run version of one VN date, newest first.
orderPaymentspaymentpayment.read (F-01 Finance): the tenders, transactions, allocations and periods of one order.
paymentObligationspaymentpayment.read (F-01 Finance): every payment obligation, newest first.
paymentsNeedingAttentionpaymentpayment.read (F-01 Finance): payments that need a person (#479). Read only.
paymentTransactionspaymentpayment.read (F-01 Finance): provider captures and refunds with their attempt and obligation, newest first.
refundCasepaymentOne refund case with its legs and history. Requires refund.read (RFD-01).
refundCasespaymentRefund cases, newest first. Requires refund.read (RFD-01, Finance). orderCode (#479): exact business order code, any letter case; an unknown code matches nothing.
unappliedPaymentspaymentPRC-01 reconcile.read (Finance): captured money not applied to an obligation. Read only (GAP-149 / GAP-1620).
voucherpayment
voucherspaymentManual vouchers, newest first (VCH-01).

Dữ liệu ​

Bảng được tham chiếu nhiều nhất trong module:

BảngCộtĐược trỏ tớiRLS
payment_intents199✓
payment_obligations188✓
provider_transactions187✓
refund_cases356✓
cod_collections283✓
cashbook_entries182✓
cod_reconciliation_runs202✓
vouchers292✓
cancellation_decisions231✓
finance_policy_kinds51✓

Quyền ​

MãQuyềnỨng dụngVai tròPhạm viTrạng thái
F-01payment.readWEB_ADMINfinanceALLPROPOSED
FRM-02refund.readWEB_ADMINfinance_managerALLPROPOSED
ORD-03refund.submitAPP_USERuserOWNDEFINED
ORD-04payment.method_selectAPP_USERuserOWNDEFINED
RFD-01refund.readWEB_ADMINfinanceALLPROPOSED
RFD-02refund.recoverWEB_ADMINfinanceALLPROPOSED
U-04payment.readAPP_USERuserOWNDEFINED
U-05payment.startAPP_USERuserOWNPROPOSED

Danh sách đầy đủ và cách đọc các cờ: Ma trận quyền.

Giao diện Web Admin ​

Đường dẫnHằng số
/cashbook/depositsCASHBOOK_DEPOSITS
/cashbook/revenueCASHBOOK_REVENUE
/cashbook/vouchersCASHBOOK_VOUCHERS
/cashbook/vouchers/:idCASHBOOK_VOUCHER_DETAIL
/cashbook/vouchers/:id/editCASHBOOK_VOUCHER_EDIT
/cashbook/vouchers/newCASHBOOK_VOUCHER_NEW
/paymentsPAYMENTS
/payments/:idPAYMENT_DETAIL
/payments/attentionPAYMENT_ATTENTION
/payments/momo-simulatorPAYMENT_MOMO_SIMULATOR
/payments/refund-requestsPAYMENT_REFUND_REQUESTS
/payments/refund-requests/:idPAYMENT_REFUND_DETAIL
/payments/unappliedPAYMENT_UNAPPLIED
/reconciliation/discrepanciesRECONCILIATION_DISCREPANCIES
/reconciliation/discrepancies/:idRECONCILIATION_DISCREPANCY_DETAIL
/reconciliation/gatewayRECONCILIATION_GATEWAY
/reconciliation/gateway/:date/:runIdRECONCILIATION_GATEWAY_RUN

File nguồn ​

Backend:

  • code/apps/api/supabase/functions/graphql/domains/payment/

Dữ liệu: bảng thuộc domain payment — xem Cơ sở dữ liệu.

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17