|
@@ -12,16 +12,16 @@ from starlette.responses import HTMLResponse
|
|
|
from sqlalchemy.orm import Session
|
|
|
from fastapi.encoders import jsonable_encoder
|
|
|
|
|
|
-from .database import get_db_session
|
|
|
-from .crud import create_order, get_order, get_orders
|
|
|
-from .schemas import order_info_linepay as orderSechmas
|
|
|
+from sql.database import get_db_session
|
|
|
+from sql.crud import create_order, get_order, get_orders
|
|
|
+from sql.schemas import order_info_linepay as orderSechmas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# dotenv
|
|
|
-dotenv_path = join(dirname(__file__),'./env/.env')
|
|
|
-# dotenv_path = join(dirname(__file__),'./env/test.env') ## sandbox
|
|
|
+# dotenv_path = join(dirname(__file__),'./env/.env')
|
|
|
+dotenv_path = join(dirname(__file__),'./env/test.env') ## sandbox
|
|
|
load_dotenv(dotenv_path)
|
|
|
|
|
|
# logger (TBD)
|
|
@@ -33,8 +33,8 @@ templates = Jinja2Templates(directory="templates")
|
|
|
LINE_PAY_CHANNEL_ID = os.environ.get("LINE_PAY_CHANNEL_ID")
|
|
|
LINE_PAY_CHANNEL_SECRET = os.environ.get("LINE_PAY_CHANNEL_SECRET")
|
|
|
LINE_PAY_REQEST_BASE_URL = "https://{}".format(os.environ.get("HOST_NAME"))
|
|
|
-line = LinePayApi(LINE_PAY_CHANNEL_ID, LINE_PAY_CHANNEL_SECRET, is_sandbox=False)
|
|
|
-# line = LinePayApi(LINE_PAY_CHANNEL_ID, LINE_PAY_CHANNEL_SECRET, is_sandbox=True)
|
|
|
+# line = LinePayApi(LINE_PAY_CHANNEL_ID, LINE_PAY_CHANNEL_SECRET, is_sandbox=False)
|
|
|
+line = LinePayApi(LINE_PAY_CHANNEL_ID, LINE_PAY_CHANNEL_SECRET, is_sandbox=True)
|
|
|
|
|
|
# CACHE
|
|
|
CACHE = {}
|
|
@@ -44,12 +44,12 @@ app = FastAPI()
|
|
|
|
|
|
|
|
|
@app.get('/')
|
|
|
-def hellow():
|
|
|
+def hello():
|
|
|
return {"Hello" : "World"}
|
|
|
|
|
|
## Request
|
|
|
@app.post('/request', response_class=HTMLResponse)
|
|
|
-async def pay_request(userinfo: schemas.UserInfo, db: Session = Depends(get_db)):
|
|
|
+async def pay_request():
|
|
|
order_id = str(uuid.uuid4())
|
|
|
amount = 1200
|
|
|
currency = "TWD"
|