--- title: 'CalculatePD' disqus: hackmd --- # CalculatePDAPI Version | Handler | Desc | Date --------|---------|--------|---------- 1.0.0 | Jum | Create | 2025-05-19 **Description:** Call API in core to calculate information for PD insurance input. --- ## Specification 1. Endpoint Name: **CalculatePD** 2. Environment URLs | Environment | URL | |-------------|-----| | SIT | https://api-sit.cathay-ins.com.vn:9527/guarantee/api/Comprehensive/CalculatePD | | UAT | https://api-uat.cathay-ins.com.vn:9527/guarantee/api/Comprehensive/CalculatePD | | Core | /cxinsvn/servlet/HttpDispatcher/ATWA_1000/calculateForPD | --- ## Header Specification ### 1. Frontend Calling API Gateway Headers | Item | Description | |-------------------------|-------------| | Method | POST | | Required Header | Content-Type: application/json; charset=UTF-8 | | Required Header | x-api-version=1 | | Bearer Token | Obtain `"access_token"` from login API. This token should be used in Bearer Token format. See [login API]( /lfbsyk40QCuaISPSf0x30g) for details. | ### 2. Middleware Calling Core Headers | Parameter | Core Parameter | Type | Required | Description | |-----------|----------------|--------|----------|-------------| | loginId | CLIENT_TARGET | String | Y | Login account (from frontend `loginId`) | | token | TOKEN | String | Y | Token obtained from login | | language | LG_CODE | String | Y | Language code: Vietnamese: `vi-VN`, English: `en-US`, Chinese: `zh-TW`. Defaults to Vietnamese if not provided | --- ## Request Fields | Field Name | Core Parameter | Type | Required | Description | |------------|----------------|--------|----------|-------------| | language | LG_CODE | String | Y | Language code (`zh-TW`, `vi-VN`) | | loginId | CLIENT_TARGET | String | Y | Agent staff ID | | token | TOKEN | String | Y | Core token | | pack | PACK | String | Y | Premium package (e.g., PDA) | | procDate | PROC_DATE | String | Y | Processing date (YYYY-MM-DD) | | insrScope | INSURANCE_SCOPE| String | Y | Insurance scope | | insrList | INSR_LIST | List | Y | List of insured persons | --- ## insrList Fields | Field Name | Core Parameter | Type | Required | Description | |------------------|-----------------|---------|----------|-------------| | insrCertType | INSR_CERT_TYPE | String | Y | Certificate type (1: National ID, 2: Birth Certificate, 3: Passport, 4: Military ID, 5: Other, 6: Tax ID) | | insrCertNumber | INSR_CERT_NUMBER | String | Y | Certificate number (National ID/Birth Certificate: 12 digits, Passport: 7–10 characters) | | insrNo | INSR_NO | Integer | Y | Sequence number | ### Request 範例 1. 前端Request API Gateway 範例 ```json= { "language": "vi-VN", "loginId": "0100014373", "token": "NlXEt66fejIrQvIGampcPnLVdmIYVo0wdZf8T5H5xkM5lpVpvuhDn9qSaAQDSkbkOdUjxvXufQpyH0WZWvQThw==", "pack":"PDA", "procDate": "2023-11-16", "insrScope": "VN", "insrList": [ { "insrNo": "1", "certificateType": "1", "certificateNumber": "122312145" } ] } ``` ## Response ### Response Fields | Field Name | Data Type | Length | Description | |------------|-----------|--------|-------------| | status | Integer | 3 | Success: 200 / Failure: 500 / Timeout: 504 | | success | Boolean | - | true / false | | message | String | - | Response message content | | total | Integer | - | Total number of records | | data | Object | - | Data object containing premium details | --- ### Data Object Detail | Field Name | Data Type | Length | Description | |-------------|-----------|--------|-------------| | prem | String | - | Scheduled premium | | discRate | String | - | Discount rate | | addRate | String | - | Additional rate | | paytDeae | String | - | Paid amount | | totDiscPrem | String | - | Total discount premium | | totAddPrem | String | - | Total additional premium | | premTotal | String | - | Total premium | | realPrem | String | - | Actual premium received | | discPrem | String | - | Discounted premium | | loadingFee | String | - | Loading fee | | premList | List | - | List of premium details per insured | --- ### premList Detail | Field Name | Data Type | Length | Description | |---------------|-----------|--------|-------------| | insrNo | String | - | Insurance sequence number | | rank | String | - | Rank of premium (e.g., PDA) | | amt | String | - | Insured amount | | prem | String | - | Scheduled premium | | realPrem | String | - | Actual premium | | discPrem | String | - | Discounted premium | | fronPrem | String | - | Foreign/front premium | | fronAmt | String | - | Foreign/front insured amount | | fronRealPrem | String | - | Foreign/front actual premium | | fronDiscPrem | String | - | Foreign/front discounted premium | | fronAddPrem | String | - | Foreign/front additional premium | | insrCertType | String | - | Insurance certificate type (1: National ID, 2: Birth Certificate, 3: Passport, 4: Military ID, 5: Other, 6: Tax ID) | ### Response 範例 ```json= { "status": 200, "message": "成功", "success": true, "total": 1, "data": { "prem": "270000.0", "discRate": "0", "addRate": "0", "paytDeae": "2023-11-23", "totDiscPrem": "0.00", "totAddPrem": "0.00", "premTotal": "270000.00", "realPrem": null, "discPrem": "0", "loadingFee": "0", "premList": [ { "insrNo": "0", "rank": null, "isBuyEPack": null, "amt": "115000000", "prem": "270000.0", "realPrem": "270000.00", "discPrem": "0.00", "addPrem": null, "fronPrem": "270000.0", "fronAmt": "115000000", "fronRealPrem": "270000.00", "fronDiscPrem": "0.00", "fronAddPrem": null, "insrCertType": "1" } ] } } ``` ###### tags: `agentportal` `Documentation`