# Business Logic - JKKSeikyKeiHenkoCC.seikyKeiHenko() [553 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKSeikyKeiHenkoCC` |
| Layer | CC / Common Component (shared processing component called by BPM screens) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKSeikyKeiHenkoCC.seikyKeiHenko()

This method is the **central orchestration hub** for the Invoice Contract Modification workflow (request contract change processing) in the K-Opticom customer management system. It coordinates a complex sequence of business operations triggered by a single user action on the KKSV0405 screen - the screen where customers or operators modify an existing invoice contract (e.g., change service content, switch payment methods, add or cancel optional services, or register a new subscription).

The method implements a **routing/dispatch pattern**: it reads a work data map (`ccMsg`) from the request parameter, extracts service-level flags and codes, then branches across dozens of service component (SC) calls to handle each business domain. The specific branches cover:

- **Accept content registration** (`execEKK0011D020`) - handles the case where a service is already in Accepted (010) status, specifically for FTTH (Fiber To The Home) and eo Electric services.
- **Invoice contract content modification** (`execEKK0491C060`) - always executed; updates core contract details.
- **Bank transfer processing** (paywayCd 2 or 3) - creates new bank account codes, registers transfer procedures, requests reviews, and records approval or rejection results.
- **Credit card processing** (paywayCd 4) - manages a full authorization flow via Paygent (payment gateway), including initial authorization requests (settlement or reservation), credit card company agreements, invoice procedures, and credit review result registration.
- **Invoice payment method change** (`execEKK0491C240`) - changes the payment method on existing invoice contracts when recordAddFlg is true.
- **Service contract line content change** (`execEKK0251A010`, `execEKK0251C030`) - changes line content during service contract modification when ido_div is 00015.
- **Invoice option cancel/dissolve** (`execEKK0441C210`, `execEKK0441C230`, `execEKK0441C240`) - cancels or dissolves invoice option services.
- **Invoice option registration** (`execEKK0441D010` and state-based branches) - registers new invoice option services with review, conclusion, and start processing based on service status thresholds.
- **Progress registration** (`execEKK1091D010`) - registers processing progress after contract modification.
- **Confirmation processing** (funcCd 1) - updates judgment transaction data for new contracts or service additions (ido_div 00001 or 00002).

