# Business Logic — JKKSeikyKeiBunkatsuCC.editInMsg_EKK0521D010() [323 LOC]

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

## 1. Role

### JKKSeikyKeiBunkatsuCC.editInMsg_EKK0521D010()

This method constructs the inbound message template (CAANMsg) for the **Credit Billing Procedure (クレジット請求手続)**, specifically the `EKK0521D010` screen. It acts as the central **message builder** that transforms incoming child data maps and initial order data into a standardized CBS (Component-Based Service) inbound message, preparing it for submission to downstream billing services.

The method implements the **Builder pattern** combined with **Data Mapping**: it first prepares the common area (operator metadata, dates, function code) via delegation to `editInMsg()`, then populates a `CAANMsg` template with credit card billing fields extracted from multiple sources — the `childMap` (containing `kksv040309_`-prefixed fields from the data entry screen), the `kksv040333sc` HashMap (from the `EKKA0010004` Payment Order Request small payment scheme result), and the `crecardMap` (from `EKK0521A010CBSMSG1LIST`, the credit card agreement data). Each field follows a consistent **priority resolution strategy**: attempt to read from a small-payment scheme result first, and if the value is absent, fall back to the childMap source. This dual-source approach supports card brand routing where the actual acquiring card company code and issuer class come from the payment response rather than the entry screen.

