diff --git a/apps/trade/models.py b/apps/trade/models.py index 67c881d..3ea606f 100644 --- a/apps/trade/models.py +++ b/apps/trade/models.py @@ -449,6 +449,15 @@ def set_verified(self, session, verified, verification_data, bonus_account): return True return False +class FingerPrints(Base): + __tablename__ = 'finger_prints' + id = Column(Integer, primary_key=True) + user_id = Column(Integer, ForeignKey('users.id') ,nullable=False) + broker_id = Column(Integer, ForeignKey('users.id') ,nullable=False) + finger_print = Column(Integer, nullable=False) + remote_ip = Column(String, nullable=False) + + class Position(Base): __tablename__ = 'position' @@ -1615,7 +1624,8 @@ def get_list(session, broker_id, account_id, status_list, page_size, offset, fil return query @staticmethod - def create(session, user, broker, currency, amount, method, data, client_order_id, email_lang): + def create(session, user, broker, currency, amount, method, data, client_order_id, email_lang, + user_withdraw_percent_fee=None, user_withdraw_fixed_fee=None): import uuid confirmation_token = uuid.uuid4().hex @@ -1629,6 +1639,12 @@ def create(session, user, broker, currency, amount, method, data, client_order_ fixed_fee = withdraw_method['fixed_fee'] break + if user_withdraw_percent_fee is not None: + percent_fee = min(percent_fee, user_withdraw_percent_fee) + + if user_withdraw_fixed_fee is not None: + fixed_fee = min(fixed_fee, user_withdraw_fixed_fee) + withdraw_record = Withdraw(user_id = user.id, account_id = user.id, username = user.username, diff --git a/apps/trade/views.py b/apps/trade/views.py index 9061027..1bee7ea 100644 --- a/apps/trade/views.py +++ b/apps/trade/views.py @@ -942,6 +942,9 @@ def processWithdrawRequest(session, msg): verification_level = session.user.verified + user_withdraw_percent_fee = session.user.withdraw_percent_fee + user_withdraw_fixed_fee = session.user.withdraw_fixed_fee + withdraw_structure = json.loads(session.broker.withdraw_structure) limits = None for withdraw_method in withdraw_structure[msg.get('Currency')]: @@ -977,7 +980,9 @@ def processWithdrawRequest(session, msg): msg.get('Method'), msg.get('Data', {} ), client_order_id, - session.email_lang) + session.email_lang, + user_withdraw_percent_fee, + user_withdraw_fixed_fee) TradeApplication.instance().db_session.commit() @@ -1428,7 +1433,7 @@ def processProcessDeposit(session, msg): found_deposit_by_secret = True break - if not found_deposit_by_secret and deposit_list: + if not found_deposit_by_secret and deposit is not None: # we found deposits using the same secret, but with different data. # this means that the user reused the deposit address. Let's create another # deposit record based on the last deposit we found and process it. diff --git a/apps/ws_gateway/verification_webhook_handler.py b/apps/ws_gateway/verification_webhook_handler.py index d8b91ec..2080425 100644 --- a/apps/ws_gateway/verification_webhook_handler.py +++ b/apps/ws_gateway/verification_webhook_handler.py @@ -46,6 +46,7 @@ def post(self, *args, **kwargs): address_postal = None address_country = None address_country_code = None + finger_print = None photo_fields = [] id_fields = [] @@ -96,6 +97,8 @@ def post(self, *args, **kwargs): address_country = value['country'] address_country_code = get_country_code(address_country) + if 'finger_print' in key: + finger_print = value #form stack if 'name-first' in key: @@ -173,6 +176,7 @@ def post(self, *args, **kwargs): 'formID': formID, 'submissionID': submissionID, 'created_at': createdAt, + 'browser_finger_print': finger_print, 'name': { 'first': first_name, 'middle': middle_name, diff --git a/requirements.txt b/requirements.txt index 0343e46..6367149 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,5 @@ appdirs mailchimp pycountry pyboleto -mock \ No newline at end of file +mock +yowsup2