# 거래내역 확인

## 1. Search - 수집 내역 확인

| HTTP Method | 테스트(Sandbox)                                              | 운영(Production)                                       |
| ----------- | --------------------------------------------------------- | ---------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/EasyFin/Bank/{jobID}> | <https://popbill.linkhub.co.kr/EasyFin/Bank/{jobID}> |

- 금융기관에서 수집된 계좌 거래내역을 확인합니다.

> 매개변수 Page, PerPage, Order를 이용하여 페이징 기능을 구현할 수 있습니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/easyfinbank/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Path 파라미터**

- jobID `type: string` `length: 18` `required: Y` `description: 팝빌에서 할당한 작업아이디`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/api-reference/easyfinbank/api/job#RequestJob) API의 반환값

**Query 파라미터**

- TradeType `type: string` `length: -` `required: N` `description: 거래유형 (다중 선택 가능)`
  - `I`: 입금
  - `O`: 출금
  - 다중 선택시 콤마(',')로 구분. 예) I,O
  - 기본값 : 전체조회
- SearchString `type: string` `length: -` `required: N` `description: 조회 검색어`
  - `입·출금액`: 입금 또는 출금 금액을 입력
  - `거래 내역 메모`: [\[SaveMemo – 거래 내역 메모저장\]](https://developers.popbill.com/api-reference/easyfinbank/api/search#SaveMemo) 을 사용하여 저장한 값
  - `비고`: remark1, remark2, remark3 조회
  - 기본값 : 전체조회
- Page `type: number` `length: -` `required: N` `description: 목록 페이지번호`
  - 기본값 : 1
- PerPage `type: number` `length: -` `required: N` `description: 페이지당 표시할 목록 건수`
  - 최대 : 1,000건
  - 기본값 : 500건
- Order `type: string` `length: 1` `required: N` `description: 목록 정렬 방향`
  - `D`: 내림차순 : 기본값
  - `A`: 오름차순
  - API를 호출하고 반환 받은 거래일시(trdt) 기준

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/EasyFin/Bank/{jobID}?TradeType={TradeType}&SearchString={SearchString}&Page={Page}&PerPage={PerPage}&Order={Order}' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`
- total `type: number` `length: -` `description: 총 검색결과 건수`
- perPage `type: number` `length: -` `description: 페이지당 목록 건수`
- pageNum `type: number` `length: -` `description: 페이지 번호`
- pageCount `type: number` `length: -` `description: 페이지 개수`
- lastScrapDT `type: string` `length: 14` `description: 최종 조회일시`
  - 형식 : yyyyMMddHHmmss
- balance `type: string` `length: 20` `description: 현재 잔액`
- list `type: array` `length: -` `description: 거래내역 조회 목록`
  - 최대 : 1,000건
  - tid `type: string` `length: 32` `description: 거래내역 아이디`
    - 거래 내역에 대해 팝빌이 할당한 고유 식별값
  - trdate `type: string` `length: 8` `description: 거래일자`
    - 형식 : yyyyMMdd
  - trserial `type: number` `length: -` `description: 거래일련번호`
    - 거래일자별 거래 내역 순번
  - trdt `type: string` `length: 14` `description: 거래일시`
    - 형식 : yyyyMMddHHmmss
  - accIn `type: string` `length: 20` `description: 입금액`
  - accOut `type: string` `length: 20` `description: 출금액`
  - balance `type: string` `length: 20` `description: 잔액`
  - remark1 `type: string` `length: 500` `description: 비고 1`
    - {BankCode}="0003"(기업은행) 경우 받는분 계좌번호
    - {BankCode}="0004"(국민은행) 경우 내통장 표시내용
  - remark2 `type: string` `length: 500` `description: 비고 2`
    - 은행별 제공 정보 다름(거래구분, 거래종류, 거래내용, 적요 등)
  - remark3 `type: string` `length: 500` `description: 비고 3`
    - 은행별 제공 정보 다름(거래내용, 적요, 내역, 비고 등)
  - remark4 `type: string` `length: 500` `description: 비고 4`
    - 은행별 제공 정보 다름(거래점, 취급점, 처리점 등)
  - regDT `type: string` `length: 14` `description: 등록일시`
    - 형식 : yyyyMMddHHmmss
  - memo `type: string` `length: 100` `description: 거래 내역 메모`
    - [\[SaveMemo – 거래 내역 메모저장\]](https://developers.popbill.com/api-reference/easyfinbank/api/search#SaveMemo)을 사용하여 저장한 값

**응답 예시**

```json
{
    "code": 1,
    "total": 0,
    "perPage": 500,
    "pageNum": 1,
    "pageCount": 0,
    "list": [
              {
                "memo": "",
                "tid": "02301311400000000120250930000001",
                "trdate": "20250930",
                "trserial": 1,
                "trdt": "20250930144901",
                "accIn": "1000",
                "accOut": "0",
                "remark4": "",
                "balance": "8000",
                "regDT": "20251022194257",
                "remark1": "(주)링크허브",
                "remark2": "",
                "remark3": "전자망"
              }
    ],
    "message": "확인완료",
    "lastScrapDT": "20251021111915",
    "balance": "2000"
}
```

## 2. Summary - 수집 내역 합계

| HTTP Method | 테스트(Sandbox)                                                      | 운영(Production)                                               |
| ----------- | ----------------------------------------------------------------- | ------------------------------------------------------------ |
| GET         | <https://popbill-test.linkhub.co.kr/EasyFin/Bank/{jobID}/Summary> | <https://popbill.linkhub.co.kr/EasyFin/Bank/{jobID}/Summary> |

- 금융기관에서 수집된 계좌 거래내역의 입금 및 출금 합계정보를 제공합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/easyfinbank/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Path 파라미터**

- jobID `type: string` `length: 18` `required: Y` `description: 팝빌에서 할당한 작업아이디`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/api-reference/easyfinbank/api/job#RequestJob) API의 반환값

**Query 파라미터**

- TradeType `type: string` `length: -` `required: N` `description: 거래유형 (다중 선택 가능)`
  - `I`: 입금
  - `O`: 출금
  - 다중 선택시 콤마(',')로 구분. 예) I,O
  - 기본값 : 전체조회
- SearchString `type: string` `length: -` `required: N` `description: 조회 검색어`
  - `입·출금액`: 입금 또는 출금 금액을 입력
  - `거래 내역 메모`: [\[SaveMemo – 거래 내역 메모저장\]](https://developers.popbill.com/api-reference/easyfinbank/api/search#SaveMemo) 을 사용하여 저장한 값
  - `비고`: remark1, remark2, remark3 내용 조회
  - 기본값 : 전체조회

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/EasyFin/Bank/{jobID}/Summary?TradeType={TradeType}&SearchString={SearchString}' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- count `type: number` `length: -` `description: 수집 건수`
- cntAccIn `type: number` `length: -` `description: 입금거래 건수`
- cntAccOut `type: number` `length: -` `description: 출금거래 건수`
- totalAccIn `type: number` `length: -` `description: 입금액 합계`
- totalAccOut `type: number` `length: -` `description: 출금액 합계`

**응답 예시**

```json
{
    "count": 0,
    "cntAccIn": 0,
    "cntAccOut": 0,
    "totalAccIn": 0,
    "totalAccOut": 0
}
```

## 3. SaveMemo - 거래 내역 메모저장

| HTTP Method | 테스트(Sandbox)                                               | 운영(Production)                                        |
| ----------- | ---------------------------------------------------------- | ----------------------------------------------------- |
| POST        | <https://popbill-test.linkhub.co.kr/EasyFin/Bank/SaveMemo> | <https://popbill.linkhub.co.kr/EasyFin/Bank/SaveMemo> |

- 한 건의 거래 내역에 메모를 저장합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/easyfinbank/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Query 파라미터**

- TID `type: string` `length: 32` `required: Y` `description: 메모를 저장할 거래내역 아이디`
  - [\[Search - 수집 내역 확인\]](https://developers.popbill.com/api-reference/easyfinbank/api/search#Search) API를 호출하고 반환 받은 거래내역 아이디(tid)
- Memo `type: string` `length: 100` `required: Y` `description: 거래 내역 메모`

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/EasyFin/Bank/SaveMemo?TID={TID}&Memo={Memo}' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`

**응답 예시**

```json
{
    "code": 1,
    "message": "저장 완료"
}
```