The method is a **shared utility** called by `execEKK0521D010()` and serves as the data preparation layer between the entry screen (`KKSV040309`) and the billing CBS `EKK0521D010`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg_EKK0521D010(param, dataMap, childMap)"])
    START --> STEP1["Step1: Edit common area via editInMsg(param)"]
    STEP1 --> STEP2["Step2: Create CAANMsg template for EKK0521D010CBSMsg"]
    STEP2 --> STEP3["Step3: Set TEMPLATEID, FUNC_CODE, OPERATOR_ID, OPE_DATE, OPE_TIME"]
    STEP3 --> STEP4["Step4: Retrieve workMap, kksv040333sc, crecardMap"]
    STEP4 --> STEP5["Step5: Overwrite FUNC_CODE from dataMap"]
    STEP5 --> IF_CC_JIGYO["IF kksv040309_crecard_jigyo_cd is empty"]
    IF_CC_JIGYO -->|Yes| SET_JIGYO_NULL["Set CRECARD_JIGYO_CD = null"]
    IF_CC_JIGYO -->|No| SET_JIGYO["Set CRECARD_JIGYO_CD from childMap"]
    SET_JIGYO_NULL --> IF_CARD_BRAND["IF pyCardBrand is null"]
    SET_JIGYO --> IF_CARD_BRAND
    IF_CARD_BRAND -->|Yes| IF_COMP_CD["IF kksv040309_crecard_comp_cd is empty"]
    IF_CARD_BRAND -->|No| SET_COMP_PYBRAND["Set CRECARD_COMP_CD = pyCardBrand"]
    IF_COMP_CD -->|Yes| SET_COMP_NULL["Set CRECARD_COMP_CD = null"]
    IF_COMP_CD -->|No| SET_COMP_CHILD["Set CRECARD_COMP_CD from childMap"]
    SET_COMP_NULL --> IF_MASKED_CARD["IF pyMaskedCardNumber is null"]
    SET_COMP_CHILD --> IF_MASKED_CARD
    SET_COMP_PYBRAND --> IF_MASKED_CARD
    IF_MASKED_CARD -->|Yes| IF_CARD_NO["IF kksv040309_crecard_no is empty"]
    IF_MASKED_CARD -->|No| SET_NO_PYMASKED["Set CRECARD_NO = pyMaskedCardNumber"]
    IF_CARD_NO -->|Yes| SET_NO_NULL["Set CRECARD_NO = null"]
    IF_CARD_NO -->|No| SET_NO_CHILD["Set CRECARD_NO from childMap"]
    SET_NO_NULL --> IF_VALID_TERM["Read pyCardValidTerm from kksv040333sc"]
    SET_NO_CHILD --> IF_VALID_TERM
    SET_NO_PYMASKED --> IF_VALID_TERM
    IF_VALID_TERM --> IF_PYVT_NULL["IF pyCardValidTerm is null"]
    IF_PYVT_NULL -->|Yes| IF_YK_KIGEN["IF kksv040309_crecard_yk_kigen is empty"]
    IF_PYVT_NULL -->|No| SET_YK_KIGEN["Set CRECARD_YK_KIGEN = 20 + pyCardValidTerm"]
    IF_YK_KIGEN -->|Yes| SET_YK_KIGEN_NULL["Set CRECARD_YK_KIGEN = null"]
    IF_YK_KIGEN -->|No| SET_YK_KIGEN_CHILD["Set CRECARD_YK_KIGEN from childMap"]
    SET_YK_KIGEN_NULL --> STEP6["Step6: Set CREDIT_KOKAN_CD from childMap"]
    SET_YK_KIGEN_CHILD --> STEP6
    SET_YK_KIGEN --> STEP6
    STEP6 --> STEP7["Step7: Set CRECARD_NM_ROMAJI from childMap"]
    STEP7 --> STEP8["Step8: Set CRECARD_NM_KANA from childMap"]
    STEP8 --> STEP9["Step9: Set IDO_DIV from childMap"]
    STEP9 --> STEP10["Step10: Set UPD_DTM_BF from childMap"]
    STEP10 --> STEP11["Step11: Set CRECA_MK_YM from childMap"]
    STEP11 --> IF_ACQ_ID["IF pyAcqId is null"]
    IF_ACQ_ID -->|Yes| SET_ACQ_CHILD["Set pyAcqId from childMap"]
    IF_ACQ_ID -->|No| SET_ACQ_DIRECT["Use pyAcqId as-is"]
    SET_ACQ_CHILD --> SET_SHIKOSAKI["Set SHIKOSAKI_COMP_CD = pyAcqId"]
    SET_ACQ_DIRECT --> SET_SHIKOSAKI
    SET_SHIKOSAKI --> IF_CRECARD_SBT["IF pyDebitPrepaidType is null"]
    IF_CRECARD_SBT -->|Yes| GET_SBT_FROM_MAP["Set pyDebitPrepaidType from crecardMap"]
    IF_CRECARD_SBT -->|No| SET_SBT_DIRECT["Use pyDebitPrepaidType as-is"]
    GET_SBT_FROM_MAP --> SET_SBT["Set CRECARD_SBT_CD = pyDebitPrepaidType"]
    SET_SBT_DIRECT --> SET_SBT
    SET_SBT --> IF_ISSUER["IF pyIssurClass is null"]
    IF_ISSUER -->|Yes| GET_ISSUER_FROM_MAP["Set pyIssurClass from crecardMap"]
    IF_ISSUER -->|No| SET_ISSUER_DIRECT["Use pyIssurClass as-is"]
    GET_ISSUER_FROM_MAP --> SET_ISSUER["Set CRDT_ISSUER_DIV = pyIssurClass"]
    SET_ISSUER_DIRECT --> SET_ISSUER
    SET_ISSUER --> STEP12["Step12: Wrap template into CAANMsg[] array"]
    STEP12 --> STEP13["Step13: Put TEMPLATE_LIST_KEY into paramMap"]
    STEP13 --> RETURN["Return paramMap"]
