Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
|
|
|
|
4 |
def card_authorization(onfftid, tot_amt, com_tax_amt, com_free_amt, com_vat_amt, card_no, install_period, user_nm, user_phone2, product_nm, expire_date, cert_type, card_user_type, auth_value, password, card_nm, order_no, pay_type):
|
5 |
url = "https://store.onoffkorea.co.kr/payment/index.php"
|
6 |
data = {
|
@@ -28,7 +30,15 @@ def card_authorization(onfftid, tot_amt, com_tax_amt, com_free_amt, com_vat_amt,
|
|
28 |
try:
|
29 |
return response.json()
|
30 |
except ValueError:
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
else:
|
33 |
return {"error": "Request failed", "status_code": response.status_code}
|
34 |
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
4 |
+
import xml.etree.ElementTree as ET
|
5 |
+
|
6 |
def card_authorization(onfftid, tot_amt, com_tax_amt, com_free_amt, com_vat_amt, card_no, install_period, user_nm, user_phone2, product_nm, expire_date, cert_type, card_user_type, auth_value, password, card_nm, order_no, pay_type):
|
7 |
url = "https://store.onoffkorea.co.kr/payment/index.php"
|
8 |
data = {
|
|
|
30 |
try:
|
31 |
return response.json()
|
32 |
except ValueError:
|
33 |
+
# XML 응답 처리
|
34 |
+
try:
|
35 |
+
root = ET.fromstring(response.text)
|
36 |
+
result = {}
|
37 |
+
for child in root:
|
38 |
+
result[child.tag] = child.text
|
39 |
+
return result
|
40 |
+
except ET.ParseError:
|
41 |
+
return {"error": "Invalid XML response", "details": response.text}
|
42 |
else:
|
43 |
return {"error": "Request failed", "status_code": response.status_code}
|
44 |
|