The method acts as a **shared utility** called from multiple screens and BPM operations, primarily via `KKSV0405OPOperation`. It receives all necessary context through a single parameter map (`fixedText`-keyed data) and returns the modified parameter object with updated state for downstream processing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["seikyKeiHenko starts"])
    subgraph INIT["Initialization"]
        GET_MSG["Get ccMsg from param.getData(fixedText)"]
        NEW_SC["Create ServiceComponentRequestInvoker"]
        GET_FUNCCD["Get func_code from ccMsg"]
        GET_SVCSTAT["Parse svc_kei_stat_cd_max to svcKeiStatCdNet"]
        GET_PAYWAY["Get paywayCd, paywayPaySkekkaCd"]
        GET_FLAGS["Get seiOpSvcKeiInsFlg, seiOpSvcKeiDslFlg, futureFlg"]
        GET_LIST["Get KKSV040501CCList svc_list"]
    end
    subgraph CHECKLIST["Check svc_list"]
        CHECK_LIST["svc_list != null and size > 0"]
        GET_CHILD["childMap = svc_list.get(0)"]
        GET_STATECD["Get kksv040501_svc_kei_stat_cd"]
        GET_SVCCD["Get kksv0405work_svc_cd"]
        CHECK_UKSTATE["Service status == 010 accepted?"]
        CHECK_UKSTATE_SVC["svc_cd == 51 or electricity?"]
    end
    subgraph EXEC0011["Accept Registration"]
        EXEC_0011["execEKK0011D020 Apply Content Registration"]
    end
    subgraph EXEC0491["Invoice Contract Modification"]
        EXEC_0491["execEKK0491C060 Invoice Contract Content Change"]
    end
    subgraph CHECK_PAYWAY["Payment Method Branch"]
        CHECK_23["paywayCd == 2 or 3?"]
        CHECK_4["paywayCd == 4?"]
    end
    subgraph CHECK_BANK["Bank Transfer branch"]
        EXEC_KOZA["execKozaNewCd New Account Code"]
        EXEC_0501D["execEKK0501D010 Bank Transfer Procedure"]
        EXEC_0501C030["execEKK0501C030 Bank Transfer Review Request"]
        CHECK_PAYREVIEW["paywayPaySkekkaCd == 0?"]
        CHECK_PAYREVIEW_NG["paywayPaySkekkaCd == 1?"]
    end
    subgraph CHECK_CREDIT["Credit Card branch"]
        CHECK_NO_REVIEW["paywayPaySkekkaCd unset?"]
        CHECK_UPDATE["funcCd == 1 update mode?"]
        CHECK_TOKEN["token exists in KKSV040531SC?"]
        EXEC_AUTHORI["execEKKA0010004 Settlement or execEKKA0010003 Reservation"]
        CHECK_SNNRSLT["Authorization result code check"]
        EXEC_0531A010["execEKK0531A010 Credit Card Company Agreement"]
        CHECK_ISSUER["crecardSbtCd or crdtIssuerDiv missing?"]
        EXEC_0521A010["execEKK0521A010 Credit Card Agreement"]
        EXEC_0521D["execEKK0521D010 Credit Invoice Procedure"]
        EXEC_0521C030C["execEKK0521C030 Credit Review Request"]
        CHECK_CRREVIEW["Credit review == 0 or unset?"]
    end
    subgraph EXEC_PAYCHANGE["Invoice Payment Change"]
        EXEC_0491C240["execEKK0491C240 Invoice Payment Change"]
        CHECK_CREDIT_INIT["paywayCd==4 and no review set?"]
        EXEC_1031D["execEKK1031D010 Credit Initial Authorization"]
    end
    subgraph EXEC_LINECHANGE["Line Content Change"]
        EXEC_0251A["execEKK0251A010 Contract Line Agreement Search"]
        EXEC_0251C["execEKK0251C030 Contract Line Content Change"]
    end
    subgraph EXEC_CANCELDIS["Invoice Cancel or Dissolve"]
        CHECK_CANCEL_STAT["seiOpSvcKeiStat == 010 or 020?"]
        EXEC_0441C210["execEKK0441C210 Cancel"]
        EXEC_0441C230["execEKK0441C230 Dissolve"]
        CHECK_CANCEL_DETERM["funcCd == 1 determination?"]
        EXEC_0441C240["execEKK0441C240 Dissolve Confirmation"]
        CHECK_FUTURE["futureFlg != 1?"]
    end
    subgraph EXEC_OPTIONINS["Invoice Option Registration"]
        EXEC_0441D010["execEKK0441D010 Service Contract Registration"]
        CHECK_STAT_20["svcKeiStatCdNet >= 20?"]
        CHECK_STAT_30["svcKeiStatCdNet >= 30?"]
        CHECK_STAT_100["svcKeiStatCdNet 100-220?"]
        EXEC_0441C030["execEKK0441C030 Review"]
        EXEC_0441C040["execEKK0441C040 Conclusion"]
        EXEC_0441C070["execEKK0441C070 Start"]
        EXEC_0441C060["execEKK0441C060 Reserved Effective Date"]
    end
    subgraph EXEC_PAYWAYTCML["Payment Notification Mail Control"]
        EXEC_0491C250["execEKK0491C250 Payment Notification Mail Control Change"]
    end
    subgraph EXEC_PROGRESS["Progress Registration"]
        EXEC_1091D["execEKK1091D010 Progress Registration"]
        CHECK_JDG["jdg_flg == 1 or isFauthori?"]
        EXEC_1091DJ["execEKK1091D010_jdg Review Result Screen Progress"]
        CHECK_MSKMSHONO["mskmshoNo set?"]
        EXEC_0021B011["execEKK0021B011 Application Number Existence Check"]
        EXEC_0021C060["execEKK0021C060 Application Detail Review"]
    end
    subgraph CONFIRM["Confirmation funcCd==1"]
        CHECK_IDO["ido_div == 00001 or 00002?"]
        SET_JUDGE_UPDATE["param.setData JUDGE_UPDATE_MAP"]
        FOR_UPD["For each svc_list: updMkmScinsprtWkCall"]
        SET_SVCNUMS["Set key_svc_kei_no1 through key_svc_kei_no4"]
        EXEC_UPDATE_JUDGE["execUpdateJudge Judge Transaction Update"]
    end
    END_RETURN(["Return param"])
    START --> INIT
    INIT --> CHECKLIST
    CHECK_LIST -->|Yes| GET_CHILD
    GET_CHILD --> GET_STATECD
    GET_STATECD --> GET_SVCCD
    GET_SVCCD --> CHECK_UKSTATE
    CHECK_UKSTATE -->|Yes| CHECK_UKSTATE_SVC
    CHECK_UKSTATE -->|No| EXEC0491
    CHECK_UKSTATE_SVC -->|Yes FTTH or electricity| EXEC0011
    CHECK_UKSTATE_SVC -->|No| EXEC0491
    EXEC0011 --> EXEC0491
    EXEC0491 --> CHECK_PAYWAY
    CHECK_PAYWAY -->|2 or 3| CHECK_BANK
    CHECK_PAYWAY -->|4| CHECK_CREDIT
    CHECK_PAYWAY -->|else| EXEC_PROGRESS
    CHECK_BANK --> EXEC_KOZA
    EXEC_KOZA --> EXEC_0501D
    EXEC_0501D --> EXEC_0501C030
    EXEC_0501C030 --> CHECK_PAYREVIEW
    CHECK_PAYREVIEW -->|== 0| EXEC_0501C080
    CHECK_PAYREVIEW -->|== 1| EXEC_0501C090
    CHECK_CREDIT --> CHECK_NO_REVIEW
    CHECK_NO_REVIEW -->|Yes| CHECK_UPDATE
    CHECK_NO_REVIEW -->|No| CHECK_ISSUER
    CHECK_UPDATE -->|funcCd==1| EXEC_AUTHORI
    EXEC_AUTHORI --> CHECK_SNNRSLT
    CHECK_SNNRSLT -->|Error| THROW_ERR
    CHECK_SNNRSLT -->|NG| THROW_NG
    CHECK_SNNRSLT -->|OK| EXEC_0531A010
    EXEC_0531A010 --> CHECK_ISSUER
    CHECK_ISSUER -->|missing| EXEC_0521A010
    CHECK_ISSUER -->|present| EXEC_0521D
    EXEC_0521A010 --> EXEC_0521D
    EXEC_0521D --> EXEC_0521C030C
    EXEC_0521C030C --> CHECK_CRREVIEW
    CHECK_CRREVIEW -->|0 or unset| EXEC_0521C110
    CHECK_CRREVIEW -->|== 1| EXEC_0521C120
    CHECK_CREDIT --> EXEC_PAYCHANGE
    EXEC_PAYCHANGE --> EXEC_0491C240
    EXEC_0491C240 --> CHECK_CREDIT_INIT
    CHECK_CREDIT_INIT -->|yes| EXEC_1031D
    EXEC_CANCELDIS --> EXEC_OPTIONINS
    EXEC_LINECHANGE --> EXEC_PAYWAYTCML
    EXEC_PAYWAYTCML --> EXEC_PROGRESS
    EXEC_OPTIONINS --> EXEC_PROGRESS
    EXEC_PAYCHANGE --> EXEC_PROGRESS
    EXEC_1031D --> EXEC_PROGRESS
    EXEC_0521C110 --> EXEC_PROGRESS
    EXEC_0521C120 --> EXEC_PROGRESS
    EXEC_0501C080 --> EXEC_PROGRESS
    EXEC_0501C090 --> EXEC_PROGRESS
    EXEC_PROGRESS --> CONFIRM
    CONFIRM --> END_RETURN
    subgraph THROWS["Error Handling"]
        THROW_ERR["Set err_flg E_AUTHORI_ERR throw CCException"]
        THROW_NG["Set err_flg E_AUTHORI_NG throw CCException"]
    end
    THROW_ERR -.-> END_RETURN
    THROW_NG -.-> END_RETURN
```

**Branch explanations:**

1. **Initialization**: Extracts all work data from the `ccMsg` map including function code, service status, payment method code, flags for optional service operations, and the service list.

2. **svc_list check**: The main processing is gated on whether `KKSV040501CCList` has entries. If empty, the method skips to confirmation processing (funcCd==1) and returns early.

3. **ukState determination**: If service status is `010` (Accepted), only FTTH (svc_cd==51) or eo Electric (svc_cd==JKKStrConst.CD00130_05) trigger accept registration. For other statuses, or for non-accepted services, `ukState` is true and accept registration is called.

4. **Payment method branching**:
   - Bank transfer (codes 2 or 3): New account code creation, transfer procedure, review request, and result registration.
   - Credit card (code 4): Authorization via Paygent, company agreement, invoice procedure, review, and result registration.
   - Other: Skips payment processing entirely.

5. **Invoice payment change**: Always executed when recordAddFlg is true.

6. **Line content change**: Conditionally executed when ido_div is `00015` and ekk0251RunFlg is `1`.

7. **Invoice option cancel/dissolve**: Conditionally executed when seiOpSvcKeiDslFlg is `1`.

8. **Invoice option registration**: Conditionally executed when seiOpSvcKeiInsFlg is `1`, with state-based sub-branches.

9. **Progress registration**: Executed when ukState is true.

10. **Confirmation (funcCd==1)**: Processes judgment update maps for confirmation scenarios (new contracts or service additions).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for SC call execution; carries connection context and transaction boundaries for all downstream service component invocations. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying business data between BPM screens and CC components. Contains the control map (operator ID, operating date), work data map for SC mapping, and the `ccMsg` data block keyed by `fixedText`. Returned with updated state including judgment update maps and error flags. |
| 3 | `fixedText` | `String` | Key string used to retrieve the `ccMsg` work data map from `param.getData(fixedText)`. Identifies which data block to use (typically a screen-specific work area identifier). |

**Additional fields/values extracted from the work data map (`ccMsg`):**

| No | Key / Field | Type | Business Description |
|----|-------------|------|---------------------|
| 4 | `func_code` | `String` | Function code distinguishing screen modes: `1` = confirmation (determination mode), other values = execution (edit) mode. |
| 5 | `svc_kei_stat_cd_max` | `String` | Maximum service contract status code (numeric string); determines which service lifecycle stages to process (>=20 review, >=30 conclusion, 100-220 start). |
| 6 | `kksv0405work_payway_cd` | `String` | Payment method code: `2` or `3` = bank transfer, `4` = credit card. Controls the payment processing branch. |
| 7 | `kksv0405work_payway_pay_skekka_cd` | `String` | Payment review result code: `0` = OK (approval), `1` = NG (rejection), unset = requires review. |
| 8 | `kksv0405work_seiopsvc_kei_ins_flg` | `String` | Invoice option service contract registration flag: `1` = register new invoice option service. |
| 9 | `kksv0405work_seiopsvc_kei_dsl_flg` | `String` | Invoice option service contract dissolve flag: `1` = cancel or dissolve invoice option service. |
| 10 | `kksv0405work_seiopsvc_kei_stat` | `String` | Invoice option service contract status: `010` = Accepted, `020` = Under review. |
| 11 | `kksv0405work_future_flg` | `1` | Future date execution flag: `1` = scheduled for future, `0` = immediate execution. |
| 12 | `ekk0251_run_flg` | `String` | Service contract line content change execution flag: `1` = run line content change processing. |
| 13 | `kksv0405work_ido_div` | `String` | Modification division code: `00015` = line group content change target; `00001`/`00002` = new contract or service addition (for confirmation). |
| 14 | `record_add_flg` | `Boolean` | Account/credit card scheme record code addition flag: true when new account or credit card scheme code needs to be added. |
| 15 | `KKSV040501CCList` | `ArrayList<HashMap>` | Service detail list containing per-line-item data including service status, service code, and application details. |
| 16 | `kksv0405work_svc_cd` | `String` | Service code: `51` = FTTH, `JKKStrConst.CD00130_05` = eo Electric (electricity). |
| 17 | `jdg_flg` | `String` | Judgment flag: `1` = review result reflection screen processing. |
| 18 | `kksv040529_paywaytcml_ctl_cd` | `Object` | Payment notification mail control code; if present, triggers mail control change processing. |
| 19 | `kksv040524_mskmsho_no` | `String` | Application number; if set, triggers application number existence check. |
| 20 | `JCMConstants.FUNC_CODE_KEY` | - | Control map key for function code (used in update mode checks). |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `execEKK0011D020` | EKK0011D020SC | KK_T_ODR_HAKKO_JOKEN, KK_T_ODR_MSKM (inferred) | Apply content registration - registers new order content with acceptance |
| U | `execEKK0491C060` | EKK0491C060SC | KK_T_SEIKY_KEI (inferred) | Invoice contract content modification - updates existing contract details |
| C | `execEKK0501D010` | EKK0501D010SC | KK_T_KOZA (inferred) | Bank transfer procedure - registers transfer details |
| C | `execEKK0501C030` | EKK0501C030SC | KK_T_KOZA_SEKKA (inferred) | Bank transfer review request - submits review request to bank |
| C | `execEKK0501C080` | EKK0501C080SC | - | Bank transfer review result OK registration - records approval result |
| C | `execEKK0501C090` | EKK0501C090SC | - | Bank transfer review result NG registration - records rejection result |
| C | `execEKKA0010004` | EKKA0010004SC | Paygent gateway | Settlement authorization request via Paygent |
| C | `execEKKA0010003` | EKKA0010003SC | Paygent gateway | Reservation authorization request via Paygent |
| C | `execEKK0531A010` | EKK0531A010SC | KK_T_CRED_CARD (inferred) | Credit card company agreement search - searches credit card company agreements |
| C | `execEKK0521A010` | EKK0521A010SC | KK_T_CRED_CARD_AGREEMENT (inferred) | Credit card agreement - registers credit card company agreement |
| C | `execEKK0521D010` | EKK0521D010SC | KK_T_CRED_INV (inferred) | Credit invoice procedure - registers credit invoice details |
| C | `execEKK0521C030` | EKK0521C030SC | - | Credit review request - submits credit review to card company |
| C | `execEKK0521C110` | EKK0521C110SC | - | Credit review result OK registration - records credit approval result |
| C | `execEKK0521C120` | EKK0521C120SC | - | Credit review result NG registration - records credit rejection result |
| U | `execEKK0491C240` | EKK0491C240SC | KK_T_SEIKY_PAY (inferred) | Invoice payment change - updates payment method on invoice |
| C | `execEKK1031D010` | EKK1031D010SC | KK_T_CRED_AUTHORI (inferred) | Credit initial authorization registration - registers initial authorization |
| R | `execEKK0251A010` | EKK0251A010SC | KK_T_SVC_CONTRACT_LINE (inferred) | Service contract line agreement search - searches contract line agreements |
| U | `execEKK0251C030` | EKK0251C030SC | KK_T_SVC_CONTRACT_LINE (inferred) | Service contract line content change - modifies line details |
| C | `execEKK0441C210` | EKK0441C210SC | KK_T_SEIKY_OPT (inferred) | Invoice option cancel - cancels invoice option service |
| C | `execEKK0441C230` | EKK0441C230SC | KK_T_SEIKY_OPT (inferred) | Invoice option dissolve - dissolves invoice option service |
| C | `execEKK0441C240` | EKK0441C240SC | KK_T_SEIKY_OPT (inferred) | Invoice option dissolve confirmation - confirms dissolve processing |
| C | `execEKK0441D010` | EKK0441D010SC | KK_T_SEIKY_OPT (inferred) | Invoice option service contract registration - registers new option service |
| R | `execEKK0441C030` | EKK0441C030SC | - | Invoice option service contract review - reviews option service |
| C | `execEKK0441C040` | EKK0441C040SC | KK_T_SEIKY_OPT (inferred) | Invoice option service contract conclusion - concludes option agreement |
| C | `execEKK0441C070` | EKK0441C070SC | KK_T_SEIKY_OPT (inferred) | Invoice option service contract start - starts option service |
| C | `execEKK0441C060` | EKK0441C060SC | KK_T_SEIKY_OPT (inferred) | Invoice option reserved effective date application - applies reserved effective date |
| U | `execEKK0491C250` | EKK0491C250SC | - | Payment notification mail control change - modifies mail notification settings |
| C | `execEKK1091D010` | EKK1091D010SC | KK_T_PROC_STAT (inferred) | Progress registration - registers processing status |
| C | `execEKK1091D010_jdg` | EKK1091D010SC | KK_T_PROC_STAT (inferred) | Review result screen progress registration - registers progress for review screen |
| R | `execEKK0021B011` | EKK0021B011SC | KK_T_MSKM_SHO (inferred) | Application number existence check - searches for existing application numbers |
| R | `execEKK0021C060` | EKK0021C060SC | - | Application detail review follow-up - reviews application details |
| U | `editErrInfo` | - | - | Sets error flag and populates error info in param |
| U | `editInMsg` | - | - | Sets common area data in SC input message |
| U | `editOutMsg_EKK0011D020` | - | - | Sets output mapping for EKK0011D020 result |
| U | `updMkmScinsprtWkCall` | - | - | Updates application screen entry support work information |
| U | `execUpdateJudge` | - | - | Executes judgment transaction update |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0405 | `KKSV0405OPOperation.run` -> `CCRequestBroker.invoke` -> `JKKSeikyKeiHenkoCC.seikyKeiHenko` | EKK0011D020SC [C] KK_T_ODR_HAKKO_JOKEN, EKK0491C060SC [U] KK_T_SEIKY_KEI, EKK0501D010SC [C] KK_T_KOZA, EKK0521D010SC [C] KK_T_CRED_INV, EKK0441D010SC [C] KK_T_SEIKY_OPT, EKK1091D010SC [C] KK_T_PROC_STAT, EKK0491C240SC [U] KK_T_SEIKY_PAY, EKKA0010004SC [C] Paygent, EKKA0010003SC [C] Paygent |
| 2 | Reference only | `JKKSeikyKeiBunkatsuCC` references `JKKSeikyKeiHenkoCC.SNN_RSLT_CD_OK`, `SNN_RSLT_CD_NG`, `SNN_RSLT_CD_ERR` constants and `getFauthoriSnnRsltCd()` static method | N/A (constant access only) |

## 6. Per-Branch Detail Blocks

**Block 1** — [ASSIGN] `(initialization)` (L300)

> Extract work data map, create SC invoker, and read all processing flags from ccMsg.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = param.getData(fixedText)` [-> work data map keyed by fixedText] |
| 2 | EXEC | `scCall = new ServiceComponentRequestInvoker()` [-> SC call instance] |
| 3 | SET | `funcCd = ccMsg.get("func_code")` [-> function code: "1"=confirmation, else=execution] |
| 4 | SET | `svcKeiStatCdNet = Integer.parseInt(ccMsg.get("svc_kei_stat_cd_max"))` [-> max service status code] |
| 5 | SET | `paywayCd = ccMsg.get("kksv0405work_payway_cd")` [-> "2","3"=bank, "4"=credit] |
| 6 | SET | `paywayPaySkekkaCd = ccMsg.get("kksv0405work_payway_pay_skekka_cd")` [-> "0"=OK, "1"=NG] |
| 7 | SET | `seiOpSvcKeiInsFlg = ccMsg.get("kksv0405work_seiopsvc_kei_ins_flg")` [-> "1"=register option] |
| 8 | SET | `seiOpSvcKeiDslFlg = ccMsg.get("kksv0405work_seiopsvc_kei_dsl_flg")` [-> "1"=dissolve option] |
| 9 | SET | `seiOpSvcKeiStat = ccMsg.get("kksv0405work_seiopsvc_kei_stat")` [-> "010"=Accepted, "020"=Under review] |
| 10 | SET | `futureFlg = ccMsg.get("kksv0405work_future_flg")` [-> "1"=future date execution] |
| 11 | SET | `ekk0251RunFlg = ccMsg.get("ekk0251_run_flg")` [-> "1"=run line content change] |
| 12 | SET | `ido_div = ccMsg.get("kksv0405work_ido_div")` [-> modification division code] |
| 13 | SET | `recordAddFlg = ccMsg.get("record_add_flg")` [-> true=need to add account/card code] |
| 14 | SET | `optKaiyaku = false`, `optTouroku = false` [-> discount CC call flags, deprecated in v24.00.00] |
| 15 | SET | `isFauthori = false` [-> initial authorization execution flag, ANK-2565] |
| 16 | SET | `svc_list = ccMsg.get("KKSV040501CCList")` [-> service detail list] |

