Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wallet_withdrawals #545

Open
freelancing-solutions opened this issue Jul 27, 2021 · 0 comments
Open

add wallet_withdrawals #545

freelancing-solutions opened this issue Jul 27, 2021 · 0 comments
Labels

Comments

@freelancing-solutions
Copy link
Owner

add wallet_withdrawals

        if await self.can_update_wallet_async(uid=uid) is True:
            wallet_instance: WalletModel = WalletModel.query(WalletModel.uid == uid).get_async().get_result()
            if isinstance(wallet_instance, WalletModel):
                if isinstance(add, int):
                    wallet_instance.available_funds.amount += add
                if isinstance(sub, int):
                    wallet_instance.available_funds.amount -= sub
                key = wallet_instance.put_async().get_result()
                if key is None:
                    message: str = "General error updating database"
                    raise DataServiceError(status=500, description=message)
                message: str = "Successfully created transaction"
                return jsonify({'status': True, 'payload': wallet_instance.to_dict(),
                                'message': message}), 200
        message: str = "Unable to find wallet"
        return jsonify({'status': False, 'message': message}), 500


    # TODO add wallet_withdrawals

ade0347cce800d207fe5593d26f82fe717324578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant