# Eo / Web / Webview / Kka16801sf

## Overview

The `KKA16801SF` module is the **Remote Support Plus cancellation integration** view logic for the koptWebA application. It provides a web-based workflow for operators to view, confirm, cancel, recover, or cancel reservations for Remote Support Plus option service contracts. The module was created as a OneStop (ワンストップ) adaptation based on the koptWebB module `KKW02516SFLogic` (Remote Support Plus option cancellation).

This module sits between the web presentation layer (JSP views) and backend business services (KKSV02xx mappers). It handles a three-step transaction flow — confirm, fix (finalize), and navigation — while supporting three operational modes: **cancellation (解約)**, **recovery (回復)**, and **reservation cancellation (予約取消)**.

## Key Classes and Interfaces

### KKA16801SFLogic

**File:** `source/koptWebA/src/eo/web/webview/KKA16801SF/KKA16801SFLogic.java`

The core controller class for this module. It extends `JCCWebBusinessLogic` and serves as the central orchestrator for the Remote Support Plus cancellation workflow. This class handles both traditional screen-based operations (via `action*` methods) and OneStop API-based operations (via `apiControl`).

The class is organized into several logical sections:

- **OneStop API methods** — `apiControl`, `apiInit`, `createMsgMap`, `singleChkForOneStop`, `singleKnrnChkForOneStop`, `commonKnrnChkForOneStop`, `overwriteDataBeanKnrnChkForInit`, `overwriteDataBean`, `apiTerminal`
- **Screen action methods** — `actionInit`, `actionClear`, `actionBack`, `actionUpd`, `actionFix`, `actionShusei`, `actionFin`
- **Service execution methods** — `executeInitSvc`, `executeDslSvc`, `executeKaihkSvc`, `executeRsvclSvc`
- **DataBean setup methods** — `setHktgiBean`, `setDataInit`, `setDataDsl`, `setDataKaihk`, `setDataRsvcl`
- **Utility methods** — `getMsgRep`, `getWrisvcMsg`

#### OneStop API Methods

These methods handle the OneStop integration pattern where XML requests are received and processed without traditional screen rendering.

**`apiControl()`** — Entry point for OneStop API requests. This method:
1. Parses incoming XML into a `requestMap`
2. Extracts the `func_code` to determine operation type
3. Runs validation: `apiInit` -> `singleChkForOneStop` -> `singleKnrnChkForOneStop` -> `commonKnrnChkForOneStop` -> `overwriteDataBeanKnrnChkForInit`
4. Calls `actionInit()` for initial display
5. Calls `actionUpd()` for confirmation processing
6. If `func_code` is `"1"`, calls `actionFix()` to finalize
7. Returns a structured XML response via `apiTerminal("00")`
8. Catches `JCCWebServiceException` for service interface errors and `Exception` for system-level errors (return code `"99"`)

**`apiInit()`** — Initializes the OneStop request context. Parses incoming XML, extracts `func_code`, validates that only func_code `"1"` (confirm button) or `"2"` (update button) are allowed for update APIs, creates message maps, and initializes the warning list.

**`createMsgMap()`** — Builds the internal error message maps:
- `warMsgMap` — Warning messages (currently unused)
- `tkckErrMsgMap` — Single-item error messages (currently unused)
- `errMsgMap` — Error messages, pre-populated with:
  - `E5013` — "Usage end date cannot be in the past"
- `sifErrMap` — Service interface error mapping (e.g., `E5011`/`E5012` for end date errors)

**`singleChkForOneStop()`** — Validates individual input fields from the OneStop request:
- `func_code` — Required, 1-digit numeric, must be `"1"` or `"2"`
- `sysid` — Required, 10-character alphanumeric
- `svc_kei_no` — Required, 10-character alphanumeric
- `ido_rsn_dbri_cd` — Required, 2-digit numeric (cancellation reason category)
- `ido_rsn_cbri_cd` — Optional, 2-digit numeric (sub-category)
- `ido_rsn_memo` — Optional, 1-100 characters
- `user_id` — Required, 6-10 character alphanumeric
- `use_endymd` — Required, 8-character date (YYYYMMDD)

