Kgshop commited on
Commit
2af774e
·
verified ·
1 Parent(s): ea6ad62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -9
app.py CHANGED
@@ -1192,8 +1192,7 @@ ORDER_TEMPLATE = '''
1192
  messages: [
1193
  {
1194
  address: '{{ ton_wallet_address }}',
1195
- amount: '{{ (order.total_price * 10**9)|int }}', // nanoTONs
1196
- payload: btoa('order_id:{{ order.id }}') // base64 encoded payload
1197
  }
1198
  ]
1199
  };
@@ -1207,10 +1206,6 @@ ORDER_TEMPLATE = '''
1207
  paymentStatus.textContent = '✅ Транзакция отправлена! Проверяем...';
1208
  paymentStatus.className = 'status-paid';
1209
 
1210
- // NOTE: For a real application, you must verify the transaction on the backend
1211
- // by listening to blockchain events or polling. This is a client-side confirmation.
1212
-
1213
- // Update order status on the backend (client-side trigger)
1214
  fetch('/update_order_status_after_payment', {
1215
  method: 'POST',
1216
  headers: { 'Content-Type': 'application/json' },
@@ -1851,9 +1846,6 @@ def update_order_status_after_payment():
1851
 
1852
  data = load_data()
1853
  if order_id in data.get('orders', {}):
1854
- # In a real app, you would verify the transaction using the `boc` from the payload
1855
- # against a TON blockchain API before changing the status.
1856
- # For this example, we trust the client-side confirmation.
1857
  data['orders'][order_id]['status'] = 'paid'
1858
  save_data(data)
1859
  logging.info(f"Order {order_id} status updated to 'paid' after client-side confirmation.")
 
1192
  messages: [
1193
  {
1194
  address: '{{ ton_wallet_address }}',
1195
+ amount: '{{ (order.total_price * 10**9)|int }}' // nanoTONs
 
1196
  }
1197
  ]
1198
  };
 
1206
  paymentStatus.textContent = '✅ Транзакция отправлена! Проверяем...';
1207
  paymentStatus.className = 'status-paid';
1208
 
 
 
 
 
1209
  fetch('/update_order_status_after_payment', {
1210
  method: 'POST',
1211
  headers: { 'Content-Type': 'application/json' },
 
1846
 
1847
  data = load_data()
1848
  if order_id in data.get('orders', {}):
 
 
 
1849
  data['orders'][order_id]['status'] = 'paid'
1850
  save_data(data)
1851
  logging.info(f"Order {order_id} status updated to 'paid' after client-side confirmation.")