Files
sam-api/app/Http/Controllers/Api/V1/BarobillController.php
권혁성 5448f0e57d deploy: 2026-03-12 배포
- feat: [barobill] 바로빌 카드/은행/홈택스 REST API 구현
- feat: [equipment] 설비관리 API 백엔드 구현
- feat: [payroll] 급여관리 계산 엔진 및 일괄 처리 API
- feat: [QMS] 점검표 템플릿 관리 + 로트심사 개선
- feat: [생산/출하] 수주 단위 출하 자동생성 + 상태 흐름 개선
- feat: [receiving] 입고 성적서 파일 연결
- feat: [견적] 제어기 타입 체계 변경
- feat: [email] 테넌트 메일 설정 마이그레이션 및 모델
- feat: [pmis] 시공관리 테이블 마이그레이션
- feat: [R2] 파일 업로드 커맨드 + filesystems 설정
- feat: [배포] Jenkinsfile 롤백 기능 추가
- fix: [approval] SAM API 규칙 준수 코드 개선
- fix: [account-codes] 계정과목 중복 데이터 정리
- fix: [payroll] 일괄 생성 시 삭제된 사용자 건너뛰기
- fix: [db] codebridge DB 분리 후 깨진 FK 제약조건 제거
- refactor: [barobill] 바로빌 연동 코드 전면 개선
2026-03-12 15:20:20 +09:00

137 lines
4.1 KiB
PHP

<?php
namespace App\Http\Controllers\Api\V1;
use App\Helpers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Services\BarobillService;
use Illuminate\Http\Request;
class BarobillController extends Controller
{
public function __construct(
private BarobillService $barobillService
) {}
/**
* 연동 현황 조회
*/
public function status()
{
return ApiResponse::handle(function () {
$setting = $this->barobillService->getSetting();
return [
'bank_service_count' => 0,
'account_link_count' => 0,
'member' => $setting ? [
'barobill_id' => $setting->barobill_id,
'biz_no' => $setting->corp_num,
'status' => $setting->isVerified() ? 'active' : 'inactive',
'server_mode' => $this->barobillService->isTestMode() ? 'test' : 'production',
] : null,
];
}, __('message.fetched'));
}
/**
* 바로빌 로그인 정보 등록
*/
public function login(Request $request)
{
$data = $request->validate([
'barobill_id' => 'required|string',
'password' => 'required|string',
]);
return ApiResponse::handle(function () use ($data) {
return $this->barobillService->saveSetting([
'barobill_id' => $data['barobill_id'],
]);
}, __('message.saved'));
}
/**
* 바로빌 회원가입 정보 등록
*/
public function signup(Request $request)
{
$data = $request->validate([
'business_number' => 'required|string|size:10',
'company_name' => 'required|string',
'ceo_name' => 'required|string',
'business_type' => 'nullable|string',
'business_category' => 'nullable|string',
'address' => 'nullable|string',
'barobill_id' => 'required|string',
'password' => 'required|string',
'manager_name' => 'nullable|string',
'manager_phone' => 'nullable|string',
'manager_email' => 'nullable|email',
]);
return ApiResponse::handle(function () use ($data) {
return $this->barobillService->saveSetting([
'corp_num' => $data['business_number'],
'corp_name' => $data['company_name'],
'ceo_name' => $data['ceo_name'],
'biz_type' => $data['business_type'] ?? null,
'biz_class' => $data['business_category'] ?? null,
'addr' => $data['address'] ?? null,
'barobill_id' => $data['barobill_id'],
'contact_name' => $data['manager_name'] ?? null,
'contact_tel' => $data['manager_phone'] ?? null,
'contact_id' => $data['manager_email'] ?? null,
]);
}, __('message.saved'));
}
/**
* 바로빌 서비스 URL 조회 (공통)
*/
private function getServiceUrl(string $path): array
{
return ['url' => $this->barobillService->getBaseUrl().$path];
}
/**
* 은행 빠른조회 서비스 URL 조회
*/
public function bankServiceUrl()
{
return ApiResponse::handle(function () {
return $this->getServiceUrl('/BANKACCOUNT.asmx');
}, __('message.fetched'));
}
/**
* 계좌 연동 등록 URL 조회
*/
public function accountLinkUrl()
{
return ApiResponse::handle(function () {
return $this->getServiceUrl('/BANKACCOUNT.asmx');
}, __('message.fetched'));
}
/**
* 카드 연동 등록 URL 조회
*/
public function cardLinkUrl()
{
return ApiResponse::handle(function () {
return $this->getServiceUrl('/CARD.asmx');
}, __('message.fetched'));
}
/**
* 공인인증서 등록 URL 조회
*/
public function certificateUrl()
{
return ApiResponse::handle(function () {
return $this->getServiceUrl('/CORPSTATE.asmx');
}, __('message.fetched'));
}
}