If any check fails, returns XML with error code `"10"` and a list of field errors.

**`commonKnrnChkForOneStop()`** — Cross-field business rule validation. Invokes multiple backend services:
1. **KKSV0820** — Verifies SYSID, service contract number, and user ID exist
2. **KKSV0061** — Fetches cancellation reason code list
3. **KKSV0062** — Checks service status; retrieves pricing group code for specific network types (Wi-Fi/EMobile/UQ-WiMAX)
4. **KKSV0463** — Gets cancellation reason sub-category substitution
5. **KKSV0551** — Gets cancellation reason category options

Returns specific error codes for each validation failure:
- `E5003` — SYSID not found
- `E5004` — Service contract number not found
- `E5005` — User ID not found
- `E5006` — Cancellation reason code combination invalid
- `E5007` — Service contract cannot be cancelled

**`overwriteDataBeanKnrnChkForInit()`** — Prepares and validates data for the initial display. This is one of the most complex methods:
1. Calls **KKSV0042** to fetch comprehensive service contract information (contract agreement, common info, promotion, codes, discounts, service details, option info, network type, etc.)
2. Validates the network type is one of "EO Home Type", "EO Metro Type", or "EO Mansion Type" (returns `E5008` if not)
3. Calls **KKSV0043** to fetch option service contracts
4. Identifies the target Remote Support Plus option contract (filtering out non-RS-Plus options and already-cancelled contracts)
5. Returns `E5009` if no valid option contract is found
6. Validates both main service and option service statuses are in cancellable states
7. Builds the inheritance list and sets screen info for the next screen

**`overwriteDataBean()`** — Splits the `use_endymd` (YYYYMMDD) into year, month, and day components and writes them to the service form bean.

**`apiTerminal(String returnCd)`** — Sends the final XML response, using `JKKOneStopApiCommonUtil.setReturnXml()` with the given return code.

#### Screen Action Methods

These handle the traditional screen-based workflow.

**`actionInit()`** — Initial display handler. Steps:
1. Retrieves screen info from the session
2. Sets up the `hktgiBean` (inheritance list DataBean)
3. Calls `executeInitSvc()` to query Remote Support Plus info
4. Calls `setDataInit()` to configure the DataBean
5. Checks the `tran_div` (processing category) and validates the option service contract status:
  - **Cancellation mode** (`OP_TRAN_DIV_DSL`): Requires status "030", "100", or "210"
  - **Recovery mode** (`OP_TRAN_DIV_KAIHK`): Requires status "910"
  - **Reservation cancellation mode** (`OP_TRAN_DIV_RSV_CL`): Requires status "010", "020", "030", or "100"
6. If status doesn't match, displays a warning and disables updates

**`actionClear()`** — Clears the form by re-executing `executeInitSvc()` and `setDataInit()`.

**`actionBack()`** — Returns to the calling screen by setting `NEXT_SCREEN_ID` in the common info bean.

**`actionUpd()`** — Confirmation processing. Steps:
1. Retrieves `tran_div` to determine the processing mode
2. For cancellation mode: calls `setDataDsl()` then `executeDslSvc()` with `func_code = "2"` (confirmation)
3. If no return message ID, navigates to screen `KKW025170PJP` (confirmation screen) with the "Cancellation" message
4. If a return message ID is present, displays the appropriate error/warning

**`actionFix()`** — Finalization processing. Branches by `tran_div`:
- **Cancellation** — Calls `executeDslSvc()` with `func_code = "1"` (execution)
- **Recovery** — Calls `setDataKaihk()` then `executeKaihkSvc()` with `func_code = "1"`
- **Reservation cancellation** — Calls `setDataRsvcl()` then `executeRsvclSvc()` with `func_code = "1"`

After execution, navigates to `KKW025180PJP` (completion screen) on success.

**`actionShusei()`** — Correction handler that returns to the change screen `KKW025160PJP`.

