Giter Site home page Giter Site logo

bitcart / bitcart Goto Github PK

View Code? Open in Web Editor NEW
483.0 14.0 103.0 6.62 MB

https://bitcart.ai

License: MIT License

Python 99.05% Shell 0.58% Makefile 0.13% Mako 0.06% Jinja 0.17%
python docker docker-compose bitcoin electrum merchant litecoin fastapi starlette hacktoberfest

bitcart's Introduction

Bitcart

Github All Contributors CircleCI Codecov Python versions

Bitcart is a platform for merchants, users and developers which offers easy setup and use.

Linked repositories

Our ecosystem consists of a few packages, this is our central repository.

It is recommended to propose feature requests to Bitcart ecosystem as a whole on that repository.

Full list of our repositories:

https://github.com/bitcart/bitcart - Bitcart Core Daemons and Merchants API

https://github.com/bitcart/bitcart-admin - The admin panel of Bitcart

https://github.com/bitcart/bitcart-store - Bitcart ready store

https://github.com/bitcart/bitcart-docker - Docker packaging, base for all deployment methods

https://github.com/bitcart/bitcart-sdk - Python library for coins connection

https://github.com/bitcart/bitccl - The BitCCL scripting language for checkout flow automation

https://github.com/bitcart/bitcart-docs - Bitcart documentation

https://github.com/bitcart/bitcart-site - Bitcart official site

Docs

Docs are available at https://docs.bitcart.ai or in our docs repository

Contributing

See our contributing guidelines for details.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

MrNaif2018
MrNaif2018

🚧 💻 📖 🎨
tomasmor42
tomasmor42

💻
Yağız Değirmenci
Yağız Değirmenci

💻
Weidong Sun
Weidong Sun

💻
kartecianos
kartecianos

💻
CYBORG
CYBORG

🎨
Saksham Singh
Saksham Singh

🎨
Orestis Charalampakos
Orestis Charalampakos

🎨 💻
TobyAsE
TobyAsE

💻 🎨
Shadman Ahmed
Shadman Ahmed

🎨
Karol Trzeszczkowski
Karol Trzeszczkowski

💻
Maxime Koitsalu
Maxime Koitsalu

💻 🎨
Shubham-Singh-Rajput
Shubham-Singh-Rajput

🌍
Nicolás Giacconi
Nicolás Giacconi

💻 🎨
leovoon
leovoon

💻 🎨 ️️️️♿️
Mustapha Nezzari
Mustapha Nezzari

🌍
surfer190
surfer190

📖
restyler
restyler

📖
gruve-p
gruve-p

💻
g00g1
g00g1

💻
RAVAAN
RAVAAN

🛡️

This project follows the all-contributors specification. Contributions of any kind welcome!

Copyright and License

Copyright (C) 2019 MrNaif2018

Licensed under the MIT license

bitcart's People

Contributors

allcontributors[bot] avatar dependabot-preview[bot] avatar dependabot[bot] avatar fawazahmed0 avatar g00g1 avatar ghostwalkerj avatar gruve-p avatar karoltrzeszczkowski avatar mrnaif2018 avatar mrnaif2022 avatar pyup-bot avatar renovate[bot] avatar stevenwilliams avatar timoxgagarin avatar tomasmor42 avatar zakhar-petukhov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitcart's Issues

Wallet improvements

