def patch(self):
     """
     Retrieves the information of an user
     :return:
     """
     data = request.get_json(force=True)
     accounts_controller = AccountsController()
     account = accounts_controller.update_account(account_data=data)
     return jsonify(account)
 def get(self):
     """
     Retrieves the information of an user
     :return:
     """
     data = request.get_json(force=True)
     accounts_controller = AccountsController()
     account = accounts_controller.retrieve_account(filters=data)
     return jsonify(account)
 def validate_account(self, params):
     self.start.is_valid = UsersController.validate_user(
         params, self.workflow_log)
     if self.start.is_valid:
         bank_account = AccountsController.get_bank_account(
             params.get('user_id'), self.workflow_log)
         self.account = Account(bank_account.get('user_id'),
                                bank_account.get('balance'))
         condition_obj = namedtuple('obj', ['balance', 'is_valid'])(
             self.account.balance, self.start.is_valid)
         self.validator = ConditionValidator(condition_obj)
 def get_account_balance(self, params):
     AccountsController.get_bank_account_balance(params, self.workflow_log)
 def deposit_money(self, params):
     AccountsController.withdraw_or_deposit_money(params,
                                                  self.workflow_log,
                                                  transaction='CR',
                                                  currency='COP')
 def withdraw_in_dollars(self, params):
     AccountsController.withdraw_or_deposit_money(params,
                                                  self.workflow_log,
                                                  transaction='DB',
                                                  currency='USD')