**`actionFin()`** — Completion handler that returns to the calling screen.

#### Service Execution Methods

Each of these methods follows the same pattern: configure the use case ID, set up input/output maps via the mapper, invoke the service, and retrieve results.

**`executeInitSvc(X31SDataBeanAccess[] paramBean)`** — Calls use case `KKSV0215` to query Remote Support Plus option contract info. Maps the option contract agreement data from the output.

**`executeDslSvc(X31SDataBeanAccess[] paramBean, String func_code)`** — Calls use case `KKSV0216` for cancellation. The `func_code` determines whether it's a confirmation (`"2"`) or execution (`"1"`). Also checks for discount service change messages.

**`executeKaihkSvc(X31SDataBeanAccess[] paramBean, String func_code)`** — Calls use case `KKSV0217` for service recovery.

**`executeRsvclSvc(X31SDataBeanAccess[] paramBean, String func_code)`** — Calls use case `KKSV0218` for reservation cancellation. Since the `IT1-2013-0000299` change, also sets up the form input support work information.

#### DataBean Setup Methods

**`setHktgiBean(X31SDataBeanAccess[] paramBean)`** — Copies data from the inheritance list bean to the top-level form bean. Sets:
- `unyo_ymd` (operation date)
- `rsv_aply_ymd` (reservation application date) to `"20991231"`
- `tran_div` (processing category)
- `sysid`, `svc_kei_no`, `ido_div`
- The cancellation reason code list (iterating over all entries)
- `op_svc_kei_no`, `mskm_no`, `mskm_dtl_no`

**`setDataInit(X31SDataBeanAccess[] paramBean)`** — Prepares the form for display:
- Enables update state
- Handles the case where `svc_endymd` equals the maximum date (`"20991231"`) by displaying an empty string for the usage end date
- Splits `unyo_ymd` into year/month/day components for the end date fields

**`setDataDsl(X31SDataBeanAccess[] paramBean)`** — For cancellation mode: combines year/month/day into the full `use_endymd`, sets `svc_endymd`, sets `svc_chrg_endymd` to the operation date, and sets the progress-specific field 1.

**`setDataKaihk(X31SDataBeanAccess[] paramBean)`** — For recovery mode: sets `kaihk_ymd` to the operation date and configures progress-specific field 1.

**`setDataRsvcl(X31SDataBeanAccess[] paramBean)`** — For reservation cancellation mode: configures progress-specific field 1.

#### Utility Methods

**`getMsgRep(String trandiv, String rtn_msg_id)`** — Returns replacement text arrays for specific error messages:
- EKB0690-NW (cancellation): "Usage end date", "past"
- EKB5440-JW (recovery): "Outside recovery period", "recovery"
- EKB5420-JW (reservation cancellation): "Option", "reservation cancellation"

**`getWrisvcMsg(String func_code, HashMap<String, Object> outputMap)`** — Extracts discount service change messages from the `WrisvcAutoAplyCC` output map and stores them in the session via `JKKSetSessionMessage`.

**`svcKeiStatCheck(OneStopDataBeanAccess ekk0081a010cbsmsg1List)`** — Checks if the main service contract status is NOT in a cancellable state (i.e., not "Contracted", "Service in progress", "Suspended/Interrupted").

**`taihiOpsSvKeiCheck(OneStopDataBeanAccess taihiOpsSvKeiList)`** — Checks if the option service contract status is NOT in a cancellable state.

---

### KKW02516SFBean

**File:** `source/koptWebA/src/eo/web/webview/KKA16801SF/KKW02516SFBean.java`

The main DataBean that holds all screen data for this module. It extends `X33VViewBaseBean` and implements `X33VListedBeanInterface` and `X31CBaseBean`.

Key data fields include:

| Field Group | Fields | Purpose |
|---|---|---|
| Contract list | `cust_kei_hktgi_list_list` | Customer contract inheritance list (`X33VDataTypeList`) |
| Usage dates | `use_staymd`, `use_endymd` (year/mon/day), `use_endymd_year`, `use_endymd_mon`, `use_endymd_day` | Start/end dates |
| Identification | `sysid`, `svc_kei_no` | SYSID and service contract number |
| Cancellation reason | `ido_div`, `ido_rsn_list_list` (list), `op_svc_kei_no` | Cancellation category, reason codes, option contract number |
| Processing | `tran_div`, `mskm_no`, `mskm_dtl_no` | Processing category, application number, detail number |
| Dates | `unyo_ymd`, `unyo_dtm`, `rsv_aply_ymd`, `gene_add_dtm`, `last_upd_dtm` | Operation dates, timestamps |
| Service info | `op_svc_kei_stat`, `op_svc_cd`, `pcrs_cd`, `pplan_cd`, `svc_staymd`, `svc_endymd`, `svc_chrg_endymd`, `kaihk_ymd` | Service contract metadata |
| Response | `rtn_msg_id` | Return message ID from service calls |
| Flags | `chg_kahi_flg`, `returnData` | Update enabled flag, OneStop return data |

The constructor initializes the `cust_kei_hktgi_list_list` with one pre-allocated `KKW02516SF01DBean` element. The `getJsflist_typelist_cust_kei_hktgi_list()` method converts the list for JSF display.

This bean is referenced by:
- **JSP:** `KKW025160PJP.jsp` (initial/change screen), `KKW025170PJP.jsp` (confirmation screen), `KKW025180PJP.jsp` (completion screen)
- **XML:** `WEBGAMEN_KKW025160PJP.xml`, `WEBGAMEN_KKW025170PJP.xml`, `WEBGAMEN_KKW025180PJP.xml`
- **OneStop config:** `WEBGAMEN_KKA168010PJP.xml` (references both `KKA16801SFLogic` and `KKW02516SFBean`)

---

### KKW02516SF01DBean

**File:** `source/koptWebA/src/eo/web/webview/KKA16801SF/KKW02516SF01DBean.java`

A list item DataBean representing a single entry in the customer contract inheritance list. Implements `X33VDataTypeBeanInterface`, `X33VListedBeanInterface`, and `Serializable`.

Holds:
- `sysid` — SYSID (update/value/state triplet)
- `svc_kei_no` — Service contract number (update/value/state triplet)
- `ido_div` — Cancellation category (update/value/state triplet)
- `ido_rsn_cd_list` — List of cancellation reason codes (`X33VDataTypeList`)
- `ido_rsn_memo` — Cancellation memo (update/value/state triplet)
- `op_svc_kei_no_list` — List of option service contract numbers
- `tran_div` — Processing category
- `mskm_no`, `mskm_dtl_no` — Application number and detail number

The `loadModelData()` method provides reflective data access using a key/subkey naming convention. Keys like `"契約理由コード/0"` resolve to the first element of `ido_rsn_cd_list`. The special subkey `"*"` returns the list size.

The `typeModelData()` method maps field names to their Java types for type-safe DataBean access.

List management is handled by `addListDataInstance()`, `removeElementFromListData()`, and `clearListDataInstance()`.

---

### KKW02516SF02DBean

**File:** `source/koptWebA/src/eo/web/webview/KKA16801SF/KKW02516SF02DBean.java`

A minimal DataBean for cancellation reason entries. Fields:
- `ido_rsn_cd` — Cancellation reason code (update/value/state)
- `ido_rsn_memo` — Cancellation reason memo (update/value/state)

This bean is used for displaying/entering cancellation reason details in list form. It implements the same `loadModelData()`/`storeModelData()` reflective access pattern as `KKW02516SF01DBean`.

---

### KKW02516SFChecker

**File:** `source/koptWebA/src/eo/web/webview/KKA16801SF/KKW02516SFChecker.java`

A GUI check class implementing `X31SGuiCheckBase`. Currently, the `checkMethod()` receives the check type and parameter but simply returns `true`, meaning no client-side GUI validation is enforced by this checker. The business logic validation is performed server-side within the `KKA16801SFLogic` class.