```

**Key design patterns in this flow:**

1. **Common Area Preparation (Step 1-3):** Delegates to `editInMsg()` to set common fields (template ID, operator ID, operation date/time), then configures the CBS-specific template metadata.

2. **Dual-Source Field Resolution (Card Brand, Card Number, Card Validity, Issuer):** For fields populated by the payment scheme (`EKKA0010004`), the method checks if a value exists in `kksv040333sc` first. If absent, it falls back to `childMap` (the entry screen data). This supports **card brand routing** — the actual card issuer/acquirer is determined by the payment response.

3. **Follower Fields (Card Company, Card No, Card Name, etc.):** Fields that are not derived from payment scheme results are directly taken from `childMap` with null-safety checks (empty string → setNull).

4. **Date Transformation (Card Validity):** The `pyCardValidTerm` from the payment scheme is in `YYMM` format, which is expanded to `20YYMM` (full 4-digit year) before being set into the template.

5. **Template Assembly (Step 12-13):** The completed template is wrapped in a `CAANMsg` array and stored under `TEMPLATE_LIST_KEY` in the paramMap for the CBS invocation layer.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying the control context (operator ID, operation date/time) and the mapping work area. It is the primary vehicle for passing screen-level operational data and for returning the assembled template message via its data map. |
| 2 | `dataMap` | `Map<String, Object>` | A map containing screen-level data including the function code (`FUNC_CODE_KEY`), the credit card agreement data (`EKK0521A010CBSMSG1LIST`), and other cross-screen data. Used as a fallback source for credit card type and issuer classification. |
| 3 | `childMap` | `HashMap<String, Object>` | A map carrying child data from upstream processes. Contains the initial order request result (`MAP_KEY_KKSV040333SC` = `"KKSV040333SC"`), credit card entry data prefixed with `kksv040309_`, and payment scheme response fields. This is the primary source for credit card billing fields. |

**Fields accessed on `param`:**

| Field / Method | Type | Business Description |
|----------------|------|---------------------|
| `param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` | `Object` | ID of the operator performing the billing procedure. |
| `param.getControlMapData(SCControlMapKeys.OPE_DATE)` | `Object` | Operation date (YYYYMMDD format). |
| `param.getControlMapData(SCControlMapKeys.OPE_TIME)` | `Object` | Operation time. |
| `param.getMappingWorkArea()` | `Map<Object, Object>` | Work area mapping from the request. |
| `param.getData(key)` (via `editInMsg`) | `Object` | Retrieved by `editInMsg` to get existing template data. |
| `param.putData(key, value)` (via `editInMsg`) | — | Used by `editInMsg` to store common area data. |
| `param.get(key)` (via `editInMsg`) | `Object` | Accessed by `editInMsg` to populate paramMap. |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKSeikyKeiBunkatsuCC.editInMsg` | - | - | Calls `editInMsg` in `JKKSeikyKeiBunkatsuCC` — prepares common area of paramMap (template ID, operator, date/time) |
| - | `JJKCommonUtil.isNull` | JJKCommonUtil | - | Calls `isNull` for null/empty checks on payment scheme fields (pyCardBrand, pyMaskedCardNumber, pyCardValidTerm, pyAcqId, pyDebitPrepaidType, pyIssurClass) |
| R | `EKK0521A010CBSMsg1List.getString` | EKK0521A010CBS | - | Reads `CRECARD_SBT_CD` and `CRDT_ISSUER_DIV` from the credit card agreement message as fallback sources |
| - | `CAANMsg.set` | CAANMsg | - | Sets template fields: TEMPLATEID, FUNC_CODE, OPERATOR_ID, OPERATE_DATE, OPERATE_DATETIME, CRECARD_JIGYO_CD, CRECARD_COMP_CD, CRECARD_NO, CRECARD_YK_KIGEN, CREDIT_KOKAN_CD, CRECARD_NM_ROMAJI, CRECARD_NM_KANA, IDO_DIV, UPD_DTM_BF, CRECA_MK_YM, CRECARD_NO_AZKRI_ID, SHIKOSAKI_COMP_CD, CRECARD_SBT_CD, CRDT_ISSUER_DIV |
| - | `CAANMsg.setNull` | CAANMsg | - | Sets null on template fields when source data is empty: CRECARD_JIGYO_CD, CRECARD_COMP_CD, CRECARD_NO, CRECARD_YK_KIGEN |
| R | `EKKA0010004CBSMsg.PY_CARD_BRAND` | EKKA0010004CBS | - | Reads `py_card_brand` from kksv040333sc — used as CRECARD_COMP_CD when present |
| R | `EKKA0010004CBSMsg.PY_MASKED_CARD_NUMBER` | EKKA0010004CBS | - | Reads `py_masked_card_number` from kksv040333sc — masked card number for display |
| R | `EKKA0010004CBSMsg.PY_CARD_VALID_TERM` | EKKA0010004CBS | - | Reads `py_card_valid_term` (YYMM format) from kksv040333sc — card expiration date |
| R | `EKKA0010004CBSMsg.PY_ACQ_ID` | EKKA0010004CBS | - | Reads `py_acq_id` (acquiring card company code) from kksv040333sc — used as SHIKOSAKI_COMP_CD |
| R | `EKKA0010004CBSMsg.PY_DEBIT_PREPAID_TYPE` | EKKA0010004CBS | - | Reads `py_debit_prepaid_type` from kksv040333sc — used as CRECARD_SBT_CD |
| R | `EKKA0010004CBSMsg.PY_ISSUR_CLASS` | EKKA0010004CBS | - | Reads `py_issur_class` from kksv040333sc — used as CRDT_ISSUER_DIV |

