# Business Logic — JKKIntrInfoChgCfmCC.chgCouponInfo() [70 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKIntrInfoChgCfmCC` |
| Layer | CC/Common Component |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKIntrInfoChgCfmCC.chgCouponInfo()

This method performs coupon code update processing for a service contract. It receives a coupon code from the caller, validates and retrieves the coupon information from an external introduction scheme system, updates the associated introduction scheme record, and then registers or updates the progression number (task flow tracking number) in the internal system. The method serves as the central coordination point for the "introduction code" feature added in revision ANK-4416-00-00, which enables simultaneous entry of introduction codes and partner enterprise entry codes. It implements a delegation pattern: internal SC calls delegate actual data access to service components, while this method manages the overall business flow — validation, conditional branching by coupon presence and input state, scheme update, agreement confirmation I/F invocation, and progression management. If no coupon code is provided, the method short-circuits and returns early, avoiding unnecessary processing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chgCouponInfo start"])
    WORK_MAP_INIT["Initialize workMap, couponInfoCC"]
    GET_INMAP["Get inMap from param.getData(fixedText)"]
    CALL_EKK0311B002SC["callEKK0311B002SC
(Coupon code retrieval)"]
    CHECK_BLANK["isCouponCdBlank(workMap, inMap)?"]
    NO_COUPON["No coupon code
return param"]
    CHECK_INPUT_CD["inMap.coupon_cd not blank?"]
    CALL_EKK0311A010_TRUE["callEKK0311A010SC_upd(true)"]
    CHECK_INTRO_SCHEME["couponInfoCC.coupon_cd not blank?"]
    CALL_EKK0311C010_TRUE["callEKK0311C010SC
(Update intro scheme)"]
    CALL_EKK0311A010_FALSE["callEKK0311A010SC_upd(false)"]
    CALL_EKK0311C010_FALSE["callEKK0311C010SC
(Update intro scheme w/ subscriber clearing)"]
    CALL_EKK0081A010["callEKK0081A010SC
(Service agreement confirmation I/F)"]
    CHECK_PRG_NO["inMap.prg_no not blank?"]
    CALL_EKK1091C010["callEKK1091C010SC
(Update progression)"]
    CALL_EKK1091D010["callEKK1091D010SC
(Register progression
with updCouponCd=\"2\")"]
    SET_RESULT["param.setData(fixedText, workMap)"]
    LOG_END["printlnEjbLog end"]
    RETURN_PARAM["return param"]
    END(["chgCouponInfo end"])

    START --> WORK_MAP_INIT --> GET_INMAP --> CALL_EKK0311B002SC --> CHECK_BLANK
    CHECK_BLANK -- true --> NO_COUPON --> RETURN_PARAM
    CHECK_BLANK -- false --> CHECK_INPUT_CD
    CHECK_INPUT_CD -- true --> CALL_EKK0311A010_TRUE --> CHECK_INTRO_SCHEME
    CHECK_INTRO_SCHEME -- true --> CALL_EKK0311C010_TRUE --> CALL_EKK0081A010
    CHECK_INTRO_SCHEME -- false --> CALL_EKK0081A010
    CHECK_INPUT_CD -- false --> CALL_EKK0311A010_FALSE --> CALL_EKK0311C010_FALSE --> CALL_EKK0081A010
    CALL_EKK0081A010 --> CHECK_PRG_NO
    CHECK_PRG_NO -- true --> CALL_EKK1091C010 --> SET_RESULT
    CHECK_PRG_NO -- false --> CALL_EKK1091D010 --> SET_RESULT
    SET_RESULT --> LOG_END --> RETURN_PARAM --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Application session handle carrying context (transaction, authentication, locale) for the current service operation. Used as an argument to all SC calls. |
| 2 | `param` | `IRequestParameterReadWrite` | Request/response parameter object. Contains input data accessed via `getData(fixedText)` returning `inMap`, and receives output data via `setData(fixedText, workMap)` before return. |
| 3 | `fixedText` | `String` | Key identifier for the data block within `param`. Used to extract the input `HashMap` (`couponInfoChgCC` per caller configuration) and store the resulting `workMap`. |

**Internal/external state read:**
- `UPD_COUPON_CD` — constant `"2"` used to flag progression registration as a coupon update operation [-> UPD_COUPON_CD="2" (JKKIntrInfoChgCfmCC.java:179)].

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0311B002SC` | EKK0311B002SC | — | Retrieves coupon code data associated with the service interface. Acts as the initial coupon information lookup. |
| R | `callEKK0311A010SC_upd` | EKK0311A010SC | — | Gets introduction scheme information for the coupon code. Called with a boolean flag to indicate whether the coupon code was provided by the user (`true`) or needs to be derived (`false`). |
| U | `callEKK0311C010SC` | EKK0311C010SC | — | Updates the introduction scheme record with the validated coupon code. If the user-supplied coupon was not found in the introduction scheme, this step is skipped. |
| R | `callEKK0081A010SC` | EKK0081A010SC | — | Invokes the service contract agreement confirmation I/F to search for progression registration data. Prepares data for subsequent progression handling. |
| U | `callEKK1091C010SC` | EKK1091C010SC | — | Updates the progression number (task flow tracking number) when one already exists — i.e., when a progression was registered during a prior introduction code update. |
| C | `callEKK1091D010SC` | EKK1091D010SC | — | Registers a new progression number with the update coupon code flag (`UPD_COUPON_CD = "2"`). Used when no progression number exists yet. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0782 | `KKSV0782OPOperation` → `CCRequestBroker target7` → `chgCouponInfo` | `callEKK0311B002SC [R], callEKK0311A010SC_upd [R], callEKK0311C010SC [U], callEKK0081A010SC [R], callEKK1091C010SC [U], callEKK1091D010SC [C]` |
| 2 | Screen:KKSV0783 | `KKSV0783OPOperation` → `CCRequestBroker target4` → `chgCouponInfo` | `callEKK0311B002SC [R], callEKK0311A010SC_upd [R], callEKK0311C010SC [U], callEKK0081A010SC [R], callEKK1091C010SC [U], callEKK1091D010SC [C]` |

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L3362)

> Initialize working maps and extract input data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `printlnEjbLog("chgCouponInfo start")` // Log start of processing |
| 2 | SET | `workMap = new HashMap<String, Object>()` // Working map for this operation |
| 3 | SET | `couponInfoCC = new HashMap<String, Object>()` // Map to hold coupon info from SC |
| 4 | SET | `inMap = (HashMap) param.getData(fixedText)` // Extract input data from param [-> fixedText="couponInfoChgCC" per caller] |

**Block 2** — [CALL] (L3375)

> Retrieve coupon code data via SC.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0311B002SC(param, handle, workMap, inMap)` // Retrieve coupon code information from introduction scheme |

**Block 3** — [IF] `(isCouponCdBlank(workMap, inMap))` — COUPON CODE EXISTENCE CHECK (L3378)

> Determine whether both the input coupon code and the retrieved coupon code are blank/null. If both are blank, no further processing is needed.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `printlnEjbLog("chgCouponInfo coupon code non-existence")` // No coupon code exists |
| 2 | RETURN | `return param` // Early return — no further processing needed |

**Block 4** — [IF] `(!JKKStringUtil.isNullBlank((String) inMap.get("coupon_cd")))` — USER SUPPLIED COUPON CODE (L3386)

> Branch when the user has explicitly entered a coupon code. The system validates the coupon against the introduction scheme and, if valid, updates the scheme.

**Block 4.1** — [CALL] — GET INTRODUCTION SCHEME INFO (L3389)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0311A010SC_upd(param, handle, workMap, inMap, couponInfoCC, true)` // Get introduction scheme info (user-supplied coupon flag=true) |

**Block 4.2** — [IF] `(!JKKStringUtil.isNullBlank((String) couponInfoCC.get("coupon_cd")))` — COUPON FOUND IN SCHEME (L3392)

> The coupon code was found in the introduction scheme. Proceed to update the scheme record.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0311C010SC(param, handle, workMap, inMap, couponInfoCC, true)` // Update introduction scheme (flag=true) |

**Block 5** — [ELSE] — USER DID NOT SUPPLY COUPON CODE (L3397)

> Branch when the user has NOT entered a coupon code. The system retrieves coupon info and updates the scheme with subscriber number clearing processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0311A010SC_upd(param, handle, workMap, inMap, couponInfoCC, false)` // Get introduction scheme info (user-supplied coupon flag=false) |
| 2 | CALL | `callEKK0311C010SC(param, handle, workMap, inMap, couponInfoCC, false)` // Update introduction scheme (subscriber number clearing processing) |

**Block 6** — [CALL] — SERVICE AGREEMENT CONFIRMATION I/F (L3405)

> Invoke the service contract agreement confirmation I/F to search for progression registration data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0081A010SC(param, handle, workMap, inMap)` // Service contract agreement confirmation I/F call (progression registration data search) |

**Block 7** — [IF] `(!JKKStringUtil.isNullBlank((String) inMap.get("prg_no")))` — PROGRESSION NUMBER EXISTS (L3408)

> A progression number is present in the input map, meaning a progression was registered during a prior introduction code update. Update the existing progression instead of creating a new one.

**Block 7.1** — [CALL] — UPDATE PROGRESSION (L3411)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK1091C010SC(param, handle, workMap, inMap)` // Update the progression |

**Block 8** — [ELSE] — NO PROGRESSION NUMBER (L3413)

> No progression number exists. Register a new progression with the update coupon code flag set to `"2"`.

**Block 8.1** — [CALL] — REGISTER PROGRESSION (L3416)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK1091D010SC(param, handle, workMap, inMap, UPD_COUPON_CD)` // Register progression with updCouponCd [-> UPD_COUPON_CD="2" (JKKIntrInfoChgCfmCC.java:179)] |

**Block 9** — [FINALIZATION] (L3420)

> Store the working map back into the param object and log completion.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.setData(fixedText, workMap)` // Store result into param |
| 2 | EXEC | `printlnEjbLog("chgCouponInfo end")` // Log end of processing |
| 3 | RETURN | `return param` // Return updated param |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `coupon_cd` | Field | Coupon code — a promotional code entered by the user or derived from the introduction scheme. Used to track referral/partner business origin. |
| `prg_no` | Field | Progression number — an internal task flow tracking ID that records the current stage of a service contract process. |
| `workMap` | Field | Working map — a transient HashMap used to carry intermediate data through the method's processing steps. |
| `inMap` | Field | Input map — the HashMap extracted from `param` containing the raw input data for this operation. |
| `couponInfoCC` | Field | Coupon info map — a HashMap that holds the coupon information returned from the introduction scheme SC lookup. |
| UPD_COUPON_CD | Constant | Update coupon code flag — when set to `"2"`, indicates that the progression registration is a coupon update operation. |
| `fixedText` | Parameter | Data key — the key used to access the specific data block within the `param` object (value `"couponInfoChgCC"` for both callers). |
| EKK0311B002SC | SC Code | Coupon code retrieval service component — looks up coupon code data. |
| EKK0311A010SC | SC Code | Introduction scheme info retrieval service component — gets introduction scheme details for a given coupon code. |
| EKK0311C010SC | SC Code | Introduction scheme update service component — updates the introduction scheme record with validated coupon data. |
| EKK0081A010SC | SC Code | Service contract agreement confirmation I/F — invokes the agreement confirmation interface for progression data search. |
| EKK1091C010SC | SC Code | Progression update service component — updates an existing progression record. |
| EKK1091D010SC | SC Code | Progression registration service component — registers a new progression record. |
| KKSV0782 | Screen | Screen for introduction code and partner enterprise entry code simultaneous entry processing. |
| KKSV0783 | Screen | Screen for introduction code processing. |
| ANK-4416-00-00 | Change Request | Change request for introduction code and partner enterprise entry code simultaneous entry support. |
