# API calls
##### Step1. Importing InvoiceService.php (App/Services/InvoiceService.php)
```
use App\Services\InvoiceService;
```
##### Step2. Instantiates object of class InvoiceService()
```
$invoice_serivce = new InvoiceService();
```
### 1.QRcode - Get result of checking QRcode invocie
#### <font color="green">Method</font>
##### checkQrcode()
```
$invoice_serivce->checkQrcode(Params);
```
#### Params
| Field | Type | Description |
| -------- | -------- | -------- |
| qrcode | String | the qrcode information after scaning invoice|
>sample: (App/Http/Controllers/TestController.php)
>
```
{
"qrcode": DK3877535610908230244000000940000009b0000000027466374ll8VzDFsZg05iXh1IdJyVw==:**********:2:2:1:GATSBY 潔面濕紙巾(玻尿酸)42入超值包:1:125
}
```
#### Sample Response
##### Success:
```
{
"error": 0,
"message": "Matching item is found."
}
```
##### Error:
###### "1" - Non-matching items.
```
{
"error": 1,
"message": "Non-matching items."
}
```
###### "2" - Purchase order is not found
```
{
"error": 2,
"message": "Purchase order is not found. Please enter your invoice after 48 hrs."
}
```
###### "3" - unexpected response
```
{
"error": 3,
"message": "unexpected response."
}
```
###### "4" - Incomplete Information
```
{
"error": 4,
"message": "Incomplete Information. Please rescan the qrcode"
}
```
---
### 2.Barcode - Get result of checking Barcode invocie
#### <font color="green">Method</font>
##### checkBarcode()
```
$invoice_serivce->checkBarcode(Params);
```
#### Params
| Field | Type | Description |Sample|
| -------- | -------- | -------- |-------- |
| invNum | str | invoice number |DK83868820|
| invDate | str | invoice issue date (YYYY/MM/DD)|2020/08/23|
| invTerm | str | invoice period (Year and month, "YYYMM", of the Republic era, and month must be even month.)|10908|
| randomNumber | int | the barcode|1667|
#### Sample Response
##### Success:
```
{
"error": 0,
"message": "Matching item is found."
}
```
##### Error:
###### "1" - Non-matching items.
```
{
"error": 1,
"message": "Non-matching items."
}
```
###### "2" - Purchase order is not found
```
{
"error": 2,
"message": "Purchase order is not found. Please enter your invoice after 48 hrs."
}
```
###### "3" - unexpected response
```
{
"error": 3,
"message": "unexpected response."
}
```
###### "5" - No invoice Number (invDate/invTerm/randomNumber)
```
{
"error": 5,
"message": "Please fill in the invoice number."
}
```
###### tags: `invoice`