# 계좌 거래내역 수집 요청

## 1. RequestJob - 수집 요청

계좌 거래내역 수집을 팝빌에 요청합니다.

- 최대 1개월 단위로 수집 요청이 가능하며, 조회일로부터 최대 3개월 이전 내역까지 조회가 가능합니다.
- API를 호출하고 반환 받은 작업아이디(JobID)는 수집을 요청한 시점으로부터 1시간 동안만 유효합니다.

```ruby
def requestJob(corpNum, bankCode, accountNumber, sDate, eDate, userID = "")
```

### 요청

**Parameters**

- corpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- bankCode `type: String` `length: 4` `required: Y` `description: 은행 기관코드`
  - [\[참고\] 조회 가능한 금융기관](https://developers.popbill.com/guide/easyfinbank/introduction/easy-intro#banklist)
- accountNumber `type: String` `length: 30` `required: Y` `description: 계좌번호`
- sDate `type: String` `length: 8` `required: Y` `description: 검색 시작일자`
  - 형식 : yyyyMMdd
- eDate `type: String` `length: 8` `required: Y` `description: 검색 종료일자`
  - 형식 : yyyyMMdd
- userID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

String - 요청에 대한 작업아이디(JobID)

### 예외

**PopbillException**

- code `type: Integer` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- message `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 2. GetJobState - 수집 상태 확인

[\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/job#RequestJob) API를 호출하고 반환 받은 작업아이디(JobID)를 이용하여 수집 상태를 확인합니다.

- 수집 상태(jobState) = 3(완료)이면서, 수집 결과코드(errorCode) = 1(수집성공)인 경우 [\[Search - 수집 내역 확인\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/search#Search) 이 가능합니다.

```ruby
def getJobState(corpNum, jobID, userID = "")
```

### 요청

**Parameters**

- corpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- jobID `type: String` `length: 18` `required: Y` `description: 팝빌에서 할당한 작업아이디`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/job#RequestJob) API의 반환값
- userID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**EasyFinBankJobState**

- jobID `type: String` `length: 18` `description: 팝빌에서 할당한 작업아이디`
- jobState `type: Integer` `length: 1` `description: 수집 상태`
  - `0`: 접수
  - `1`: 대기
  - `2`: 진행
  - `3`: 완료
- startDate `type: String` `length: 8` `description: 시작일자`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/job#RequestJob)에 입력한 SDate (형식 : yyyyMMdd)
- endDate `type: String` `length: 8` `description: 종료일자`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/job#RequestJob)에 입력한 EDate (형식 : yyyyMMdd)
- errorCode `type: Integer` `length: -` `description: 수집 결과코드`
  - 성공 : 1
  - 실패 : 음의 정수 8자리 숫자값
  - [\[참고\] 오류코드](https://developers.popbill.com/error-code "_blank")
- errorReason `type: String` `length: -` `description: 오류메시지`
  - 수집실패시 반환되는 사유
- jobStartDT `type: String` `length: 14` `description: 작업 시작일시`
  - 형식 : yyyyMMddHHmmss
- jobEndDT `type: String` `length: 14` `description: 작업 종료일시`
  - 형식 : yyyyMMddHHmmss
- regDT `type: String` `length: 14` `description: 수집 요청일시`
  - 형식 : yyyyMMddHHmmss

### 예외

**PopbillException**

- code `type: Integer` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- message `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 3. ListActiveJob - 수집 상태 목록 확인

[\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/job#RequestJob) API를 호출하고 반환 받은 작업아이디(JobID) 목록의 수집 상태를 확인합니다.

```ruby
def listActiveJob(corpNum, userID = "")
```

### 요청

**Parameters**

- corpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- userID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**EasyFinBankJobState\[ ]**

- jobID `type: String` `length: 18` `description: 팝빌에서 할당한 작업아이디`
- jobState `type: Integer` `length: 1` `description: 수집 상태`
  - `0`: 접수
  - `1`: 대기
  - `2`: 진행
  - `3`: 완료
- startDate `type: String` `length: 8` `description: 시작일자`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/job#RequestJob)에 입력한 SDate (형식 : yyyyMMdd)
- endDate `type: String` `length: 8` `description: 종료일자`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/easyfinbank/ruby/api/job#RequestJob)에 입력한 EDate (형식 : yyyyMMdd)
- errorCode `type: Integer` `length: -` `description: 수집 결과코드`
  - 성공 : 1
  - 실패 : 음의 정수 8자리 숫자값
  - [\[참고\] 오류코드](https://developers.popbill.com/error-code "_blank")
- errorReason `type: String` `length: -` `description: 오류메시지`
  - 수집실패시 반환되는 사유
- jobStartDT `type: String` `length: 14` `description: 작업 시작일시`
  - 형식 : yyyyMMddHHmmss
- jobEndDT `type: String` `length: 14` `description: 작업 종료일시`
  - 형식 : yyyyMMddHHmmss
- regDT `type: String` `length: 14` `description: 수집 요청일시`
  - 형식 : yyyyMMddHHmmss

### 예외

**PopbillException**

- code `type: Integer` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- message `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`