**How to classify:**
- **C** (Create): Not directly applicable — this method builds a message template rather than inserting data.
- **R** (Read): All field extractions from `childMap`, `kksv040333sc`, `dataMap`, and `crecardMap`.
- **U** (Update): `editInMsg` call updates the paramMap. The `CAANMsg.set` calls populate the template with transformed values.
- **D** (Delete): Not applicable — no deletion operations.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `getString` [R], `set` [U], `setNull` [-], `isNull` [-]  # NOSONAR

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: EKK0521D010 (via execEKK0521D010) | `execEKK0521D010` -> `editInMsg_EKK0521D010` | `CAANMsg.set [U] EKK0521D010CBSMsg fields` |

**Instructions:**

The method is called directly by `JKKSeikyKeiBunkatsuCC.execEKK0521D010()`, which serves as the CBS handler for the credit billing procedure `EKK0521D010`. The full call chain traces back to the screen `KKSV040309` (credit card entry screen), where child data is populated and passed through the execution flow to this method.

The terminal operations from this method resolve to CBS field writes (`CAANMsg.set`) for the `EKK0521D010CBSMsg` message schema, and field reads (`getString`) from the `EKK0521A010CBSMsg1List` as fallback sources. No direct database or entity table operations occur within this method — it purely transforms and maps data between input maps and the output CBS template.

## 6. Per-Branch Detail Blocks

### Common Area Setup (L2492-L2510)

Sets up the common (shared) area of the inbound message.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `paramMap = editInMsg(param);` // 共通領域の設定 (Set common area) | Delegates to `editInMsg` to prepare the paramMap with common template data |
| 2 | SET | `template = new CAANMsg(EKK0521D010CBSMsg.class.getName());` // 共通テンプレート作成 (Create common template) | Creates a new CAANMsg template for the EKK0521D010 CBS |
| 3 | SET | `template.set(EKK0521D010CBSMsg.TEMPLATEID, TEMPLATE_ID_EKK0521D010);` // テンプレートID (Template ID) [-> "EKK0521D010"] | Sets the service IF ID |
| 4 | SET | `template.set(EKK0521D010CBSMsg.FUNC_CODE, "1");` // デフォルト機能コード (Default func code) | Sets initial func code to "1" |
| 5 | SET | `operatorId = param.getControlMapData(SCControlMapKeys.OPERATOR_ID);` // オペレータID取得 (Get operator ID) | Reads operator ID from control map |
| 6 | SET | `template.set(JCMConstants.OPERATOR_ID_KEY, operatorId);` | Sets operator ID into template |
| 7 | SET | `operateDate = param.getControlMapData(SCControlMapKeys.OPE_DATE);` // 運用日付取得 (Get operation date) | Reads operation date |
| 8 | SET | `template.set(JCMConstants.OPERATE_DATE_KEY, operateDate);` | Sets operation date into template |
| 9 | SET | `operateDateTime = param.getControlMapData(SCControlMapKeys.OPE_TIME);` // 運用日時取得 (Get operation time) | Reads operation time |
| 10 | SET | `template.set(JCMConstants.OPERATE_DATETIME_KEY, operateDateTime);` | Sets operation time into template |

### Child Data Retrieval (L2511-L2523)

Retrieves child data maps from the parameter and data maps.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `workMap = param.getMappingWorkArea();` // 作業領域の取得 (Get work area) | Retrieves work area mapping |
| 2 | SET | `kksv040333sc = (HashMap) childMap.get(MAP_KEY_KKSV040333SC);` // 初回オーソリ依頼マップ (Initial order request map) [-> "KKSV040333SC"] | Gets payment order request result from childMap |
| 3 | SET | `crecardMap = (CAANMsg) dataMap.get("EKK0521A010CBSMSG1LIST");` // クレジットカード同意照会マップ (Credit card agreement inquiry map) | Gets credit card agreement data from dataMap |
| 4 | SET | `template.set(EKK0521D010CBSMsg.FUNC_CODE, dataMap.get(JCMConstants.FUNC_CODE_KEY));` // 機能コード上書き (Overwrite func code) | Overwrites FUNC_CODE with value from dataMap |

