|
@@ -1,3 +1,5 @@
|
|
|
+import uuid
|
|
|
+
|
|
|
from fastapi import APIRouter
|
|
|
from linepay import LinePayApi
|
|
|
from fastapi.templating import Jinja2Templates
|
|
@@ -8,15 +10,14 @@ templates = Jinja2Templates(directory="templates")
|
|
|
router = APIRouter()
|
|
|
|
|
|
LINE_PAY_CHANNEL_ID = "1656387996"
|
|
|
-SECRET_KEY = \
|
|
|
- "df2f77bd544240801a048bd4293afd8eeb7fff3cb7050e42c791db4b83ebadcd"
|
|
|
+SECRET_KEY = "37336af5452f74ee871a9fa38d81602e"
|
|
|
|
|
|
HOST_NAME = "https://api.ptt.cx:8750"
|
|
|
# Line Pay Config
|
|
|
LINE_PAY_CHANNEL_ID = LINE_PAY_CHANNEL_ID
|
|
|
LINE_PAY_CHANNEL_SECRET = SECRET_KEY
|
|
|
# LINE_PAY_REQEST_BASE_URL = "https://{}".format(HOST_NAME)
|
|
|
-LINE_PAY_REQEST_BASE_URL = "hhttps://api.ptt.cx:8750/api/v1/linepay"
|
|
|
+LINE_PAY_REQEST_BASE_URL = "https://api.ptt.cx:8750"
|
|
|
line = LinePayApi(
|
|
|
LINE_PAY_CHANNEL_ID, LINE_PAY_CHANNEL_SECRET, is_sandbox=True
|
|
|
)
|
|
@@ -28,7 +29,7 @@ CACHE = {}
|
|
|
# Request
|
|
|
@router.post('/request')
|
|
|
async def pay_request():
|
|
|
- order_id = "20211227011"
|
|
|
+ order_id = str(uuid.uuid4())
|
|
|
amount = "1"
|
|
|
currency = "TWD"
|
|
|
|