From b10713344a57f94c8deb1caa9c6ef9bdf9e18642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Tue, 17 Mar 2026 14:38:54 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[barobill]=20SOAP=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=2027=EA=B0=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(MNG=20100%=20=EB=8F=99=EB=93=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 카카오톡 15개: 채널/템플릿 관리, 알림톡/친구톡 발송, 전송결과 조회 - SMS 4개: 단문 발송, 발신번호 확인/목록, 전송상태 조회 - 계좌 5개: 관리URL, 입출금URL, 범용URL, 일별/월별 조회 - 카드 6개: 수정/해지/해지취소, 일별/월별 조회, 사용내역URL - 세금계산서 1개: 목록URL - API 56개 메서드 = MNG 54개 + 유틸리티 메서드 --- app/Services/Barobill/BarobillSoapService.php | 571 ++++++++++++++++++ 1 file changed, 571 insertions(+) diff --git a/app/Services/Barobill/BarobillSoapService.php b/app/Services/Barobill/BarobillSoapService.php index 5a495856..6d685200 100644 --- a/app/Services/Barobill/BarobillSoapService.php +++ b/app/Services/Barobill/BarobillSoapService.php @@ -32,6 +32,10 @@ class BarobillSoapService extends Service protected ?SoapClient $tiClient = null; + protected ?SoapClient $kakaotalkClient = null; + + protected ?SoapClient $smsClient = null; + protected string $certKey = ''; protected string $corpNum = ''; @@ -151,6 +155,8 @@ protected function buildSoapUrls(string $baseUrl): array 'ti' => $baseUrl.'/TI.asmx?WSDL', 'bankaccount' => $baseUrl.'/BANKACCOUNT.asmx?WSDL', 'card' => $baseUrl.'/CARD.asmx?WSDL', + 'kakaotalk' => $baseUrl.'/KAKAOTALK.asmx?WSDL', + 'sms' => $baseUrl.'/SMS.asmx?WSDL', ]; } @@ -160,6 +166,8 @@ protected function resetClients(): void $this->bankAccountClient = null; $this->cardClient = null; $this->tiClient = null; + $this->kakaotalkClient = null; + $this->smsClient = null; } /** @@ -242,6 +250,16 @@ protected function getTiClient(): ?SoapClient return $this->tiClient ??= $this->createSoapClient($this->soapUrls['ti']); } + protected function getKakaotalkClient(): ?SoapClient + { + return $this->kakaotalkClient ??= $this->createSoapClient($this->soapUrls['kakaotalk']); + } + + protected function getSmsClient(): ?SoapClient + { + return $this->smsClient ??= $this->createSoapClient($this->soapUrls['sms']); + } + // ========================================================================= // SOAP 호출 (핵심) // ========================================================================= @@ -256,6 +274,8 @@ public function call(string $service, string $method, array $params = []): array 'ti' => $this->getTiClient(), 'bankaccount' => $this->getBankAccountClient(), 'card' => $this->getCardClient(), + 'kakaotalk' => $this->getKakaotalkClient(), + 'sms' => $this->getSmsClient(), default => null, }; @@ -518,6 +538,91 @@ public function getCashChargeUrl(string $corpNum, string $userId, string $userPw ]); } + /** + * 계좌 관리 URL 조회 + */ + public function getBankAccountManagementUrl(string $corpNum, string $userId, string $userPwd): array + { + return $this->call('bankaccount', 'GetBankAccountManagementURL', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $userId, + 'PWD' => $userPwd, + ]); + } + + /** + * 입출금내역 조회 URL + */ + public function getBankAccountLogUrl(string $corpNum, string $userId, string $userPwd): array + { + return $this->call('bankaccount', 'GetBankAccountLogURL', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $userId, + 'PWD' => $userPwd, + ]); + } + + /** + * 바로빌 범용 URL 조회 + */ + public function getBarobillUrl(string $corpNum, string $userId, string $userPwd, string $togo = ''): array + { + return $this->call('bankaccount', 'GetBaroBillURL', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $userId, + 'PWD' => $userPwd, + 'TOGO' => $togo, + ]); + } + + /** + * 계좌 일별 입출금내역 조회 + */ + public function getDailyBankAccountTransLog( + string $corpNum, + string $id, + string $bankAccountNum, + string $baseDate, + string $transDirection = '', + int $countPerPage = 20, + int $currentPage = 1 + ): array { + return $this->call('bankaccount', 'GetDailyBankAccountTransLog', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $id, + 'BankAccountNum' => $bankAccountNum, + 'BaseDate' => $baseDate, + 'TransDirection' => $transDirection, + 'CountPerPage' => $countPerPage, + 'CurrentPage' => $currentPage, + 'OrderDirection' => 'D', + ]); + } + + /** + * 계좌 월별 입출금내역 조회 + */ + public function getMonthlyBankAccountTransLog( + string $corpNum, + string $id, + string $bankAccountNum, + string $baseMonth, + string $transDirection = '', + int $countPerPage = 20, + int $currentPage = 1 + ): array { + return $this->call('bankaccount', 'GetMonthlyBankAccountTransLog', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $id, + 'BankAccountNum' => $bankAccountNum, + 'BaseMonth' => $baseMonth, + 'TransDirection' => $transDirection, + 'CountPerPage' => $countPerPage, + 'CurrentPage' => $currentPage, + 'OrderDirection' => 'D', + ]); + } + // ========================================================================= // 카드조회 (CARD) // ========================================================================= @@ -599,6 +704,99 @@ public function getCardManagementUrl(string $corpNum, string $userId, string $us ]); } + /** + * 카드 사용내역 URL 조회 + */ + public function getCardLogUrl(string $corpNum, string $userId, string $userPwd): array + { + return $this->call('card', 'GetCardLogURL', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $userId, + 'PWD' => $userPwd, + ]); + } + + /** + * 카드 정보 수정 + */ + public function updateCard(string $corpNum, array $cardData): array + { + return $this->call('card', 'UpdateCard', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'CardNum' => preg_replace('/[^0-9]/', '', $cardData['card_num'] ?? ''), + 'WebId' => $cardData['web_id'] ?? '', + 'WebPwd' => $cardData['web_pwd'] ?? '', + 'Alias' => $cardData['alias'] ?? '', + 'Usage' => $cardData['usage'] ?? '', + ]); + } + + /** + * 카드 해지 + */ + public function stopCard(string $corpNum, string $cardNum): array + { + return $this->call('card', 'StopCard', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'CardNum' => preg_replace('/[^0-9]/', '', $cardNum), + ]); + } + + /** + * 카드 해지 취소 + */ + public function cancelStopCard(string $corpNum, string $cardNum): array + { + return $this->call('card', 'CancelStopCard', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'CardNum' => preg_replace('/[^0-9]/', '', $cardNum), + ]); + } + + /** + * 카드 일별 사용내역 조회 + */ + public function getDailyCardLog( + string $corpNum, + string $id, + string $cardNum, + string $baseDate, + int $countPerPage = 20, + int $currentPage = 1 + ): array { + return $this->call('card', 'GetDailyCardLog', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $id, + 'CardNum' => preg_replace('/[^0-9]/', '', $cardNum), + 'BaseDate' => $baseDate, + 'CountPerPage' => $countPerPage, + 'CurrentPage' => $currentPage, + 'OrderDirection' => 'D', + ]); + } + + /** + * 카드 월별 사용내역 조회 + */ + public function getMonthlyCardLog( + string $corpNum, + string $id, + string $cardNum, + string $baseMonth, + int $countPerPage = 20, + int $currentPage = 1 + ): array { + return $this->call('card', 'GetMonthlyCardLog', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $id, + 'CardNum' => preg_replace('/[^0-9]/', '', $cardNum), + 'BaseMonth' => $baseMonth, + 'CountPerPage' => $countPerPage, + 'CurrentPage' => $currentPage, + 'OrderDirection' => 'D', + ]); + } + // ========================================================================= // 홈택스 (TI) // ========================================================================= @@ -627,6 +825,379 @@ public function getTaxInvoiceIssueUrl(string $corpNum, string $userId, string $u ]); } + /** + * 세금계산서 목록 URL 조회 + */ + public function getTaxInvoiceListUrl(string $corpNum, string $userId, string $userPwd): array + { + return $this->call('ti', 'GetTaxInvoiceListURL', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $userId, + 'PWD' => $userPwd, + ]); + } + + // ========================================================================= + // 카카오톡 (KAKAOTALK) + // ========================================================================= + + /** + * 카카오톡 채널 목록 조회 + */ + public function getKakaotalkChannels(string $corpNum): array + { + return $this->call('kakaotalk', 'GetKakaotalkChannels', [ + 'CorpNum' => $this->formatBizNo($corpNum), + ]); + } + + /** + * 카카오톡 채널 관리 URL 조회 + */ + public function getKakaotalkChannelManagementUrl(string $corpNum, string $id): array + { + return $this->call('kakaotalk', 'GetKakaotalkChannelManagementURL', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $id, + ]); + } + + /** + * 카카오톡 템플릿 목록 조회 + */ + public function getKakaotalkTemplates(string $corpNum, string $channelId): array + { + return $this->call('kakaotalk', 'GetKakaotalkTemplates', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ChannelId' => $channelId, + ]); + } + + /** + * 카카오톡 템플릿 관리 URL 조회 + */ + public function getKakaotalkTemplateManagementUrl(string $corpNum, string $id): array + { + return $this->call('kakaotalk', 'GetKakaotalkTemplateManagementURL', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'ID' => $id, + ]); + } + + /** + * 알림톡 단건 발송 + */ + public function sendATKakaotalk( + string $corpNum, + string $senderId, + string $yellowId, + string $templateName, + string $receiverName, + string $receiverNum, + string $title, + string $message, + string $smsMessage = '', + string $smsSubject = '', + string $smsSenderNum = '', + string $reserveDT = '' + ): array { + return $this->call('kakaotalk', 'SendATKakaotalk', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'YellowId' => $yellowId, + 'TemplateName' => $templateName, + 'SendDT' => $reserveDT, + 'SmsReply' => (empty($smsMessage) || empty($smsSenderNum)) ? 'N' : 'S', + 'SmsSenderNum' => $smsSenderNum, + 'KakaotalkMessage' => [ + 'ReceiverName' => $receiverName, + 'ReceiverNum' => $receiverNum, + 'Title' => $title, + 'Message' => $message, + 'SmsMessage' => $smsMessage, + 'SmsSubject' => $smsSubject, + ], + ]); + } + + /** + * 알림톡 단건 발송 (버튼 포함) + */ + public function sendATKakaotalkEx( + string $corpNum, + string $senderId, + string $yellowId, + string $templateName, + string $receiverName, + string $receiverNum, + string $title, + string $message, + array $buttons = [], + string $smsMessage = '', + string $smsSubject = '', + string $smsSenderNum = '', + string $reserveDT = '' + ): array { + $kakaotalkMessage = [ + 'ReceiverName' => $receiverName, + 'ReceiverNum' => $receiverNum, + 'Title' => $title, + 'Message' => $message, + 'SmsMessage' => $smsMessage, + 'SmsSubject' => $smsSubject, + ]; + + if (! empty($buttons)) { + $kakaotalkMessage['Buttons'] = ['KakaotalkButton' => $buttons]; + } + + return $this->call('kakaotalk', 'SendATKakaotalkEx', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'YellowId' => $yellowId, + 'TemplateName' => $templateName, + 'SendDT' => $reserveDT, + 'SmsReply' => (empty($smsMessage) || empty($smsSenderNum)) ? 'N' : 'S', + 'SmsSenderNum' => $smsSenderNum, + 'KakaotalkMessage' => $kakaotalkMessage, + ]); + } + + /** + * 알림톡 대량 발송 + */ + public function sendATKakaotalks( + string $corpNum, + string $senderId, + string $yellowId, + string $templateName, + array $messages, + string $reserveDT = '' + ): array { + return $this->call('kakaotalk', 'SendATKakaotalks', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'YellowId' => $yellowId, + 'TemplateName' => $templateName, + 'SendDT' => $reserveDT, + 'SmsReply' => 'N', + 'SmsSenderNum' => '', + 'KakaotalkMessages' => ['KakaotalkATMessage' => $messages], + ]); + } + + /** + * 친구톡 텍스트 단건 발송 + */ + public function sendFTKakaotalk( + string $corpNum, + string $senderId, + string $channelId, + string $receiverName, + string $receiverNum, + string $message, + array $buttons = [], + string $smsMessage = '', + string $smsSubject = '', + bool $adYn = false, + string $reserveDT = '' + ): array { + return $this->call('kakaotalk', 'SendFTKakaotalk', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'ChannelId' => $channelId, + 'ReceiverName' => $receiverName, + 'ReceiverNum' => $receiverNum, + 'Message' => $message, + 'Buttons' => $buttons, + 'SmsMessage' => $smsMessage, + 'SmsSubject' => $smsSubject, + 'AdYn' => $adYn ? 'Y' : 'N', + 'ReserveDT' => $reserveDT, + ]); + } + + /** + * 친구톡 대량 발송 + */ + public function sendFTKakaotalks( + string $corpNum, + string $senderId, + string $channelId, + array $messages, + bool $adYn = false, + string $reserveDT = '' + ): array { + return $this->call('kakaotalk', 'SendFTKakaotalks', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'ChannelId' => $channelId, + 'Messages' => $messages, + 'AdYn' => $adYn ? 'Y' : 'N', + 'ReserveDT' => $reserveDT, + ]); + } + + /** + * 친구톡 이미지 발송 + */ + public function sendFIKakaotalk( + string $corpNum, + string $senderId, + string $channelId, + string $receiverName, + string $receiverNum, + string $message, + string $imageUrl, + array $buttons = [], + string $smsMessage = '', + string $smsSubject = '', + bool $adYn = false, + string $reserveDT = '' + ): array { + return $this->call('kakaotalk', 'SendFIKakaotalk', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'ChannelId' => $channelId, + 'ReceiverName' => $receiverName, + 'ReceiverNum' => $receiverNum, + 'Message' => $message, + 'ImageURL' => $imageUrl, + 'Buttons' => $buttons, + 'SmsMessage' => $smsMessage, + 'SmsSubject' => $smsSubject, + 'AdYn' => $adYn ? 'Y' : 'N', + 'ReserveDT' => $reserveDT, + ]); + } + + /** + * 친구톡 와이드 이미지 발송 + */ + public function sendFWKakaotalk( + string $corpNum, + string $senderId, + string $channelId, + string $receiverName, + string $receiverNum, + string $message, + string $imageUrl, + array $buttons = [], + string $smsMessage = '', + string $smsSubject = '', + bool $adYn = false, + string $reserveDT = '' + ): array { + return $this->call('kakaotalk', 'SendFWKakaotalk', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'ChannelId' => $channelId, + 'ReceiverName' => $receiverName, + 'ReceiverNum' => $receiverNum, + 'Message' => $message, + 'ImageURL' => $imageUrl, + 'Buttons' => $buttons, + 'SmsMessage' => $smsMessage, + 'SmsSubject' => $smsSubject, + 'AdYn' => $adYn ? 'Y' : 'N', + 'ReserveDT' => $reserveDT, + ]); + } + + /** + * 카카오톡 전송 결과 조회 (단건) + */ + public function getSendKakaotalk(string $corpNum, string $sendKey): array + { + return $this->call('kakaotalk', 'GetSendKakaotalk', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SendKey' => $sendKey, + ]); + } + + /** + * 카카오톡 전송 결과 조회 (다건) + */ + public function getSendKakaotalks(string $corpNum, array $sendKeyList): array + { + return $this->call('kakaotalk', 'GetSendKakaotalks', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SendKeyList' => $sendKeyList, + ]); + } + + /** + * 카카오톡 예약 전송 취소 + */ + public function cancelReservedKakaotalk(string $corpNum, string $sendKey): array + { + return $this->call('kakaotalk', 'CancelReservedKakaotalk', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SendKey' => $sendKey, + ]); + } + + // ========================================================================= + // 문자 (SMS) + // ========================================================================= + + /** + * SMS 단문 발송 + */ + public function sendSMSMessage( + string $corpNum, + string $senderId, + string $fromNumber, + string $toName, + string $toNumber, + string $contents, + string $sendDT = '', + string $refKey = '' + ): array { + return $this->call('sms', 'SendSMSMessage', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SenderID' => $senderId, + 'FromNumber' => $fromNumber, + 'ToName' => $toName, + 'ToNumber' => $toNumber, + 'Contents' => $contents, + 'SendDT' => $sendDT, + 'RefKey' => $refKey, + ]); + } + + /** + * SMS 발신번호 등록 여부 확인 + */ + public function checkSMSFromNumber(string $corpNum, string $fromNumber): array + { + return $this->call('sms', 'CheckSMSFromNumber', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'FromNumber' => $fromNumber, + ]); + } + + /** + * SMS 등록된 발신번호 목록 + */ + public function getSMSFromNumbers(string $corpNum): array + { + return $this->call('sms', 'GetSMSFromNumbers', [ + 'CorpNum' => $this->formatBizNo($corpNum), + ]); + } + + /** + * SMS 전송 상태 조회 + */ + public function getSMSSendState(string $corpNum, string $sendKey): array + { + return $this->call('sms', 'GetSMSSendState', [ + 'CorpNum' => $this->formatBizNo($corpNum), + 'SendKey' => $sendKey, + ]); + } + // ========================================================================= // 유틸리티 // =========================================================================