# 부가기능

## 1. SendEmail - 메일 재전송

| HTTP Method | 테스트(Sandbox)                                           | 운영(Production)                                    |
| ----------- | ------------------------------------------------------ | ------------------------------------------------- |
| POST        | <https://popbill-test.linkhub.co.kr/Cashbill/{MgtKey}> | <https://popbill.linkhub.co.kr/Cashbill/{MgtKey}> |

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

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/cashbill/getting-started/authorization)
- Content-Type `required: Y` `description: 요청 본문 형식`
  - `application/json`
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-HTTP-Method-Override `required: Y` `description: 요청 메서드 재정의`
  - `EMAIL`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Path 파라미터**

- MgtKey `type: string` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`

**요청 본문**

- receiver `type: string` `length: -` `required: Y` `description: 수신자 메일주소`

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/Cashbill/{MgtKey}' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --header 'X-HTTP-Method-Override: EMAIL' \
  --data '{
    "receiver": "test@test.com"
  }'
```

### Response

**응답 본문**

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

**응답 예시**

```json
{
    "code": 1,
    "message": "이메일 재전송 완료"
}
```

## 2. SendSMS - 문자 재전송

| HTTP Method | 테스트(Sandbox)                                           | 운영(Production)                                    |
| ----------- | ------------------------------------------------------ | ------------------------------------------------- |
| POST        | <https://popbill-test.linkhub.co.kr/Cashbill/{MgtKey}> | <https://popbill.linkhub.co.kr/Cashbill/{MgtKey}> |

- 현금영수증과 관련된 안내 SMS(단문) 문자를 재전송하는 함수로, 팝빌 사이트 \[ 문자 > 결과 > 전송결과 ] 메뉴에서 전송결과를 확인할 수 있습니다.
- 메시지는 최대 90byte까지 입력 가능하고, 초과한 내용은 자동으로 삭제되어 전송합니다. (한글 최대 45자)

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/cashbill/getting-started/authorization)
- Content-Type `required: Y` `description: 요청 본문 형식`
  - `application/json`
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-HTTP-Method-Override `required: Y` `description: 요청 메서드 재정의`
  - `SMS`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Path 파라미터**

- 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까지 입력 가능하고, 초과한 내용은 자동으로 삭제되어 전송

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/Cashbill/{MgtKey}' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --header 'X-HTTP-Method-Override: SMS' \
  --data '{
    "sender": "발신번호",
    "receiver": "수신번호",
    "contents": "메시지 내용"
  }'
```

### Response

**응답 본문**

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

**응답 예시**

```json
{
    "code": 1,
    "message": "문자알림 재전송 완료"
}
```

## 3. SendFAX - 팩스 전송

| HTTP Method | 테스트(Sandbox)                                           | 운영(Production)                                    |
| ----------- | ------------------------------------------------------ | ------------------------------------------------- |
| POST        | <https://popbill-test.linkhub.co.kr/Cashbill/{MgtKey}> | <https://popbill.linkhub.co.kr/Cashbill/{MgtKey}> |

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

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

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/cashbill/getting-started/authorization)
- Content-Type `required: Y` `description: 요청 본문 형식`
  - `application/json`
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-HTTP-Method-Override `required: Y` `description: 요청 메서드 재정의`
  - `FAX`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Path 파라미터**

- MgtKey `type: string` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`

**요청 본문**

- sender `type: string` `length: -` `required: Y` `description: 발신번호`
- receiver `type: string` `length: -` `required: Y` `description: 수신번호`

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/Cashbill/{MgtKey}' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --header 'X-HTTP-Method-Override: FAX' \
  --data '{
    "sender": "발신번호",
    "receiver": "수신번호"
  }'
```

### Response

**응답 본문**

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

**응답 예시**

```json
{
    "code": 1,
    "message": "팩스 재전송 완료"
}
```

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

| HTTP Method | 테스트(Sandbox)                                            | 운영(Production)                                     |
| ----------- | ------------------------------------------------------- | -------------------------------------------------- |
| POST        | <https://popbill-test.linkhub.co.kr/Cashbill/{ItemKey}> | <https://popbill.linkhub.co.kr/Cashbill/{ItemKey}> |

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

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/cashbill/getting-started/authorization)
- Content-Type `required: Y` `description: 요청 본문 형식`
  - `application/x-www-form-urlencoded; charset=utf-8`
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Path 파라미터**

- ItemKey `type: string` `length: 18` `required: Y` `description: 팝빌에서 현금영수증 관리 목적으로 할당한 식별번호`
  - [\[Search - 목록 조회\]](https://developers.popbill.com/api-reference/cashbill/api/info#Search) 를 통하여 응답의 itemKey를 확인

**요청 본문**

- MgtKey `type: string` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/Cashbill/{ItemKey}' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
  --data-urlencode 'MgtKey=TEST0001'
```

### Response

**응답 본문**

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

**응답 예시**

```json
{
    "code": 1,
    "message": "할당 완료"
}
```

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

| HTTP Method | 테스트(Sandbox)                                                  | 운영(Production)                                           |
| ----------- | ------------------------------------------------------------- | -------------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/Cashbill/EmailSendConfig> | <https://popbill.linkhub.co.kr/Cashbill/EmailSendConfig> |

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

### Request

**요청 헤더**

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

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/Cashbill/EmailSendConfig' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- emailType `type: string` `length: -` `description: 메일 전송 유형`
  - `CSH_ISSUE`: 고객에게 현금영수증이 발행 되었음을 알려주는 메일
- sendYN `type: boolean` `length: -` `description: 전송 여부`
  - `true`: 전송
  - `false`: 미전송

**응답 예시**

```json
[
    {
        "emailType": "CSH_ISSUE",
        "sendYN": true
    }
]
```

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

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

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

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/cashbill/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 파라미터**

- EmailType `type: string` `length: -` `required: Y` `description: 메일 전송 유형`
  - `CSH_ISSUE`: 고객에게 현금영수증이 발행 되었음을 알려주는 메일
- SendYN `type: boolean` `length: -` `required: Y` `description: 전송 여부`
  - `true`: 전송
  - `false`: 미전송

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/Cashbill/EmailSendConfig?EmailType={EmailType}&SendYN={SendYN}' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

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

**응답 예시**

```json
{
    "code": 1,
    "message": "수정 완료"
}
```