---

### KKW02516SFConst

**File:** `source/koptWebA/src/eo/web/webview/KKA16801SF/KKW02516SFConst.java`

A utility class containing constant String definitions used throughout the module. All fields are public static final String constants that serve as keys for DataBean field access. Key constants include:

| Constant | Value (Japanese) | Purpose |
|---|---|---|
| `CUST_KEI_HKTGI_LIST` | 顧客契約引継リスト | Contract inheritance list key |
| `USE_STAYMD` | 利用開始日 | Usage start date |
| `USE_ENDYMD` | 利用終了日 | Usage end date |
| `USE_ENDYMD_YEAR/MON/DAY` | 利用終了日（年/月/日） | End date components |
| `SYSID` | SYSID | System ID |
| `SVC_KEI_NO` | サービス契約番号 | Service contract number |
| `IDO_DIV` | 異動区分 | Movement/cancellation category |
| `IDO_RSN_LIST` | 異動理由リスト | Cancellation reason list |
| `TRAN_DIV` | 処理区分 | Processing category |
| `MSKM_NO` | 申請番号 | Application number |
| `OP_SVC_KEI_NO` | オプションサービス契約番号 | Option service contract number |
| `OP_SVC_KEI_STAT` | オプションサービス契約ステータス | Option contract status |
| `RTN_MSG_ID` | 返却メッセージID | Return message ID |
| `CHG_KAHI_FLG` | 更新状態可否フラグ | Update enabled flag |

---

## How It Works

### OneStop API Flow

The OneStop integration pattern processes XML requests without rendering intermediate screens. Here is the complete request flow:

```mermaid
flowchart TD
    A["Incoming XML Request"] --> B["apiControl()"]
    B --> C["apiInit()"]
    C --> D["Parse XML to Map"]
    D --> E["Extract func_code"]
    E --> F["Validate func_code
is 1 or 2"]
    F -->|Invalid| G["Set E5001
Return"]
    F -->|Valid| H["createMsgMap()"]
    H --> I["singleChkForOneStop()
Field Validation"]
    I -->|Error| J["Set error code 10
Return"]
    I -->|Valid| K["singleKnrnChkForOneStop()"]
    K --> L["commonKnrnChkForOneStop()
Business Rules"]
    L --> M["KKSV0820
Entity Check"]
    M --> N["KKSV0061
Reason List"]
    N --> O["KKSV0062
Status Check"]
    O --> P["KKSV0463
Reason Substitution"]
    P --> Q["KKSV0551
Reason Category"]
    Q --> R["overwriteDataBeanKnrnChkForInit()
Data Loading & Validation"]
    R --> S["KKSV0042
Contract Lookup"]
    S --> T["KKSV0043
Option Lookup"]
    T --> U["actionInit()
Initial Display"]
    U --> V["actionUpd()
Confirmation"]
    V --> W["func_code = 1?
Confirm Button"]
    W -->|No| X["apiTerminal 00"]
    W -->|Yes| Y["actionFix()
Finalize"]
    Y --> X
    X --> Z["XML Response"]
```

### Screen-Based Flow

For traditional screen navigation, the flow is:

1. **Initial Display (`actionInit`)** — Query service info, load contract data, validate status
2. **Update Confirmation (`actionUpd`)** — Validate input (e.g., end date), call confirmation service
3. **Fix/Confirm (`actionFix`)** — Execute the actual operation (cancel/recover/reservation-cancel)
4. **Navigation** — Redirect to completion screen (`KKW025180PJP`) or back to change screen

### Processing Modes

The module supports three processing modes controlled by the `tran_div` field:

| Mode | Code | Service | Action |
|---|---|---|---|
| Cancellation (解約) | `OP_TRAN_DIV_DSL` | KKSV0216 | Cancel option service |
| Recovery (回復) | `OP_TRAN_DIV_KAIHK` | KKSV0217 | Restore cancelled service |
| Reservation Cancel (予約取消) | `OP_TRAN_DIV_RSV_CL` | KKSV0218 | Cancel a pending reservation |

