Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
| 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,
|
| 5 |
-
user_nm, user_phone2, product_nm, expire_date, cert_type, card_user_type,
|
| 6 |
-
auth_value, password, card_nm, order_no, pay_type):
|
| 7 |
url = "https://store.onoffkorea.co.kr/payment/index.php"
|
| 8 |
data = {
|
| 9 |
"onfftid": onfftid,
|
|
@@ -25,7 +23,6 @@ def card_authorization(onfftid, tot_amt, com_tax_amt, com_free_amt, com_vat_amt,
|
|
| 25 |
"order_no": order_no,
|
| 26 |
"pay_type": pay_type
|
| 27 |
}
|
| 28 |
-
|
| 29 |
response = requests.post(url, data=data)
|
| 30 |
if response.status_code == 200:
|
| 31 |
try:
|
|
@@ -39,34 +36,32 @@ with gr.Blocks() as app:
|
|
| 39 |
with gr.Tab("์นด๋ ๊ฒฐ์ ์น์ธ ์์ฒญ"):
|
| 40 |
with gr.Row():
|
| 41 |
with gr.Column(scale=1):
|
| 42 |
-
onfftid = gr.
|
| 43 |
tot_amt = gr.Number(label="๊ฒฐ์ ๊ธ์ก (๊ธ์ก์ ์
๋ ฅํ์ธ์)")
|
| 44 |
com_tax_amt = gr.Number(label="๊ณผ์ธ์น์ธ๊ธ์ก (ํ์์ ์
๋ ฅ)")
|
| 45 |
com_free_amt = gr.Number(label="๋น๊ณผ์ธ์น์ธ๊ธ์ก (ํ์์ ์
๋ ฅ)")
|
| 46 |
com_vat_amt = gr.Number(label="๋ถ๊ฐ์ธ (ํ์์ ์
๋ ฅ)")
|
| 47 |
card_no = gr.Textbox(label="์นด๋๋ฒํธ", placeholder="์นด๋๋ฒํธ๋ฅผ ์
๋ ฅํ์ธ์")
|
| 48 |
-
install_period = gr.Dropdown([str(i).zfill(2) for i in range(13)], label="ํ ๋ถ๊ธฐ๊ฐ ์ ํ")
|
| 49 |
user_nm = gr.Textbox(label="๊ฒฐ์ ์๋ช
", placeholder="๊ฒฐ์ ์์ ์ด๋ฆ์ ์
๋ ฅํ์ธ์")
|
| 50 |
user_phone2 = gr.Textbox(label="๊ฒฐ์ ์ ์ฐ๋ฝ์ฒ", placeholder="์ฐ๋ฝ์ฒ๋ฅผ ์
๋ ฅํ์ธ์")
|
| 51 |
product_nm = gr.Textbox(label="์ํ๋ช
", placeholder="์ํ๋ช
์ ์
๋ ฅํ์ธ์")
|
| 52 |
expire_date = gr.Textbox(label="์ ํจ๊ธฐ๊ฐ(YYMM)", placeholder="์: 2306")
|
| 53 |
-
cert_type = gr.Radio(choices=["0 - ์ธ์ฆ", "1 - ๋น์ธ์ฆ"], label="์ธ์ฆ์ฌ๋ถ ์ ํ")
|
| 54 |
-
card_user_type = gr.Radio(choices=["0 - ๊ฐ์ธ์นด๋", "1 - ๋ฒ์ธ์นด๋"], label="์นด๋์ ํ ์ ํ")
|
| 55 |
auth_value = gr.Textbox(label="์ธ์ฆ๋ฒํธ", placeholder="๊ฐ์ธ์ ์ฃผ๋ฏผ๋ฒํธ ์ 6์๋ฆฌ, ๋ฒ์ธ์ ์ฌ์
์๋ฑ๋ก๋ฒํธ")
|
| 56 |
password = gr.Textbox(label="์นด๋ ๋น๋ฐ๋ฒํธ ์ 2์๋ฆฌ", placeholder="๋น๋ฐ๋ฒํธ ์ 2์๋ฆฌ")
|
| 57 |
-
card_nm = gr.Textbox(label="์นด๋์ฌ๋ช
(ํ์์ ์
๋ ฅ)",
|
| 58 |
-
order_no = gr.Textbox(label="์ฃผ๋ฌธ๋ฒํธ (ํ์์ ์
๋ ฅ)",
|
| 59 |
-
pay_type = gr.
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
submit_button.click(
|
| 65 |
fn=card_authorization,
|
| 66 |
-
inputs=[onfftid
|
| 67 |
-
user_nm, user_phone2, product_nm, expire_date, cert_type, card_user_type,
|
| 68 |
-
auth_value, password, card_nm, order_no, pay_type.value],
|
| 69 |
outputs=result_area
|
| 70 |
)
|
| 71 |
|
| 72 |
-
app.launch()
|
|
|
|
| 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 = {
|
| 7 |
"onfftid": onfftid,
|
|
|
|
| 23 |
"order_no": order_no,
|
| 24 |
"pay_type": pay_type
|
| 25 |
}
|
|
|
|
| 26 |
response = requests.post(url, data=data)
|
| 27 |
if response.status_code == 200:
|
| 28 |
try:
|
|
|
|
| 36 |
with gr.Tab("์นด๋ ๊ฒฐ์ ์น์ธ ์์ฒญ"):
|
| 37 |
with gr.Row():
|
| 38 |
with gr.Column(scale=1):
|
| 39 |
+
onfftid = gr.Textbox(label="์จ์คํ์ฝ๋ฆฌ์ TID", value="OFPT000000011017")
|
| 40 |
tot_amt = gr.Number(label="๊ฒฐ์ ๊ธ์ก (๊ธ์ก์ ์
๋ ฅํ์ธ์)")
|
| 41 |
com_tax_amt = gr.Number(label="๊ณผ์ธ์น์ธ๊ธ์ก (ํ์์ ์
๋ ฅ)")
|
| 42 |
com_free_amt = gr.Number(label="๋น๊ณผ์ธ์น์ธ๊ธ์ก (ํ์์ ์
๋ ฅ)")
|
| 43 |
com_vat_amt = gr.Number(label="๋ถ๊ฐ์ธ (ํ์์ ์
๋ ฅ)")
|
| 44 |
card_no = gr.Textbox(label="์นด๋๋ฒํธ", placeholder="์นด๋๋ฒํธ๋ฅผ ์
๋ ฅํ์ธ์")
|
| 45 |
+
install_period = gr.Dropdown([str(i).zfill(2) for i in range(13)], label="ํ ๋ถ๊ธฐ๊ฐ ์ ํ", value="00")
|
| 46 |
user_nm = gr.Textbox(label="๊ฒฐ์ ์๋ช
", placeholder="๊ฒฐ์ ์์ ์ด๋ฆ์ ์
๋ ฅํ์ธ์")
|
| 47 |
user_phone2 = gr.Textbox(label="๊ฒฐ์ ์ ์ฐ๋ฝ์ฒ", placeholder="์ฐ๋ฝ์ฒ๋ฅผ ์
๋ ฅํ์ธ์")
|
| 48 |
product_nm = gr.Textbox(label="์ํ๋ช
", placeholder="์ํ๋ช
์ ์
๋ ฅํ์ธ์")
|
| 49 |
expire_date = gr.Textbox(label="์ ํจ๊ธฐ๊ฐ(YYMM)", placeholder="์: 2306")
|
| 50 |
+
cert_type = gr.Radio(choices=["0 - ์ธ์ฆ", "1 - ๋น์ธ์ฆ"], label="์ธ์ฆ์ฌ๋ถ ์ ํ", value="0 - ์ธ์ฆ")
|
| 51 |
+
card_user_type = gr.Radio(choices=["0 - ๊ฐ์ธ์นด๋", "1 - ๋ฒ์ธ์นด๋"], label="์นด๋์ ํ ์ ํ", value="0 - ๊ฐ์ธ์นด๋")
|
| 52 |
auth_value = gr.Textbox(label="์ธ์ฆ๋ฒํธ", placeholder="๊ฐ์ธ์ ์ฃผ๋ฏผ๋ฒํธ ์ 6์๋ฆฌ, ๋ฒ์ธ์ ์ฌ์
์๋ฑ๋ก๋ฒํธ")
|
| 53 |
password = gr.Textbox(label="์นด๋ ๋น๋ฐ๋ฒํธ ์ 2์๋ฆฌ", placeholder="๋น๋ฐ๋ฒํธ ์ 2์๋ฆฌ")
|
| 54 |
+
card_nm = gr.Textbox(label="์นด๋์ฌ๋ช
(ํ์์ ์
๋ ฅ)", placeholder="์นด๋์ฌ๋ช
์ ์
๋ ฅํ์ธ์")
|
| 55 |
+
order_no = gr.Textbox(label="์ฃผ๋ฌธ๋ฒํธ (ํ์์ ์
๋ ฅ)", placeholder="์ฃผ๋ฌธ๋ฒํธ๋ฅผ ์
๋ ฅํ์ธ์")
|
| 56 |
+
pay_type = gr.Textbox(label="๊ฒฐ์ ํ์
", value="card")
|
| 57 |
+
|
| 58 |
+
submit_button = gr.Button("๊ฒฐ์ ์น์ธ ์์ฒญ")
|
| 59 |
+
result_area = gr.JSON(label="๊ฒฐ๊ณผ")
|
| 60 |
|
| 61 |
submit_button.click(
|
| 62 |
fn=card_authorization,
|
| 63 |
+
inputs=[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],
|
|
|
|
|
|
|
| 64 |
outputs=result_area
|
| 65 |
)
|
| 66 |
|
| 67 |
+
app.launch()
|