**Block 2** — [IF] `(svc_list != null && svc_list.size() > 0)` (L346)

> Main processing entry: if the service list is empty, skip to confirmation (funcCd==1) and return.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childMap = svc_list.get(0)` [-> first service item] |
| 2 | SET | `listSvcstateCd = childMap.get("kksv040501_svc_kei_stat_cd")` [-> service contract status code] |
| 3 | SET | `svc_cd = ccMsg.get("kksv0405work_svc_cd")` [-> service code: "51"=FTTH, CD00130_05=electricity] |
| 4 | SET | `ukState = false` [-> non-accepted state flag] |

**Block 2.1** — [IF] `(listSvcstateCd == "010")` `[OK]` (L356)

> Service status is "Accepted" (010) - special handling for FTTH and electricity.

| # | Type | Code |
|---|------|------|
| 1 | IF | `svc_cd.equals("51") || svc_cd.equals(JKKStrConst.CD00130_05)` [-> FTTH (51) or eo Electric] |
| 2 | SET | `ukState = true` [-> accept registration needed] |

**Block 2.2** — [ELSE] `(svc status != "010")` (L364)

> Service is not in accepted status; treat as non-accepted for registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ukState = true` [-> always non-accepted branch] |

**Block 3** — [IF] `(ukState == true)` (L370)

