Simon Volpert gmipay / 17bd341
Integrate payment checking and recording of access rights updates The test address used to check the functionality is ommitted from this commit If you wish to perform tests at this point, use your own Simon Volpert 3 years ago
1 changed file(s) with 12 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
+12
-5
get less more
208208 # First request to access file by this client
209209 if access_index == -1:
210210 # Create an invoice
211 record = [request_file.name, 'invoice', 'bitcoin cash address', '0.0', datetime.datetime.now().isoformat(' ', timespec='seconds')]
211 balance = get_balance(test_address)
212 record = [request_file.name, 'invoice', test_address, str(balance), datetime.datetime.now().isoformat(' ', timespec='seconds')]
212213 access_data.append(record)
213214 write_access_data()
214215 # Show payment request page
215216 show_invoice()
216217 raise SystemExit
217218 # Second request to access file by this client
218 elif len(record) > 1 and record[0] != 'paid':
219 elif len(record) > 1 and record[1] != 'paid':
220 balance = float(record[3])
221 new_balance = get_balance(record[2])
222 if new_balance < balance + default_price:
223 record[4] = datetime.datetime.now().isoformat(' ', timespec='seconds')
224 write_access_data()
225 show_invoice()
226 raise SystemExit
219227 # Mark payment as received
220228 record[1] = 'paid'
221 for num, line in enumerate(access_data):
222 access_file[num] = ' '.join(line)
223 write_state(cert_hash, access_file)
229 record[3] = str(new_balance - balance)
230 write_access_data()
224231 # Give the client their file
225232 if len(record) > 1 and record[1] == 'paid':
226233 # Patch mime type definitions with Gemini-specific types