Spaces:
Sleeping
Sleeping
Update garuda/api/router.py
Browse files- garuda/api/router.py +5 -2
garuda/api/router.py
CHANGED
|
@@ -19,7 +19,7 @@ from ..data.flight_dummy_data import (
|
|
| 19 |
router = APIRouter(prefix="/flights", tags=["Flights"])
|
| 20 |
|
| 21 |
book_id_counter = 1
|
| 22 |
-
|
| 23 |
|
| 24 |
# ======================
|
| 25 |
# helper
|
|
@@ -238,7 +238,8 @@ def refund(data: RefundRequest):
|
|
| 238 |
refund_amount = booking["price_paid"] #* 0.8
|
| 239 |
|
| 240 |
item = {
|
| 241 |
-
"refund_id": str(uuid4()),
|
|
|
|
| 242 |
"booking_id": booking["booking_id"],
|
| 243 |
"refund_amount": refund_amount,
|
| 244 |
"status": "pending"
|
|
@@ -246,6 +247,8 @@ def refund(data: RefundRequest):
|
|
| 246 |
|
| 247 |
refund_db.append(item)
|
| 248 |
|
|
|
|
|
|
|
| 249 |
return item
|
| 250 |
|
| 251 |
|
|
|
|
| 19 |
router = APIRouter(prefix="/flights", tags=["Flights"])
|
| 20 |
|
| 21 |
book_id_counter = 1
|
| 22 |
+
refund_id_counter = 1
|
| 23 |
|
| 24 |
# ======================
|
| 25 |
# helper
|
|
|
|
| 238 |
refund_amount = booking["price_paid"] #* 0.8
|
| 239 |
|
| 240 |
item = {
|
| 241 |
+
# "refund_id": str(uuid4()),
|
| 242 |
+
"refund_id": f"RF{refund_id_counter:04d}"
|
| 243 |
"booking_id": booking["booking_id"],
|
| 244 |
"refund_amount": refund_amount,
|
| 245 |
"status": "pending"
|
|
|
|
| 247 |
|
| 248 |
refund_db.append(item)
|
| 249 |
|
| 250 |
+
refund_id_counter += 1
|
| 251 |
+
|
| 252 |
return item
|
| 253 |
|
| 254 |
|