> Execute accept content registration when service is not accepted, or when accepted but is FTTH/electricity.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0011D020(handle, param, scCall, ccMsg, childMap)` [-> Apply content registration] |

**Block 4** — [EXEC] `(always executed)` (L384)

> Invoice contract content modification - always runs regardless of state.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0491C060(handle, param, scCall, ccMsg, childMap)` [-> Invoice contract content change] |

**Block 5** — [IF] `(paywayCd == "2" || paywayCd == "3")` `[bank transfer]` (L390)

> Bank transfer processing branch.

| # | Type | Code |
|---|------|------|
| 1 | IF | `recordAddFlg == true` |
| 2 | CALL | `execKozaNewCd(handle, param, ccMsg, childMap)` [-> New bank account code creation] |
| 3 | CALL | `execEKK0501D010(handle, param, scCall, ccMsg, childMap)` [-> Bank transfer procedure] |
| 4 | CALL | `execEKK0501C030(handle, param, scCall, ccMsg, childMap)` [-> Bank transfer review request] |

**Block 5.1** — [IF] `(paywayPaySkekkaCd == "0")` `[OK]` (L403)

> Bank transfer review result is OK (approval).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0501C080(handle, param, scCall, ccMsg, childMap)` [-> Register review result OK] |

**Block 5.2** — [ELSE IF] `(paywayPaySkekkaCd == "1")` `[NG]` (L407)

> Bank transfer review result is NG (rejection).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0501C090(handle, param, scCall, ccMsg, childMap)` [-> Register review result NG] |

**Block 6** — [ELSE IF] `(paywayCd == "4")` `[credit card]` (L413)

> Credit card payment processing branch.

| # | Type | Code |
|---|------|------|
| 1 | IF | `recordAddFlg == true` |
| 2 | IF | `JKKCommonUtil.isNull(paywayPaySkekkaCd)` [-> review result code unset] |
| 3 | IF | `JPCModelConstant.FUNC_CD_1.equals(ccMsg.get(FUNC_CODE_KEY))` [-> update mode] |

**Block 6.1** — [IF] `(update mode && no review set)` `(L424)`