Each mode has specific valid service contract statuses that allow the operation to proceed.

## Data Model

The data model centers around the `KKW02516SFBean` and its nested list beans. The key entities are:

```mermaid
flowchart TD
    A["KKW02516SFBean
Main Screen Bean"] --> B["cust_kei_hktgi_list_list
X33VDataTypeList"]
    B --> C["KKW02516SF01DBean
Contract List Item"]
    C --> D["sysid
svc_kei_no
ido_div
tran_div
mskm_no
mskm_dtl_no"]
    C --> E["ido_rsn_cd_list
Cancellation Reasons"]
    C --> F["op_svc_kei_no_list
Option Contract Numbers"]
    C --> G["ido_rsn_memo
Cancellation Memo"]
    A --> H["use_staymd
use_endymd
(unyo_ymd components)"]
    A --> I["op_svc_kei_stat
op_svc_cd
pcrs_cd
pplan_cd"]
    A --> J["rtn_msg_id
chg_kahi_flg
returnData"]
```

The `KKW02516SF01DBean` acts as a list element, with its own `ido_rsn_cd_list` (cancellation reason codes) and `op_svc_kei_no_list` (option service contract numbers) as nested `X33VDataTypeList` fields. The `KKW02516SF02DBean` provides a dedicated bean for cancellation reason entries with reason code and memo fields.

## Dependencies and Integration

### Inbound Dependencies

Other modules depend on this module's classes:

- `WEBGAMEN_KKA168010PJP.xml` — OneStop screen definition for this module (references `KKA16801SFLogic` and `KKW02516SFBean`)
- `x31business_logic_KKA16801SF.xml` — Business logic wiring
- `KKW025160PJP.jsp` — Initial/change screen (uses `KKW02516SFBean`)
- `KKW025170PJP.jsp` — Confirmation screen (uses `KKW02516SFBean`)
- `KKW025180PJP.jsp` — Completion screen (uses `KKW02516SFBean`)
- `WEBGAMEN_KKW025160PJP.xml`, `WEBGAMEN_KKW025170PJP.xml`, `WEBGAMEN_KKW025180PJP.xml` — Screen XML configs

### Backend Service Mappers

This module invokes the following backend mappers:

| Mapper | Use Case | Purpose |
|---|---|---|
| `KKSV0215_KKSV0215OPDBMapper` | KKSV0215 | Query Remote Support Plus info |
| `KKSV0216_KKSV0216OPDBMapper` | KKSV0216 | Cancellation confirmation/execution |
| `KKSV0217_KKSV0217OPDBMapper` | KKSV0217 | Recovery processing |
| `KKSV0218_KKSV0218OPDBMapper` | KKSV0218 | Reservation cancellation |
| `KKSV0042_KKSV0042OPDBMapper` | KKSV0042 | Service contract comprehensive lookup |
| `KKSV0043_KKSV0043OPDBMapper` | KKSV0043 | Option service contract lookup |
| `KKSV0061_KKSV0061OPDBMapper` | KKSV0061 | Cancellation reason code list |
| `KKSV0062_KKSV0062OPDBMapper` | KKSV0062 | Service status and pricing info |
| `KKSV0463_KKSV0463OPDBMapper` | KKSV0463 | Cancellation reason substitution |
| `KKSV0551_KKSV0551OPDBMapper` | KKSV0551 | Cancellation reason category |
| `KKSV0820_KKSV0820OPDBMapper` | KKSV0820 | Entity existence check (SYSID/contract/user) |

### Framework Dependencies

The module relies on the OneStop common utility infrastructure:
- `JKKOneStopApiCommonUtil` — OneStop API common utilities (validation, error handling, XML response)
- `JKKCommonConst` / `JKKScreenConst` — Shared constants for codes and screen IDs
- `JKKSetSessionMessage` — Session-based message management
- `JCCWebCommon` — General web utilities
- `JCCMessageCache` — Message cache for error messages

### Related Modules

