aiqtech commited on
Commit
a4cbdf0
ยท
verified ยท
1 Parent(s): b7c24d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -18
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.Label(label="์˜จ์˜คํ”„์ฝ”๋ฆฌ์•„ TID", value="OFPT000000011017")
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="์นด๋“œ์‚ฌ๋ช… (ํ•„์š”์‹œ ์ž…๋ ฅ)", optional=True, placeholder="์นด๋“œ์‚ฌ๋ช…์„ ์ž…๋ ฅํ•˜์„ธ์š”")
58
- order_no = gr.Textbox(label="์ฃผ๋ฌธ๋ฒˆํ˜ธ (ํ•„์š”์‹œ ์ž…๋ ฅ)", optional=True, placeholder="์ฃผ๋ฌธ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”")
59
- pay_type = gr.Label(label="๊ฒฐ์ œํƒ€์ž…", value="card")
60
-
61
- submit_button = gr.Button("๊ฒฐ์ œ ์Šน์ธ ์š”์ฒญ")
62
- result_area = gr.JSON(label="๊ฒฐ๊ณผ")
63
 
64
  submit_button.click(
65
  fn=card_authorization,
66
- inputs=[onfftid.value, tot_amt, com_tax_amt, com_free_amt, com_vat_amt, card_no, install_period,
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()