# 부가기능

## 1. SendEmail - 메일 재전송

현금영수증과 관련된 안내 메일을 재전송 합니다.

```pb
function response sendemail(string corpnum, string mgtkey, string receiver, string userid) throws popbillexception
```

### 요청

**Parameters**

- corpnum `type: string` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- mgtkey `type: string` `length: 24` `required: Y` `description: 메일 재전송할 현금영수증 문서번호`
- receiver `type: string` `length: -` `required: Y` `description: 수신자 메일주소`
- userid `type: string` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**Response**

- code `type: long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`
- confirmNum `type: string` `length: 9` `description: 국세청승인번호`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재
- tradeDate `type: string` `length: 8` `description: 거래일자`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMdd
- tradeDT `type: string` `length: 14` `description: 거래일시`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMddHHmmss

### 예외

**PopbillException**

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

## 2. SendSMS - 문자 재전송

현금영수증과 관련된 안내 SMS(단문) 문자를 재전송하는 함수로, 팝빌 사이트 \[ 문자 > 결과 > 전송결과 ] 메뉴에서 전송결과를 확인할 수 있습니다.

- 메시지는 최대 90byte까지 입력 가능하고, 초과한 내용은 자동으로 삭제되어 전송합니다. (한글 최대 45자)

```pb
function response sendsms(string corpnum, string mgtkey, string sender, string receiver, string contents, string userid) throws popbillexception
```

### 요청

**Parameters**

- corpnum `type: string` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- mgtkey `type: string` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`
- sender `type: string` `length: -` `required: Y` `description: 발신번호`
- receiver `type: string` `length: -` `required: Y` `description: 수신번호`
- contents `type: string` `length: 90` `required: Y` `description: 메시지 내용`
  - 최대 90 byte까지 입력 가능하고, 초과한 내용은 자동으로 삭제되어 전송
- userid `type: string` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**Response**

- code `type: long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`
- confirmNum `type: string` `length: 9` `description: 국세청승인번호`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재
- tradeDate `type: string` `length: 8` `description: 거래일자`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMdd
- tradeDT `type: string` `length: 14` `description: 거래일시`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMddHHmmss

### 예외

**PopbillException**

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

## 3. SendFAX - 팩스 전송

현금영수증을 팩스로 전송하는 함수로, 팝빌 사이트 \[ 팩스 > 결과 > 전송결과 ] 메뉴에서 전송결과를 확인할 수 있습니다.

```pb
function response sendfax(string corpnum, string mgtkey, string sender, string receiver, string userid) throws popbillexception
```

> API 호출 시 포인트가 차감됩니다.

### 요청

**Parameters**

- corpnum `type: string` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- mgtkey `type: string` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`
- sender `type: string` `length: -` `required: Y` `description: 발신번호`
- receiver `type: string` `length: -` `required: Y` `description: 수신번호`
- userid `type: string` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**Response**

- code `type: long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`
- confirmNum `type: string` `length: 9` `description: 국세청승인번호`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재
- tradeDate `type: string` `length: 8` `description: 거래일자`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMdd
- tradeDT `type: string` `length: 14` `description: 거래일시`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMddHHmmss

### 예외

**PopbillException**

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

## 4. AssignMgtKey - 문서번호 할당

팝빌 사이트를 통해 발행하여 문서번호가 할당되지 않은 현금영수증에 문서번호를 할당합니다.

```pb
function response assignmgtkey(string corpnum, string itemkey, string mgtkey, string userid) throws popbillexception
```

### 요청

**Parameters**

- corpnum `type: string` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- itemkey `type: string` `length: 18` `required: Y` `description: 팝빌에서 현금영수증 관리 목적으로 할당한 식별번호`
  - [\[Search – 목록 조회\]](https://developers.popbill.com/reference/cashbill/pb/api/info#Search)를 통하여 CashbillInfo의 변수 'itemKey'를 확인
- mgtkey `type: string` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`
- userid `type: string` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**Response**

- code `type: long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`
- confirmNum `type: string` `length: 9` `description: 국세청승인번호`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재
- tradeDate `type: string` `length: 8` `description: 거래일자`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMdd
- tradeDT `type: string` `length: 14` `description: 거래일시`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMddHHmmss

### 예외

**PopbillException**

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

## 5. ListEmailConfig - 알림메일 발송설정 조회

현금영수증 관련 메일 항목에 대한 발송설정을 확인합니다.

```pb
subroutine listEmailconfig(string corpnum, ref emailconfig ref_returnlist[]) throws popbillexception
```

### 요청

**Parameters**

- corpnum `type: string` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- ref\_returnlist `type: ref EmailConfig[ ]` `length: -` `required: Y` `description: 서브루틴 반환 결과값`
  - emailType `type: String` `length: -` `required: N` `description: 메일 전송 유형`
    - `CSH_ISSUE`: 고객에게 현금영수증이 발행 되었음을 알려주는 메일
  - sendYN `type: boolean` `length: -` `required: N` `description: 전송 여부`
    - `true`: 전송
    - `false`: 미전송

### 응답

emailconfig - 요청 파라미터의 `ref_returnlist` 확인

### 예외

**PopbillException**

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

## 6. UpdateEmailConfig - 알림메일 발송설정 수정

현금영수증 관련 메일 항목에 대한 발송설정을 수정합니다.

```pb
function response updateEmailConfig(string corpnum, string emailtype, boolean sendYN, string userid) throws popbillexception
```

### 요청

**Parameters**

- corpnum `type: string` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- emailtype `type: string` `length: -` `required: Y` `description: 메일 전송 유형`
  - `CSH_ISSUE`: 고객에게 현금영수증이 발행 되었음을 알려주는 메일
- sendYN `type: boolean` `length: -` `required: Y` `description: 전송 여부`
- userid `type: string` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**Response**

- code `type: long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`
- confirmNum `type: string` `length: 9` `description: 국세청승인번호`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재
- tradeDate `type: string` `length: 8` `description: 거래일자`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMdd
- tradeDT `type: string` `length: 14` `description: 거래일시`
  - 현금영수증 발행 시점에 팝빌에서 자동으로 할당 RegistIssue, RevokeRegistIssue API 사용할 경우만 존재 형식 : yyyyMMddHHmmss

### 예외

**PopbillException**

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