Spaces:
Sleeping
Sleeping
Update garuda/api/router.py
Browse files- garuda/api/router.py +10 -2
garuda/api/router.py
CHANGED
|
@@ -160,12 +160,20 @@ def refund(data: RefundRequest):
|
|
| 160 |
"messages":"Booking not found!"
|
| 161 |
}
|
| 162 |
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
item = {
|
| 166 |
"refund_id": str(uuid4()),
|
| 167 |
"booking_id": booking["booking_id"],
|
| 168 |
-
"refund_amount": refund_amount
|
|
|
|
| 169 |
}
|
| 170 |
|
| 171 |
refund_db.append(item)
|
|
|
|
| 160 |
"messages":"Booking not found!"
|
| 161 |
}
|
| 162 |
|
| 163 |
+
for r in refund_db:
|
| 164 |
+
if str(r["booking_id"]) == data.booking_id:
|
| 165 |
+
return {
|
| 166 |
+
"status":401,
|
| 167 |
+
"messages":"Refund On-Progress"
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
refund_amount = booking["price_paid"] #* 0.8
|
| 171 |
|
| 172 |
item = {
|
| 173 |
"refund_id": str(uuid4()),
|
| 174 |
"booking_id": booking["booking_id"],
|
| 175 |
+
"refund_amount": refund_amount,
|
| 176 |
+
"status": "on-progress"
|
| 177 |
}
|
| 178 |
|
| 179 |
refund_db.append(item)
|