Cane Agency · Specification · Perspective documentสถาบันอ้อย · เอกสารข้อกำหนด · เอกสารรายมุมมอง
This document defines the bank's two bounded contexts — Credit & Risk and Bank Lending — their aggregates and invariants, the events they publish and consume, and the ubiquitous language of regulated cane lending. It mirrors SPEC-DDD and graph/spec-graph.json. Both contexts are strictly downstream readers of the platform core, gated by ConsentGrant (PDPA, NFR-08); every credit decision is reproducible and explainable (NFR-09).
เอกสารนี้นิยามสองบริบทของธนาคาร — Credit & Risk และ Bank Lending — แอกกริเกตและกฎคงที่ เหตุการณ์ที่ผลิตและบริโภค และภาษากลางของการปล่อยกู้อ้อยที่ถูกกำกับ สะท้อน SPEC-DDD และ graph/spec-graph.json ทั้งสองบริบทเป็นผู้อ่านปลายน้ำของแกนกลางอย่างเคร่งครัด กำกับด้วย ConsentGrant (PDPA, NFR-08); ทุกการตัดสินใจสินเชื่อทำซ้ำและอธิบายได้ (NFR-09)
| Contextบริบท | Ownsเป็นเจ้าของ | Responsibility & relationshipความรับผิดชอบและความสัมพันธ์ |
|---|---|---|
| Credit & Risk เครดิตและความเสี่ยง | ConsentGrant · CreditAssessment | A downstream reader of the whole platform core, gated by ConsentGrant. Assembles the consented feature snapshot and produces the cane-specific score consumed by Bank Lending. Owns consent lifecycle and model/decision governance (NFR-08/09).ผู้อ่านปลายน้ำของแกนกลางทั้งหมด กำกับด้วย ConsentGrant ประกอบ snapshot (สแนปช็อต) คุณลักษณะที่ได้รับความยินยอมและผลิตคะแนนเฉพาะอ้อยที่ Bank Lending บริโภค ดูแลวงจรความยินยอมและการกำกับ model (โมเดล)/การตัดสินใจ (NFR-08/09) |
| Bank Lending สินเชื่อสถาบันการเงิน | LoanProduct · LoanApplication · LoanAccount · Collateral · LoanLedgerEntry | Formal bank lending, separate from เงินเกี๊ยว. Consumes the score from Credit & Risk and the settlement-offset contract from Settlement; produces the loan lifecycle and its append-only ledger. FinancialInstitution is owned by network_identity (as Mill).การปล่อยกู้ธนาคารทางการ แยกจากเงินเกี๊ยว บริโภคคะแนนจาก Credit & Risk และสัญญาการหักกลบจาก Settlement; ผลิตวงจรสินเชื่อและสมุดบัญชีแบบต่อท้าย FinancialInstitution เป็นของ network_identity (เช่นเดียวกับ Mill) |
| Aggregate (root)แอกกริเกต (ราก) | Contextบริบท | Invariantsกฎคงที่ |
|---|---|---|
| ConsentGrant | Credit & Risk | Scoped to (grantor × grantee FI × scope) with an expiry; append-only — revocation posts a superseding record; status = active only while now < expires_at and not revoked; a bank read resolves only against an active grant covering the requested scope, and every resolved access is logged (NFR-08).จำกัดขอบเขตต่อ (ผู้ให้ × FI ผู้รับ × scope) พร้อมวันหมดอายุ; ต่อท้ายเท่านั้น — การเพิกถอนบันทึกระเบียนแทนที่; status = active เฉพาะเมื่อ now < expires_at และยังไม่เพิกถอน; ธนาคารอ่านได้เฉพาะเมื่อมีความยินยอมที่ใช้งานครอบคลุม scope และบันทึกทุกการเข้าถึง (NFR-08) |
| CreditAssessment | Credit & Risk | Requires an active ConsentGrant covering the subject; freezes model_ver + factors_snapshot at assessment time (immutable); a re-score posts a new assessment; an approved application must reference one; declines carry decision_reasons (NFR-09).ต้องมี ConsentGrant active ครอบคลุมผู้ถูกประเมิน; ตรึง model_ver + factors_snapshot ณ เวลาประเมิน (แก้ไม่ได้); การให้คะแนนใหม่บันทึกเป็นรายการใหม่; คำขอที่อนุมัติต้องอ้างการประเมิน; การปฏิเสธมี decision_reasons (NFR-09) |
| LoanApplication | Bank Lending | Cannot enter scoring without a covering ConsentGrant; approved requires an assessment_id and any product-required collateral; status only moves forward; withdrawn/rejected open no account.เข้าสู่ scoring ไม่ได้ถ้าไม่มี ConsentGrant คุ้มครอง; approved ต้องมี assessment_id และหลักประกันที่ผลิตภัณฑ์กำหนด; สถานะเดินหน้าอย่างเดียว; ถอน/ปฏิเสธไม่เปิดบัญชี |
| LoanAccount (owns LoanLedgerEntry, Collateral) | Bank Lending | Opened only from an approved application; outstanding_amt is derived from the append-only ledger and never edited; status follows the loan state machine (SPEC-PWF-FIN Section 8) and never skips; a delivery_receivable pledge routes settlement-offset repayments ahead of เงินเกี๊ยว; write-offs post as ledger entries.เปิดจากคำขอที่อนุมัติเท่านั้น; outstanding_amt คำนวณจากสมุดต่อท้ายและไม่แก้ทับ; สถานะเดินตาม state machine สินเชื่อ (SPEC-PWF-FIN ข้อ 8) ไม่ข้ามขั้น; การจำนำ delivery_receivable ส่งการชำระแบบหักกลบก่อนเงินเกี๊ยว; การตัดหนี้สูญบันทึกเป็นรายการบัญชี |
| LoanProduct | Bank Lending | Belongs to one FI; borrower_kinds ⊆ {cane_farmer, quota_farmer, sugar_factory}; principal_min ≤ principal_max; a subsidy scheme is recorded in subsidy_note, never as a separate price.สังกัด FI เดียว; borrower_kinds ⊆ {cane_farmer, quota_farmer, sugar_factory}; principal_min ≤ principal_max; โครงการอุดหนุนบันทึกใน subsidy_note ไม่ใช่ราคาแยก |
The normative consistency boundaries of this perspective's home contexts (credit_risk · lending), rendered from graph dataModeling.aggregates (v0.4.0, PROP-018). The prose invariants above stay explanatory; the rules here are the transactional contract an implementation must enforce. Column-level persistence for every member entity lives in the sibling SPEC-ERD family (see the Data column).
ขอบเขตความสอดคล้องเชิงบรรทัดฐานของ context ที่ home อยู่มุมมองนี้ (credit_risk · lending) render จาก dataModeling.aggregates ใน graph (v0.4.0, PROP-018) คำอธิบาย invariant ข้างบนคงไว้เพื่อความเข้าใจ; กติกาในส่วนนี้คือสัญญาเชิง transaction ที่ implementation ต้องบังคับใช้ ส่วน persistence ระดับ column ของ entity สมาชิกทุกตัวอยู่ในตระกูล SPEC-ERD พี่น้อง (ดู column ข้อมูล)
| Aggregate root | Membersสมาชิก | Context | Transaction ruleกติกา transaction | Dataข้อมูล |
|---|---|---|---|---|
| ConsentGrant | ConsentGrant | credit_risk | Terms frozen at grant; only status (active → expired/revoked) transitions. Every consent-gated read re-evaluates the grant in-request.เงื่อนไขตรึงตอนให้ความยินยอม; เปลี่ยนได้เฉพาะสถานะ (active → expired/revoked) การอ่านที่ต้องใช้ความยินยอมตรวจ grant ซ้ำทุกคำขอ | ERD-FIN |
| CreditAssessment | CreditAssessment | credit_risk | Immutable snapshot — factors_snapshot + model_ver make every decision reproducible (NFR-09).snapshot แก้ไขไม่ได้ — factors_snapshot + model_ver ทำให้ทุกการตัดสินใจทำซ้ำได้ (NFR-09) | ERD-FIN |
| LoanProduct | LoanProduct | lending | Reference root — product terms version by row; live applications pin their product row.root อ้างอิง — เงื่อนไขผลิตภัณฑ์แยกตามแถว; ใบสมัครที่ค้างอยู่ตรึงแถวผลิตภัณฑ์ของตน | ERD-FIN |
| LoanApplication | LoanApplication · Collateral | lending | Decision transitions freeze the application; application-stage collateral closes with the decision (loan state machine).การตัดสินใจตรึงใบสมัคร; หลักประกันชั้นใบสมัครปิดพร้อมการตัดสินใจ (state machine สินเชื่อ) | ERD-FIN |
| LoanAccount | LoanAccount · LoanLedgerEntry | lending | outstanding_amt = principal − Σ repayment entries, updated in the same transaction as each appended entry.outstanding_amt = เงินต้น − Σ รายการชำระ ปรับใน transaction เดียวกับรายการที่ append | ERD-FIN |
The DI registration contract for this perspective's contexts, from graph dataModeling.lifecycles — vocabulary singleton | scoped (per request / unit of work) | transient (.NET, per the PROP-005 ASP.NET Core foundation). Platform-wide conventions (DbContext, repositories, handlers, caches, hosted jobs) are stated once in SPEC-DDD and bind here unless a row below overrides them; the rows list the notable components an implementation must wire per context.
สัญญาการลงทะเบียน DI ของ context ในมุมมองนี้ จาก dataModeling.lifecycles ใน graph — ใช้ศัพท์ singleton | scoped (ต่อคำขอ / unit of work) | transient (.NET ตามรากฐาน ASP.NET Core ของ PROP-005) กติการวมทั้ง platform (DbContext, repository, handler, cache, hosted job) ประกาศครั้งเดียวใน SPEC-DDD และมีผลที่นี่เว้นแต่แถวด้านล่างกำหนดต่าง; แถวในตารางคือ component สำคัญที่ implementation ต้องต่อสายราย context
| Component | Kindชนิด | Lifetime | Rationaleเหตุผล |
|---|---|---|---|
| ConsentGate | department_policy | scoped | Re-evaluates ConsentGrant per request — PDPA NFR-08; never cached across requests.ตรวจ ConsentGrant ซ้ำทุกคำขอ — PDPA NFR-08; ไม่ cache ข้ามคำขอ |
| ScoringModel | domain_service | singleton | Immutable versioned model (model_ver) — reproducibility NFR-09.model ตรึง version (model_ver) — ทำซ้ำได้ NFR-09 |
| AssessmentSnapshotWriter | app_service | scoped | Freezes factors_snapshot with the score.ตรึง factors_snapshot พร้อมคะแนน |
| Component | Kindชนิด | Lifetime | Rationaleเหตุผล |
|---|---|---|---|
| Loan repositories | repository | scoped | — |
| AmortizationCalculator | calculator | transient | — |
| DisbursementSaga | app_service | scoped | Account opening + first ledger entry atomic; repay_source wiring to PaymentItem offsets.เปิดบัญชี + รายการ ledger แรกแบบ atomic; ต่อสาย repay_source เข้าการหักจาก PaymentItem |
| Eventเหตุการณ์ | Producerผู้ผลิต | Consumersผู้บริโภค |
|---|---|---|
| ConsentGranted / ConsentRevoked | Credit & Risk | Bank Lending, Finance portal, Mobile app, NotificationsBank Lending, portal สินเชื่อ, แอปมือถือ, การแจ้งเตือน |
| CreditAssessmentCompleted | Credit & Risk | Bank Lending, Finance portal, ReportsBank Lending, portal สินเชื่อ, รายงาน |
| LoanApplicationSubmitted | Bank Lending | Credit & Risk, Finance portal |
| LoanApproved / LoanRejected | Bank Lending | Finance portal, Mobile app, Notificationsportal สินเชื่อ, แอปมือถือ, การแจ้งเตือน |
| LoanDisbursed | Bank Lending | Settlement, Mobile app, ReportsSettlement, แอปมือถือ, รายงาน |
| DeliveryReceivableAssigned | Bank Lending | Settlement, PortalSettlement, portal |
| LoanRepaymentPosted | Bank Lending | Finance portal, Mobile app, Statementsportal สินเชื่อ, แอปมือถือ, ใบแจ้งยอด |
| LoanDelinquent / LoanRestructured / LoanWrittenOff | Bank Lending | Finance portal, Reportsportal สินเชื่อ, รายงาน |
The core's existing PaymentPosted additionally triggers LoanRepaymentPosted when the settled delivery carries an assigned receivable; PaymentPosted keeps its original contract.
PaymentPosted เดิมของแกนกลางกระตุ้น LoanRepaymentPosted เพิ่มเมื่อการส่งมอบที่ปิดงวดมีการโอนสิทธิลูกหนี้; PaymentPosted คงสัญญาเดิม
| Thaiไทย | Englishอังกฤษ | Meaningความหมาย |
|---|---|---|
| การให้ความยินยอม | consent grant | Scoped, time-boxed, revocable authorization (ConsentGrant) to read a tenant's platform data (NFR-08).การอนุญาตที่จำกัดขอบเขต มีอายุ เพิกถอนได้ (ConsentGrant) ในการอ่านข้อมูลของฝ่ายหนึ่ง (NFR-08) |
| คะแนนเครดิต | credit score / assessment | Cane-specific alternative-data score (CreditAssessment); auditable via model_ver + factors_snapshot.คะแนนจากข้อมูลทางเลือกเฉพาะอ้อย (CreditAssessment); ตรวจสอบได้ด้วย model_ver + factors_snapshot |
| หลักประกัน | collateral | Security for a loan: standing crop, quota, delivery receivable, land, contract, or clean.หลักประกันสินเชื่อ: อ้อยยืนต้น โควตา ลูกหนี้การค้า ที่ดิน สัญญา หรือไม่มีหลักประกัน |
| ลูกหนี้การค้า | delivery receivable | A mill's future PaymentItem pledged as collateral; enables settlement-offset repayment.PaymentItem ในอนาคตของโรงงานที่นำมาจำนำ; ทำให้ชำระคืนแบบหักกลบตอนปิดงวดได้ |
| การหักกลบตอนปิดงวด | settlement offset | Repaying a loan from the deduction on a settled PaymentItem rather than in cash.ชำระสินเชื่อจากการหักใน PaymentItem ที่ปิดงวด แทนเงินสด |
| หนี้ไม่ก่อให้เกิดรายได้ | non-performing loan (NPL) | A loan impaired after prolonged delinquency; may be restructured or written off.สินเชื่อด้อยคุณภาพหลังค้างชำระนาน; อาจปรับโครงสร้างหรือตัดหนี้สูญ |
| สินเชื่อห่วงโซ่อุปทาน | supply-chain finance | A bank LoanAccount that wholesale-funds a mill/quota-org via CreditLine.funding_account_id.LoanAccount ที่ให้ทุนขายส่งแก่โรงงาน/องค์กรโควต้าผ่าน CreditLine.funding_account_id |
| ธ.ก.ส. · เครดิตบูโร · ธปท. | BAAC · NCB · BoT | The rural lender (fi_type state_bank), the credit-history registry, and the central-bank supervisor a lender reports within (F8).ผู้ให้กู้ชนบท (fi_type state_bank), ทะเบียนประวัติเครดิต, และธนาคารกลางผู้กำกับที่ผู้ให้กู้รายงาน (F8) |
| Revฉบับ | Dateวันที่ | Changesการเปลี่ยนแปลง |
|---|---|---|
| 1.0 | 2026-07-07 | Initial version — PROP-003 (spec v4.0): Credit & Risk + Bank Lending contexts, aggregates & invariants, 12 lending events, finance ubiquitous languageฉบับแรก — PROP-003 (spec (สเปก) v4.0): บริบท Credit & Risk + Bank Lending แอกกริเกตและกฎคงที่ เหตุการณ์สินเชื่อ 12 รายการ ภาษากลางการเงิน |
| 1.1 | 2026-07-08 | PROP-005 (FED, spec v6.0): perspective re-keyed from customer group to capacity (document code unchanged); identity defers to the federation context (Person · Tenant · TenantCapacity · Membership); every *_tenant_type + *_tenant_id pair collapses to tenant_id.PROP-005 (FED, spec v6.0): มุมมองเปลี่ยนคีย์จากกลุ่มลูกค้าเป็น capacity (รหัสเอกสารคงเดิม); อัตลักษณ์อ้างอิงบริบท federation (Person · Tenant · TenantCapacity · Membership); คู่ *_tenant_type + *_tenant_id ทั้งหมดยุบเป็น tenant_id |
| 0.1.0 | 2026-07-11 | PROP-014 (spec v0.1.0): semantic versioning restarted at 0.1.0 (was Rev 1.1 · 2026-07-08); docnav updated for the gov_cluster split — GOV re-homed to docs/gov/ocsb/, new BOARD (กอน.) sibling added.PROP-014 (spec v0.1.0): รีสตาร์ท semantic versioning ที่ 0.1.0 (เดิม Rev 1.1 · 2026-07-08); ปรับ docnav ตามการแยก gov_cluster — ย้าย GOV ไป docs/gov/ocsb/ เพิ่มพี่น้อง BOARD (กอน.) |
| 0.2.0 | 2026-07-13 | PROP-018 P2 (spec v0.4.0): aggregate map figure + normative aggregate boundaries & transaction rules (Section 5) and the DI component lifetime map (Section 6) for credit_risk · lending — rendered from the graph's dataModeling block (aggregates · lifecycles).PROP-018 P2 (spec v0.4.0): ภาพผัง aggregate + ขอบเขต aggregate และกติกา transaction เชิงบรรทัดฐาน (ข้อ 5) และผัง lifetime ของ component แบบ DI (ข้อ 6) ของ credit_risk · lending — render จาก block dataModeling ใน graph (aggregates · lifecycles) |
| 0.3.0 | 2026-07-28 | PROP-037 applied (spec v0.29.0) — Section 3 gains the reliability-extract rail: scope reliability_score is the single door by which a platform score reaches Credit & Risk, as an aggregate extract, gate-checked per request and logged to the farmer.apply PROP-037 (spec v0.29.0) — ข้อ 3 เพิ่มเส้นทาง reliability extract: scope reliability_score เป็นประตูเดียวที่คะแนนของ platform เข้าสู่ Credit & Risk |
| 0.4.0 | 2026-08-03 | PROP-073 (spec v0.47.0): one word — Tenant. Party → Tenant, party_id (and every prefixed form) → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, party context/switcher → tenant context/switcher, cross-party → cross-tenant, organisation → organization, and ผู้เล่น retired as the Thai gloss (the Latin word tenant instead, R-THAI). Hold list untouched: counterparty · third party · tripartite working group · Person*/person_id; display codes and token claims were held by R-NULL for one release and then MOVED at v0.47.1 on client decision (C-1), because no token has ever been SIGNED — no auth exists in the built ocsb/ocsf prototypes — and the only printed codes were eight fixture strings in apps/ocsf/fund-shell.jsx, swept in the same pass: PTY- → TNT-, TCA- → TCA-, TQL- → TQL-, claim tnt → tnt, claim dep → dep. Carried in the same pass: the PROP-075 rectification — the retired directory noun domain becomes department (A-82 R-ONETREE) and the dangling A-86/A-87/A-88 citations are re-pointed at the ids they were actually given, A-81/A-82/A-83.PROP-073 (spec v0.47.0): คำเดียว — Tenant Party → Tenant, party_id ทุกรูป → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, cross-party → cross-tenant และเลิกใช้ ผู้เล่น เป็นคำแทนวัตถุนี้ในภาษาไทย (ใช้คำละติน tenant ตาม R-THAI) รายการห้ามแตะไม่ถูกแตะ: คู่สัญญา · third party · คณะทำงานไตรภาคี · Person*/person_id รอบเดียวกันแก้ค้างจาก PROP-075: domain → department (A-82) และแก้การอ้าง A-86/A-87/A-88 ที่ไม่มีอยู่จริงเป็น A-81/A-82/A-83 |
| 0.4.1 | 2026-08-03 | PROP-073 PATCH 1 (spec v0.47.1 / v0.47.2 / v0.47.3 as applicable): the identifiers v0.47.0 had held, moved on client decision. PTY-######## → TNT-######## · PCA-######## → TCA-######## · PQL-######## → TQL-######## · token claim pty → tnt · token claim dom → dep (v0.47.1, C-1 — R-NULL had held them as a stored VALUE and a wire format; reversed because no token has ever been signed and the only printed codes were fixture strings). quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2 — org is organization abbreviated, not a resemblance). The retired role LABEL swept as a phrase family and quota organization naming the tenant → quota group / กลุ่มโควตา (v0.47.3). All retired forms are in the FR-396 crosswalk and refused in new text by NFR-142.PROP-073 PATCH 1 (spec v0.47.1 / v0.47.2 / v0.47.3 ตามที่เกี่ยวข้อง): ตัวระบุที่ v0.47.0 คงไว้ ถูกย้ายตามการตัดสินของลูกค้า PTY- → TNT- · PCA- → TCA- · PQL- → TQL- · claim pty → tnt · claim dom → dep (v0.47.1, C-1) · quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2) · ป้ายชื่อบทบาทที่เลิกใช้และ องค์กรโควตา ที่เรียก tenant → กลุ่มโควตา (v0.47.3) ทุกรูปที่เลิกใช้อยู่ในตารางแปลง FR-396 |