### Credit Card Business Code (L2527-L2532)

Maps the credit card business code from childMap to the template.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_crecard_jigyo_cd"))` // クレジット請求手続マッピング - クレジットカード事業コード (Credit billing - card business code) | Checks if business code is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.CRECARD_JIGYO_CD);` (if empty) | Sets card business code to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_JIGYO_CD, childMap.get("kksv040309_crecard_jigyo_cd"));` (if not empty) | Sets card business code from childMap |

### Card Brand / Card Company Code (L2536-L2558)

**ANK-3846-00-00 change:** Card brand routing logic. Previously used `EKKA0010001CBSMsg.CR_CARD_BRAND_OPTCD` for card brand; now uses `EKKA0010004CBSMsg.PY_CARD_BRAND` (payment card brand) from the payment scheme result. If a card brand is present in the payment result, it is used as the card company code; otherwise, the card company code falls back to the `kksv040309_crecard_comp_cd` childMap field.

**Block 4.1** — IF `[pyCardBrand is null]` (L2545)

> If card brand is not present in the payment scheme result, fall back to childMap for card company code.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_crecard_comp_cd"))` | Checks if card company code is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.CRECARD_COMP_CD);` (if empty) | Sets card company code to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_COMP_CD, childMap.get("kksv040309_crecard_comp_cd"));` (if not empty) | Sets card company code from childMap |

**Block 4.2** — ELSE `[pyCardBrand exists]` (L2553)

> When card brand is present in the payment scheme result, use it as the card company code.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_COMP_CD, pyCardBrand);` | Sets card company code from payment scheme card brand [-> `EKKA0010004CBSMsg.PY_CARD_BRAND`] |

### Masked Card Number (L2564-L2587)

**ANK-3846-00-00 change:** Previously used `EKKA0010001CBSMsg.CR_INQUIRE_CARD_NO` (inquiry card number); now uses `EKKA0010004CBSMsg.PY_MASKED_CARD_NUMBER` (masked card number from payment scheme). If the masked card number is available, it overrides the entry screen card number.

**Block 5.1** — IF `[pyMaskedCardNumber is null]` (L2573)

> If masked card number from payment scheme is not available, use the card number from childMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_crecard_no"))` | Checks if card number from entry is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.CRECARD_NO);` (if empty) | Sets card number to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_NO, childMap.get("kksv040309_crecard_no"));` (if not empty) | Sets card number from childMap |

**Block 5.2** — ELSE `[pyMaskedCardNumber exists]` (L2581)

> When masked card number is present in the payment scheme result, use it as the card number.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_NO, pyMaskedCardNumber);` | Sets card number from payment scheme masked card number [-> `EKKA0010004CBSMsg.PY_MASKED_CARD_NUMBER`] |

### Card Validity Period (L2591-L2611)

**ANK-3846-00-00 change:** Previously used `EKKA0010001CBSMsg.CR_CARD_VALID_TERM`; now uses `EKKA0010004CBSMsg.PY_CARD_VALID_TERM` (payment card validity term). The payment scheme returns `YYMM` format, which is expanded to `20YYMM` (full 4-digit year) before being set.

**Block 6.1** — IF `[pyCardValidTerm is null]` (L2597)

> If card validity from payment scheme is not available, fall back to childMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_crecard_yk_kigen"))` | Checks if card validity from entry is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.CRECARD_YK_KIGEN);` (if empty) | Sets card validity to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_YK_KIGEN, childMap.get("kksv040309_crecard_yk_kigen"));` (if not empty) | Sets card validity from childMap |

**Block 6.2** — ELSE `[pyCardValidTerm exists]` (L2606)

