POPBill Developers
가이드

튜토리얼

ASP 개발환경에서 팝빌 SDK를 추가하여 휴폐업 대량조회 (CheckCorpNums) 함수를 구현하는 예시입니다.

1. POPBiLL SDK 추가 및 설정

① 팝빌 연동자료실에서 ASP SDK 예제코드 다운로드 후 압축을 해제합니다.

② 압축해제한 SDK 예제코드에 포함된 Popbill/ 폴더를 웹사이트 Root Directory 경로에 복사합니다.

③ 휴폐업조회 서비스 연동환경 설정을 위해 프로젝트 Root Directory에 common.asp 파일을 생성하고 아래의 코드를 참고하여 API Key 를 설정합니다.

<!--#include virtual="/Popbill/Popbill.asp"-->
<!--#include virtual="/Popbill/ClosedownService.asp"-->

<%
  ' 링크아이디
  LinkID = "LINKID"

  ' 비밀키
  SecretKey = "SwWxqU+0TExEXy/9TVjKPExI2VTUMMSLZtJf3Ed8q3I="

  ' 휴폐업조회 서비스 객체 선언
  set m_ClosedownService = new ClosedownService

  ' 휴폐업조회 서비스 객체 초기화
  m_ClosedownService.Initialize LinkID, SecretKey

  ' 연동환경 설정, True-테스트, False-운영(Production), (기본값:False)
  m_ClosedownService.IsTest = True

  ' 인증토큰 IP 검증 설정, True-사용, False-미사용, (기본값:True)
  m_ClosedownService.IPRestrictOnOff = True

  ' 통신 IP 고정, True-사용, False-미사용, (기본값:False)
  m_ClosedownService.UseStaticIP = False

  ' 로컬시스템 시간 사용여부, True-사용, False-미사용, (기본값:True)
  m_ClosedownService.UseLocalTimeYN = True
%>

2. CheckCorpNums 기능 구현

프로젝트에 함수 호출을 처리하는 파일을 생성하고, 아래의 코드를 참조하여 코드를 추가합니다.

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
    <title>Popbill Closedown Test.</title>
  </head>
<!--#include file="common.asp"-->
<%

  '팝빌회원 사업자번호
  UserCorpNum = "1234567890"

  '조회할 사업자번호 배열, 최대 1000건
  Dim CorpNumList(3)
  CorpNumList(0) = "1234567890"
  CorpNumList(1) = "6798700433"
  CorpNumList(2) = "1231212312"

  On Error Resume Next

  Set result = m_ClosedownService.checkCorpNums(UserCorpnum, CorpNumList)

  If Err.Number <> 0 Then
    code = Err.Number
    message = Err.Description
    Err.Clears
  End If

  On Error GoTo 0
%>
  <body>
    <div id="content">
    <p class="heading1">Response</p>
    <br/>
    <fieldset class="fieldset1">
    <legend>휴폐업조회 - 대량</legend>
    <br/>
      <p class="info">> state (휴폐업상태) : null-알수없음, 0-등록되지 않은 사업자번호, 1-사업중, 2-폐업, 3-휴업</p>
      <p class="info">> type (사업 유형) : null-알수없음, 1-일반과세자, 2-면세과세자, 3-간이과세자, 4-비영리법인, 국가기관</p>
    <br/>
    <%
    If Not IsEmpty(result) Then
    For i=0 To result.Count-1
    %>
    <fieldset class="fieldset2">
    <legend>휴폐업정보 [<%=i+1 %>]</legend>
      <ul>
        <li>사업자번호(corpNum) : <%= result.Item(i).corpNum%></li>
        <li>휴폐업상태(state) : <%= result.Item(i).state%></li>
        <li>사업자유형(type) : <%= result.Item(i).ctype%></li>
        <li>휴폐업일자(stateDate) : <%= result.Item(i).stateDate%></li>
        <li>과세유형 전환일자(typeDate) : <%= result.Item(i).typeDate%></li>
        <li>국세청 확일일자(checkDate) : <%= result.Item(i).checkDate%></li>
      </ul>
    </fieldset>
    <%
    Next
    End If

    %>

  </fieldset>

  </body>
</html>

3. 결과 확인

함수 호출 반환 결과는 아래와 같습니다.
- 성공 : Response code 로 숫자 1 반환
- 실패 : PopbillException 으로 음의 정수 8자리 숫자값 오류코드와 오류메시지 반환 [오류코드]