|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
import logging |
|
|
|
|
import requests |
|
|
|
|
import json |
|
|
|
|
import datetime |
|
|
|
|
|
|
|
|
|
from mixpanel import Mixpanel |
|
|
|
|
|
|
|
|
|
@ -70,11 +71,19 @@ def transaction_to_roistat(user_id, payment_id, event_name, amount, time, status |
|
|
|
|
except: |
|
|
|
|
resp_json = None |
|
|
|
|
|
|
|
|
|
with open("./roistat.log", "a") as text_file: |
|
|
|
|
|
|
|
|
|
if resp.status_code != 200 or not resp_json or not resp_json.get('processed'): |
|
|
|
|
logger.error('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % ( |
|
|
|
|
payment_id, amount, resp.text)) |
|
|
|
|
logger_roistat.debug('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % ( |
|
|
|
|
payment_id, amount, resp.text)) |
|
|
|
|
|
|
|
|
|
text_file.write(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s \n' % ( |
|
|
|
|
payment_id, amount, resp.text)) |
|
|
|
|
else: |
|
|
|
|
logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp.text)) |
|
|
|
|
logger_roistat.debug('TRANSACTION_TO_ROISTAT: ' + str(resp.text)) |
|
|
|
|
|
|
|
|
|
text_file.write(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s \n' % ( |
|
|
|
|
payment_id, amount, resp.text)) |
|
|
|
|
|