This issue contains a list of improvements in the wallet area (wallet operations, UI/UX):

  • Add ability to create wallet right via the admin interface, display the seed and (optionally) create a wallet by using xpub only
  • Hardware wallet support
  • More utilities (check electrum commands/features and implement them in the UI)
  • Better wallet handling in case of disabling/enabling new currencies
  • Improve wallet processing, reduce sync times (maybe re-consider current approach and consider the fact that the daemon might be syncing, it takes a bit of time, or that the wallet is large, plus some daemons might be slower than others)
  • Avoid the cases when user is unable to edit wallets because of invalid xpub entered somehow/disabled currency/daemon unavailable
  • In continuation: currently, on server startup, user must wait quite some time for all wallets to load to get access to the wallets page, server stats and invoice creation
  • Check BIP39 support/whether it's supported by restore function in electrum
  • Also test all the code for BCH, depends on Electron-Cash/Electron-Cash#2319
  • Ethereum support (#105)
  • Monero support

Add authentification to API

Our bitcart backend API is written in fastapi.
It is located in main.py file and api/ folder.
Currently it is accessible by everyone.
We should add authentification, either Token, or JWT, or some other kind of auth.
Some useful links:
https://fastapi.tiangolo.com/tutorial/security/intro/
https://fastapi.tiangolo.com/tutorial/security/get-current-user/
https://fastapi.tiangolo.com/tutorial/security/first-steps/
https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/

The user model is defined in schemes.py(pydantic validation for output in API), and database model in models.py.
Also, when user is logged in API should be restricted to displaying only those wallets, store, products, invoices that user have.
User has is_superuser value, if it is True, then all data should be displayed.
If user is not superuser, users list might not be accessible at all, or there should be a new endpoint added:
/users/current
Or /profile
Returning logged user info.

Deployment improvements

This issue contains the list of improvements in the deployment area:

  • Add more convenient scripts to the deployment repo (like, creating a new admin user/fixing db?)
  • Install convenient scripts to the /usr/bin (not a chance: we support multiple deployments on one server, so it is not possible to use global scripts)
  • Add documentation on how to uninstall and/or uninstall script
  • Investigate the issue with the script from profile.d not always loading settings (possibly in the multiple deployments case)
  • Improve deployments scripts:
    • Better handle (and fix) local deployment, don't edit /etc/hosts or edit it in a clever way (detect if entry already exists)
    • Improve general code structure, make it easier to add new settings
    • Add ability to preview settings before starting installation
    • Improve ADDITIONAL_COMPONENTS handling, handle special cases and allow using
      export BITCART_ADDITIONAL_COMPONENTS=$BITCART_ADDITIONAL_COMPONENTS,newcomponent
    • Setup tests for the generator, ensure same results for same configuration
  • Add more deployments logs
  • Remove some system-dependent commands from scripts (i.e. apt install git)
  • Improve domain handling, maybe use one domain for everything, and make other services be hosted under suburls (nginx subapps), or allow both settings; avoid exporting 6 variables to set domains; better clarify the _HOST and _URL env variables
  • Fix Tor support
  • Add tests to generator (check some things in generated output to ensure rules are working)
  • Support configuring current instance from the configurator (and add services page)
  • Fix enter in configurator on some pages
  • Add more custom components:
    • Tor relay
    • Your own node support, hosting full nodes + an electrum server of the choice (ElectrumX/Electrs/EPS/Fulcrum), add ability to use electrum servers for electrum wallets, and make daemons use electrum servers (bitcart/bitcart-docker#8) Not needed. See reasoning in the issue
    • Pihole support
  • Possibly, support windows? Not needed
  • Add more easy deployment methods from custom providers (for example, digitalocean) Not needed for now

TODO before setting up release versioning

Currently, when pushing a commit to master, it is deployed automatically to docker hub at latest tag.
But when we add multiple architecture builds, it will not be desired to build everything on each commit.
Plus, having a clear changelog between versions will help people to notice the changes we do
Here's a list of issues we have to resolve before setting it all up:

  • 100 % test coverage on Merchants API (#122)
  • Upgrade all electrums to 4.0.3 (#123)
  • Release SDK 1.0 and use it (bitcart/bitcart-sdk#3)
  • Refactor some left code (#121)
  • Fix issue with balance fetching after wallet was added (#127)
  • Use APIManager for invoice status updates (#126)
  • Lower timeout on SDK poll_updates method (2->1 or less)
  • Fix scaling issues with postgres database connections (when cpu cores >= 4 and hyperthreading) (#134)
  • Decide on commit message guidelines (#118)
  • Check all code, that every component works
  • Check edge cases in invoice polling, for example, when there are no workers available (#126)
  • Maybe add a consistent payment request status mapping to daemon/SDK (already available as status_str)
  • Improve documentation, ensure it is up to date to everything currently added
  • Add changelog to SDK, and to other repos, finalize contributing guidelines

Then, we can start discussing versioning in bitcartcc.

Invoicing improvements

This issue contains a list of improvements in invoicing area (invoice creation/checkout policies and new features):

  • Add a button at stores page to easily see invoices associated with a store (via improved search, see #169)
  • Add store website setting back, and display it on checkout (after successful checkout, "Return to store" button can be clicked to return to store site OR admin instance) No use
  • Add more consistent UI of expired/paid invoices, possibly not changing the dialog size (display the check mark inside the component where scan/copy tabs are displayed, and not instead of the whole checkout dialog) It's fine
  • Fix an issue with scrollbars appearing sometimes on expired/complete invoices (possibly related to a css animation; a more consistent UI might fix this issue)
  • For store POS privacy, use non-integer id's (see #169 for more information)
  • Improve privacy of endpoints, make store POS access invoices, stores and products endpoints without making those endpoints publicly available (possibly via pre-authorization, we can use docker volumes to share a "cookie" file with credentials for the store)
  • Integrate some services for inter-currency conversion? (via plugins system)
  • Improve checkout rates handling, allow changing rate provider from the UI, add ability to try out (and get rates for information purposes) the exchange rates right from the UI
  • Add a store policy to make customer email optional in the store POS.
  • Add a dialog in the admin's checkout modal to enter an email.
  • Internalization, i18n (see #168)
  • Add ability to customize the look of the checkout page in detail (possibly via vuetify exported color css variables, see #166)
  • Add ability to easily integrate a payment button to some store (for users to not implement it manually), with a variety of configuration options
  • Possibly list possible integrations/display connected integrations (WooCommerce, WHMCS) and display revelant docs links
  • Crowdfunding support
  • Refunds support
  • Amount paid detection (#152)
  • Recurring payments support (#174)
  • Add ability for customers to add additional notes to invoices

[BUG] Notification providers missing required fields

Some notification providers, like email, have defaults which aren't used in our environment.
Users need to have a way to use their own smtp server anyway.
Currently we display only required fields: https://github.com/bitcartcc/bitcart/blob/fe64f072da6fa8002d2f334b86781fdbc8e8a076/api/settings.py#L98

But other fields are useful too. We need to parse additional schema, and include fields which may have defaults, too.
Example of a complex schema:
https://github.com/liiight/notifiers/blob/master/notifiers/providers/email.py
It uses json schema:
https://notifiers.readthedocs.io/en/latest/providers/email.html
We will need to parse the schema to extract arguments and their defaults.

Add alembic migrations to the project

Bitcart backend API uses gino orm(kind of orm), which is executing sqlalchemy core queries via async database driver.
But there are no migrations yet, so user data might be broken if we won't add migrations.
All is needed is to setup alembic with that project, and add applying migrations code somewhere in docker-entrypoint.sh.
But as bitcart is using async orm, we might need to find alternate solution for that if it is possible.
Also any ideas on using a better orm are appreciated.
In future we might switch to edgedb at all.

[FEATURE] Adopt commit message guidelines

By adopting commit message guidelines we can get the following benefits:

  • Ability to generate changelog automatically
  • Ability to easily know which commit introduced which change, type of changes introduced
  • And more

There are two possible guidelines we could adopt:
https://www.conventionalcommits.org/en/v1.0.0/
or
https://gitmoji.carloscuesta.me/ (used in fastapi, for example)

We should add notes into our contributing guidelines and decide on specific messages to use. (i.e. "BREAKING CHANGES:" vs "breaking:" vs ":boom:"

TODO: Bitcart roadmap June 2019

  • Create frontend
  • Add lightning support(electrum/lightning)
  • Add Litecoin support(electrum-ltc)
  • Add omni layer support(electrum-omni probably)
    Main target for this month is to try to create frontend.
    Previous month: #28

[BUG]

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Linux]
  • Version [e.g. master branch]

Additional context
Add any other context about the problem here.

TODO: Bitcart roadmap August 2019

  • Switch to fastapi (api done, 90% test coverage, almost done tests)
  • Create admin panel(backend section) working with fastapi api
  • Refactor daemons, as for now every other daemon is almost a copy of BTC daemon
  • Improve docs
  • Improve checkout design
  • Add more examples of usage
  • Add Litecoin support(electrum-ltc)
  • Add omni layer support(electrum-omni probably)
    Previous month: #39

User settings improvements

This issue contains a list of things to improve in user settings area.

  • Add user email verification (via server email settings)
  • Possibly discourage the possibility of admin changing other user's passwords Not needed
  • Add user invite links, with ability for the user to enter their password after entering that link Not sure why is it even needed
  • Add change password functionality for non-server admins
  • Add 2FA support
  • Add webauthn support
  • Add ability for shared access, for some user to give a read/write access to their stores, and special filters in admin panel to filter between your own stores and other user's stores Moved to #329

[FEATURE] Set up a logging system across the project

We need to set up logging across the project in order to be able to debug future bugs easier for all users, as some unexpected exception may happen and be lost.

A new api/logging.py file should be created, which will either define logger creation options, or create a logger instance. If it requires some env variables, then logger is created inside settings

The logger formatting should be as follows:

22-10-2020 17:56:00.05 | INFO | api.models.Invoice.create | started creating invoice

The format may be changed, any suggestions welcome. So it's a date, log level, function that logs something, and the message itself

logging.handlers.TimedRotatingFileHandler should be used as a logging handler, by separating logs per day. Logs should be probably saved in logs/ directory.

Merchants API should expose log files (only with server_management scope) via some API endpoint, and admin panel should provide a way to view logs for server admins.

Each component should do logging when necessary, and sometimes when not too (by using loglevel DEBUG).

Daemon might have logs enabled too to be able to diagnose errors in daemon implementation or electrum itself.

Also, all exceptions must be logged. Maybe a global exception handler can be installed, like sys.exc_hook, which will log the error and then raise it

Use APIManager for invoice status updates

Currently we are running a task for each invoice, to track status change.
We have to test whether it's efficient to do it this way. For example, what happens if there are no free workers available?
Currently, it is a while True loop, checking for updates.
It works same way as poll_updates, but without event system.
We should use APIManager in SDK 1.0 instead, and make daemon send updates.
But, an unique secret string should be created then, so that updates can't be sent from outside.

BitCCL Integration

This issue contains a list of improvements in the BitCCL area (integrating it):

  • Fix security issues with imports still being allowed, for example:
    template.__globals__['os'].listdir('/')
  • Start integration process with the Merchants API: extend plugins functionality or move the state from state module to state object or other way that is easier to modify
  • Think of execution policies: store-wide and server-wide, to configure/limit scripts options
  • Integrate into the Merchants API
  • Custom scripts execution policies

Note: BitCCL might be implemented as a plugin (see #242)

TODO: Bitcart roadmap September 2019

UI improvements and customization

This issue contains a list of issues in the UI area:

  • Investigate vuetify theme customization capabilities at the runtime (after compile step), possibly we could export colors and make them changeable via custom css, plus we can export more editable css classes on different UI elements
  • Find ready vuetify themes, add ability to easily switch them
  • Investigate bulma theme customization capabilities, use bulmaswatch as a source of easily changeable themes; find other solutions
  • Create UI design guidelines, perform a general review of our UI
  • Set up functional UI tests
  • Server theme customization and other UI settings

Balances in wallet's balance fields not updated in database

Currently, as wallet sync can take a long time, it is delegated to a dramatiq task.
It calls balance method and saves result in balance field. (it is done to make daemon restore and load wallet, afterwards all calls are fast)
But after that, balance field never updates.
But /crud/stats endpoint calls balance on each wallet, displaying it in stats.
We should make balance field a field computed on-the-fly and not stored in database.
Also an in-memory (or redis) cache for 5 minutes could be enabled for balance field and /crud/stats endpoint.
The task will still call balance or help method to sync the wallet

TODO: BitcartCC Long-term roadmap

This issue contains a list of long-term issues and features to add. We decided to switch to long-term planning instead of per-month planning.

Core Daemons and Coins support

  • Omni layer support (electrum-omni probably)
  • Ethereum support (#105)
  • Investigate weird issue failing CI at times (for example, this CI run)

Merchants API

  • Add ability to extend API endpoints and database schema with plugins
  • Refactor codebase (#109)

Admin Panel

  • Add more server management settings to admin (lightning management?)
  • Add ability to add new pages and extend navigation with plugins

Store

  • Add ability to extend store functionality or add new pages with plugins

Docker and deployment

  • Tor and using your own node support(bitcart/bitcart-docker#8)
  • Add ability to add runtime plugins to API, store and admin

Docs

  • Finalize docs

BitCCL

  • Add more functions and events for ease of usage
  • Integrate into main Merchants API

SDK

Other integrations and improvements

  • Set up release versioning (#125)

TODO: Bitcart roadmap Hacktober 2019

This month Hacktoberfest is held!
We welcome all new contributors, this issue is a list of all issues from bitcart projects(new features, bug fixes, etc.).
If you have any questions regarding the project, open an issue on github or contact us in our Telegram group.
Main hacktoberfest discussion can be done in this related issue (#72)

[BUG] payment methods inconsistent order

Describe the bug
Sometimes, very rarely, I got payment methods displayed in the wrong order. (usually, they are ordered by the order wallets are connected to the store). Maybe it's something like a hot reload bug or something, but once I saw it in production too.

To Reproduce
N/A

[FEATURE] Please consider a copyright license that protects the users of this software.

Your project is labeled to use the MIT license, which is an open source license but it has the strict allowance that code under this license can be re-released by anyone later as closed source.

The direct effect is that while todays release is open source, there is no way to know that next month your organization does not decide to relicense to a closed source version. We just have your promise to not do that.

This is a huge risk to merchants. Merchants that would use this product want to receive updates, may want to pay someone to build features and generally want to make sure that they don't lock themselves into a dead-end project.

Maybe also relevant for your own motivation is that any competitor can come and fork your project and compete against you with a closed source project using your own code as a basis.

Describe the solution you'd like

Please consider relicensing your project to use a so called "copyleft" license which disallows you or anyone else from using this code against the userbase. I personally prefer GPLv3 for this.

Additional context

In Bitcoin Cash we had several cases where companies did follow the route I explained, which cost the community a lot.

The first is that the company nchain has relicensed their fork of one full node to no longer be open source. Code that goes in there can not be copied by others, they had some rule about the code being limited to their chain only.

The second is that the Bitcoin,com wallet was forked from another and after a year of development and getting a lot of people using their product, they stopped posting sources. They effectively made it closed source.

Neither of these actions is possible with any of the GPL licenses. Please consider protecting your users by adopting a GPL license.

[BUG] Startup issues when there are 8 or more logical cores available

When starting our production setup:
gunicorn -c gunicorn.conf.py main:app
with 4 cores and hyperthreading (so 8 logical cores), or with 8 cores and more, it fails to start.
Workers fails with "sorry, too many clients already" error from postgres.
From what I know, postgres default is 100 clients.
We need to fix this issue as it prevents scalability.
https://github.com/bitcartcc/bitcart/blob/8d6897d5817a7004634f2b0ae044f3b87b6ba2dc/main.py#L37
A temporary fix was to shorten the number of workers in an asyncpg pool.
We should find a permanent fix for this.
Maybe pgbouncer should be used?
Any ideas and PR's welcome

TODO: Bitcart roadmap July 2019

  • Fully connect frontend and backend(add checkout)
  • Add lightning to UI
  • Refactor code
  • Investigate about core api, undo commit 5b2c63c in some time
  • Unify docker install, make it all work flawlessly
  • Add lightning support(electrum/lightning)
  • Add Litecoin support(electrum-ltc)
  • Add omni layer support(electrum-omni probably)
    Main target for this month is to try to create frontend.
    Frontend created
    Lightning created #51
    New target: add lightning to UI
    Previous month: #34

Dependabot can't evaluate your Python dependency files

Dependabot can't evaluate your Python dependency files.

As a result, Dependabot couldn't check whether any of your dependencies are out-of-date.

The error Dependabot encountered was:

InstallationError('Invalid requirement: \'"pytest-cov>=2.4.0,<2.6"\'\n')

You can mention @dependabot in the comments below to contact the Dependabot team.

Refactor: simplify some functions

Currently flake8 reports the following functions which are too complex:
изображение
It would be good to refactor those functions into multiple smaller ones, especially model_view.

Add tests for websocket endpoints

Currently we have almost all the endpoints tested, it would be needed to test websocket endpoints too. TestClient has websocket_connect to test websockets.
All the websocket endpoints must: close connection if id provided is invalid, or object with such id doesn't exist in db(for now it looks like connection isn't closed even when using .close())
If all is fine, it should add the websocket to channel layer.
And testing notifications may be done, they are sent from tasks.py.
From my previous attempt in testing websockets I got Future got attached to a different event loop error.
Any help welcome.

TODO: Bitcart roadmap May 2019

  • Basic bitcoin features support, core features
  • Refine backend gui and make it work without page reload(ajax)
  • Finalize CI/CD and deployment
  • Create frontend
  • Add lightning support(electrum/lightning)
  • Add Litecoin support(electrum-ltc)
  • Add omni layer support(electrum-omni probably)

Hacktoberfest welcome

This month Hacktoberfest is held!
We welcome all new and existing contributors, this issue is a list of all issues from bitcart projects(new features, bug fixes, etc.).
If you have any questions regarding the project, open an issue on github or contact us in our Telegram group.

[BUG] Critical worker timeout in production

Describe the bug
In very rare cases, invoice is never marked as expired till the server restart

To Reproduce
Server must be running, invoice created, and then the gunicorn worker that created the invoice gets critical worker timeout and is restarted. This way invoice is lost

Expected behavior
Invoice not to expire

Screenshots
изображение

Desktop (please complete the following information):
Version: latest

Opened a question at fastapi repo: tiangolo/fastapi#2682

Hacktoberfest welcome

Welcome to everyone who decided to contribute to bitcart during hacktoberfest period or after that.
First, many thanks for your help and support.
How can you help?
There are a lot of ways.
First of all, you can try to use bitcart and find some bugs, open issues about bitcart components in their repositories.
This repository is considered the main one.
Also, you can try to fix issues and add features from issues marked with hacktoberfest label
If you need some help understanding bitcart, join our telegram group.
The roadmap #74 in this repository is also a list of all issues currently opened, check it out first if you want to open some PR's.
Thanks a lot!

[FEATURE] Making contributions easier

First of all congrats @MrNaif2018 and @xiaoxianma 🎉 🚀 it is been a long time since i glanced at Bitcart, but it looks really stable and neat right now. But i have a one concern, repository having a lack of documentation, especially for contributors, setting up environment manually and a poor CONTRIBUTING.md could be frustrating for newcomers.

But i think it can be imrpoved easily. What do you guys think about this?

[BUG] Using invalid currency on invoice creation makes invoice created with no payments connected

Basically the title.

On our demo, when someone has created an invoice with currency="string" (not possible via admin, it's via API), it has been created and stuck in pending, as it has no payments because of the error.

When no currency found, rate from electrum returns NaN

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/uvicorn/protocols/http/httptools_impl.py", line 391, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.6/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.6/site-packages/fastapi/applications.py", line 181, in __call__
    await super().__call__(scope, receive, send)  # pragma: no cover
  File "/usr/local/lib/python3.6/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.6/site-packages/starlette/middleware/base.py", line 25, in __call__
    response = await self.dispatch_func(request, self.call_next)
  File "/app/main.py", line 30, in add_onion_host
    response = await call_next(request)
  File "/usr/local/lib/python3.6/site-packages/starlette/middleware/base.py", line 45, in call_next
    task.result()
  File "/usr/local/lib/python3.6/site-packages/starlette/middleware/base.py", line 38, in coro
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.6/site-packages/starlette/middleware/cors.py", line 86, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/lib/python3.6/site-packages/starlette/middleware/cors.py", line 142, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/local/lib/python3.6/site-packages/fastapi/routing.py", line 183, in app
    dependant=dependant, values=values, is_coroutine=is_coroutine
  File "/usr/local/lib/python3.6/site-packages/fastapi/routing.py", line 133, in run_endpoint_function
    return await dependant.call(**values)
  File "/app/api/utils.py", line 320, in post
    obj = await self.custom_methods["post"](model, user)
  File "/app/api/crud.py", line 87, in create_invoice
    await update_invoice_payments(obj, wallets, discounts, task_wallets, store, product, promocode)
  File "/app/api/crud.py", line 98, in update_invoice_payments
    price = invoice.price / await coin.rate(invoice.currency)
  File "/usr/local/lib/python3.6/site-packages/bitcart/coins/btc.py", line 344, in rate
    return convert_amount_type(await self.server.exchange_rate(currency))
  File "/usr/local/lib/python3.6/site-packages/bitcart/utils.py", line 18, in convert_amount_type
    return Decimal(amount)
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

Actually, it seems like something else is happening. Maybe server returned html instead of a valid number?

[BUG] Maxprice endpoint returning invalid values

Describe the bug
/products/maxprice endpoint seems to return incorrect value. On our demo it returns 100, while price of the biggest product is 5.

To Reproduce
Steps to reproduce the behavior:
Open https://api.bitcartcc.com/products/maxprice returns 100, while https://api.bitcartcc.com/products?store=1 returns products where maximum price is 5.

Expected behavior
maxprice returns 5

Screenshots
If applicable, add screenshots to help explain your problem.
изображение

Desktop (please complete the following information):

  • OS: Linux
  • Version master branch

Server settings improvements

This issue contains a list of improvements in the server setting area.

  • Add file storage support (upload and temporary/permanent file links creation), to be able to upload custom logo and reference it right from the instance
  • Server theme customization and other UI settings Move to #166
  • More server actions: server restart action
  • Possibly improve logs page UX for working with many log files
  • Add ability to re-configure server without running scripts (ssh to server and then running settings) (configurator is out)
  • Add ability to dynamically configure instance domains and their corresponding components (allow installing multiple store POS, for example, or using one store POS on multiple domains at once) Has no practical use for now
  • Restart server management command
  • Custom scripts execution policies Moved, see #165

Do we need to switch to starlette? (Community decision)

Starlette is a light ASGI framework and toolchain, modular and extendable.
It is ASGI, so it is 100% faster than django, it is one of the fastest even from ASGI frameworks(faster than good old aiohttp too)
We can switch to it fully, or use it in only some parts of our application(websockets, background tasks), or don't switch at all.
Check out their docs, it shows what starlette is.
It is a community decision, leave your opinions here.

100 % test coverage

By getting 100 % test coverage we will get all edge cases covered, so that they won't need to be tested manually and nothing will break.
Only a small amount of code is not tested yet.
A good start could be from testing CRUD pagination search endpoints. (?query=sometext)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.