Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -418,6 +418,7 @@ def view_receipt(transaction_id):
|
|
| 418 |
return jsonify({'error': 'Transaction not found'}), 404
|
| 419 |
|
| 420 |
image_url = transaction_data.get('image_url')
|
|
|
|
| 421 |
return jsonify({'error': str(e)+f"image: {image_url}"}), 500
|
| 422 |
|
| 423 |
@app.route('/api/admin/receipt/<string:transaction_id>/download', methods=['GET'])
|
|
@@ -441,9 +442,10 @@ def download_receipt(transaction_id):
|
|
| 441 |
io.BytesIO(r.content),
|
| 442 |
mimetype='image/jpeg',
|
| 443 |
as_attachment=True,
|
| 444 |
-
|
| 445 |
)
|
| 446 |
except Exception as e:
|
|
|
|
| 447 |
return jsonify({'error': str(e)}), 500
|
| 448 |
|
| 449 |
|
|
|
|
| 418 |
return jsonify({'error': 'Transaction not found'}), 404
|
| 419 |
|
| 420 |
image_url = transaction_data.get('image_url')
|
| 421 |
+
print(image_url)
|
| 422 |
return jsonify({'error': str(e)+f"image: {image_url}"}), 500
|
| 423 |
|
| 424 |
@app.route('/api/admin/receipt/<string:transaction_id>/download', methods=['GET'])
|
|
|
|
| 442 |
io.BytesIO(r.content),
|
| 443 |
mimetype='image/jpeg',
|
| 444 |
as_attachment=True,
|
| 445 |
+
attachment_filename='receipt.jpg'
|
| 446 |
)
|
| 447 |
except Exception as e:
|
| 448 |
+
print(f"Error in view_receipt/download_receipt: {e}") # Print the exception to your server logs
|
| 449 |
return jsonify({'error': str(e)}), 500
|
| 450 |
|
| 451 |
|