-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
from models import ResponseDto, BalanceRequestDto, BookingRequestDto | ||
from atoss import get_balance, post_booking | ||
from fastapi import FastAPI | ||
from fastapi import FastAPI, HTTPException | ||
|
||
|
||
app = FastAPI() | ||
|
||
@app.post('/api/balance') | ||
def balance(body: BalanceRequestDto) -> ResponseDto: | ||
return get_balance( | ||
personal_number=body.personal_number, | ||
pin=body.pin, | ||
) | ||
try: | ||
return get_balance( | ||
personal_number=body.personal_number, | ||
pin=body.pin, | ||
) | ||
except: | ||
raise HTTPException(status_code=403) | ||
|
||
@app.post('/api/booking') | ||
def booking(body: BookingRequestDto) -> ResponseDto: | ||
return post_booking( | ||
personal_number=body.personal_number, | ||
pin=body.pin, | ||
action=body.action, | ||
type=body.type, | ||
) | ||
|
||
try: | ||
return post_booking( | ||
personal_number=body.personal_number, | ||
pin=body.pin, | ||
action=body.action, | ||
type=body.type, | ||
) | ||
except: | ||
raise HTTPException(status_code=403) |