> When card validity is present in the payment scheme result, transform `YYMM` to `20YYMM` format.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_YK_KIGEN, "20" + pyCardValidTerm);` | Expands YYMM to 20YYMM format for full 4-digit year [-> `EKKA0010004CBSMsg.PY_CARD_VALID_TERM`] |

### Credit Conversion Code (L2613-L2618)

Direct mapping of the credit conversion code from childMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_credit_kokan_cd"))` // クレジット請求手続マッピング - クレジット交換コード (Credit billing - credit conversion code) | Checks if conversion code is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.CREDIT_KOKAN_CD);` (if empty) | Sets conversion code to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.CREDIT_KOKAN_CD, childMap.get("kksv040309_credit_kokan_cd"));` (if not empty) | Sets conversion code from childMap |

### Cardholder Name Romaji (L2620-L2625)

Direct mapping of the cardholder name in Romaji (Latin alphabet) from childMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_crecard_nm_romaji"))` // クレジット請求手続マッピング - クレジットカード名義（ローマ字）(Card name Romaji) | Checks if Romaji name is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.CRECARD_NM_ROMAJI);` (if empty) | Sets Romaji name to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_NM_ROMAJI, childMap.get("kksv040309_crecard_nm_romaji"));` (if not empty) | Sets Romaji name from childMap |

### Cardholder Name Kana (L2627-L2632)

Direct mapping of the cardholder name in Kana (Japanese phonetic) from childMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_crecard_nm_kana"))` // クレジット請求手続マッピング - クレジットカード名義カナ名 (Card name Kana) | Checks if Kana name is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.CRECARD_NM_KANA);` (if empty) | Sets Kana name to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_NM_KANA, childMap.get("kksv040309_crecard_nm_kana"));` (if not empty) | Sets Kana name from childMap |

### Modification Division (L2634-L2641)

Maps the modification division (変更区分) which indicates the type of change operation.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_ido_div"))` // クレジット請求手続マッピング - 異動区分 (Modification division) | Checks if modification division is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.IDO_DIV);` (if empty) | Sets modification division to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.IDO_DIV, childMap.get("kksv040309_ido_div"));` (if not empty) | Sets modification division from childMap |

### Update Date-Time Before (L2643-L2650)

Maps the update date-time before (before update timestamp) from childMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(childMap.get("kksv040309_upd_dtm_bf"))` // 更新年月日时分秒 (Update date-time before) | Checks if pre-update timestamp is empty |
| 2 | SET | `template.setNull(EKK0521D010CBSMsg.UPD_DTM_BF);` (if empty) | Sets pre-update timestamp to null |
| 3 | SET | `template.set(EKK0521D010CBSMsg.UPD_DTM_BF, childMap.get("kksv040309_upd_dtm_bf"));` (if not empty) | Sets pre-update timestamp from childMap |

### Card Invalid Month (ANK-2565-00-00) (L2654)

Adds the credit card invalid month from childMap. Uses prefix-based key construction.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0521D010CBSMsg.CRECA_MK_YM, childMap.get(PREFIX_KKSV040309 + EKK0521D010CBSMsg.CRECA_MK_YM));` // クレジットカード無効年月 (Card invalid month) [PREFIX = "kksv040309_"] | Sets card invalid month from childMap using prefix + field name concatenation |

### Acquiring Card Company Code (L2692-L2743)

**ANK-3846-00-00 change:** Previously used `EKKA0010001CBSMsg.CR_BRANDCODE` (credit brand code) and fell back to `EKK0531B502CBSMsg1List.CREDIT_KOKAN_CD` from the destination company list; now uses `EKKA0010004CBSMsg.PY_ACQ_ID` (acquiring card company code from payment scheme).

**Block 8.1** — IF `[pyAcqId is null]` (L2702)

> If acquiring card company code from payment scheme is not available, fall back to childMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `pyAcqId = childMap.get(PREFIX_KKSV040309 + EKK0521D010CBSMsg.SHIKOSAKI_COMP_CD);` [PREFIX = "kksv040309_"] | Gets acquiring card company code from childMap |

**Block 8.2** — ELSE `[pyAcqId exists]` (L2707)

> Use the acquiring card company code directly from the payment scheme result.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | — (no explicit set; pyAcqId retains value from kksv040333sc) | pyAcqId kept as-is from payment scheme [-> `EKKA0010004CBSMsg.PY_ACQ_ID`] |