> In update mode with no review result, perform Paygent authorization.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv040531sc = childMap.get("KKSV040531SC")` [-> authorization map] |
| 2 | SET | `token = kksv040531sc.get("token")` [-> Paygent token] |
| 3 | IF | `JKKCommonUtil.isNull(token)` [-> no token = settlement] |
| 4 | CALL | `execEKKA0010004(handle, param, scCall, ccMsg, childMap)` [-> Settlement authorization] |
| 5 | ELSE | (token exists = reservation) |
| 6 | CALL | `execEKKA0010003(handle, param, scCall, ccMsg, childMap)` [-> Reservation authorization] |
| 7 | SET | `trnRsltCd = kksv040531sc.get(PY_RESULTCODE)` [-> processing result code] |
| 8 | SET | `snnRsltCd = getFauthoriSnnRsltCd(trnRsltCd)` [-> authorization judgment code] |
| 9 | SET | `rspnsCd = kksv040531sc.get(PY_RESPONSE_CODE)` [-> response code] |
| 10 | SET | `ccMsg.put("response_code", rspnsCd)` |
| 11 | SET | `rspnsDtl = kksv040531sc.get(PY_RESPONSE_DETAIL)` [-> response detail] |
| 12 | SET | `ccMsg.put("response_detail", rspnsDtl)` |
| 13 | SET | `ccMsg.put("KKSV040531SC", kksv040531sc)` |
| 14 | IF | `SNN_RSLT_CD_ERR.equals(snnRsltCd)` `[== "9" system error]` |
| 15 | SET | `ccMsg.put("err_flg", "E_AUTHORI_ERR")` |
| 16 | EXEC | `editErrInfo(param)` |
| 17 | THROW | `new CCException("Service component error", new Exception())` |
| 18 | ELSE IF | `SNN_RSLT_CD_NG.equals(snnRsltCd)` `[== "1" authorization NG]` |
| 19 | SET | `ccMsg.put("err_flg", "E_AUTHORI_NG")` |
| 20 | EXEC | `editErrInfo(param)` |
| 21 | THROW | `new CCException("Service component error", new Exception())` |
| 22 | SET | `ccMsg.put("prg_stat", JKKFamiilyPackConst.CD00647_0800)` [-> program status] |
| 23 | SET | `isFauthori = true` [-> flag initial authorization was executed] |
| 24 | CALL | `execEKK0531A010(handle, param, scCall, ccMsg, childMap)` [-> Credit card company agreement search] |

**Block 6.2** — [ELSE] `(paywayPaySkekkaCd IS set)` `(L496)`

> Review result code is already set; skip Paygent authorization and proceed to credit processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv040531sc = childMap.get("KKSV040531SC")` |
| 2 | SET | `crecardSbtCd = kksv040531sc.get(PY_DEBIT_PREPAID_TYPE)` [-> debit/prepaid type] |
| 3 | SET | `crdtIssuerDiv = kksv040531sc.get(PY_ISSUR_CLASS)` [-> issuer division] |
| 4 | IF | `JKKCommonUtil.isNull(crecardSbtCd) || JKKCommonUtil.isNull(crdtIssuerDiv)` [-> missing data] |
| 5 | CALL | `execEKK0521A010(handle, param, scCall, ccMsg, childMap)` [-> Credit card agreement] |
| 6 | CALL | `execEKK0521D010(handle, param, scCall, ccMsg, childMap)` [-> Credit invoice procedure] |
| 7 | CALL | `execEKK0521C030(handle, param, scCall, ccMsg, childMap)` [-> Credit review request] |

**Block 6.3** — [IF/ELSE IF] `(credit review result check)` `(L516)`

> Check credit review result code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonUtil.isNull(paywayPaySkekkaCd) || paywayPaySkekkaCd == "0"` [-> OK or unset] |
| 2 | CALL | `execEKK0521C110(handle, param, scCall, ccMsg, childMap)` [-> Credit review OK registration] |
| 3 | ELSE IF | `paywayPaySkekkaCd == "1"` [-> NG] |
| 4 | CALL | `execEKK0521C120(handle, param, scCall, ccMsg, childMap)` [-> Credit review NG registration] |

**Block 7** — [IF] `(recordAddFlg == true)` (L530)

> Invoice payment method change when record addition flag is set.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0491C240(handle, param, scCall, ccMsg, childMap)` [-> Invoice payment change] |
| 2 | IF | `paywayCd == "4" && (paywayPaySkekkaCd is empty or null)` |
| 3 | IF | `JPCModelConstant.FUNC_CD_1.equals(ccMsg.get(FUNC_CODE_KEY))` [-> update mode] |
| 4 | CALL | `execEKK1031D010(handle, param, scCall, ccMsg, childMap)` [-> Credit initial authorization registration] |

**Block 8** — [IF] `(ido_div == "00015" && ekk0251RunFlg == "1")` `(L552)`

