แนวคิดหลัก
คำศัพท์สำคัญ
| Term | Description | Example |
|---|---|---|
template_code | รหัสอ้างอิงของ consent template | demo_mobile_kyc |
customer_id | รหัสผู้ใช้หรือลูกค้า | 550e8400-e29b-41d4-a716-446655440000 |
consent_version_id | รหัสเฉพาะของแต่ละ template version | 123e4567-e89b-12d3-a456-426614174010 |
Published กับ Pending
| Type | Endpoint | When to use |
|---|---|---|
| Published | /v1/consent-templates/{code}/latest | ใช้ดึง template ปัจจุบันที่พร้อมแสดงให้ผู้ใช้ทุกคน |
| Pending | /v1/customers/{id}/consents/templates/{code}/pending | ใช้ตรวจสอบว่าผู้ใช้มี template update ที่ยังไม่ยอมรับหรือไม่ |
ตัวอย่าง Pending: มีการปล่อย Template v2.0 แล้ว แต่ผู้ใช้ยังไม่เคยเห็น → accepted: false หลังจากผู้ใช้ตัดสินใจแล้ว → accepted: true
ค่า Decision
| Value | Meaning |
|---|---|
given | ผู้ใช้ยินยอม |
reject | ผู้ใช้ปฏิเสธ |
withdraw | ผู้ใช้ถอนความยินยอมที่เคยให้ไว้ |
การทำงานโดยสรุป
1. GET /latest → แสดง consent template ปัจจุบันให้ผู้ใช้
2. GET /pending → ตรวจสอบว่าผู้ใช้มีรายการอัปเดตที่ต้องตัดสินใจหรือไม่
3. POST /decisions → บันทึกคำตอบของผู้ใช้ (given/reject/withdraw)