diff options
Diffstat (limited to 'lib/soap/mdg/send/vendor-master/action.ts')
| -rw-r--r-- | lib/soap/mdg/send/vendor-master/action.ts | 22 |
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, }); |