> Service contract line content change processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0251A010(handle, param, scCall, ccMsg, childMap)` [-> Contract line agreement search] |
| 2 | CALL | `execEKK0251C030(handle, param, scCall, ccMsg, childMap)` [-> Contract line content change] |

**Block 9** — [IF] `(seiOpSvcKeiDslFlg == "1")` `(L566)`

> Invoice option cancel/dissolve processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `seiOpSvcKeiStat == "010" || seiOpSvcKeiStat == "020"` [-> Accepted or Under review] |
| 2 | CALL | `execEKK0441C210(handle, param, scCall, ccMsg, childMap)` [-> Cancel invoice option] |
| 3 | SET | `optKaiyakuCd = "05"` |
| 4 | ELSE | (not Accepted or Under review) |
| 5 | CALL | `execEKK0441C230(handle, param, scCall, ccMsg, childMap)` [-> Dissolve invoice option] |
| 6 | IF | `funcCd == "1"` [-> determination mode] |
| 7 | CALL | `execEKK0441C240(handle, param, scCall, ccMsg, childMap)` [-> Dissolve confirmation] |
| 8 | SET | `optKaiyakuCd = "03"` |
| 9 | IF | `futureFlg != "1"` [-> not future date execution] |
| 10 | SET | `optKaiyaku = true` [-> discount CC needed, deprecated v24.00.00] |
| 11 | SET | `optKaiyakuSvckeiStat = childMap.get("wrisvcautoaplycc_seiopsvc_kei_stat")` |
| 12 | SET | `execWrisvcAutoAply` [-> commented out / deprecated in v24.00.00] |

**Block 10** — [IF] `(seiOpSvcKeiInsFlg == "1")` `(L602)`

> Invoice option service registration processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0441D010(handle, param, scCall, ccMsg, childMap)` [-> Register invoice option service] |
| 2 | IF | `svcKeiStatCdNet >= 20` [-> review threshold] |
| 3 | CALL | `execEKK0441C030(handle, param, scCall, ccMsg, childMap)` [-> Invoice option review] |
| 4 | IF | `svcKeiStatCdNet >= 30` [-> conclusion threshold] |
| 5 | CALL | `execEKK0441C040(handle, param, scCall, ccMsg, childMap)` [-> Invoice option conclusion] |
| 6 | IF | `svcKeiStatCdNet >= 100 && svcKeiStatCdNet <= 220` [-> start threshold] |
| 7 | SET | `seikyYm = childMap.get("kksv040505_first_seiky_ym")` [-> first invoice month] |
| 8 | SET | `svcChrgYmd = childMap.get("kksv040519_svc_chrg_staymd")` [-> service charge start date] |
| 9 | IF | `seikyYm is set && svcChrgYmd is NOT set` [-> missing charge start date] |
| 10 | SET | `ccMsg.put("err_flg", "E_CHRG")` |
| 11 | RETURN | `return param` [-> early return with error] |
| 12 | CALL | `execEKK0441C070(handle, param, scCall, ccMsg, childMap)` [-> Invoice option start] |
| 13 | IF | `futureFlg == "1"` [-> future date execution] |
| 14 | CALL | `execEKK0441C060(handle, param, scCall, ccMsg, childMap)` [-> Reserved effective date] |
| 15 | IF | `futureFlg != "1"` [-> not future date] |
| 16 | SET | `optTourokuCd = "01"`, `optTouroku = true` [-> discount CC needed, deprecated] |
| 17 | SET | `opTourokuSvckeiStat = childMap.get("wrisvcautoaplycc_seiopsvc_kei_stat")` |

**Block 11** — [IF] `(kksv040529_paywaytcml_ctl_cd != null)` `(L654)`

> Payment notification mail control code change.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0491C250(handle, param, scCall, ccMsg, childMap)` [-> Mail control change] |

**Block 12** — [IF] `(ukState == true)` `(L665)`

> Progress registration and follow-up processing when service is non-accepted.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK1091D010(handle, param, scCall, ccMsg, childMap)` [-> Progress registration] |
| 2 | SET | `jdg_flg = ccMsg.get("jdg_flg")` [-> judgment flag] |
| 3 | IF | `jdg_flg == "1" || isFauthori` [-> review screen or initial auth done] |
| 4 | CALL | `execEKK1091D010_jdg(handle, param, scCall, ccMsg, childMap)` [-> Review result screen progress] |
| 5 | SET | `mskmshoNo = childMap.get("kksv040524_mskmsho_no")` [-> application number] |
| 6 | IF | `mskmshoNo != null && mskmshoNo.length() > 0` |
| 7 | CALL | `execEKK0021B011(handle, param, scCall, ccMsg, childMap)` [-> Application number existence check] |
| 8 | IF | `ccMsg.containsKey("EKK0021B011CBSMSG1LIST")` [-> search result list present] |
| 9 | SET | `templateList = ccMsg.get("EKK0021B011CBSMSG1LIST")` |
| 10 | IF | `templateList != null && templateList.length > 1` [-> multiple matches = error] |
| 11 | SET | `ccMsg.put("err_flg", "E_MSKMSHONO")` |
| 12 | RETURN | `return param` [-> early return with error] |
| 13 | CALL | `execEKK0021C060(handle, param, scCall, ccMsg, childMap)` [-> Application detail review] |

**Block 13** — [ASSIGN] `(new childMap)` `(L693)`

