Repository navigation
Fix: Add pickup_code generation to Razorpay webhook for offline reliability - #32
Conversation
| "payment_id": payment_id, | ||
| "razorpay_payment_data": payment, | ||
| "pickup_code": pickup_code, | ||
| "updated_at": firestore.SERVER_TIMESTAMP |
Check notice
Code scanning / Bandit (reported by Codacy)
Standard pseudo-random generators are not suitable for security/cryptographic purposes. Note
There was a problem hiding this comment.
Pylintpython3 (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Pylint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
| snapshot = order_ref.get(transaction=transaction) | ||
| if not snapshot.exists: | ||
| print(f"❌ Order {internal_order_id} not found!") | ||
| return |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 6 spaces, expected 12 (bad-indentation) Warning
| print(f"❌ Order {internal_order_id} not found!") | ||
| return | ||
|
|
||
| current_data = snapshot.to_dict() |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 6 spaces, expected 12 (bad-indentation) Warning
| return | ||
|
|
||
| current_data = snapshot.to_dict() | ||
|
|
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 6 spaces, expected 12 (bad-indentation) Warning
|
|
||
| current_data = snapshot.to_dict() | ||
|
|
||
| if current_data.get("status") == "PAID": |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 8 spaces, expected 16 (bad-indentation) Warning
| current_data = snapshot.to_dict() | ||
|
|
||
| if current_data.get("status") == "PAID": | ||
| print(f"ℹ️ Order {internal_order_id} was already PAID. Skipping update.") |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 8 spaces, expected 16 (bad-indentation) Warning
| "payment_id": payment_id, | ||
| "razorpay_payment_data": payment, | ||
| "pickup_code": pickup_code, | ||
| "updated_at": firestore.SERVER_TIMESTAMP |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 8 spaces, expected 16 (bad-indentation) Warning
| "pickup_code": pickup_code, | ||
| "updated_at": firestore.SERVER_TIMESTAMP | ||
| }) | ||
| print(f"✅ SUCCESS: Generated Pickup Code {pickup_code} for Order {internal_order_id}") |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 8 spaces, expected 16 (bad-indentation) Warning
| except Exception as e: | ||
| print(f"❌ Transaction failed: {e}") | ||
|
|
||
| else: |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 8 spaces, expected 16 (bad-indentation) Warning
| else: | ||
| print(f"⚠️ Payment received without internal_order_id: {payment['id']}") | ||
|
|
||
| return {"status": "ok"} |
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 8 spaces, expected 16 (bad-indentation) Warning
Check warning
Code scanning / Prospector (reported by Codacy)
Bad indentation. Found 8 spaces, expected 16 (bad-indentation) Warning
app/webhook.py: Saved and secure.