**Block 8.3** — (Both paths converge here)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0521D010CBSMsg.SHIKOSAKI_COMP_CD, pyAcqId);` // 仕向け先会社コード (Destination company code) | Sets the destination/acquiring company code |

### Card Type (Credit Card Kind) (ANK-3602-00-00) (L2747-L2771)

**ANK-3846-00-00 change:** Previously used `EKKA0010001CBSMsg.CR_CARD_TYPE`; now uses `EKKA0010004CBSMsg.PY_DEBIT_PREPAID_TYPE` (debit/prepaid card type from payment scheme). If not available in payment scheme, falls back to `crecardMap` (credit card agreement data).

**Block 9.1** — IF `[pyDebitPrepaidType is null]` (L2754)

> If debit/prepaid type from payment scheme is not available, try to get it from the credit card agreement map.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `null != crecardMap` | Checks if credit card agreement map exists |
| 2 | SET | `pyDebitPrepaidType = crecardMap.getString(EKK0521A010CBSMsg1List.CRECARD_SBT_CD);` | Gets card type from credit card agreement message |

**Block 9.2** — ELSE `[pyDebitPrepaidType exists]` (L2765)

> Use the debit/prepaid type from the payment scheme result.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0521D010CBSMsg.CRECARD_SBT_CD, pyDebitPrepaidType);` // クレジットカード種類コード (Credit card type code) [-> `EKKA0010004CBSMsg.PY_DEBIT_PREPAID_TYPE`] | Sets card type code from payment scheme |

### Issuer Division (ANK-3602-00-00) (L2774-L2791)

**ANK-3846-00-00 change:** Previously used `EKKA0010001CBSMsg.CR_ISSUER_CLASS`; now uses `EKKA0010004CBSMsg.PY_ISSUR_CLASS` (issuer class from payment scheme).

**Block 10.1** — IF `[pyIssurClass is null]` (L2780)

> If issuer class from payment scheme is not available, get it from the credit card agreement map.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `null != crecardMap` | Checks if credit card agreement map exists |
| 2 | SET | `pyIssurClass = crecardMap.getString(EKK0521A010CBSMsg1List.CRDT_ISSUER_DIV);` | Gets issuer division from credit card agreement message |

**Block 10.2** — ELSE `[pyIssurClass exists]` (L2785)