This module is part of the broader Remote Support Plus ecosystem:
- `eo.web.webview.KKA17101SF`, `KKA17201SF`, `KKA17401SF` — Related Remote Support Plus screens
- `eo.web.webview.KKW01101SF`, `KKW00127SF` — Option contract screens
- `eo.web.webview.CommonInfoCF` — Common information screen
- `eo.web.webview.commonOneStop` — OneStop shared utilities

## Notes for Developers

### Architecture Pattern

This module implements the **OneStop pattern** introduced in version 23.00.00 (2015/09/30), where koptWebB business logic was ported to koptWebA. The OneStop API methods (`apiControl` through `apiTerminal`) wrap the same screen-based logic (`actionInit` through `actionFin`) to support API-driven workflows. When working on this module, be aware that both code paths need to be understood.

### Key Constants for func_code

- `func_code = "1"` — Confirm button pressed (triggers `actionFix`)
- `func_code = "2"` — Update button pressed (triggers `actionUpd` only)

### Error Code Reference

| Error Code | Meaning | Trigger Condition |
|---|---|---|
| `E5001` | Regulatory control error | func_code is not "1" or "2" |
| `E5003` | SYSID not found | KKSV0820 returns empty SYSID |
| `E5004` | Service contract not found | KKSV0820 returns empty svc_kei_no |
| `E5005` | User ID not found | KKSV0820 returns empty user_id |
| `E5006` | Cancellation reason invalid | Code pair doesn't match allowed combinations |
| `E5007` | Contract cannot be cancelled | Service status doesn't allow cancellation |
| `E5008` | Wrong network type | prc_gcp_cd is not EO Home/Metro/Mansion |
| `E5009` | No option contract found | Target RS-Plus contract not found |
| `E5010` | Service status mismatch | Main or option service not in cancellable state |
| `E5011` | End date error (state EA) | Service interface error |
| `E5012` | End date error (state EB) | Service interface error |
| `E5013` | End date in the past | use_endymd is before operation date |

### Cancellation Reason Category

The `ido_rsn_dbri_cd` is always set to `IDO_DIV_VALUE_00031` (option settings category) when the module runs as a OneStop API. This is defined as `OS_IDO_DIV` in the logic class.

### Service Contract Status Codes

Valid cancellable statuses for both main service and option service: `"010"` (Contracted), `"100"` (Service in progress), `"210"` (Suspended/Interrupted). If either service has a different status, `E5010` is returned.

### DataBean Field Triplet Pattern

Each DataBean field follows an `_update`/`_value`/`_state` triplet pattern:
- `_update` — Whether the field is being modified
- `_value` — The current value
- `_state` — Display/edit state (enabled/disabled)

Additionally, `_enabled` boolean fields control JSF component rendering.

### Message Replacement

The `getMsgRep()` method provides custom replacement text for specific error messages. When adding new error scenarios, ensure the corresponding replacement strings are added here.

### Logging

The module uses `JSYwebLog.println(JSYwebLog.DataBean_Dump, ...)` to log full DataBean dumps at key points (end of each action method). This is useful for debugging DataBean state transitions.

### Screen Navigation Targets

| Screen ID | JSP | Purpose |
|---|---|---|
| `KKW025160PJP` | KKW025160PJP.jsp | Initial/change screen |
| `KKW025170PJP` | KKW025170PJP.jsp | Confirmation screen |
| `KKW025180PJP` | KKW025180PJP.jsp | Completion screen |
| `KKA168010PJP` | WEBGAMEN_KKA168010PJP.xml | OneStop API endpoint |

### Version History Highlights

- **v23.00.00** (2015/09/30) — OneStop port from koptWebB (WO7)
- **v26.00.00** (2016/06/03) — Premium support policy
- **v26.00.01** (2016/07/06) — Recovery handling fee charges

The module code is extensive (~1900 lines) with significant conditional logic based on processing modes and func_code. When making changes, test all three modes (cancellation, recovery, reservation cancellation) across both the OneStop API and screen-based flows.