> Prepare for confirmation processing phase.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childMap = new HashMap<String, Object>()` |

**Block 14** — [IF] `(funcCd == "1")` `[confirmation/determination mode]` `(L696)`

> Confirmation processing: update judgment transaction data for new contracts or service additions.

| # | Type | Code |
|---|------|------|
| 1 | IF | `ido_div == "00001" || ido_div == "00002"` [-> new contract or service addition] |
| 2 | EXEC | `param.setData(JUDGE_UPDATE_MAP, new HashMap<String, Object>())` [-> create judgment update map] |
| 3 | SET | `outMap = param.getData(JUDGE_UPDATE_MAP)` |
| 4 | SET | `svcKeiList = new ArrayList<String>()` |
| 5 | FOR | `for (i = 0; i < svc_list.size(); i++)` |
| 6 | SET | `childMap = svc_list.get(i)` |
| 7 | CALL | `scvkei = updMkmScinsprtWkCall(handle, param, ccMsg, childMap)` [-> update work support info] |
| 8 | SET | `svcKeiList.add(scvkei)` |
| 9 | FOR | `for (j = 0; j < svcKeiList.size(); j++)` |
| 10 | SET | `outMap.put("key_svc_kei_no" + (j+1), svcKeiList.get(j))` |
| 11 | IF | `svcKeiList.size() == 1` |
| 12 | SET | `outMap.put("key_svc_kei_no2", "")`, `key_svc_kei_no3 = ""`, `key_svc_kei_no4 = ""` |
| 13 | ELSE IF | `svcKeiList.size() == 2` |
| 14 | SET | `outMap.put("key_svc_kei_no3", "")`, `key_svc_kei_no4 = ""` |
| 15 | ELSE IF | `svcKeiList.size() == 3` |
| 16 | SET | `outMap.put("key_svc_kei_no4", "")` |
| 17 | SET | `jkkupdatejudgetrancc = new JKKUpdateJudgeTranCC()` |
| 18 | CALL | `jkkupdatejudgetrancc.execUpdateJudge(handle, param, JUDGE_UPDATE_MAP)` |

**Block 15** — [RETURN] `(L752)`

> Return the modified parameter object.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` [-> returns modified request parameter with all SC results] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `seikyKeiHenko` | Field / Method | Invoice Contract Modification - the core business operation for changing invoice contracts in the K-Opticom system |
| `func_code` | Field | Function code - distinguishes screen mode: "1" = confirmation (determination), other values = execution (edit) |
| `svc_kei_stat_cd_max` | Field | Service contract status code (maximum) - numeric threshold determining which lifecycle stages to process |
| `kksv0405work_payway_cd` | Field | Payment method code - "2" or "3" = bank transfer, "4" = credit card |
| `kksv0405work_payway_pay_skekka_cd` | Field | Payment review result code - "0" = OK (approved), "1" = NG (rejected), unset = awaiting review |
| `kksv0405work_seiopsvc_kei_ins_flg` | Field | Invoice option service registration flag - "1" triggers option service registration processing |
| `kksv0405work_seiopsvc_kei_dsl_flg` | Field | Invoice option service dissolve flag - "1" triggers cancel or dissolve processing |
| `kksv0405work_seiopsvc_kei_stat` | Field | Invoice option service status - "010" = Accepted, "020" = Under review |
| `kksv0405work_future_flg` | Field | Future date execution flag - "1" = scheduled for future, "0" = immediate |
| `kksv0405work_ido_div` | Field | Modification division code - "00015" = line group content change, "00001"/"00002" = new contract/service addition |
| `kksv0405work_svc_cd` | Field | Service code - "51" = FTTH, CD00130_05 = eo Electric (electricity) |
| `kksv0405work_svc_kei_ucwk_no` | Field | Service detail work number - internal tracking ID for service contract line items |
| `kksv040501_svc_kei_stat_cd` | Field | Service contract status code from service list item - "010" = Accepted |
| `kksv040501CCList` | Field | Service detail list - ArrayList of HashMaps containing per-line service contract data |
| `record_add_flg` | Field | Account/credit card scheme code addition flag - true when new codes need to be added |
| `jdg_flg` | Field | Judgment flag - "1" triggers review result reflection screen processing |
| `kksv040529_paywaytcml_ctl_cd` | Field | Payment notification mail control code - if present, triggers mail control change |
| `kksv040524_mskmsho_no` | Field | Application number - used for application number existence check |
| `KKSV040501CCList` | Field | Key name for the service list in ccMsg work data map |
| `SNN_RSLT_CD_OK` | Constant | Authorization result code "0" = OK (initial authorization approved) |
| `SNN_RSLT_CD_NG` | Constant | Authorization result code "1" = NG (initial authorization rejected) |
| `SNN_RSLT_CD_ERR` | Constant | Authorization result code "9" = System error (initial authorization error) |
| `JUDGE_UPDATE_MAP` | Constant | Map key "judge_update_map" for judgment update CC correlation data |
| `KKSV040531SC` | Constant | Map key for initial authorization request map |
| `JKKStrConst.CD00130_05` | Constant | eo Electric service code constant |
| `JPCModelConstant.FUNC_CD_1` | Constant | Function code constant for update mode |
| FTTH | Business term | Fiber To The Home - fiber-optic broadband internet service offered by K-Opticom |
| eo Electric | Business term | Electricity service offered by K-Opticom (subsidiary of KDDI) |
| SC (Service Component) | Technical | Service Component - a microservice layer in the eo customer system architecture; each SC handles a specific business operation |
| CBS (Contract Business Service) | Technical | Contract Business Service - a service layer component handling contract-related business operations |
| CC (Common Component) | Technical | Common Component - a shared Java class providing reusable business logic, typically extending AbstractCommonComponent |
| BPM | Technical | Business Process Management - the workflow engine that orchestrates screen operations and CC calls |
| Paygent | Business term | Payment gateway service used for credit card authorization (replaced CLEAP in v58.00.00) |
| CLEAP | Business term | Legacy payment gateway (replaced by Paygent in v58.00.00) |
| `execUpdateJudge` | Method | Executes judgment transaction update - updates judge-related transaction data during confirmation |
| `updMkmScinsprtWkCall` | Method | Updates application screen entry support work information - called during confirmation for each service item |
| `editInMsg` | Method | Sets common area data in SC input message |
| `editOutMsg_EKK0011D020` | Method | Sets output mapping for EKK0011D020 (apply content registration) result data |
| `getFauthoriSnnRsltCd` | Method | Static method that converts authorization processing result codes to authorization judgment result codes |
| `execWrisvcAutoAply` | Method | Discount CC (coupons) processing - deprecated and removed in v24.00.00 |
| `mskm_sbt_cd` | Field | Application type code |
| `mskmsho_ariv_ymd` | Field | Application document arrival date (year/month/day) |
| `mskm_uk_dtm` | Field | Application acceptance date/time (year/month/day hour:minute:second) |
| `mskm_uk_tnt_user_id` | Field | Application acceptance responsible user ID |
| `mskm_ymd` | Field | Application date (year/month/day) |
| `ttl_business_center_uk_no` | Field | Total business center acceptance number |
| `ttl_business_mskm_opt_cd` | Field | Total business application option code |
| `mskm_rrks_telno` | Field | Application contact phone number |
| `mskm_jssis_sbt_cd` | Field | Application implementer type code |
| `cust_yobo_jiko` | Field | Customer preference item (self) |
| `tel_rrk_kibo_time_cd` | Field | Telephone contact preferred time slot code |
| `takcho_kibo_time_cd` | Field | Home survey preferred time slot code |
| `kari_mskm_flg` | Field | Temporary application flag |
| `referer` | Field | Referrer information |
| `kepco_custinfo_juju_doi_um` | Field | KEPCO (Kansai Electric Power) customer information consent yes/no |
| `consmbsn_mskm_stat_skbt_cd` | Field | Consumer business application status identification code |