> Use the issuer class from the payment scheme result.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0521D010CBSMsg.CRDT_ISSUER_DIV, pyIssurClass);` // クレジットイシュア区分 (Credit issuer division) [-> `EKKA0010004CBSMsg.PY_ISSUR_CLASS`] | Sets issuer division from payment scheme |

### Template Assembly (L2794-L2796)

Wraps the completed template into an array and stores it in the paramMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `templates = new CAANMsg[1];` | Creates single-element template array |
| 2 | SET | `templates[0] = template;` | Assigns built template to array |
| 3 | SET | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);` // テンプレートリスト設定 (Set template list) | Stores template array under TEMPLATE_LIST_KEY |
| 4 | RETURN | `return paramMap;` | Returns the complete paramMap with assembled template |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `editInMsg_EKK0521D010` | Method | Credit billing procedure message builder — constructs the inbound CBS message template |
| `EKK0521D010` | Screen/Batch | Credit Billing Procedure (クレジット請求手続) — the CBS transaction for processing credit card billing |
| `CAANMsg` | Class | Common message container — a schema-based message object for CBS communication |
| `EKK0521D010CBSMsg` | Schema | CBS message schema for credit billing procedure — defines all fields in the billing message |
| `EKKA0010004CBSMsg` | Schema | Payment Order Request small payment scheme response schema — contains actual payment results including card brand, masked number, validity, acquirer ID, and issuer class |
| `EKK0521A010CBSMsg1List` | Schema | Credit card agreement inquiry message list — holds credit card agreement data used as fallback source |
| `TEMPLATE_ID_EKK0521D010` | Constant | Template identifier value `"EKK0521D010"` — identifies the CBS service interface |
| `MAP_KEY_KKSV040333SC` | Constant | Map key `"KKSV040333SC"` — references the initial order request result map in childMap |
| `PREFIX_KKSV040309` | Constant | String prefix `"kksv040309_"` — prefix used to construct childMap keys for the credit card entry screen |
| `SCControlMapKeys.OPERATOR_ID` | Constant key | Control map key for the operator performing the operation |
| `SCControlMapKeys.OPE_DATE` | Constant key | Control map key for the operation date |
| `SCControlMapKeys.OPE_TIME` | Constant key | Control map key for the operation time |
| `JCMConstants.TEMPLATE_LIST_KEY` | Constant key | Key for storing the CAANMsg array in the data map |
| `JCMConstants.FUNC_CODE_KEY` | Constant key | Key for the function code in dataMap |
| `py_card_brand` | Field | Card brand from payment scheme — used as the card company code when card brand routing is active |
| `py_masked_card_number` | Field | Masked card number from payment scheme — partial card number with digits masked for security |
| `py_card_valid_term` | Field | Card validity period from payment scheme in YYMM format |
| `py_acq_id` | Field | Acquiring card company code from payment scheme — identifies the card company that processed the transaction |
| `py_debit_prepaid_type` | Field | Debit/prepaid card type from payment scheme — classifies card as debit, credit, or prepaid |
| `py_issur_class` | Field | Issuer division from payment scheme — classifies the card issuer (e.g., domestic, international) |
| `crecard_jigyo_cd` | Field | Credit card business code (クレジットカード事業コード) — identifies the card business type |
| `crecard_comp_cd` | Field | Credit card company code (クレジットカード会社コード) — identifies the card issuing company |
| `crecard_no` | Field | Credit card number (クレジットカード番号) — the card number for billing |
| `crecard_yk_kigen` | Field | Credit card validity period (クレジットカード有効期限) — card expiration date |
| `credit_kokan_cd` | Field | Credit conversion code (クレジット交換コード) — code for credit conversion/type |
| `crecard_nm_romaji` | Field | Cardholder name in Romaji (クレジットカード名義ローマ字) — cardholder name in Latin alphabet |
| `crecard_nm_kana` | Field | Cardholder name in Kana (クレジットカード名義カナ名) — cardholder name in Japanese phonetic script |
| `ido_div` | Field | Modification division (異動区分) — indicates the type of change (new, modify, cancel) |
| `upd_dtm_bf` | Field | Update date-time before (更新年月日时分秒更新前) — timestamp before the update |
| `creca_mk_ym` | Field | Credit card invalid month (クレジットカード無効年月) — month when the card was marked invalid |
| `crecard_no_azkri_id` | Field | Credit card number reservation ID (クレジットカード番号予約ID) — reservation ID for the card number |
| `shikosaki_comp_cd` | Field | Destination company code (仕向け先会社コード) — the acquiring/destination card company |
| `crecard_sbt_cd` | Field | Credit card type code (クレジットカード種類コード) — classifies card as debit, credit, or prepaid |
| `crdt_issuer_div` | Field | Credit issuer division (クレジットイシュア区分) — identifies the card issuer type |
| `kksv040309` | Screen prefix | Screen code prefix for the credit card entry screen (KKSV040309) |
| `kksv040333sc` | Data key | Initial order request result data from screen KKSV040333 — contains payment scheme response |
| `crecardMap` | Data key | Credit card agreement inquiry data from `EKK0521A010CBSMSG1LIST` — fallback data source |
| `childMap` | Parameter | HashMap carrying child data from upstream screens/processes — primary source for billing fields |
| `dataMap` | Parameter | Map containing screen-level data including function code and credit card agreement info |
| `param` | Parameter | IRequestParameterReadWrite — the main request parameter object carrying control context and data |
| editInMsg | Method | Common area message preparation method — sets up operator ID, dates, template ID |
| JKKCommonUtil.isNull | Method | Utility for null/empty string checking — determines if a value should be treated as missing |
| CAANMsg.set | Method | Sets a field value in the CBS message template |
| CAANMsg.setNull | Method | Explicitly sets a field to null in the CBS message template |
| CAANMsg.getString | Method | Retrieves a string field value from a CBS message object |
| REQUEST | Business concept | Credit billing request — the business operation of requesting credit card payment processing |
