Tutorial
Following is an example to implement NTS Crawling job request (RequestJob) API by adding the POPBiLL SDK within Java setting.
1. Add POPBiLL SDK
To add POPBiLL SpringBoot Starter, enter dependency information on “build.gradle” file of SpringBoot project, then Refresh it.
※ POPBiLL SpringBoot Starter is compatible with SpringBoot v1.0 and later and it is provided with POPBiLL Java SDK AutoConfiguration.
dependencies {
implementation 'kr.co.linkhub:popbill-spring-boot-starter:1.14.0'
}
2. POPBiLL SDK Setting
For SDK configuration setting, enter the code below within the application.yml file.
popbill:
#LinkID
linkId: TESTER
#SecretKey
secretKey: SwWxqU+0TErBXy/9TVjIPEnI0VTUMMSQZtJf3Ed8q3I=
#Stage setting value , true(TEST), false(PRODUCTION)
isTest: true
#Whether to recommend use of authentication token IP restriction function or not,
#recommended to use (true), to not use (false)
isIpRestrictOnOff: true
#Whether to use POPBiLL API service static IP or not,
#true – use, false- do not use, default(false)
useStaticIp: false
#Whether to use local system time or not,
#true – use(default – recommended), false – do not use
useLocalTimeYn: true
3. Implement RequestJob Function
① To add Service Class Bean object NTS Crawling, add @Autowired annotation and RequestJob API code.
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.popbill.api.HTTaxinvoiceService;
import com.popbill.api.PopbillException;
import com.popbill.api.hometax.QueryType;
@Controller
public class HTTaxinvoiceServiceController {
@Autowired
private HTTaxinvoiceService htTaxinvoiceService;
@RequestMapping(value = "requestJob", method = RequestMethod.GET)
public String requestJob(Model m) {
// Business registration number of a POPBiLL user
String corpNum = "1234567890";
// Type of e-Tax invoice
// SELL – sales
// BUY – purchase
// TRUSTEE - consigned
QueryType TIType = QueryType.SELL;
// Date type
// W – date of preparation
// I – date of issuance
// S – date of filing
String DType = "S";
// Starting date (format : yyyyMMdd)
String SDate = "20220101";
// End date (format : yyyyMMdd)
String EDate = "20220130";
try {
String jobID = htTaxinvoiceService.requestJob(corpNum, TIType,
DType, SDate, EDate);
m.addAttribute("Result", jobID);
} catch (PopbillException e) {
// If an exceptional error occurs,
// check the error code with e.getCode( )
// and check the error message with e.getMessage( )
System.out.println("Error Code : " + e.getCode());
System.out.println("Error Message : " + e.getMessage());
}
return "response";
}
}
② Add response.html file that outputs the code and message of the API calling result.
<html xmlns:th="http://www.thymeleaf.org"">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Popbill SDK Response</title>
</head>
<body>
<ul>
<li>JobID for a request (JobID) : <span th:text="${Result}"></span></li>
</ul>
</body>
</html>
4. Check the Result
If the API calling is being processed successfully, Response code will be returned as “1” and if it fails, an error code(8-digits that starts with “-”) and error message will be returned to POPBiLL Exception. [Error Code]

