summaryrefslogtreecommitdiff
path: root/lib/soap/mdg/send/vendor-master
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-07-09 13:44:47 +0000
committerjoonhoekim <26rote@gmail.com>2025-07-09 13:44:47 +0000
commit25d569828b704a102f681a627c76c4129afa8be3 (patch)
tree1b50a5aa8f5ad4380b7d662a03c58dad9fdbb86d /lib/soap/mdg/send/vendor-master
parente78dec9c4d51f2f2741edc6da6c2afa18e418f15 (diff)
(김준회) XML 기반 MDG 송신시 인증헤더 추가
Diffstat (limited to 'lib/soap/mdg/send/vendor-master')
-rw-r--r--lib/soap/mdg/send/vendor-master/action.ts22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/soap/mdg/send/vendor-master/action.ts b/lib/soap/mdg/send/vendor-master/action.ts
index ae0c2c89..e0bd7009 100644
--- a/lib/soap/mdg/send/vendor-master/action.ts
+++ b/lib/soap/mdg/send/vendor-master/action.ts
@@ -624,7 +624,7 @@ export async function getVendorSendStatistics(): Promise<{
export async function sendTestVendorDataToMDG(formData: Record<string, string>): Promise<{
success: boolean;
message: string;
- responseData?: any;
+ responseData?: unknown;
}> {
try {
console.log('🧪 테스트용 VENDOR 데이터 SOAP 송신 시작');
@@ -728,12 +728,24 @@ export async function sendVendorEnvelopeToMDG(envelope: string): Promise<{
// 직접 XML 전송의 경우 기존 fetch 방식 유지
const MDG_ENDPOINT_URL = "http://shii8dvddb01.hec.serp.shi.samsung.net:50000/sap/xi/engine?type=entry&version=3.0&Sender.Service=P2038_D&Interface=http%3A%2F%2Fshi.samsung.co.kr%2FP2_MD%2FMDZ%5EP2MD3007_AO&QualityOfService=ExactlyOnce";
+ // 인증 헤더 준비
+ const headers: Record<string, string> = {
+ 'Content-Type': 'text/xml; charset=utf-8',
+ 'SOAPAction': 'http://sap.com/xi/WebService/soap1.1',
+ };
+
+ // Basic Authentication 헤더 추가
+ if (MDG_SOAP_USERNAME && MDG_SOAP_PASSWORD) {
+ const credentials = Buffer.from(`${MDG_SOAP_USERNAME}:${MDG_SOAP_PASSWORD}`).toString('base64');
+ headers['Authorization'] = `Basic ${credentials}`;
+ console.log('🔐 Basic Authentication 헤더 추가 완료');
+ } else {
+ console.warn('⚠️ MDG SOAP 인증 정보가 환경변수에 설정되지 않았습니다.');
+ }
+
const res = await fetch(MDG_ENDPOINT_URL, {
method: 'POST',
- headers: {
- 'Content-Type': 'text/xml; charset=utf-8',
- 'SOAPAction': 'http://sap.com/xi/WebService/soap1.1',
- },
+ headers,
body: envelope,
});