diff --git a/.prettierignore b/.prettierignore index 45869137c..97a304b41 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,3 +11,7 @@ **/lnbits/static/vendor **/lnbits/static/bundle.* **/lnbits/static/css/* + +flake.lock + +.venv diff --git a/Makefile b/Makefile index eff6642e5..7bb79ce70 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ check: mypy pyright checkblack checkruff checkprettier checkbundle test: test-unit test-wallets test-api test-regtest prettier: - poetry run ./node_modules/.bin/prettier --write lnbits + poetry run ./node_modules/.bin/prettier --write . pyright: poetry run ./node_modules/.bin/pyright @@ -27,7 +27,7 @@ checkruff: poetry run ruff check . checkprettier: - poetry run ./node_modules/.bin/prettier --check lnbits + poetry run ./node_modules/.bin/prettier --check . checkblack: poetry run black --check . diff --git a/README.md b/README.md index e6627f20a..9f72442c0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ - -![phase: beta](https://img.shields.io/badge/phase-beta-C41E3A) [![license-badge]](LICENSE) [![docs-badge]][docs] ![PRs: welcome](https://img.shields.io/badge/PRs-Welcome-08A04B) [](https://t.me/lnbits) [](https://opensats.org) +![phase: beta](https://img.shields.io/badge/phase-beta-C41E3A) [![license-badge]](LICENSE) [![docs-badge]][docs] ![PRs: welcome](https://img.shields.io/badge/PRs-Welcome-08A04B) [](https://t.me/lnbits) [](https://opensats.org) ![Lightning network wallet](https://i.imgur.com/DeIiO0y.png) # The world's most powerful suite of bitcoin tools. -## Run for yourself, for others, or as part of a stack. + +## Run for yourself, for others, or as part of a stack. + LNbits is beta, for responsible disclosure of any concerns please contact an admin in the community chat. LNbits is a Python server that sits on top of any funding source. It can be used as: @@ -43,7 +44,7 @@ LNbits is packaged with tools to help manage funds, such as a table of transacti Extend YOUR LNbits to meet YOUR needs. -All non-core features are installed as extensions, reducing your code base and making your LNbits unique to you. Extend your LNbits install in any direction, and even create and share your own extensions. +All non-core features are installed as extensions, reducing your code base and making your LNbits unique to you. Extend your LNbits install in any direction, and even create and share your own extensions. diff --git a/docs/devs/api.md b/docs/devs/api.md index 946e9f1ba..3a8839178 100644 --- a/docs/devs/api.md +++ b/docs/devs/api.md @@ -5,8 +5,6 @@ title: API reference nav_order: 3 --- - -API reference -============= +# API reference [Swagger Docs](https://legend.lnbits.com/docs) diff --git a/docs/devs/development.md b/docs/devs/development.md index 6d5984224..b9c71f8c7 100644 --- a/docs/devs/development.md +++ b/docs/devs/development.md @@ -5,30 +5,27 @@ nav_order: 4 has_children: true --- - -For developers -============== +# For developers Thanks for contributing :) - -Run -===== +# Run This starts the lnbits uvicorn server + ```bash poetry run lnbits ``` This starts the lnbits uvicorn with hot reloading. + ```bash make dev # or poetry run lnbits --reload ``` -Precommit hooks -===== +# Precommit hooks This ensures that all commits adhere to the formatting and linting rules. @@ -36,31 +33,35 @@ This ensures that all commits adhere to the formatting and linting rules. make install-pre-commit-hook ``` -Tests -===== +# Tests This project has unit tests that help prevent regressions. Before you can run the tests, you must install a few dependencies: + ```bash poetry install npm i ``` Then to run the tests: + ```bash make test ``` Run formatting: + ```bash make format ``` Run mypy checks: + ```bash poetry run mypy ``` Run everything: + ```bash make all ``` diff --git a/docs/devs/extensions.md b/docs/devs/extensions.md index 2476bfe16..dac8ab3e4 100644 --- a/docs/devs/extensions.md +++ b/docs/devs/extensions.md @@ -5,11 +5,10 @@ title: Making extensions nav_order: 2 --- - -Extension set up -================= +# Extension set up Start off by creating a fork of the [example extension](https://github.com/lnbits/example) into own GitHub repository and rename the repository to `mysuperplugin`: + ```sh cd [my-working-folder] git clone https://github.com/[my-user-name]/mysuperplugin.git --depth=1 # Let's not use dashes or anything; it doesn't like those. @@ -18,6 +17,7 @@ rm -rf .git/ find . -type f -print0 | xargs -0 sed -i 's/example/mysuperplugin/g' # Change all occurrences of 'example' to your plugin name 'mysuperplugin'. mv templates/example templates/mysuperplugin # Rename templates folder. ``` + - if you are on macOS and having difficulty with 'sed', consider `brew install gnu-sed` and use 'gsed', without -0 option after xargs. 1. Edit `manifest.json` and change the organisation name to your GitHub username. @@ -30,17 +30,15 @@ mv templates/example templates/mysuperplugin # Rename templates folder. 1. ... 1. Profit!!! -Extension structure explained ------------------------------ -* views_api.py: This is where your public API would go. It will be exposed at "$DOMAIN/$PLUGIN/$ROUTE". For example: https://lnbits.com/mysuperplugin/api/v1/tools. -* views.py: The `/` path will show up as your plugin's home page in lnbits' UI. Other pages you can define yourself. The `templates` folder should explain itself in relation to this. -* migrations.py: Create database tables for your plugin. They'll be created automatically when you start lnbits. +## Extension structure explained + +- views_api.py: This is where your public API would go. It will be exposed at "$DOMAIN/$PLUGIN/$ROUTE". For example: https://lnbits.com/mysuperplugin/api/v1/tools. +- views.py: The `/` path will show up as your plugin's home page in lnbits' UI. Other pages you can define yourself. The `templates` folder should explain itself in relation to this. +- migrations.py: Create database tables for your plugin. They'll be created automatically when you start lnbits. ... This document is a work-in-progress. Send pull requests if you get stuck, so others don't. - -Adding new dependencies ------------------------ +## Adding new dependencies DO NOT ADD NEW DEPENDENCIES. Try to use the dependencies that are available in `pyproject.toml`. Getting the LNbits project to accept a new dependency is time consuming and uncertain, and may result in your extension NOT being made available to others. @@ -53,9 +51,7 @@ $ poetry add **But we need an extra step to make sure LNbits doesn't break in production.** Dependencies need to be added to `pyproject.toml`, then tested by running on `poetry` compatibility can be tested with `nix build .#checks.x86_64-linux.vmTest`. - -SQLite to PostgreSQL migration ------------------------ +## SQLite to PostgreSQL migration LNbits currently supports SQLite and PostgreSQL databases. There is a migration script `tools/conv.py` that helps users migrate from SQLite to PostgreSQL. This script also copies all extension databases to the new backend. @@ -64,22 +60,31 @@ LNbits currently supports SQLite and PostgreSQL databases. There is a migration `mock_data.zip` contains a few lines of sample SQLite data and is used in automated GitHub test to see whether your migration in `conv.py` works. Run your extension and save a few lines of data into a SQLite `your_extension.sqlite3` file. Unzip `tests/data/mock_data.zip`, add `your_extension.sqlite3`, updated `database.sqlite3` and zip it again. Add the updated `mock_data.zip` to your PR. ### running migration locally + you will need a running postgres database #### create lnbits user for migration database + ```console sudo su - postgres -c "psql -c 'CREATE ROLE lnbits LOGIN PASSWORD 'lnbits';'" ``` + #### create migration database + ```console sudo su - postgres -c "psql -c 'CREATE DATABASE migration;'" ``` + #### run the migration + ```console make test-migration ``` + sudo su - postgres -c "psql -c 'CREATE ROLE lnbits LOGIN PASSWORD 'lnbits';'" + #### clean migration database afterwards, fails if you try again + ```console sudo su - postgres -c "psql -c 'DROP DATABASE IF EXISTS migration;'" ``` diff --git a/docs/devs/swagger.html b/docs/devs/swagger.html index c787eb2b9..4054fe9ae 100644 --- a/docs/devs/swagger.html +++ b/docs/devs/swagger.html @@ -1,29 +1,32 @@ - - - - - My New API - - -
- - + + + + + My New API + + +
+ + + diff --git a/docs/devs/websockets.md b/docs/devs/websockets.md index c64d044fd..cdadfeaec 100644 --- a/docs/devs/websockets.md +++ b/docs/devs/websockets.md @@ -5,15 +5,12 @@ title: Websockets nav_order: 2 --- - -Websockets -================= +# Websockets `websockets` are a great way to add a two way instant data channel between server and client. LNbits has a useful in built websocket tool. With a websocket client connect to (obv change `somespecificid`) `wss://legend.lnbits.com/api/v1/ws/somespecificid` (you can use an online websocket tester). Now make a get to `https://legend.lnbits.com/api/v1/ws/somespecificid/somedata`. You can send data to that websocket by using `from lnbits.core.services import websocketUpdater` and the function `websocketUpdater("somespecificid", "somdata")`. - Example vue-js function for listening to the websocket: ``` diff --git a/docs/guide/admin_ui.md b/docs/guide/admin_ui.md index d3ad458bc..253d37378 100644 --- a/docs/guide/admin_ui.md +++ b/docs/guide/admin_ui.md @@ -4,17 +4,15 @@ title: Admin UI nav_order: 4 --- +# Admin UI -Admin UI -======== The LNbits Admin UI lets you change LNbits settings via the LNbits frontend. It is disabled by default and the first time you set the environment variable `LNBITS_ADMIN_UI=true` the settings are initialized and saved to the database and will be used from there as long the UI is enabled. From there on the settings from the database are used. +# Super User -Super User -========== With the Admin UI we introduced the super user, it is created with the initialisation of the Admin UI and will be shown with a success message in the server logs. The super user has access to the server and can change settings that may crash the server and make it unresponsive via the frontend and api, like changing funding sources. @@ -29,48 +27,52 @@ We also added a decorator for the API routes to check for super user. There is also the possibility of posting the super user via webhook to another service when it is created. you can look it up here https://github.com/lnbits/lnbits/blob/main/lnbits/settings.py `class SaaSSettings` +# Admin Users -Admin Users -=========== environment variable: `LNBITS_ADMIN_USERS`, comma-separated list of user ids Admin Users can change settings in the admin ui as well, with the exception of funding source settings, because they require e server restart and could potentially make the server inaccessible. Also they have access to all the extension defined in `LNBITS_ADMIN_EXTENSIONS`. +# Allowed Users -Allowed Users -============= environment variable: `LNBITS_ALLOWED_USERS`, comma-separated list of user ids By defining this users, LNbits will no longer be usable by the public, only defined users and admins can then access the LNbits frontend. Setting this environment variable also disables account creation. Account creation can be also disabled by setting `LNBITS_ALLOW_NEW_ACCOUNTS=false` +# How to activate -How to activate -============= ``` $ sudo systemctl stop lnbits.service $ cd ~/lnbits-legend $ sudo nano .env ``` + -> set: `LNBITS_ADMIN_UI=true` Now start LNbits once in the terminal window + ``` $ poetry run lnbits ``` + You can now `cat` the Super User ID: + ``` $ cat data/.super_user 123de4bfdddddbbeb48c8bc8382fe123 ``` + You can access your super user account at `/wallet?usr=super_user_id`. You just have to append it to your normal LNbits web domain. -After that you will find the __`Admin` / `Manage Server`__ between `Wallets` and `Extensions` +After that you will find the **`Admin` / `Manage Server`** between `Wallets` and `Extensions` Here you can design the interface, it has TOPUP to fill wallets and you can restrict access rights to extensions only for admins or generally deactivated for everyone. You can make users admins or set up Allowed Users if you want to restrict access. And of course the classic settings of the .env file, e.g. to change the funding source wallet or set a charge fee. Do not forget + ``` sudo systemctl start lnbits.service ``` + A little hint, if you set `RESET TO DEFAULTS`, then a new Super User Account will also be created. The old one is then no longer valid. diff --git a/docs/guide/extension-install.md b/docs/guide/extension-install.md index 8117e993b..dda8e5529 100644 --- a/docs/guide/extension-install.md +++ b/docs/guide/extension-install.md @@ -10,16 +10,16 @@ Go to `Manage Server` > `Server` > `Extensions Manifests` ![image](https://user-images.githubusercontent.com/2951406/213494038-e8152d8e-61f2-4cb7-8b5f-361fc3f9a31f.png) - An `Extension Manifest` is a link to a `JSON` file which contains information about various extensions that can be installed (repository of extensions). Multiple repositories can be configured. For more information check the [Manifest File](https://github.com/lnbits/lnbits/blob/main/docs/guide/extension-install.md#manifest-file) section. - **LNbits** administrators should configure their instances to use repositories that they trust (like the [lnbits-extensions](https://github.com/lnbits/lnbits-extensions/) one). + > **Warning** > Extensions can have bugs or malicious code, be careful what you install!! ## Install New Extension + Only administrator users can install or upgrade extensions. Go to `Manage Extensions` > `Add Remove Extensions` @@ -45,13 +45,12 @@ Select the version to be installed (usually the last one) and click `Install`. O > > For Explicit Release: the order of the releases is the one in the "extensions" object - The extension has been installed but it cannot be accessed yet. In order to activate the extension toggle it in the `Activated` state. Go to `Manage Extensions` (as admin user or regular user). Search for the extension and enable it. - ## Uninstall Extension + On the `Install` page click `Manage` for the extension you want to uninstall: ![image](https://user-images.githubusercontent.com/2951406/213653194-32cbb1da-dcc8-43cf-8a82-1ec5d2d3dc16.png) @@ -65,6 +64,7 @@ Users will no longer be able to access the extension. > The database for the extension is not removed. If the extension is re-installed later, the data will be accessible. ## Manifest File + The manifest file is just a `JSON` file that lists a collection of extensions that can be installed. This file is of the form: ```json @@ -77,30 +77,32 @@ The manifest file is just a `JSON` file that lists a collection of extensions th There are two ways to specify installable extensions: ### Explicit Release + It goes under the `extensions` object and it is of the form: + ```json - { - "id": "lnurlp", - "name": "LNURL Pay Links", - "version": 1, - "shortDescription": "Upgrade to version 111111111", - "icon": "receipt", - "details": "All charge names should be 111111111. API panel must show:
", - "archive": "https://github.com/lnbits/lnbits-extensions/raw/main/new/lnurlp/1/lnurlp.zip", - "hash": "a22d02de6bf306a7a504cd344e032cc6d48837a1d4aeb569a55a57507bf9a43a", - "htmlUrl": "https://github.com/lnbits/lnbits-extensions/tree/main/new/lnurlp/1", - "infoNotification": "This is a very old version", - "dependencies": ["other-ext-id"] - } +{ + "id": "lnurlp", + "name": "LNURL Pay Links", + "version": 1, + "shortDescription": "Upgrade to version 111111111", + "icon": "receipt", + "details": "All charge names should be 111111111. API panel must show:
", + "archive": "https://github.com/lnbits/lnbits-extensions/raw/main/new/lnurlp/1/lnurlp.zip", + "hash": "a22d02de6bf306a7a504cd344e032cc6d48837a1d4aeb569a55a57507bf9a43a", + "htmlUrl": "https://github.com/lnbits/lnbits-extensions/tree/main/new/lnurlp/1", + "infoNotification": "This is a very old version", + "dependencies": ["other-ext-id"] +} ```
Fields Detailed Description | Field | Type | | Description | -|----------------------|---------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | string | mandatory | The ID of the extension. Must be unique for each extension. It is also used as the path in the URL. | +| -------------------- | ------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| id | string | mandatory | The ID of the extension. Must be unique for each extension. It is also used as the path in the URL. | | name | string | mandatory | User friendly name for the extension. It will be displayed on the installation page. | -| version | string | mandatory | Version of this release. [Semantic versioning](https://semver.org/) is recommended. | +| version | string | mandatory | Version of this release. [Semantic versioning](https://semver.org/) is recommended. | | shortDescription | string | optional | A few words about the extension. It will be displayed on the installation page. | | icon | string | optional | quasar valid icon name | | details | string (html) | optional | Details about this particular release | @@ -109,31 +111,30 @@ It goes under the `extensions` object and it is of the form: | htmlUrl | string | optional | Link to the extension home page. | | infoNotification | string | optional | Users that have this release installed will see a info message for their extension. For example if the extension support will be terminated soon. | | criticalNotification | string | optional | Reserved for urgent notifications. The admin user will receive a message each time it visits the `Install` page. One example is if the extension has a critical bug. | -| dependencies | list | optional | A list of extension IDs. It signals that those extensions must be installed BEFORE the this one can be installed. +| dependencies | list | optional | A list of extension IDs. It signals that those extensions must be installed BEFORE the this one can be installed. |
This mode has the advantage of strictly specifying what releases of an extension can be installed. ### GitHub Repository + It goes under the `repos` object and it is of the form: ```json { - "id": "withdraw", - "organisation": "lnbits", - "repository": "withdraw-extension" + "id": "withdraw", + "organisation": "lnbits", + "repository": "withdraw-extension" } ``` -| Field | Type | Description | -|--------------|--------|-------------------------------------------------------| -| id | string | The ID of the extension. Must be unique for each extension. It is also used as the path in the URL. | -| organisation | string | The GitHub organisation (eg: `lnbits`) | -| repository | string | The GitHub repository name (eg: `withdraw-extension`) | +| Field | Type | Description | +| ------------ | ------ | --------------------------------------------------------------------------------------------------- | +| id | string | The ID of the extension. Must be unique for each extension. It is also used as the path in the URL. | +| organisation | string | The GitHub organisation (eg: `lnbits`) | +| repository | string | The GitHub repository name (eg: `withdraw-extension`) | The admin user will see all releases from the Github repository: ![image](https://user-images.githubusercontent.com/2951406/213508934-11de5ae5-2045-471c-854b-94b6acbf4434.png) - - diff --git a/docs/guide/faq.md b/docs/guide/faq.md index ced5a5766..8f98221f8 100644 --- a/docs/guide/faq.md +++ b/docs/guide/faq.md @@ -4,10 +4,10 @@ title: FAQ nav_order: 5 --- - # FAQ - Frequently Asked Questions ## Install options + ## Troubleshooting + ## Building hardware tools + ## Use cases of LNbits + ## Developing for LNbits + diff --git a/docs/guide/fastapi_transition.md b/docs/guide/fastapi_transition.md index ef4aa7d5d..f385b4683 100644 --- a/docs/guide/fastapi_transition.md +++ b/docs/guide/fastapi_transition.md @@ -1,19 +1,23 @@ - ## Defining a route with path parameters + **old:** + ```python # with <> @offlineshop_ext.route("/lnurl/", methods=["GET"]) ``` **new:** + ```python # with curly braces: {} @offlineshop_ext.get("/lnurl/{item_id}") ``` ## Check if a user exists and access user object + **old:** + ```python # decorators @check_user_exists() @@ -24,14 +28,18 @@ async def do_routing_stuff(): **new:** If user doesn't exist, `Depends(check_user_exists)` will raise an exception. If user exists, `user` will be the user object + ```python # depends calls @core_html_routes.get("/my_route") async def extensions(user: User = Depends(check_user_exists)): pass ``` + ## Returning data from API calls + **old:** + ```python return ( { @@ -42,9 +50,11 @@ return ( HTTPStatus.OK, ) ``` + FastAPI returns `HTTPStatus.OK` by default id no Exception is raised **new:** + ```python return { "id": wallet.wallet.id, @@ -54,6 +64,7 @@ return { ``` To change the default HTTPStatus, add it to the path decorator + ```python @core_app.post("/api/v1/payments", status_code=HTTPStatus.CREATED) async def payments(): @@ -61,7 +72,9 @@ async def payments(): ``` ## Raise exceptions + **old:** + ```python return ( {"message": f"Failed to connect to {domain}."}, @@ -74,6 +87,7 @@ abort(HTTPStatus.INTERNAL_SERVER_ERROR, "Could not process withdraw LNURL.") **new:** Raise an exception to return a status code other than the default status code. + ```python raise HTTPException( status_code=HTTPStatus.BAD_REQUEST, @@ -82,7 +96,9 @@ raise HTTPException( ``` ## Extensions + **old:** + ```python from quart import Blueprint @@ -92,6 +108,7 @@ amilk_ext: Blueprint = Blueprint( ``` **new:** + ```python from fastapi import APIRouter from lnbits.jinja2_templating import Jinja2Templates @@ -114,9 +131,12 @@ offlineshop_rndr = template_renderer([ ``` ## Possible optimizations + ### Use Redis as a cache server + Instead of hitting the database over and over again, we can store a short lived object in [Redis](https://redis.io) for an arbitrary key. Example: -* Get transactions for a wallet ID -* User data for a user id -* Wallet data for a Admin / Invoice key + +- Get transactions for a wallet ID +- User data for a user id +- Wallet data for a Admin / Invoice key diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 95eecb871..63ceef907 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -16,6 +16,7 @@ Mininum poetry version has is ^1.2, but it is recommended to use latest poetry. Make sure you have Python 3.9 or 3.10 installed. ### install python on ubuntu + ```sh # for making sure python 3.9 is installed, skip if installed. To check your installed version: python3 --version sudo apt update @@ -25,6 +26,7 @@ sudo apt install python3.9 python3.9-distutils ``` ### install poetry + ```sh curl -sSL https://install.python-poetry.org | python3 - # Once the above poetry install is completed, use the installation path printed to terminal and replace in the following command @@ -56,6 +58,7 @@ poetry run lnbits # adding --debug in the start-up command above to help your troubleshooting and generate a more verbose output # Note that you have to add the line DEBUG=true in your .env file, too. ``` + #### Updating the server ``` @@ -97,7 +100,7 @@ nix run Ideally you would set the environment via the `.env` file, but you can also set the env variables or pass command line arguments: -``` sh +```sh # .env variables are currently passed when running, but LNbits can be managed with the admin UI. LNBITS_ADMIN_UI=true ./result/bin/lnbits --port 9000 @@ -108,13 +111,16 @@ SUPER_USER=be54db7f245346c8833eaa430e1e0405 LNBITS_ADMIN_UI=true ./result/bin/ln ## Option 3: Docker use latest version from docker hub + ```sh docker pull lnbits/lnbits wget https://raw.githubusercontent.com/lnbits/lnbits/main/.env.example -O .env mkdir data docker run --detach --publish 5000:5000 --name lnbits --volume ${PWD}/.env:/app/.env --volume ${PWD}/data/:/app/data lnbits/lnbits ``` + build the image yourself + ```sh git clone https://github.com/lnbits/lnbits.git cd lnbits @@ -254,11 +260,10 @@ You might also need to install additional packages or perform additional setup s Take a look at [Polar](https://lightningpolar.com/) for an excellent way of spinning up a Lightning Network dev environment. - - # Additional guides ## SQLite to PostgreSQL migration + If you already have LNbits installed and running, on an SQLite database, we **highly** recommend you migrate to postgres if you are planning to run LNbits on scale. There's a script included that can do the migration easy. You should have Postgres already installed and there should be a password for the user (see Postgres install guide above). Additionally, your LNbits instance should run once on postgres to implement the database schema before the migration works: @@ -280,7 +285,6 @@ make migration Hopefully, everything works and get migrated... Launch LNbits again and check if everything is working properly. - ## LNbits as a systemd service Systemd is great for taking care of your LNbits instance. It will start it on boot and restart it in case it crashes. If you want to run LNbits as a systemd service on your Debian/Ubuntu/Raspbian server, create a file at `/etc/systemd/system/lnbits.service` with the following content: @@ -457,28 +461,36 @@ service restart nginx ``` ## Using https without reverse proxy + The most common way of using LNbits via https is to use a reverse proxy such as Caddy, nginx, or ngriok. However, you can also run LNbits via https without additional software. This is useful for development purposes or if you want to use LNbits in your local network. We have to create a self-signed certificate using `mkcert`. Note that this certificate is not "trusted" by most browsers but that's fine (since you know that you have created it) and encryption is always better than clear text. #### Install mkcert + You can find the install instructions for `mkcert` [here](https://github.com/FiloSottile/mkcert). Install mkcert on Ubuntu: + ```sh sudo apt install libnss3-tools curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64" chmod +x mkcert-v*-linux-amd64 sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert ``` + #### Create certificate + To create a certificate, first `cd` into your LNbits folder and execute the following command on Linux: + ```sh openssl req -new -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes -out cert.pem -keyout key.pem ``` + This will create two new files (`key.pem` and `cert.pem `). Alternatively, you can use mkcert ([more info](https://kifarunix.com/how-to-create-self-signed-ssl-certificate-with-mkcert-on-ubuntu-18-04/)): + ```sh # add your local IP (192.x.x.x) as well if you want to use it in your local network mkcert localhost 127.0.0.1 ::1 @@ -490,7 +502,6 @@ You can then pass the certificate files to uvicorn when you start LNbits: poetry run uvicorn lnbits.__main__:app --host 0.0.0.0 --port 5000 --ssl-keyfile ./key.pem --ssl-certfile ./cert.pem ``` - ## LNbits running on Umbrel behind Tor If you want to run LNbits on your Umbrel but want it to be reached through clearnet, _Uxellodunum_ made an extensive [guide](https://community.getumbrel.com/t/guide-lnbits-without-tor/604) on how to do it. @@ -514,6 +525,7 @@ cp /.env.example .env and change the configuration in `.env` as required. Then create the data directory + ``` mkdir data ``` diff --git a/docs/guide/wallets.md b/docs/guide/wallets.md index 34bd15814..13569aaeb 100644 --- a/docs/guide/wallets.md +++ b/docs/guide/wallets.md @@ -4,15 +4,12 @@ title: Backend wallets nav_order: 3 --- - -Backend wallets -=============== +# Backend wallets LNbits can run on top of many Lightning Network funding sources with more being added regularly. A backend wallet can be configured using the following LNbits environment variables: - ### CoreLightning - `LNBITS_BACKEND_WALLET_CLASS`: **CoreLightningWallet** diff --git a/docs/index.md b/docs/index.md index 57aeee826..a4b9dc564 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,21 +4,17 @@ title: User’s Guide nav_order: 1 --- - -LNbits, free and open-source Lightning Network wallet/accounts system -===================================================================== +# LNbits, free and open-source Lightning Network wallet/accounts system LNbits is a very simple Python application that sits on top of any funding source, and can be used as: -* Accounts system to mitigate the risk of exposing applications to your full balance, via unique API keys for each wallet -* Extendable platform for exploring Lightning Network functionality via LNbits extension framework -* Part of a development stack via LNbits API -* Fallback wallet for the LNURL scheme -* Instant wallet for LN demonstrations +- Accounts system to mitigate the risk of exposing applications to your full balance, via unique API keys for each wallet +- Extendable platform for exploring Lightning Network functionality via LNbits extension framework +- Part of a development stack via LNbits API +- Fallback wallet for the LNURL scheme +- Instant wallet for LN demonstrations - -LNbits as an account system ---------------------------- +## LNbits as an account system LNbits is packaged with tools to help manage funds, such as a table of transactions, line chart of spending, export to csv + more to come... diff --git a/tests/wallets/fixtures/json/fixtures_rest.json b/tests/wallets/fixtures/json/fixtures_rest.json index d6a433387..9161dc18a 100644 --- a/tests/wallets/fixtures/json/fixtures_rest.json +++ b/tests/wallets/fixtures/json/fixtures_rest.json @@ -1,2561 +1,2561 @@ { - "funding_sources": { + "funding_sources": { + "corelightningrest": { + "wallet_class": "CoreLightningRestWallet", + "settings": { + "corelightning_rest_url": "http://127.0.0.1:8555", + "corelightning_rest_macaroon": "eNcRyPtEdMaCaRoOn", + "user_agent": "LNbits/Tests" + } + }, + "lndrest": { + "wallet_class": "LndRestWallet", + "settings": { + "lnd_rest_endpoint": "http://127.0.0.1:8555", + "lnd_rest_macaroon": "eNcRyPtEdMaCaRoOn", + "lnd_rest_cert": "", + "user_agent": "LNbits/Tests" + } + }, + "alby": { + "wallet_class": "AlbyWallet", + "settings": { + "alby_api_endpoint": "http://127.0.0.1:8555", + "alby_access_token": "mock-alby-access-token", + "user_agent": "LNbits/Tests" + } + }, + "eclair": { + "wallet_class": "EclairWallet", + "settings": { + "eclair_url": "http://127.0.0.1:8555", + "eclair_pass": "secret", + "user_agent": "LNbits/Tests" + } + }, + "lnbits": { + "wallet_class": "LNbitsWallet", + "settings": { + "lnbits_endpoint": "http://127.0.0.1:8555", + "lnbits_admin_key": "f171ba022a764e679eef950b21fb1c04", + "user_agent": "LNbits/Tests" + } + } + }, + "functions": { + "status": { + "mocks": { "corelightningrest": { - "wallet_class": "CoreLightningRestWallet", - "settings": { - "corelightning_rest_url": "http://127.0.0.1:8555", - "corelightning_rest_macaroon": "eNcRyPtEdMaCaRoOn", - "user_agent": "LNbits/Tests" - } + "status_endpoint": { + "uri": "/v1/channel/localremotebal", + "headers": { + "macaroon": "eNcRyPtEdMaCaRoOn", + "encodingtype": "hex", + "accept": "application/json", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } }, "lndrest": { - "wallet_class": "LndRestWallet", - "settings": { - "lnd_rest_endpoint": "http://127.0.0.1:8555", - "lnd_rest_macaroon": "eNcRyPtEdMaCaRoOn", - "lnd_rest_cert": "", - "user_agent": "LNbits/Tests" - } + "status_endpoint": { + "uri": "/v1/balance/channels", + "headers": { + "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } }, "alby": { - "wallet_class": "AlbyWallet", - "settings": { - "alby_api_endpoint": "http://127.0.0.1:8555", - "alby_access_token": "mock-alby-access-token", - "user_agent": "LNbits/Tests" - } + "status_endpoint": { + "uri": "/balance", + "headers": { + "Authorization": "Bearer mock-alby-access-token", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } }, "eclair": { - "wallet_class": "EclairWallet", - "settings": { - "eclair_url": "http://127.0.0.1:8555", - "eclair_pass": "secret", - "user_agent": "LNbits/Tests" - } + "status_endpoint": { + "uri": "/globalbalance", + "headers": { + "Authorization": "Basic OnNlY3JldA==", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + } }, "lnbits": { - "wallet_class": "LNbitsWallet", - "settings": { - "lnbits_endpoint": "http://127.0.0.1:8555", - "lnbits_admin_key": "f171ba022a764e679eef950b21fb1c04", - "user_agent": "LNbits/Tests" + "status_endpoint": { + "uri": "/api/v1/wallet", + "headers": { + "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + } + }, + "tests": [ + { + "description": "success", + "call_params": {}, + "expect": { + "error_message": null, + "balance_msat": 55000 + }, + "mocks": { + "corelightningrest": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "localBalance": 55 + } + } + ] + }, + "lndrest": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "balance": 55 + } + } + ] + }, + "alby": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "balance": 55, + "unit": "sat" + } + } + ] + }, + "eclair": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "total": 0.00000055 + } + } + ] + }, + "lnbits": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "balance": 55000 + } + } + ] } + } + }, + { + "description": "error", + "call_params": {}, + "expect": { + "error_message": "Server error: '\"test-error\"'", + "balance_msat": 0 + }, + "mocks": { + "corelightningrest": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "error": "\"test-error\"" + } + } + ] + }, + "lndrest": { + "status_endpoint": [ + { + "response_type": "json", + "response": "test-error" + } + ] + }, + "alby": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "message": "\"test-error\"", + "unit": "sats" + } + } + ] + }, + "eclair": { + "status_endpoint": [ + { + "response_type": "json", + "response": { + "error": "\"test-error\"" + } + } + ] + }, + "lnbits": { + "status_endpoint": [ + { + "response_type": "json", + "response": "test-error" + } + ] + } + } + }, + { + "description": "missing data", + "call_params": {}, + "expect": { + "error_message": "no data", + "balance_msat": 0 + }, + "mocks": { + "corelightningrest": { + "status_endpoint": [ + { + "response_type": "json", + "response": {} + } + ] + }, + "lndrest": { + "status_endpoint": [ + { + "response_type": "json", + "response": {} + } + ] + }, + "alby": { + "status_endpoint": [ + { + "response_type": "json", + "response": {} + } + ] + }, + "eclair": { + "status_endpoint": [ + { + "response_type": "json", + "response": {} + } + ] + }, + "lnbits": { + "status_endpoint": [ + { + "response_type": "json", + "response": {} + } + ] + } + } + }, + { + "description": "bad json", + "call_params": {}, + "expect": { + "error_message": "Server error: 'invalid json response'", + "balance_msat": 0 + }, + "mocks": { + "corelightningrest": { + "status_endpoint": [ + { + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "lndrest": { + "status_endpoint": [ + { + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "alby": { + "status_endpoint": [ + { + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "eclair": { + "status_endpoint": [ + { + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "lnbits": { + "status_endpoint": [ + { + "response_type": "data", + "response": "data-not-json" + } + ] + } + } + }, + { + "description": "http 404", + "call_params": {}, + "expect": { + "error_message": "Unable to connect to http://127.0.0.1:8555.", + "balance_msat": 0 + }, + "mocks": { + "corelightningrest": { + "status_endpoint": [ + { + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lndrest": { + "status_endpoint": [ + { + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "alby": { + "status_endpoint": [ + { + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "eclair": { + "status_endpoint": [ + { + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lnbits": { + "status_endpoint": [ + { + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + } + } + }, + { + "description": "no mocks", + "call_params": {}, + "expect": { + "error_message": "Unable to connect to http://127.0.0.1:8555.", + "balance_msat": 0 + } } + ] }, - "functions": { - "status": { - "mocks": { - "corelightningrest": { - "status_endpoint": { - "uri": "/v1/channel/localremotebal", - "headers": { - "macaroon": "eNcRyPtEdMaCaRoOn", - "encodingtype": "hex", - "accept": "application/json", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "lndrest": { - "status_endpoint": { - "uri": "/v1/balance/channels", - "headers": { - "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "alby": { - "status_endpoint": { - "uri": "/balance", - "headers": { - "Authorization": "Bearer mock-alby-access-token", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "eclair": { - "status_endpoint": { - "uri": "/globalbalance", - "headers": { - "Authorization": "Basic OnNlY3JldA==", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "lnbits": { - "status_endpoint": { - "uri": "/api/v1/wallet", - "headers": { - "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - } + "create_invoice": { + "mocks": { + "corelightningrest": { + "create_invoice_endpoint": { + "uri": "/v1/invoice/genInvoice", + "headers": { + "macaroon": "eNcRyPtEdMaCaRoOn", + "encodingtype": "hex", + "accept": "application/json", + "User-Agent": "LNbits/Tests" }, - "tests": [ - { - "description": "success", - "call_params": {}, - "expect": { - "error_message": null, - "balance_msat": 55000 - }, - "mocks": { - "corelightningrest": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "localBalance": 55 - } - } - ] - }, - "lndrest": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "balance": 55 - } - } - ] - }, - "alby": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "balance": 55, - "unit": "sat" - } - } - ] - }, - "eclair": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "total": 0.00000055 - } - } - ] - }, - "lnbits": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "balance": 55000 - } - } - ] - } - } - }, - { - "description": "error", - "call_params": {}, - "expect": { - "error_message": "Server error: '\"test-error\"'", - "balance_msat": 0 - }, - "mocks": { - "corelightningrest": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "error": "\"test-error\"" - } - } - ] - }, - "lndrest": { - "status_endpoint": [ - { - "response_type": "json", - "response": "test-error" - } - ] - }, - "alby": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "message": "\"test-error\"", - "unit": "sats" - } - } - ] - }, - "eclair": { - "status_endpoint": [ - { - "response_type": "json", - "response": { - "error": "\"test-error\"" - } - } - ] - }, - "lnbits": { - "status_endpoint": [ - { - "response_type": "json", - "response": "test-error" - } - ] - } - } - }, - { - "description": "missing data", - "call_params": {}, - "expect": { - "error_message": "no data", - "balance_msat": 0 - }, - "mocks": { - "corelightningrest": { - "status_endpoint": [ - { - "response_type": "json", - "response": {} - } - ] - }, - "lndrest": { - "status_endpoint": [ - { - "response_type": "json", - "response": {} - } - ] - }, - "alby": { - "status_endpoint": [ - { - "response_type": "json", - "response": {} - } - ] - }, - "eclair": { - "status_endpoint": [ - { - "response_type": "json", - "response": {} - } - ] - }, - "lnbits": { - "status_endpoint": [ - { - "response_type": "json", - "response": {} - } - ] - } - } - }, - { - "description": "bad json", - "call_params": {}, - "expect": { - "error_message": "Server error: 'invalid json response'", - "balance_msat": 0 - }, - "mocks": { - "corelightningrest": { - "status_endpoint": [ - { - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "lndrest": { - "status_endpoint": [ - { - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "alby": { - "status_endpoint": [ - { - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "eclair": { - "status_endpoint": [ - { - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "lnbits": { - "status_endpoint": [ - { - "response_type": "data", - "response": "data-not-json" - } - ] - } - } - }, - { - "description": "http 404", - "call_params": {}, - "expect": { - "error_message": "Unable to connect to http://127.0.0.1:8555.", - "balance_msat": 0 - }, - "mocks": { - "corelightningrest": { - "status_endpoint": [ - { - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lndrest": { - "status_endpoint": [ - { - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "alby": { - "status_endpoint": [ - { - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "eclair": { - "status_endpoint": [ - { - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lnbits": { - "status_endpoint": [ - { - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - } - } - }, - { - "description": "no mocks", - "call_params": {}, - "expect": { - "error_message": "Unable to connect to http://127.0.0.1:8555.", - "balance_msat": 0 - } - } - ] + "method": "POST" + } }, - "create_invoice": { - "mocks": { - "corelightningrest": { - "create_invoice_endpoint": { - "uri": "/v1/invoice/genInvoice", - "headers": { - "macaroon": "eNcRyPtEdMaCaRoOn", - "encodingtype": "hex", - "accept": "application/json", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "lndrest": { - "create_invoice_endpoint": { - "uri": "/v1/invoices", - "headers": { - "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "alby": { - "create_invoice_endpoint": { - "uri": "/invoices", - "headers": { - "Authorization": "Bearer mock-alby-access-token", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "eclair": { - "create_invoice_endpoint": { - "uri": "/createinvoice", - "headers": { - "Authorization": "Basic OnNlY3JldA==", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "lnbits": { - "create_invoice_endpoint": { - "uri": "/api/v1/payments", - "headers": { - "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - } + "lndrest": { + "create_invoice_endpoint": { + "uri": "/v1/invoices", + "headers": { + "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", + "User-Agent": "LNbits/Tests" }, - "tests": [ - { - "description": "success", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "error_message": null, - "success": true, - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - }, - "mocks": { - "corelightningrest": { - "create_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "amount": 555000, - "description": "Test Invoice", - "label": "test-label" - }, - "response_type": "json", - "response": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "bolt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - ] - }, - "lndrest": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice", - "private": true - }, - "response_type": "json", - "response": { - "r_hash": "41UmpD0E6YVZTA36uEiBT1JLHHhlmOyaY77dstcmrJY=", - "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - ] - }, - "alby": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice" - }, - "response_type": "json", - "response": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - ] - }, - "eclair": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "amountMsat": 555000 - }, - "response_type": "json", - "response": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "serialized": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - ] - }, - "lnbits": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": false, - "amount": 555000, - "memo": "Test Invoice" - }, - "response_type": "json", - "response": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - ] - } - } - }, - { - "description": "error", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "error_message": "Server error: 'Test Error'", - "success": false, - "checking_id": null, - "payment_request": null - }, - "mocks": { - "corelightningrest": { - "create_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "amount": 555000, - "description": "Test Invoice", - "label": "test-label" - }, - "response_type": "json", - "response": { - "error": "Test Error" - } - } - ] - }, - "lndrest": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice", - "private": true - }, - "response_type": "json", - "response": { - "error": "Test Error" - } - } - ] - }, - "alby": { - "create_invoice_endpoint": [] - }, - "eclair": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "amountMsat": 555000 - }, - "response_type": "json", - "response": { - "error": "Test Error" - } - } - ] - }, - "lnbits": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": false, - "amount": 555000, - "memo": "Test Invoice" - }, - "response_type": "json", - "response": { - "detail": "Test Error" - } - } - ] - } - } - }, - { - "description": "missing data", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "error_message": "Server error: 'missing required fields'", - "success": false, - "checking_id": null, - "payment_request": null - }, - "mocks": { - "corelightningrest": { - "create_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "amount": 555000, - "description": "Test Invoice", - "label": "test-label" - }, - "response_type": "json", - "response": { - "some_field": "but the required fields are mising" - } - } - ] - }, - "lndrest": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice", - "private": true - }, - "response_type": "json", - "response": { - "some_field": "but the required fields are mising" - } - } - ] - }, - "alby": { - "create_invoice_endpoint": [ - { - "description": "missing payment request", - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice" - }, - "response_type": "json", - "response": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - } - ] - }, - "eclair": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "amountMsat": 555000 - }, - "response_type": "json", - "response": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - } - ] - }, - "lnbits": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": false, - "amount": 555000, - "memo": "Test Invoice" - }, - "response_type": "json", - "response": { - "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - ] - } - } - }, - { - "description": "bad json", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "success": false, - "checking_id": null, - "payment_request": null, - "error_message": "Server error: 'invalid json response'" - }, - "mocks": { - "corelightningrest": { - "create_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "amount": 555000, - "description": "Test Invoice", - "label": "test-label" - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "lndrest": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice", - "private": true - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "alby": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice" - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "eclair": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "amountMsat": 555000 - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "lnbits": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": false, - "amount": 555000, - "memo": "Test Invoice" - }, - "response_type": "data", - "response": "data-not-json" - } - ] - } - } - }, - { - "description": "http 404", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "success": false, - "checking_id": null, - "payment_request": null, - "error_message": "Unable to connect to http://127.0.0.1:8555." - }, - "mocks": { - "corelightningrest": { - "create_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "amount": 555000, - "description": "Test Invoice", - "label": "test-label" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lndrest": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice", - "private": true - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "alby": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "value": 555, - "memo": "Test Invoice" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "eclair": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "amountMsat": 555000 - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lnbits": { - "create_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": false, - "amount": 555000, - "memo": "Test Invoice" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - } - } - }, - { - "description": "no mocks", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "success": false, - "checking_id": null, - "payment_request": null, - "error_message": "Unable to connect to http://127.0.0.1:8555." - } - } - ] + "method": "POST" + } }, - "pay_invoice": { - "mocks": { - "corelightningrest": { - "pay_invoice_endpoint": { - "uri": "/v1/pay", - "headers": { - "macaroon": "eNcRyPtEdMaCaRoOn", - "encodingtype": "hex", - "accept": "application/json", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "lndrest": { - "pay_invoice_endpoint": { - "uri": "/v1/channels/transactions", - "headers": { - "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "alby": { - "pay_invoice_endpoint": { - "uri": "/payments/bolt11", - "headers": { - "Authorization": "Bearer mock-alby-access-token", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "eclair": { - "pay_invoice_endpoint": { - "uri": "/payinvoice", - "headers": { - "Authorization": "Basic OnNlY3JldA==", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - }, - "get_payment_status_endpoint": { - "uri": "/getsentinfo", - "headers": { - "Authorization": "Basic OnNlY3JldA==", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "lnbits": { - "pay_invoice_endpoint": { - "uri": "/api/v1/payments", - "headers": { - "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - }, - "get_payment_status_endpoint": { - "uri": "/api/v1/payments/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "headers": { - "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - } + "alby": { + "create_invoice_endpoint": { + "uri": "/invoices", + "headers": { + "Authorization": "Bearer mock-alby-access-token", + "User-Agent": "LNbits/Tests" }, - "tests": [ - { - "description": "success", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "error_message": null, - "success": true, - "pending": false, - "failed": false, - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "fee_msat": 50, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000" - }, - "mocks": { - "corelightningrest": { - "pay_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "maxfeepercent": "119.04761905", - "exemptfee": 0 - }, - "response_type": "json", - "response": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "msatoshi": 21000, - "msatoshi_sent": 21050, - "status": "paid" - } - } - ] - }, - "lndrest": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit": 25000 - }, - "response_type": "json", - "response": { - "payment_hash": "41UmpD0E6YVZTA36uEiBT1JLHHhlmOyaY77dstcmrJY=", - "payment_route": { - "total_fees_msat": 50 - }, - "payment_preimage": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" - } - } - ] - }, - "alby": { - "pay_invoice_endpoint": [ - { - "skip": true, - "request_type": "json", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "fee": 50, - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - } - ] - }, - "eclair": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", - "type": "mock" - } - } - ], - "get_payment_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [ - { - "status": { - "type": "sent", - "feesPaid": -50, - "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - } - ] - } - ] - }, - "lnbits": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": true, - "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - }, - "response_type": "json", - "response": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - } - ], - "get_payment_status_endpoint": [ - { - "response_type": "json", - "response": { - "paid": true, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "details": { - "fee": 50 - } - } - } - ] - } - } - }, - { - "description": "pending, no fee", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "success": false, - "pending": true, - "failed": false, - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "fee_msat": null, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000" - }, - "mocks": { - "corelightningrest": {}, - "lndrest": {}, - "alby": {}, - "eclair": [ - { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", - "type": "mock" - } - } - ], - "get_payment_status_endpoint": [ - { - "description": "get paid invoice: error", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": { - "error": "Test Error" - } - } - ] - }, - { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", - "type": "mock" - } - } - ], - "get_payment_status_endpoint": [ - { - "description": "get paid invoice: no data", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": {} - } - ] - }, - { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", - "type": "mock" - } - } - ], - "get_payment_status_endpoint": [ - { - "description": "get paid invoice: bad json", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", - "type": "mock" - } - } - ], - "get_payment_status_endpoint": [ - { - "description": "get paid invoice: pending status", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [ - { - "status": { - "type": "pending" - } - } - ] - } - ] - } - ], - "lnbits": [] - } - }, - { - "description": "error", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "success": false, - "pending": false, - "failed": true, - "checking_id": null, - "fee_msat": null, - "preimage": null, - "error_message": "Test Error" - }, - "mocks": { - "corelightningrest": { - "pay_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "maxfeepercent": "119.04761905", - "exemptfee": 0 - }, - "response_type": "json", - "response": { - "error": "Test Error" - } - } - ] - }, - "lndrest": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit": 25000 - }, - "response_type": "json", - "response": { - "payment_error": "Test Error" - } - } - ] - }, - "alby": { - "pay_invoice_endpoint": [] - }, - "eclair": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": { - "error": "Test Error" - } - } - ], - "get_payment_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [] - } - ] - }, - "lnbits": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": true, - "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - }, - "response_type": "json", - "response": { - "detail": "Test Error" - } - } - ], - "get_payment_status_endpoint": [ - { - "response_type": "json", - "response": { - "paid": true, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "details": { - "fee": 50 - } - } - } - ] - } - } - }, - { - "description": "missing data", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "error_message": "Server error: 'missing required fields'", - "success": false, - "pending": false, - "failed": true, - "checking_id": null, - "fee_msat": null, - "preimage": null - }, - "mocks": { - "corelightningrest": { - "pay_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "maxfeepercent": "119.04761905", - "exemptfee": 0 - }, - "response_type": "json", - "response": {} - } - ] - }, - "lndrest": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit": 25000 - }, - "response_type": "json", - "response": {} - } - ] - }, - "alby": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": {} - } - ] - }, - "eclair": { - "pay_invoice_endpoint": [ - { - "description": "no data from pay invoice", - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "json", - "response": {} - } - ], - "get_payment_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [] - } - ] - }, - "lnbits": {} - } - }, - { - "description": "bad json", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "error_message": "Server error: 'invalid json response'", - "success": false, - "pending": false, - "failed": true, - "checking_id": null, - "fee_msat": null, - "preimage": null - }, - "mocks": { - "corelightningrest": { - "pay_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "maxfeepercent": "119.04761905", - "exemptfee": 0 - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "lndrest": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit": 25000 - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "alby": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "data", - "response": "data-not-json" - } - ] - }, - "eclair": { - "pay_invoice_endpoint": [ - { - "description": "no data from pay invoice", - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "data", - "response": "data-not-json" - } - ], - "get_payment_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [] - } - ] - }, - "lnbits": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": true, - "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - }, - "response_type": "data", - "response": "data-not-json" - } - ], - "get_payment_status_endpoint": [ - { - "response_type": "json", - "response": { - "paid": true, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "details": { - "fee": 50 - } - } - } - ] - } - } - }, - { - "description": "http 404", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "error_message": "Unable to connect to http://127.0.0.1:8555.", - "success": false, - "pending": false, - "failed": true, - "checking_id": null, - "fee_msat": null, - "preimage": null - }, - "mocks": { - "corelightningrest": { - "pay_invoice_endpoint": [ - { - "request_type": "data", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "maxfeepercent": "119.04761905", - "exemptfee": 0 - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lndrest": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit": 25000 - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "alby": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "eclair": { - "pay_invoice_endpoint": [ - { - "description": "no data from pay invoice", - "request_type": "json", - "request_body": { - "blocking": true, - "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ], - "get_payment_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [] - } - ] - }, - "lnbits": { - "pay_invoice_endpoint": [ - { - "request_type": "json", - "request_body": { - "out": true, - "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ], - "get_payment_status_endpoint": [ - { - "response_type": "json", - "response": {} - } - ] - } - } - }, - { - "description": "no mocks", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "error_message": "Unable to connect to http://127.0.0.1:8555.", - "success": false, - "pending": false, - "failed": true, - "checking_id": null, - "fee_msat": null, - "preimage": null - } - } - ] + "method": "POST" + } }, - "get_invoice_status": { - "mocks": { - "corelightningrest": { - "get_invoice_status_endpoint": { - "uri": "/v1/invoice/listInvoices", - "query_params": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "headers": { - "macaroon": "eNcRyPtEdMaCaRoOn", - "encodingtype": "hex", - "accept": "application/json", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "lndrest": { - "get_invoice_status_endpoint": { - "uri": "/v1/invoice/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "headers": { - "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "alby": { - "get_invoice_status_endpoint": { - "uri": "/invoices/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "headers": { - "Authorization": "Bearer mock-alby-access-token", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "eclair": { - "get_invoice_status_endpoint": { - "uri": "/getreceivedinfo", - "headers": { - "Authorization": "Basic OnNlY3JldA==", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "lnbits": { - "get_invoice_status_endpoint": { - "uri": "/api/v1/payments/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "headers": { - "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - } + "eclair": { + "create_invoice_endpoint": { + "uri": "/createinvoice", + "headers": { + "Authorization": "Basic OnNlY3JldA==", + "User-Agent": "LNbits/Tests" }, - "tests": [ - { - "description": "paid", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": true, - "failed": false, - "pending": false - }, - "mocks": { - "corelightningrest": { - "get_invoice_status_endpoint": [ - { - "response_type": "json", - "response": { - "invoices": [ - { - "status": "paid" - } - ] - } - }, - { - "response_type": "json", - "response": { - "invoices": [ - { - "status": "complete" - } - ] - } - } - ] - }, - "lndrest": { - "get_invoice_status_endpoint": [ - { - "response_type": "json", - "response": { - "settled": true - } - } - ] - }, - "alby": { - "get_invoice_status_endpoint": [ - { - "response_type": "json", - "response": { - "state": "SETTLED" - } - } - ] - }, - "eclair": { - "get_invoice_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": { - "status": { - "type": "received" - } - } - } - ] - }, - "lnbits": { - "get_invoice_status_endpoint": [ - { - "response_type": "json", - "response": { - "paid": true - } - } - ] - } - } - }, - { - "description": "failed", - "description1": "pending should be false in the 'expect', this is a bug", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": false, - "failed": true, - "pending": true - }, - "mocks": { - "corelightningrest": { - "get_invoice_status_endpoint": [ - { - "response_type": "json", - "response": { - "invoices": [ - { - "status": "failed" - } - ] - } - } - ] - }, - "lndrest": { - "description": "lndrest.py doesn't handle the 'failed' status for `get_invoice_status`", - "get_invoice_status_endpoint": [] - }, - "alby": { - "description": "alby.py doesn't handle the 'failed' status for `get_invoice_status`", - "get_invoice_status_endpoint": [] - }, - "eclair": { - "get_invoice_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": { - "status": { - "type": "expired" - } - } - } - ] - }, - "lnbits": { - "description": "lnbits.py doesn't handle the 'failed' status for `get_invoice_status`", - "get_invoice_status_endpoint": [] - } - } - }, - { - "description": "pending", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": false, - "failed": false, - "pending": true - }, - "mocks": { - "corelightningrest": { - "get_invoice_status_endpoint": [ - { - "description": "no data", - "response_type": "json", - "response": {} - }, - { - "description": "error status", - "response_type": "json", - "response": { - "error": "test-error" - } - }, - { - "description": "bad json", - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lndrest": { - "get_invoice_status_endpoint": [ - { - "description": "no data", - "response_type": "json", - "response": {} - }, - { - "description": "error status", - "response_type": "json", - "response": { - "seetled": false - } - }, - { - "description": "bad json", - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "alby": { - "get_invoice_status_endpoint": [ - { - "description": "no data", - "response_type": "json", - "response": {} - }, - { - "description": "error status", - "response_type": "json", - "response": { - "status": "CREATED" - } - }, - { - "description": "bad json", - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "eclair": { - "get_invoice_status_endpoint": [ - { - "description": "no data", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": {} - }, - { - "description": "pending status", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": { - "status": { - "type": "pending" - } - } - }, - { - "description": "bad json", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lnbits": { - "get_invoice_status_endpoint": [ - { - "description": "no data", - "response_type": "json", - "response": {} - }, - { - "description": "pending true", - "response_type": "json", - "response": { - "paid": false, - "details": { - "pending": true - } - } - }, - { - "description": "bad json", - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - } - } - }, - { - "description": "no mocks", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": false, - "failed": false, - "pending": true - } - } - ] + "method": "POST" + } }, - "get_payment_status": { - "mocks": { - "corelightningrest": { - "get_payment_status_endpoint": { - "uri": "/v1/pay/listPays", - "query_params": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "headers": { - "macaroon": "eNcRyPtEdMaCaRoOn", - "encodingtype": "hex", - "accept": "application/json", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "lndrest": { - "get_payment_status_endpoint": { - "uri": "/v2/router/track/41UmpD0E6YVZTA36uEiBT1JLHHhlmOyaY77dstcmrJY=", - "headers": { - "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "alby": { - "get_payment_status_endpoint": { - "uri": "/invoices/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "headers": { - "Authorization": "Bearer mock-alby-access-token", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - }, - "eclair": { - "get_payment_status_endpoint": { - "uri": "/getsentinfo", - "headers": { - "Authorization": "Basic OnNlY3JldA==", - "User-Agent": "LNbits/Tests" - }, - "method": "POST" - } - }, - "lnbits": { - "get_payment_status_endpoint": { - "uri": "/api/v1/payments/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "headers": { - "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", - "User-Agent": "LNbits/Tests" - }, - "method": "GET" - } - } + "lnbits": { + "create_invoice_endpoint": { + "uri": "/api/v1/payments", + "headers": { + "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", + "User-Agent": "LNbits/Tests" }, - "tests": [ - { - "description": "paid", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "fee_msat": 1000, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "success": true, - "failed": false, - "pending": false - }, - "mocks": { - "corelightningrest": { - "get_payment_status_endpoint": [ - { - "response_type": "json", - "response": { - "pays": [ - { - "status": "complete", - "amount_msat": "21000msat", - "amount_sent_msat": "-22000msat", - "preimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - ] - } - } - ] - }, - "lndrest": { - "get_payment_status_endpoint": [ - { - "response_type": "stream", - "response": { - "result": { - "status": "SUCCEEDED", - "fee_msat": 1000, - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - } - } - ] - }, - "alby": { - "get_payment_status_endpoint": [ - { - "skip": true, - "response_type": "json", - "response": { - "result": { - "status": "SETTLED" - } - } - } - ] - }, - "eclair": { - "get_payment_status_endpoint": [ - { - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [ - { - "status": { - "type": "sent", - "feesPaid": -1000, - "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - } - ] - } - ] - }, - "lnbits": { - "get_payment_status_endpoint": [ - { - "response_type": "json", - "response": { - "paid": true, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "details": { - "fee": 1000 - } - } - } - ] - } - } - }, - { - "description": "failed", - "description1": "pending should be false in the 'expect', this is a bug", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "preimage": null, - "success": false, - "failed": true, - "pending": true - }, - "mocks": { - "corelightningrest": { - "get_payment_status_endpoint": [ - { - "response_type": "json", - "response": { - "pays": [ - { - "status": "failed" - } - ] - } - } - ] - }, - "lndrest": { - "get_payment_status_endpoint": [ - { - "response_type": "stream", - "response": { - "result": { - "status": "FAILED" - } - } - }, - { - "description": "error code 5", - "response_type": "stream", - "response": { - "error": { - "code": 5, - "message": "payment isn't initiated" - } - } - } - ] - }, - "alby": { - "get_payment_status_endpoint": [] - }, - "eclair": { - "get_payment_status_endpoint": [ - { - "description": "failed status", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [ - { - "status": { - "type": "failed" - } - } - ] - } - ] - }, - "lnbits": { - "get_payment_status_endpoint": [] - } - } - }, - { - "description": "pending", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "preimage": null, - "success": false, - "failed": false, - "pending": true - }, - "mocks": { - "corelightningrest": { - "get_payment_status_endpoint": [ - { - "description": "pending status", - "response_type": "json", - "response": { - "pays": [ - { - "status": "pending" - } - ] - } - }, - { - "description": "no data", - "response_type": "json", - "response": {} - }, - { - "description": "error status", - "response_type": "json", - "response": { - "error": "test-error" - } - }, - { - "description": "bad json", - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lndrest": { - "get_payment_status_endpoint": [ - { - "description": "UNKNOWN", - "response_type": "stream", - "response": { - "result": { - "status": "UNKNOWN" - } - } - }, - { - "description": "IN_FLIGHT", - "response_type": "stream", - "response": { - "result": { - "status": "IN_FLIGHT" - } - } - }, - { - "description": "error code 4", - "response_type": "stream", - "response": { - "error": { - "code": 5, - "message": "should not fail" - } - } - }, - { - "description": "no data", - "response_type": "stream", - "response": {} - }, - { - "description": "bad json", - "response_type": "stream", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "alby": { - "get_payment_status_endpoint": [ - { - "description": "CREATED", - "response_type": "stream", - "response": { - "state": "CREATED" - } - }, - { - "description": "no data", - "response_type": "stream", - "response": {} - }, - { - "description": "bad json", - "response_type": "stream", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "eclair": { - "get_payment_status_endpoint": [ - { - "description": "no data", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [] - }, - { - "description": "pending status", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "json", - "response": [ - { - "status": { - "type": "pending" - } - } - ] - }, - { - "description": "bad json", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "request_type": "json", - "request_body": { - "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - }, - "lnbits": { - "get_payment_status_endpoint": [ - { - "description": "pending true", - "response_type": "json", - "response": { - "paid": false, - "details": { - "pending": true - } - } - }, - { - "description": "no data", - "response_type": "json", - "response": {} - }, - { - "description": "missing 'paid' field", - "response_type": "json", - "response": { - "details": { - "pending": true - } - } - }, - { - "description": "missing 'details' field", - "response_type": "json", - "response": { - "paid": true - } - }, - { - "description": "bad json", - "response_type": "data", - "response": "data-not-json" - }, - { - "description": "http 404", - "response_type": "response", - "response": { - "response": "Not Found", - "status": 404 - } - } - ] - } - } - }, - { - "description": "no mocks", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "preimage": null, - "success": false, - "failed": false, - "pending": true - } - } - ] + "method": "POST" + } } + }, + "tests": [ + { + "description": "success", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "error_message": null, + "success": true, + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + }, + "mocks": { + "corelightningrest": { + "create_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "amount": 555000, + "description": "Test Invoice", + "label": "test-label" + }, + "response_type": "json", + "response": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "bolt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + ] + }, + "lndrest": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice", + "private": true + }, + "response_type": "json", + "response": { + "r_hash": "41UmpD0E6YVZTA36uEiBT1JLHHhlmOyaY77dstcmrJY=", + "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + ] + }, + "alby": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice" + }, + "response_type": "json", + "response": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + ] + }, + "eclair": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "amountMsat": 555000 + }, + "response_type": "json", + "response": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "serialized": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + ] + }, + "lnbits": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": false, + "amount": 555000, + "memo": "Test Invoice" + }, + "response_type": "json", + "response": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + ] + } + } + }, + { + "description": "error", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "error_message": "Server error: 'Test Error'", + "success": false, + "checking_id": null, + "payment_request": null + }, + "mocks": { + "corelightningrest": { + "create_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "amount": 555000, + "description": "Test Invoice", + "label": "test-label" + }, + "response_type": "json", + "response": { + "error": "Test Error" + } + } + ] + }, + "lndrest": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice", + "private": true + }, + "response_type": "json", + "response": { + "error": "Test Error" + } + } + ] + }, + "alby": { + "create_invoice_endpoint": [] + }, + "eclair": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "amountMsat": 555000 + }, + "response_type": "json", + "response": { + "error": "Test Error" + } + } + ] + }, + "lnbits": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": false, + "amount": 555000, + "memo": "Test Invoice" + }, + "response_type": "json", + "response": { + "detail": "Test Error" + } + } + ] + } + } + }, + { + "description": "missing data", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "error_message": "Server error: 'missing required fields'", + "success": false, + "checking_id": null, + "payment_request": null + }, + "mocks": { + "corelightningrest": { + "create_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "amount": 555000, + "description": "Test Invoice", + "label": "test-label" + }, + "response_type": "json", + "response": { + "some_field": "but the required fields are mising" + } + } + ] + }, + "lndrest": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice", + "private": true + }, + "response_type": "json", + "response": { + "some_field": "but the required fields are mising" + } + } + ] + }, + "alby": { + "create_invoice_endpoint": [ + { + "description": "missing payment request", + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice" + }, + "response_type": "json", + "response": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + } + ] + }, + "eclair": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "amountMsat": 555000 + }, + "response_type": "json", + "response": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + } + ] + }, + "lnbits": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": false, + "amount": 555000, + "memo": "Test Invoice" + }, + "response_type": "json", + "response": { + "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + ] + } + } + }, + { + "description": "bad json", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "success": false, + "checking_id": null, + "payment_request": null, + "error_message": "Server error: 'invalid json response'" + }, + "mocks": { + "corelightningrest": { + "create_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "amount": 555000, + "description": "Test Invoice", + "label": "test-label" + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "lndrest": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice", + "private": true + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "alby": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice" + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "eclair": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "amountMsat": 555000 + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "lnbits": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": false, + "amount": 555000, + "memo": "Test Invoice" + }, + "response_type": "data", + "response": "data-not-json" + } + ] + } + } + }, + { + "description": "http 404", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "success": false, + "checking_id": null, + "payment_request": null, + "error_message": "Unable to connect to http://127.0.0.1:8555." + }, + "mocks": { + "corelightningrest": { + "create_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "amount": 555000, + "description": "Test Invoice", + "label": "test-label" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lndrest": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice", + "private": true + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "alby": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "value": 555, + "memo": "Test Invoice" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "eclair": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "amountMsat": 555000 + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lnbits": { + "create_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": false, + "amount": 555000, + "memo": "Test Invoice" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + } + } + }, + { + "description": "no mocks", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "success": false, + "checking_id": null, + "payment_request": null, + "error_message": "Unable to connect to http://127.0.0.1:8555." + } + } + ] + }, + "pay_invoice": { + "mocks": { + "corelightningrest": { + "pay_invoice_endpoint": { + "uri": "/v1/pay", + "headers": { + "macaroon": "eNcRyPtEdMaCaRoOn", + "encodingtype": "hex", + "accept": "application/json", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + } + }, + "lndrest": { + "pay_invoice_endpoint": { + "uri": "/v1/channels/transactions", + "headers": { + "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + } + }, + "alby": { + "pay_invoice_endpoint": { + "uri": "/payments/bolt11", + "headers": { + "Authorization": "Bearer mock-alby-access-token", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + } + }, + "eclair": { + "pay_invoice_endpoint": { + "uri": "/payinvoice", + "headers": { + "Authorization": "Basic OnNlY3JldA==", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + }, + "get_payment_status_endpoint": { + "uri": "/getsentinfo", + "headers": { + "Authorization": "Basic OnNlY3JldA==", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + } + }, + "lnbits": { + "pay_invoice_endpoint": { + "uri": "/api/v1/payments", + "headers": { + "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + }, + "get_payment_status_endpoint": { + "uri": "/api/v1/payments/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "headers": { + "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + } + }, + "tests": [ + { + "description": "success", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "error_message": null, + "success": true, + "pending": false, + "failed": false, + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "fee_msat": 50, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "mocks": { + "corelightningrest": { + "pay_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "maxfeepercent": "119.04761905", + "exemptfee": 0 + }, + "response_type": "json", + "response": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "msatoshi": 21000, + "msatoshi_sent": 21050, + "status": "paid" + } + } + ] + }, + "lndrest": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit": 25000 + }, + "response_type": "json", + "response": { + "payment_hash": "41UmpD0E6YVZTA36uEiBT1JLHHhlmOyaY77dstcmrJY=", + "payment_route": { + "total_fees_msat": 50 + }, + "payment_preimage": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + } + } + ] + }, + "alby": { + "pay_invoice_endpoint": [ + { + "skip": true, + "request_type": "json", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "fee": 50, + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + ] + }, + "eclair": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", + "type": "mock" + } + } + ], + "get_payment_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [ + { + "status": { + "type": "sent", + "feesPaid": -50, + "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + ] + } + ] + }, + "lnbits": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": true, + "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + }, + "response_type": "json", + "response": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + } + ], + "get_payment_status_endpoint": [ + { + "response_type": "json", + "response": { + "paid": true, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "details": { + "fee": 50 + } + } + } + ] + } + } + }, + { + "description": "pending, no fee", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "success": false, + "pending": true, + "failed": false, + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "fee_msat": null, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "mocks": { + "corelightningrest": {}, + "lndrest": {}, + "alby": {}, + "eclair": [ + { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", + "type": "mock" + } + } + ], + "get_payment_status_endpoint": [ + { + "description": "get paid invoice: error", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": { + "error": "Test Error" + } + } + ] + }, + { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", + "type": "mock" + } + } + ], + "get_payment_status_endpoint": [ + { + "description": "get paid invoice: no data", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": {} + } + ] + }, + { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", + "type": "mock" + } + } + ], + "get_payment_status_endpoint": [ + { + "description": "get paid invoice: bad json", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000", + "type": "mock" + } + } + ], + "get_payment_status_endpoint": [ + { + "description": "get paid invoice: pending status", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [ + { + "status": { + "type": "pending" + } + } + ] + } + ] + } + ], + "lnbits": [] + } + }, + { + "description": "error", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "success": false, + "pending": false, + "failed": true, + "checking_id": null, + "fee_msat": null, + "preimage": null, + "error_message": "Test Error" + }, + "mocks": { + "corelightningrest": { + "pay_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "maxfeepercent": "119.04761905", + "exemptfee": 0 + }, + "response_type": "json", + "response": { + "error": "Test Error" + } + } + ] + }, + "lndrest": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit": 25000 + }, + "response_type": "json", + "response": { + "payment_error": "Test Error" + } + } + ] + }, + "alby": { + "pay_invoice_endpoint": [] + }, + "eclair": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": { + "error": "Test Error" + } + } + ], + "get_payment_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [] + } + ] + }, + "lnbits": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": true, + "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + }, + "response_type": "json", + "response": { + "detail": "Test Error" + } + } + ], + "get_payment_status_endpoint": [ + { + "response_type": "json", + "response": { + "paid": true, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "details": { + "fee": 50 + } + } + } + ] + } + } + }, + { + "description": "missing data", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "error_message": "Server error: 'missing required fields'", + "success": false, + "pending": false, + "failed": true, + "checking_id": null, + "fee_msat": null, + "preimage": null + }, + "mocks": { + "corelightningrest": { + "pay_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "maxfeepercent": "119.04761905", + "exemptfee": 0 + }, + "response_type": "json", + "response": {} + } + ] + }, + "lndrest": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit": 25000 + }, + "response_type": "json", + "response": {} + } + ] + }, + "alby": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": {} + } + ] + }, + "eclair": { + "pay_invoice_endpoint": [ + { + "description": "no data from pay invoice", + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "json", + "response": {} + } + ], + "get_payment_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [] + } + ] + }, + "lnbits": {} + } + }, + { + "description": "bad json", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "error_message": "Server error: 'invalid json response'", + "success": false, + "pending": false, + "failed": true, + "checking_id": null, + "fee_msat": null, + "preimage": null + }, + "mocks": { + "corelightningrest": { + "pay_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "maxfeepercent": "119.04761905", + "exemptfee": 0 + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "lndrest": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit": 25000 + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "alby": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "data", + "response": "data-not-json" + } + ] + }, + "eclair": { + "pay_invoice_endpoint": [ + { + "description": "no data from pay invoice", + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "data", + "response": "data-not-json" + } + ], + "get_payment_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [] + } + ] + }, + "lnbits": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": true, + "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + }, + "response_type": "data", + "response": "data-not-json" + } + ], + "get_payment_status_endpoint": [ + { + "response_type": "json", + "response": { + "paid": true, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "details": { + "fee": 50 + } + } + } + ] + } + } + }, + { + "description": "http 404", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "error_message": "Unable to connect to http://127.0.0.1:8555.", + "success": false, + "pending": false, + "failed": true, + "checking_id": null, + "fee_msat": null, + "preimage": null + }, + "mocks": { + "corelightningrest": { + "pay_invoice_endpoint": [ + { + "request_type": "data", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "maxfeepercent": "119.04761905", + "exemptfee": 0 + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lndrest": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit": 25000 + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "alby": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "eclair": { + "pay_invoice_endpoint": [ + { + "description": "no data from pay invoice", + "request_type": "json", + "request_body": { + "blocking": true, + "invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ], + "get_payment_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [] + } + ] + }, + "lnbits": { + "pay_invoice_endpoint": [ + { + "request_type": "json", + "request_body": { + "out": true, + "blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ], + "get_payment_status_endpoint": [ + { + "response_type": "json", + "response": {} + } + ] + } + } + }, + { + "description": "no mocks", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "error_message": "Unable to connect to http://127.0.0.1:8555.", + "success": false, + "pending": false, + "failed": true, + "checking_id": null, + "fee_msat": null, + "preimage": null + } + } + ] + }, + "get_invoice_status": { + "mocks": { + "corelightningrest": { + "get_invoice_status_endpoint": { + "uri": "/v1/invoice/listInvoices", + "query_params": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "headers": { + "macaroon": "eNcRyPtEdMaCaRoOn", + "encodingtype": "hex", + "accept": "application/json", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + }, + "lndrest": { + "get_invoice_status_endpoint": { + "uri": "/v1/invoice/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "headers": { + "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + }, + "alby": { + "get_invoice_status_endpoint": { + "uri": "/invoices/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "headers": { + "Authorization": "Bearer mock-alby-access-token", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + }, + "eclair": { + "get_invoice_status_endpoint": { + "uri": "/getreceivedinfo", + "headers": { + "Authorization": "Basic OnNlY3JldA==", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + } + }, + "lnbits": { + "get_invoice_status_endpoint": { + "uri": "/api/v1/payments/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "headers": { + "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + } + }, + "tests": [ + { + "description": "paid", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": true, + "failed": false, + "pending": false + }, + "mocks": { + "corelightningrest": { + "get_invoice_status_endpoint": [ + { + "response_type": "json", + "response": { + "invoices": [ + { + "status": "paid" + } + ] + } + }, + { + "response_type": "json", + "response": { + "invoices": [ + { + "status": "complete" + } + ] + } + } + ] + }, + "lndrest": { + "get_invoice_status_endpoint": [ + { + "response_type": "json", + "response": { + "settled": true + } + } + ] + }, + "alby": { + "get_invoice_status_endpoint": [ + { + "response_type": "json", + "response": { + "state": "SETTLED" + } + } + ] + }, + "eclair": { + "get_invoice_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": { + "status": { + "type": "received" + } + } + } + ] + }, + "lnbits": { + "get_invoice_status_endpoint": [ + { + "response_type": "json", + "response": { + "paid": true + } + } + ] + } + } + }, + { + "description": "failed", + "description1": "pending should be false in the 'expect', this is a bug", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": false, + "failed": true, + "pending": true + }, + "mocks": { + "corelightningrest": { + "get_invoice_status_endpoint": [ + { + "response_type": "json", + "response": { + "invoices": [ + { + "status": "failed" + } + ] + } + } + ] + }, + "lndrest": { + "description": "lndrest.py doesn't handle the 'failed' status for `get_invoice_status`", + "get_invoice_status_endpoint": [] + }, + "alby": { + "description": "alby.py doesn't handle the 'failed' status for `get_invoice_status`", + "get_invoice_status_endpoint": [] + }, + "eclair": { + "get_invoice_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": { + "status": { + "type": "expired" + } + } + } + ] + }, + "lnbits": { + "description": "lnbits.py doesn't handle the 'failed' status for `get_invoice_status`", + "get_invoice_status_endpoint": [] + } + } + }, + { + "description": "pending", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": false, + "failed": false, + "pending": true + }, + "mocks": { + "corelightningrest": { + "get_invoice_status_endpoint": [ + { + "description": "no data", + "response_type": "json", + "response": {} + }, + { + "description": "error status", + "response_type": "json", + "response": { + "error": "test-error" + } + }, + { + "description": "bad json", + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lndrest": { + "get_invoice_status_endpoint": [ + { + "description": "no data", + "response_type": "json", + "response": {} + }, + { + "description": "error status", + "response_type": "json", + "response": { + "seetled": false + } + }, + { + "description": "bad json", + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "alby": { + "get_invoice_status_endpoint": [ + { + "description": "no data", + "response_type": "json", + "response": {} + }, + { + "description": "error status", + "response_type": "json", + "response": { + "status": "CREATED" + } + }, + { + "description": "bad json", + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "eclair": { + "get_invoice_status_endpoint": [ + { + "description": "no data", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": {} + }, + { + "description": "pending status", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": { + "status": { + "type": "pending" + } + } + }, + { + "description": "bad json", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lnbits": { + "get_invoice_status_endpoint": [ + { + "description": "no data", + "response_type": "json", + "response": {} + }, + { + "description": "pending true", + "response_type": "json", + "response": { + "paid": false, + "details": { + "pending": true + } + } + }, + { + "description": "bad json", + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + } + } + }, + { + "description": "no mocks", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": false, + "failed": false, + "pending": true + } + } + ] + }, + "get_payment_status": { + "mocks": { + "corelightningrest": { + "get_payment_status_endpoint": { + "uri": "/v1/pay/listPays", + "query_params": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "headers": { + "macaroon": "eNcRyPtEdMaCaRoOn", + "encodingtype": "hex", + "accept": "application/json", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + }, + "lndrest": { + "get_payment_status_endpoint": { + "uri": "/v2/router/track/41UmpD0E6YVZTA36uEiBT1JLHHhlmOyaY77dstcmrJY=", + "headers": { + "Grpc-Metadata-macaroon": "eNcRyPtEdMaCaRoOn", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + }, + "alby": { + "get_payment_status_endpoint": { + "uri": "/invoices/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "headers": { + "Authorization": "Bearer mock-alby-access-token", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + }, + "eclair": { + "get_payment_status_endpoint": { + "uri": "/getsentinfo", + "headers": { + "Authorization": "Basic OnNlY3JldA==", + "User-Agent": "LNbits/Tests" + }, + "method": "POST" + } + }, + "lnbits": { + "get_payment_status_endpoint": { + "uri": "/api/v1/payments/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "headers": { + "X-Api-Key": "f171ba022a764e679eef950b21fb1c04", + "User-Agent": "LNbits/Tests" + }, + "method": "GET" + } + } + }, + "tests": [ + { + "description": "paid", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "fee_msat": 1000, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "success": true, + "failed": false, + "pending": false + }, + "mocks": { + "corelightningrest": { + "get_payment_status_endpoint": [ + { + "response_type": "json", + "response": { + "pays": [ + { + "status": "complete", + "amount_msat": "21000msat", + "amount_sent_msat": "-22000msat", + "preimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + ] + } + } + ] + }, + "lndrest": { + "get_payment_status_endpoint": [ + { + "response_type": "stream", + "response": { + "result": { + "status": "SUCCEEDED", + "fee_msat": 1000, + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + ] + }, + "alby": { + "get_payment_status_endpoint": [ + { + "skip": true, + "response_type": "json", + "response": { + "result": { + "status": "SETTLED" + } + } + } + ] + }, + "eclair": { + "get_payment_status_endpoint": [ + { + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [ + { + "status": { + "type": "sent", + "feesPaid": -1000, + "paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + ] + } + ] + }, + "lnbits": { + "get_payment_status_endpoint": [ + { + "response_type": "json", + "response": { + "paid": true, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "details": { + "fee": 1000 + } + } + } + ] + } + } + }, + { + "description": "failed", + "description1": "pending should be false in the 'expect', this is a bug", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "preimage": null, + "success": false, + "failed": true, + "pending": true + }, + "mocks": { + "corelightningrest": { + "get_payment_status_endpoint": [ + { + "response_type": "json", + "response": { + "pays": [ + { + "status": "failed" + } + ] + } + } + ] + }, + "lndrest": { + "get_payment_status_endpoint": [ + { + "response_type": "stream", + "response": { + "result": { + "status": "FAILED" + } + } + }, + { + "description": "error code 5", + "response_type": "stream", + "response": { + "error": { + "code": 5, + "message": "payment isn't initiated" + } + } + } + ] + }, + "alby": { + "get_payment_status_endpoint": [] + }, + "eclair": { + "get_payment_status_endpoint": [ + { + "description": "failed status", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [ + { + "status": { + "type": "failed" + } + } + ] + } + ] + }, + "lnbits": { + "get_payment_status_endpoint": [] + } + } + }, + { + "description": "pending", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "preimage": null, + "success": false, + "failed": false, + "pending": true + }, + "mocks": { + "corelightningrest": { + "get_payment_status_endpoint": [ + { + "description": "pending status", + "response_type": "json", + "response": { + "pays": [ + { + "status": "pending" + } + ] + } + }, + { + "description": "no data", + "response_type": "json", + "response": {} + }, + { + "description": "error status", + "response_type": "json", + "response": { + "error": "test-error" + } + }, + { + "description": "bad json", + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lndrest": { + "get_payment_status_endpoint": [ + { + "description": "UNKNOWN", + "response_type": "stream", + "response": { + "result": { + "status": "UNKNOWN" + } + } + }, + { + "description": "IN_FLIGHT", + "response_type": "stream", + "response": { + "result": { + "status": "IN_FLIGHT" + } + } + }, + { + "description": "error code 4", + "response_type": "stream", + "response": { + "error": { + "code": 5, + "message": "should not fail" + } + } + }, + { + "description": "no data", + "response_type": "stream", + "response": {} + }, + { + "description": "bad json", + "response_type": "stream", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "alby": { + "get_payment_status_endpoint": [ + { + "description": "CREATED", + "response_type": "stream", + "response": { + "state": "CREATED" + } + }, + { + "description": "no data", + "response_type": "stream", + "response": {} + }, + { + "description": "bad json", + "response_type": "stream", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "eclair": { + "get_payment_status_endpoint": [ + { + "description": "no data", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [] + }, + { + "description": "pending status", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "json", + "response": [ + { + "status": { + "type": "pending" + } + } + ] + }, + { + "description": "bad json", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "request_type": "json", + "request_body": { + "paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + }, + "lnbits": { + "get_payment_status_endpoint": [ + { + "description": "pending true", + "response_type": "json", + "response": { + "paid": false, + "details": { + "pending": true + } + } + }, + { + "description": "no data", + "response_type": "json", + "response": {} + }, + { + "description": "missing 'paid' field", + "response_type": "json", + "response": { + "details": { + "pending": true + } + } + }, + { + "description": "missing 'details' field", + "response_type": "json", + "response": { + "paid": true + } + }, + { + "description": "bad json", + "response_type": "data", + "response": "data-not-json" + }, + { + "description": "http 404", + "response_type": "response", + "response": { + "response": "Not Found", + "status": 404 + } + } + ] + } + } + }, + { + "description": "no mocks", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "preimage": null, + "success": false, + "failed": false, + "pending": true + } + } + ] } + } } diff --git a/tests/wallets/fixtures/json/fixtures_rpc.json b/tests/wallets/fixtures/json/fixtures_rpc.json index 650f520bf..6e0980ee7 100644 --- a/tests/wallets/fixtures/json/fixtures_rpc.json +++ b/tests/wallets/fixtures/json/fixtures_rpc.json @@ -1,2376 +1,2374 @@ { - "funding_sources": { + "funding_sources": { + "breez": { + "skip": true, + "wallet_class": "BreezSdkWallet", + "settings": { + "breez_api_key": "100", + "breez_greenlight_seed": "push divert icon era bracket fade much kind reason injury suffer muffin", + "breez_greenlight_device_key": "tests/wallets/certificates/cert.pem", + "breez_greenlight_device_cert": "tests/wallets/certificates/breez.crt" + } + }, + "corelightning": { + "wallet_class": "CoreLightningWallet", + "settings": { + "corelightning_rpc": "some-mock-value" + } + }, + "lndrpc": { + "wallet_class": "LndWallet", + "settings": { + "lnd_grpc_endpoint": "127.0.0.1", + "lnd_grpc_port": "10009", + "lnd_grpc_cert": "tests/wallets/fixtures/certificates/breez.crt", + "lnd_grpc_macaroon": "eNcRyPtEdMaCaRoOn" + } + } + }, + "functions": { + "status": { + "mocks": { "breez": { - "skip": true, - "wallet_class": "BreezSdkWallet", - "settings": { - "breez_api_key": "100", - "breez_greenlight_seed": "push divert icon era bracket fade much kind reason injury suffer muffin", - "breez_greenlight_device_key": "tests/wallets/certificates/cert.pem", - "breez_greenlight_device_cert": "tests/wallets/certificates/breez.crt" - } + "sdk_services": { + "method": "breez_sdk.connect", + "request_type": "function" + } }, "corelightning": { - "wallet_class": "CoreLightningWallet", - "settings": { - "corelightning_rpc": "some-mock-value" + "ln": { + "method": "pyln.client.LightningRpc.__new__", + "request_type": "function", + "response_type": "data", + "response": { + "help": { + "request_type": "function", + "response_type": "json", + "response": { + "help": [ + { + "command": "some command" + } + ] + } + }, + "listinvoices": { + "request_type": "function", + "response_type": "json", + "response": { + "invoices": [] + } + } } + } }, "lndrpc": { - "wallet_class": "LndWallet", - "settings": { - "lnd_grpc_endpoint": "127.0.0.1", - "lnd_grpc_port": "10009", - "lnd_grpc_cert": "tests/wallets/fixtures/certificates/breez.crt", - "lnd_grpc_macaroon": "eNcRyPtEdMaCaRoOn" + "rpc": { + "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + } + } + }, + "tests": [ + { + "description": "success", + "call_params": {}, + "expect": { + "error_message": null, + "balance_msat": 55000 + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "node_info": { + "request_type": "function", + "response_type": "data", + "response": { + "channels_balance_msat": 55000 + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "description": "one channel", + "response": { + "listfunds": { + "request_type": "function", + "response_type": "json", + "response": { + "channels": [ + { + "our_amount_msat": 55000 + } + ] + } + } + } + }, + { + "description": "two channels", + "response": { + "listfunds": { + "request_type": "function", + "response_type": "json", + "response": { + "channels": [ + { + "our_amount_msat": 25000 + }, + { + "our_amount_msat": 30000 + } + ] + } + } + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": { + "ChannelBalance": { + "request_type": "async-function", + "response_type": "data", + "response": { + "balance": 55 + } + } + } + } + ] } + } + }, + { + "description": "error", + "call_params": {}, + "expect": { + "error_message": "Unable to connect, got: 'test-error'", + "balance_msat": 0 + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "node_info": { + "request_type": "function", + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "response": { + "listfunds": { + "request_type": "function", + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": { + "ChannelBalance": { + "request_type": "async-function", + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + } + } + }, + { + "description": "missing data", + "call_params": {}, + "expect": { + "error_message": "no data", + "balance_msat": 0 + }, + "mocks": { + "breez": { + "sdk_services": [] + }, + "corelightning": { + "ln": [ + { + "response": { + "listfunds": { + "request_type": "function", + "response_type": "json", + "response": {} + } + } + } + ] + }, + "lndrpc": { + "rpc": [] + } + } + }, + { + "description": "RPC call failed:", + "call_params": {}, + "expect": { + "error_message": "RPC 'test_method' failed with 'test-error'.", + "balance_msat": 0 + }, + "mocks": { + "breez": { + "sdk_services": [] + }, + "corelightning": { + "ln": [ + { + "response": { + "listfunds": { + "request_type": "function", + "response_type": "exception", + "response": { + "module": "pyln.client.lightning", + "class": "RpcError", + "data": { + "method": "test_method", + "payload": "y", + "error": "test-error" + } + } + } + } + } + ] + }, + "lndrpc": { + "rpc": [] + } + } } + ] }, - "functions": { - "status": { - "mocks": { - "breez": { - "sdk_services": { - "method": "breez_sdk.connect", - "request_type": "function" - } - }, - "corelightning": { - "ln": { - "method": "pyln.client.LightningRpc.__new__", - "request_type": "function", - "response_type": "data", - "response": { - "help": { - "request_type": "function", - "response_type": "json", - "response": { - "help": [ - { - "command": "some command" - } - ] - } - }, - "listinvoices": { - "request_type": "function", - "response_type": "json", - "response": { - "invoices": [] - } - } - } - } - }, - "lndrpc": { - "rpc": { - "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} - } - } - }, - "tests": [ - { - "description": "success", - "call_params": {}, - "expect": { - "error_message": null, - "balance_msat": 55000 - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "node_info": { - "request_type": "function", - "response_type": "data", - "response": { - "channels_balance_msat": 55000 - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "description": "one channel", - "response": { - "listfunds": { - "request_type": "function", - "response_type": "json", - "response": { - "channels": [ - { - "our_amount_msat": 55000 - } - ] - } - } - } - }, - { - "description": "two channels", - "response": { - "listfunds": { - "request_type": "function", - "response_type": "json", - "response": { - "channels": [ - { - "our_amount_msat": 25000 - }, - { - "our_amount_msat": 30000 - } - ] - } - } - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": { - "ChannelBalance": { - "request_type": "async-function", - "response_type": "data", - "response": { - "balance": 55 - } - } - } - } - ] - } - } - }, - { - "description": "error", - "call_params": {}, - "expect": { - "error_message": "Unable to connect, got: 'test-error'", - "balance_msat": 0 - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "node_info": { - "request_type": "function", - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "response": { - "listfunds": { - "request_type": "function", - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": { - "ChannelBalance": { - "request_type": "async-function", - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - } - } - }, - { - "description": "missing data", - "call_params": {}, - "expect": { - "error_message": "no data", - "balance_msat": 0 - }, - "mocks": { - "breez": { - "sdk_services": [] - }, - "corelightning": { - "ln": [ - { - "response": { - "listfunds": { - "request_type": "function", - "response_type": "json", - "response": {} - } - } - } - ] - }, - "lndrpc": { - "rpc": [] - } - } - }, - { - "description": "RPC call failed:", - "call_params": {}, - "expect": { - "error_message": "RPC 'test_method' failed with 'test-error'.", - "balance_msat": 0 - }, - "mocks": { - "breez": { - "sdk_services": [] - }, - "corelightning": { - "ln": [ - { - "response": { - "listfunds": { - "request_type": "function", - "response_type": "exception", - "response": { - "module": "pyln.client.lightning", - "class": "RpcError", - "data": { - "method": "test_method", - "payload": "y", - "error": "test-error" - } - } - } - } - } - ] - }, - "lndrpc": { - "rpc": [] - } - } - } - ] + "create_invoice": { + "mocks": { + "breez": { + "sdk_services": { + "method": "breez_sdk.connect", + "request_type": "function" + } }, - "create_invoice": { - "mocks": { - "breez": { - "sdk_services": { - "method": "breez_sdk.connect", - "request_type": "function" - } - }, - "corelightning": { - "ln": { - "method": "pyln.client.LightningRpc.__new__", - "request_type": "function", - "response_type": "data", - "response": { - "help": { - "request_type": "function", - "response_type": "json", - "response": { - "help": [ - { - "command": "some command" - } - ] - } - }, - "listinvoices": { - "request_type": "function", - "response_type": "json", - "response": { - "invoices": [] - } - } - } - } - }, - "lndrpc": { - "rpc": { - "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} + "corelightning": { + "ln": { + "method": "pyln.client.LightningRpc.__new__", + "request_type": "function", + "response_type": "data", + "response": { + "help": { + "request_type": "function", + "response_type": "json", + "response": { + "help": [ + { + "command": "some command" } + ] } - }, - "tests": [ - { - "description": "success", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "success": true, - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n", - "error_message": null - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "receive_payment": { - "request_type": "function", - "request_data": { - "klass": "breez_sdk.ReceivePaymentRequest", - "kwargs": { - "amount_msat": 555000, - "description": "Test Invoice", - "preimage": null, - "opening_fee_params": null, - "use_description_hash": null - } - }, - "response_type": "data", - "response": { - "ln_invoice": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "bolt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "description": "one channel", - "response": { - "invoice": { - "request_type": "function", - "request_data": { - "kwargs": { - "deschashonly": false, - "description": "Test Invoice", - "expiry": null, - "exposeprivatechannels": true, - "label": "test-label", - "msatoshi": 555000 - } - }, - "response_type": "json", - "response": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "bolt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": { - "AddInvoice": { - "request_type": "async-function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.Invoice", - "kwargs": { - "value": 555, - "private": true, - "memo": "Test Invoice" - } - }, - "response_type": "data", - "response": { - "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")", - "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" - } - } - } - } - ] - } - } - }, - { - "description": "error", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "success": false, - "checking_id": null, - "payment_request": null, - "error_message": "test-error" - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "receive_payment": { - "request_type": "function", - "request_data": { - "klass": "breez_sdk.ReceivePaymentRequest", - "kwargs": { - "amount_msat": 555000, - "description": "Test Invoice", - "preimage": null, - "opening_fee_params": null, - "use_description_hash": null - } - }, - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "response": { - "invoice": { - "request_type": "function", - "request_data": { - "kwargs": { - "deschashonly": false, - "description": "Test Invoice", - "expiry": null, - "exposeprivatechannels": true, - "label": "test-label", - "msatoshi": 555000 - } - }, - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - }, - { - "response": { - "invoice": { - "request_type": "function", - "request_data": { - "kwargs": { - "deschashonly": false, - "description": "Test Invoice", - "expiry": null, - "exposeprivatechannels": true, - "label": "test-label", - "msatoshi": 555000 - } - }, - "response_type": "json", - "response": { - "code": -1, - "message": "test-error" - } - } - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": { - "AddInvoice": { - "request_type": "async-function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.Invoice", - "kwargs": { - "value": 555, - "private": true, - "memo": "Test Invoice" - } - }, - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - } - } - }, - { - "description": "missing data", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "success": false, - "checking_id": null, - "payment_request": null, - "error_message": "Server error: 'missing required fields'" - }, - "mocks": { - "breez": { - "sdk_services": [] - }, - "corelightning": { - "ln": [ - { - "response": { - "invoice": { - "request_type": "function", - "request_data": { - "kwargs": { - "deschashonly": false, - "description": "Test Invoice", - "expiry": null, - "exposeprivatechannels": true, - "label": "test-label", - "msatoshi": 555000 - } - }, - "response_type": "json", - "response": {} - } - } - } - ] - } - } - }, - { - "description": "rpc error", - "call_params": { - "amount": 555, - "memo": "Test Invoice", - "label": "test-label" - }, - "expect": { - "success": false, - "checking_id": null, - "payment_request": null, - "error_message": "RPC 'test_method' failed with 'test-error'." - }, - "mocks": { - "breez": { - "sdk_services": [] - }, - "corelightning": { - "ln": [ - { - "response": { - "invoice": { - "request_type": "function", - "request_data": { - "kwargs": { - "deschashonly": false, - "description": "Test Invoice", - "expiry": null, - "exposeprivatechannels": true, - "label": "test-label", - "msatoshi": 555000 - } - }, - "response_type": "exception", - "response": { - "module": "pyln.client.lightning", - "class": "RpcError", - "data": { - "method": "test_method", - "payload": "y", - "error": "test-error" - } - } - } - } - } - ] - } - } + }, + "listinvoices": { + "request_type": "function", + "response_type": "json", + "response": { + "invoices": [] } - ] + } + } + } }, - "pay_invoice": { - "mocks": { - "breez": { - "sdk_services": { - "method": "breez_sdk.connect", - "request_type": "function" - } - }, - "corelightning": { - "ln": { - "method": "pyln.client.LightningRpc.__new__", - "request_type": "function", - "response_type": "data", - "response": { - "help": { - "request_type": "function", - "response_type": "json", - "response": { - "help": [ - { - "command": "some command" - } - ] - } - }, - "listinvoices": { - "request_type": "function", - "response_type": "json", - "response": { - "invoices": [] - } - }, - "listpays": { - "description": "no data, pending", - "request_type": "function", - "response_type": "json", - "response": {} - } - } - } - }, - "lndrpc": { - "rpc": { - "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} - }, - "routerpc": { - "method": "lnbits.wallets.lnd_grpc_files.router_pb2_grpc.RouterStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} - } - } - }, - "tests": [ - { - "description": "success", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "error_message": null, - "success": true, - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "fee_msat": 50, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000" - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "send_payment": { - "request_type": "function", - "response_type": "data", - "response": { - "status": { - "value": 2 - }, - "fee_msat": 50, - "details": { - "data": { - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - } - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "response": { - "call": { - "description": "indirect call to `pay` (via `call`)", - "request_type": "function", - "request_data": { - "args": [ - "pay", - { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "description": "Unit Test Invoice", - "exemptfee": 0, - "maxfeepercent": "119.04761905" - } - ] - }, - "response_type": "json", - "response": { - "amount_sent_msat": 21000, - "amount_msat": 21050, - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - } - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": {} - } - ], - "routerpc": [ - { - "description": "one HTLCs", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 2, - "htlcs": [ - { - "route": { - "total_fees_msat": -50 - } - } - ], - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - } - } - } - } - }, - { - "description": "two HTLCs", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 2, - "htlcs": [ - { - "route": { - "total_fees_msat": -100 - } - }, - { - "route": { - "total_fees_msat": -50 - } - } - ], - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - } - } - } - } - } - ] - } - } - }, - { - "description": "error", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "__eval__:error_message": "\"Payment failed: \" in \"{error_message}\"", - "success": false, - "checking_id": null, - "fee_msat": null, - "preimage": null - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "send_payment": { - "request_type": "function", - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "description": "test-error", - "response": { - "call": { - "description": "indirect call to `pay` (via `call`)", - "request_type": "function", - "request_data": { - "args": [ - "pay", - { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "description": "Unit Test Invoice", - "exemptfee": 0, - "maxfeepercent": "119.04761905" - } - ] - }, - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": {} - } - ], - "routerpc": [ - { - "description": "No error given.", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 3, - "failure_reason": 0 - } - } - } - } - } - }, - { - "description": "Payment timed out.", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 3, - "failure_reason": 1 - } - } - } - } - } - }, - { - "description": "No route to destination.", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 3, - "failure_reason": 2 - } - } - } - } - } - }, - { - "description": "Error.", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 3, - "failure_reason": 3 - } - } - } - } - } - }, - { - "description": "Incorrect payment details.", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 3, - "failure_reason": 4 - } - } - } - } - } - }, - { - "description": "Insufficient balance.", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "data", - "response": { - "status": 3, - "failure_reason": 5 - } - } - } - } - } - }, - { - "description": "RPC error.", - "response": { - "SendPaymentV2": { - "request_type": "function", - "response_type": "function", - "response": { - "read": { - "request_type": "async-function", - "response_type": "exception", - "response": { - "data": "Payment failed: 'rpc maybe'" - } - } - } - } - } - } - ] - } - } - }, - { - "description": "missing data", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "success": false, - "checking_id": null, - "fee_msat": null, - "preimage": null, - "error_message": "Server error: 'missing required fields'" - }, - "mocks": { - "breez": { - "sdk_services": [] - }, - "corelightning": { - "ln": [ - { - "response": { - "call": { - "description": "indirect call to `pay` (via `call`)", - "request_type": "function", - "request_data": { - "args": [ - "pay", - { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "description": "Unit Test Invoice", - "exemptfee": 0, - "maxfeepercent": "119.04761905" - } - ] - }, - "response_type": "json", - "response": {} - } - } - } - ] - }, - "lndrpc": { - "rpc": [], - "routerpc": [] - } - } - }, - { - "description": "rpc error", - "call_params": { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "fee_limit_msat": 25000 - }, - "expect": { - "success": false, - "checking_id": null, - "fee_msat": null, - "preimage": null, - "error_message": "RPC 'test_method' failed with 'test-error'." - }, - "mocks": { - "breez": { - "sdk_services": [] - }, - "corelightning": { - "ln": [ - { - "response": { - "call": { - "description": "indirect call to `pay` (via `call`)", - "request_type": "function", - "request_data": { - "args": [ - "pay", - { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "description": "Unit Test Invoice", - "exemptfee": 0, - "maxfeepercent": "119.04761905" - } - ] - }, - "response_type": "exception", - "response": { - "module": "pyln.client.lightning", - "class": "RpcError", - "data": { - "method": "test_method", - "payload": "y", - "error": { - "attempts": [ - { - "fail_reason": "RPC 'test_method' failed with 'test-error'." - } - ] - } - } - } - } - } - }, - { - "response": { - "call": { - "description": "indirect call to `pay` (via `call`)", - "request_type": "function", - "request_data": { - "args": [ - "pay", - { - "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", - "description": "Unit Test Invoice", - "exemptfee": 0, - "maxfeepercent": "119.04761905" - } - ] - }, - "response_type": "exception", - "response": { - "module": "pyln.client.lightning", - "class": "RpcError", - "data": { - "method": "test_method", - "payload": "y", - "error": "test-error" - } - } - } - } - } - ] - } - } - } - ] - }, - "get_invoice_status": { - "mocks": { - "breez": { - "sdk_services": { - "method": "breez_sdk.connect", - "request_type": "function" - } - }, - "corelightning": { - "ln": { - "method": "pyln.client.LightningRpc.__new__", - "request_type": "function", - "response_type": "data", - "response": { - "help": { - "request_type": "function", - "response_type": "json", - "response": { - "help": [ - { - "command": "some command" - } - ] - } - } - } - } - }, - "lndrpc": { - "rpc": { - "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} - }, - "routerpc": { - "method": "lnbits.wallets.lnd_grpc_files.router_pb2_grpc.RouterStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} - } - } - }, - "tests": [ - { - "description": "success", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": true, - "failed": false, - "pending": false - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": { - "payment_type": { - "value": 2 - }, - "status": { - "value": 2 - } - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "description": "one invoice", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "response_type": "json", - "response": { - "invoices": [ - { - "status": "paid", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - ] - } - } - ] - } - } - ] - }, - "lndrpc": { - "routerpc": [ - { - "response": {} - } - ], - "rpc": [ - { - "response": { - "LookupInvoice": { - "request_type": "async-function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", - "kwargs": { - "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "data", - "response": { - "settled": true - } - } - } - } - ] - } - } - }, - { - "description": "pending", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": false, - "failed": false, - "pending": true - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": null - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "description": "no invoice", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - } - ] - } - }, - { - "description": "rpc error", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "exception", - "response": { - "module": "pyln.client.lightning", - "class": "RpcError", - "data": { - "method": "test_method", - "payload": "y", - "error": "test-error" - } - } - } - ] - } - }, - { - "description": "error", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "exception", - "response": { - "data": "test-error" - } - } - ] - } - }, - { - "description": "no data", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": {} - } - ] - } - }, - { - "description": "bad checking_id", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [ - { - "status": "paid", - "payment_hash": "baaade35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d72" - } - ] - } - } - ] - } - }, - { - "description": "unpaid", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [ - { - "status": "unpaid", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - ] - } - } - ] - } - } - ] - }, - "lndrpc": { - "routerpc": [ - { - "response": {} - } - ], - "rpc": [ - { - "description": "not settled", - "response": { - "LookupInvoice": { - "request_type": "async-function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", - "kwargs": { - "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "data", - "response": { - "settled": false - } - } - } - }, - { - "description": "rpc error", - "response": { - "LookupInvoice": { - "request_type": "async-function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", - "kwargs": { - "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "exception", - "response": { - "module": "grpc", - "class": "RpcError", - "data": {} - } - } - } - }, - { - "description": "rpc error", - "response": { - "LookupInvoice": { - "request_type": "async-function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", - "kwargs": { - "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - } - } - }, - { - "description": "pending - incorrect checking_id", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f" - }, - "expect": { - "success": false, - "failed": false, - "pending": true - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": null - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "description": "validation should be added", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - } - ] - } - } - ] - }, - "lndrpc": { - "routerpc": [ - { - "response": {} - } - ], - "rpc": [ - { - "response": {} - } - ] - } - } - }, - { - "description": "failed", - "description1": "pending should be false in the 'expect', this is a bug", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": false, - "failed": true, - "pending": true - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "description": "FAILED", - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": { - "payment_type": { - "value": 2 - }, - "status": { - "value": 1 - } - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "description": "expired", - "response": { - "listinvoices": [ - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [] - } - }, - { - "request_type": "function", - "request_data": { - "kwargs": { - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - }, - "response_type": "json", - "response": { - "invoices": [ - { - "status": "expired", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - ] - } - } - ] - } - } - ] - }, - "lndrpc": { - "routerpc": [], - "rpc": [] - } - } - } - ] - }, - "get_payment_status": { - "mocks": { - "breez": { - "sdk_services": { - "method": "breez_sdk.connect", - "request_type": "function" - } - }, - "corelightning": { - "ln": { - "method": "pyln.client.LightningRpc.__new__", - "request_type": "function", - "response_type": "data", - "response": { - "help": { - "request_type": "function", - "response_type": "json", - "response": { - "help": [ - { - "command": "some command" - } - ] - } - }, - "listinvoices": { - "request_type": "function", - "response_type": "json", - "response": { - "invoices": [] - } - } - } - } - }, - "lndrpc": { - "rpc": { - "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} - }, - "routerpc": { - "method": "lnbits.wallets.lnd_grpc_files.router_pb2_grpc.RouterStub.__new__", - "request_type": "function", - "response_type": "data", - "response": {} - } - } - }, - "tests": [ - { - "description": "success", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": true, - "failed": false, - "pending": false, - "fee_msat": 50, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000" - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": { - "fee_msat": 50, - "details": { - "data": { - "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" - } - }, - "payment_type": { - "value": 1 - }, - "status": { - "value": 2 - } - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "response": { - "listpays": [ - { - "request_type": "function", - "response_type": "json", - "response": { - "pays": [ - { - "status": "complete", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", - "preimage": "0000000000000000000000000000000000000000000000000000000000000000", - "amount_sent_msat": 21000, - "amount_msat": 21050 - } - ] - } - } - ] - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": {} - } - ], - "routerpc": [ - { - "description": "two HTLC", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - { - "status": 2, - "htlcs": [ - { - "route": { - "total_fees_msat": -100 - }, - "preimage": "0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "route": { - "total_fees_msat": -50 - }, - "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" - } - ] - } - ] - } - } - } - ] - } - } - }, - { - "description": "success status, no payment found", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": true, - "failed": false, - "pending": false, - "fee_msat": null, - "preimage": null - }, - "mocks": { - "breez": {}, - "corelightning": {}, - "lndrpc": { - "rpc": [ - { - "response": {} - } - ], - "routerpc": [ - { - "description": "two HTLC", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - { - "status": 2, - "htlcs": [] - } - ] - } - } - } - ] - } - } - }, - { - "description": "pending", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": false, - "failed": false, - "pending": true, - "fee_msat": null - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "description": "no data", - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": null - } - } - }, - { - "description": "error", - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - }, - { - "description": "pending", - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": { - "status": { - "value": 1 - }, - "payment_type": { - "value": 1 - } - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "response": { - "listpays": [ - { - "description": "no data", - "request_type": "function", - "response_type": "json", - "response": {} - } - ] - } - }, - { - "description": "error", - "response_type": "data", - "response": { - "listpays": { - "request_type": "function", - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - }, - { - "response": { - "listpays": [ - { - "description": "pending status", - "request_type": "function", - "response_type": "json", - "response": { - "pays": [ - { - "status": "pending", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - ] - } - } - ] - } - }, - { - "response": { - "listpays": [ - { - "description": "bad checking_id", - "request_type": "function", - "response_type": "json", - "response": { - "pays": [ - { - "status": "complete", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d7bbbbbb" - } - ] - } - } - ] - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": {} - } - ], - "routerpc": [ - { - "description": "no HTLC", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - { - "status": 0, - "htlcs": [] - } - ] - } - } - }, - { - "description": "no payments", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [] - } - } - }, - { - "description": "no status", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - {} - ] - } - } - }, - { - "description": "status: non-existend", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - { - "status": 0, - "htlcs": [ - { - "route": { - "total_fees_msat": -50 - }, - "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" - } - ] - } - ] - } - } - }, - { - "description": "status: in-flight", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - { - "status": 1, - "htlcs": [ - { - "route": { - "total_fees_msat": -50 - }, - "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" - } - ] - } - ] - } - } - }, - { - "description": "status: unknown", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - { - "status": 999, - "htlcs": [ - { - "route": { - "total_fees_msat": -50 - }, - "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" - } - ] - } - ] - } - } - }, - { - "description": "raise error", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "exception", - "response": { - "data": "test-error" - } - } - } - } - ] - } - } - }, - { - "description": "pending - incorrect checking_id", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f" - }, - "expect": { - "success": false, - "failed": false, - "pending": true, - "fee_msat": null - }, - "mocks": { - "breez": {}, - "corelightning": { - "ln": [ - { - "response": { - "listpays": [ - { - "description": "no data", - "request_type": "function", - "response_type": "json", - "response": {} - } - ] - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": {} - } - ], - "routerpc": [ - { - "description": "no HTLC", - "response": {} - } - ] - } - } - }, - { - "description": "failed", - "description1": "pending should be false in the 'expect', this is a bug", - "call_params": { - "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - }, - "expect": { - "success": false, - "failed": true, - "pending": true, - "fee_msat": null, - "preimage": null - }, - "mocks": { - "breez": { - "sdk_services": [ - { - "description": "failed status", - "response_type": "data", - "response": { - "payment_by_hash": { - "request_type": "function", - "response_type": "data", - "response": { - "status": { - "value": 3 - }, - "payment_type": { - "value": 1 - } - } - } - } - } - ] - }, - "corelightning": { - "ln": [ - { - "response": { - "listpays": [ - { - "request_type": "function", - "response_type": "json", - "response": { - "pays": [ - { - "status": "failed", - "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" - } - ] - } - } - ] - } - } - ] - }, - "lndrpc": { - "rpc": [ - { - "response": {} - } - ], - "routerpc": [ - { - "description": "two HTLC", - "response": { - "TrackPaymentV2": { - "request_type": "function", - "request_data": { - "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", - "kwargs": { - "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" - } - }, - "response_type": "__aiter__", - "response": [ - { - "status": 3, - "htlcs": [] - } - ] - } - } - } - ] - } - } - } - ] + "lndrpc": { + "rpc": { + "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + } } + }, + "tests": [ + { + "description": "success", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "success": true, + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n", + "error_message": null + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "receive_payment": { + "request_type": "function", + "request_data": { + "klass": "breez_sdk.ReceivePaymentRequest", + "kwargs": { + "amount_msat": 555000, + "description": "Test Invoice", + "preimage": null, + "opening_fee_params": null, + "use_description_hash": null + } + }, + "response_type": "data", + "response": { + "ln_invoice": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "bolt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "description": "one channel", + "response": { + "invoice": { + "request_type": "function", + "request_data": { + "kwargs": { + "deschashonly": false, + "description": "Test Invoice", + "expiry": null, + "exposeprivatechannels": true, + "label": "test-label", + "msatoshi": 555000 + } + }, + "response_type": "json", + "response": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "bolt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": { + "AddInvoice": { + "request_type": "async-function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.Invoice", + "kwargs": { + "value": 555, + "private": true, + "memo": "Test Invoice" + } + }, + "response_type": "data", + "response": { + "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")", + "payment_request": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n" + } + } + } + } + ] + } + } + }, + { + "description": "error", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "success": false, + "checking_id": null, + "payment_request": null, + "error_message": "test-error" + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "receive_payment": { + "request_type": "function", + "request_data": { + "klass": "breez_sdk.ReceivePaymentRequest", + "kwargs": { + "amount_msat": 555000, + "description": "Test Invoice", + "preimage": null, + "opening_fee_params": null, + "use_description_hash": null + } + }, + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "response": { + "invoice": { + "request_type": "function", + "request_data": { + "kwargs": { + "deschashonly": false, + "description": "Test Invoice", + "expiry": null, + "exposeprivatechannels": true, + "label": "test-label", + "msatoshi": 555000 + } + }, + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + }, + { + "response": { + "invoice": { + "request_type": "function", + "request_data": { + "kwargs": { + "deschashonly": false, + "description": "Test Invoice", + "expiry": null, + "exposeprivatechannels": true, + "label": "test-label", + "msatoshi": 555000 + } + }, + "response_type": "json", + "response": { + "code": -1, + "message": "test-error" + } + } + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": { + "AddInvoice": { + "request_type": "async-function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.Invoice", + "kwargs": { + "value": 555, + "private": true, + "memo": "Test Invoice" + } + }, + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + } + } + }, + { + "description": "missing data", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "success": false, + "checking_id": null, + "payment_request": null, + "error_message": "Server error: 'missing required fields'" + }, + "mocks": { + "breez": { + "sdk_services": [] + }, + "corelightning": { + "ln": [ + { + "response": { + "invoice": { + "request_type": "function", + "request_data": { + "kwargs": { + "deschashonly": false, + "description": "Test Invoice", + "expiry": null, + "exposeprivatechannels": true, + "label": "test-label", + "msatoshi": 555000 + } + }, + "response_type": "json", + "response": {} + } + } + } + ] + } + } + }, + { + "description": "rpc error", + "call_params": { + "amount": 555, + "memo": "Test Invoice", + "label": "test-label" + }, + "expect": { + "success": false, + "checking_id": null, + "payment_request": null, + "error_message": "RPC 'test_method' failed with 'test-error'." + }, + "mocks": { + "breez": { + "sdk_services": [] + }, + "corelightning": { + "ln": [ + { + "response": { + "invoice": { + "request_type": "function", + "request_data": { + "kwargs": { + "deschashonly": false, + "description": "Test Invoice", + "expiry": null, + "exposeprivatechannels": true, + "label": "test-label", + "msatoshi": 555000 + } + }, + "response_type": "exception", + "response": { + "module": "pyln.client.lightning", + "class": "RpcError", + "data": { + "method": "test_method", + "payload": "y", + "error": "test-error" + } + } + } + } + } + ] + } + } + } + ] + }, + "pay_invoice": { + "mocks": { + "breez": { + "sdk_services": { + "method": "breez_sdk.connect", + "request_type": "function" + } + }, + "corelightning": { + "ln": { + "method": "pyln.client.LightningRpc.__new__", + "request_type": "function", + "response_type": "data", + "response": { + "help": { + "request_type": "function", + "response_type": "json", + "response": { + "help": [ + { + "command": "some command" + } + ] + } + }, + "listinvoices": { + "request_type": "function", + "response_type": "json", + "response": { + "invoices": [] + } + }, + "listpays": { + "description": "no data, pending", + "request_type": "function", + "response_type": "json", + "response": {} + } + } + } + }, + "lndrpc": { + "rpc": { + "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + }, + "routerpc": { + "method": "lnbits.wallets.lnd_grpc_files.router_pb2_grpc.RouterStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + } + } + }, + "tests": [ + { + "description": "success", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "error_message": null, + "success": true, + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "fee_msat": 50, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "send_payment": { + "request_type": "function", + "response_type": "data", + "response": { + "status": { + "value": 2 + }, + "fee_msat": 50, + "details": { + "data": { + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "response": { + "call": { + "description": "indirect call to `pay` (via `call`)", + "request_type": "function", + "request_data": { + "args": [ + "pay", + { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "description": "Unit Test Invoice", + "exemptfee": 0, + "maxfeepercent": "119.04761905" + } + ] + }, + "response_type": "json", + "response": { + "amount_sent_msat": 21000, + "amount_msat": 21050, + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": {} + } + ], + "routerpc": [ + { + "description": "one HTLCs", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 2, + "htlcs": [ + { + "route": { + "total_fees_msat": -50 + } + } + ], + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + } + } + } + } + }, + { + "description": "two HTLCs", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 2, + "htlcs": [ + { + "route": { + "total_fees_msat": -100 + } + }, + { + "route": { + "total_fees_msat": -50 + } + } + ], + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + } + } + } + } + } + ] + } + } + }, + { + "description": "error", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "__eval__:error_message": "\"Payment failed: \" in \"{error_message}\"", + "success": false, + "checking_id": null, + "fee_msat": null, + "preimage": null + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "send_payment": { + "request_type": "function", + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "description": "test-error", + "response": { + "call": { + "description": "indirect call to `pay` (via `call`)", + "request_type": "function", + "request_data": { + "args": [ + "pay", + { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "description": "Unit Test Invoice", + "exemptfee": 0, + "maxfeepercent": "119.04761905" + } + ] + }, + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": {} + } + ], + "routerpc": [ + { + "description": "No error given.", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 3, + "failure_reason": 0 + } + } + } + } + } + }, + { + "description": "Payment timed out.", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 3, + "failure_reason": 1 + } + } + } + } + } + }, + { + "description": "No route to destination.", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 3, + "failure_reason": 2 + } + } + } + } + } + }, + { + "description": "Error.", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 3, + "failure_reason": 3 + } + } + } + } + } + }, + { + "description": "Incorrect payment details.", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 3, + "failure_reason": 4 + } + } + } + } + } + }, + { + "description": "Insufficient balance.", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "data", + "response": { + "status": 3, + "failure_reason": 5 + } + } + } + } + } + }, + { + "description": "RPC error.", + "response": { + "SendPaymentV2": { + "request_type": "function", + "response_type": "function", + "response": { + "read": { + "request_type": "async-function", + "response_type": "exception", + "response": { + "data": "Payment failed: 'rpc maybe'" + } + } + } + } + } + } + ] + } + } + }, + { + "description": "missing data", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "success": false, + "checking_id": null, + "fee_msat": null, + "preimage": null, + "error_message": "Server error: 'missing required fields'" + }, + "mocks": { + "breez": { + "sdk_services": [] + }, + "corelightning": { + "ln": [ + { + "response": { + "call": { + "description": "indirect call to `pay` (via `call`)", + "request_type": "function", + "request_data": { + "args": [ + "pay", + { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "description": "Unit Test Invoice", + "exemptfee": 0, + "maxfeepercent": "119.04761905" + } + ] + }, + "response_type": "json", + "response": {} + } + } + } + ] + }, + "lndrpc": { + "rpc": [], + "routerpc": [] + } + } + }, + { + "description": "rpc error", + "call_params": { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "fee_limit_msat": 25000 + }, + "expect": { + "success": false, + "checking_id": null, + "fee_msat": null, + "preimage": null, + "error_message": "RPC 'test_method' failed with 'test-error'." + }, + "mocks": { + "breez": { + "sdk_services": [] + }, + "corelightning": { + "ln": [ + { + "response": { + "call": { + "description": "indirect call to `pay` (via `call`)", + "request_type": "function", + "request_data": { + "args": [ + "pay", + { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "description": "Unit Test Invoice", + "exemptfee": 0, + "maxfeepercent": "119.04761905" + } + ] + }, + "response_type": "exception", + "response": { + "module": "pyln.client.lightning", + "class": "RpcError", + "data": { + "method": "test_method", + "payload": "y", + "error": { + "attempts": [ + { + "fail_reason": "RPC 'test_method' failed with 'test-error'." + } + ] + } + } + } + } + } + }, + { + "response": { + "call": { + "description": "indirect call to `pay` (via `call`)", + "request_type": "function", + "request_data": { + "args": [ + "pay", + { + "bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu", + "description": "Unit Test Invoice", + "exemptfee": 0, + "maxfeepercent": "119.04761905" + } + ] + }, + "response_type": "exception", + "response": { + "module": "pyln.client.lightning", + "class": "RpcError", + "data": { + "method": "test_method", + "payload": "y", + "error": "test-error" + } + } + } + } + } + ] + } + } + } + ] + }, + "get_invoice_status": { + "mocks": { + "breez": { + "sdk_services": { + "method": "breez_sdk.connect", + "request_type": "function" + } + }, + "corelightning": { + "ln": { + "method": "pyln.client.LightningRpc.__new__", + "request_type": "function", + "response_type": "data", + "response": { + "help": { + "request_type": "function", + "response_type": "json", + "response": { + "help": [ + { + "command": "some command" + } + ] + } + } + } + } + }, + "lndrpc": { + "rpc": { + "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + }, + "routerpc": { + "method": "lnbits.wallets.lnd_grpc_files.router_pb2_grpc.RouterStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + } + } + }, + "tests": [ + { + "description": "success", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": true, + "failed": false, + "pending": false + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": { + "payment_type": { + "value": 2 + }, + "status": { + "value": 2 + } + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "description": "one invoice", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "response_type": "json", + "response": { + "invoices": [ + { + "status": "paid", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + ] + } + } + ] + } + } + ] + }, + "lndrpc": { + "routerpc": [ + { + "response": {} + } + ], + "rpc": [ + { + "response": { + "LookupInvoice": { + "request_type": "async-function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", + "kwargs": { + "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "data", + "response": { + "settled": true + } + } + } + } + ] + } + } + }, + { + "description": "pending", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": false, + "failed": false, + "pending": true + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": null + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "description": "no invoice", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + } + ] + } + }, + { + "description": "rpc error", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "exception", + "response": { + "module": "pyln.client.lightning", + "class": "RpcError", + "data": { + "method": "test_method", + "payload": "y", + "error": "test-error" + } + } + } + ] + } + }, + { + "description": "error", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "exception", + "response": { + "data": "test-error" + } + } + ] + } + }, + { + "description": "no data", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": {} + } + ] + } + }, + { + "description": "bad checking_id", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [ + { + "status": "paid", + "payment_hash": "baaade35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d72" + } + ] + } + } + ] + } + }, + { + "description": "unpaid", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [ + { + "status": "unpaid", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + ] + } + } + ] + } + } + ] + }, + "lndrpc": { + "routerpc": [ + { + "response": {} + } + ], + "rpc": [ + { + "description": "not settled", + "response": { + "LookupInvoice": { + "request_type": "async-function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", + "kwargs": { + "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "data", + "response": { + "settled": false + } + } + } + }, + { + "description": "rpc error", + "response": { + "LookupInvoice": { + "request_type": "async-function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", + "kwargs": { + "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "exception", + "response": { + "module": "grpc", + "class": "RpcError", + "data": {} + } + } + } + }, + { + "description": "rpc error", + "response": { + "LookupInvoice": { + "request_type": "async-function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.lightning_pb2.PaymentHash", + "kwargs": { + "__eval__:r_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + } + } + }, + { + "description": "pending - incorrect checking_id", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f" + }, + "expect": { + "success": false, + "failed": false, + "pending": true + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": null + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "description": "validation should be added", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + } + ] + } + } + ] + }, + "lndrpc": { + "routerpc": [ + { + "response": {} + } + ], + "rpc": [ + { + "response": {} + } + ] + } + } + }, + { + "description": "failed", + "description1": "pending should be false in the 'expect', this is a bug", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": false, + "failed": true, + "pending": true + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "description": "FAILED", + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": { + "payment_type": { + "value": 2 + }, + "status": { + "value": 1 + } + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "description": "expired", + "response": { + "listinvoices": [ + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [] + } + }, + { + "request_type": "function", + "request_data": { + "kwargs": { + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + }, + "response_type": "json", + "response": { + "invoices": [ + { + "status": "expired", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + ] + } + } + ] + } + } + ] + }, + "lndrpc": { + "routerpc": [], + "rpc": [] + } + } + } + ] + }, + "get_payment_status": { + "mocks": { + "breez": { + "sdk_services": { + "method": "breez_sdk.connect", + "request_type": "function" + } + }, + "corelightning": { + "ln": { + "method": "pyln.client.LightningRpc.__new__", + "request_type": "function", + "response_type": "data", + "response": { + "help": { + "request_type": "function", + "response_type": "json", + "response": { + "help": [ + { + "command": "some command" + } + ] + } + }, + "listinvoices": { + "request_type": "function", + "response_type": "json", + "response": { + "invoices": [] + } + } + } + } + }, + "lndrpc": { + "rpc": { + "method": "lnbits.wallets.lnd_grpc_files.lightning_pb2_grpc.LightningStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + }, + "routerpc": { + "method": "lnbits.wallets.lnd_grpc_files.router_pb2_grpc.RouterStub.__new__", + "request_type": "function", + "response_type": "data", + "response": {} + } + } + }, + "tests": [ + { + "description": "success", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": true, + "failed": false, + "pending": false, + "fee_msat": 50, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": { + "fee_msat": 50, + "details": { + "data": { + "payment_preimage": "0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "payment_type": { + "value": 1 + }, + "status": { + "value": 2 + } + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "response": { + "listpays": [ + { + "request_type": "function", + "response_type": "json", + "response": { + "pays": [ + { + "status": "complete", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96", + "preimage": "0000000000000000000000000000000000000000000000000000000000000000", + "amount_sent_msat": 21000, + "amount_msat": 21050 + } + ] + } + } + ] + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": {} + } + ], + "routerpc": [ + { + "description": "two HTLC", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [ + { + "status": 2, + "htlcs": [ + { + "route": { + "total_fees_msat": -100 + }, + "preimage": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "route": { + "total_fees_msat": -50 + }, + "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" + } + ] + } + ] + } + } + } + ] + } + } + }, + { + "description": "success status, no payment found", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": true, + "failed": false, + "pending": false, + "fee_msat": null, + "preimage": null + }, + "mocks": { + "breez": {}, + "corelightning": {}, + "lndrpc": { + "rpc": [ + { + "response": {} + } + ], + "routerpc": [ + { + "description": "two HTLC", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [ + { + "status": 2, + "htlcs": [] + } + ] + } + } + } + ] + } + } + }, + { + "description": "pending", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": false, + "failed": false, + "pending": true, + "fee_msat": null + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "description": "no data", + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": null + } + } + }, + { + "description": "error", + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + }, + { + "description": "pending", + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": { + "status": { + "value": 1 + }, + "payment_type": { + "value": 1 + } + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "response": { + "listpays": [ + { + "description": "no data", + "request_type": "function", + "response_type": "json", + "response": {} + } + ] + } + }, + { + "description": "error", + "response_type": "data", + "response": { + "listpays": { + "request_type": "function", + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + }, + { + "response": { + "listpays": [ + { + "description": "pending status", + "request_type": "function", + "response_type": "json", + "response": { + "pays": [ + { + "status": "pending", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + ] + } + } + ] + } + }, + { + "response": { + "listpays": [ + { + "description": "bad checking_id", + "request_type": "function", + "response_type": "json", + "response": { + "pays": [ + { + "status": "complete", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d7bbbbbb" + } + ] + } + } + ] + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": {} + } + ], + "routerpc": [ + { + "description": "no HTLC", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [ + { + "status": 0, + "htlcs": [] + } + ] + } + } + }, + { + "description": "no payments", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [] + } + } + }, + { + "description": "no status", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [{}] + } + } + }, + { + "description": "status: non-existend", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [ + { + "status": 0, + "htlcs": [ + { + "route": { + "total_fees_msat": -50 + }, + "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" + } + ] + } + ] + } + } + }, + { + "description": "status: in-flight", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [ + { + "status": 1, + "htlcs": [ + { + "route": { + "total_fees_msat": -50 + }, + "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" + } + ] + } + ] + } + } + }, + { + "description": "status: unknown", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [ + { + "status": 999, + "htlcs": [ + { + "route": { + "total_fees_msat": -50 + }, + "__eval__:preimage": "bytes.fromhex(\"0000000000000000000000000000000000000000000000000000000000000000\")" + } + ] + } + ] + } + } + }, + { + "description": "raise error", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "exception", + "response": { + "data": "test-error" + } + } + } + } + ] + } + } + }, + { + "description": "pending - incorrect checking_id", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f" + }, + "expect": { + "success": false, + "failed": false, + "pending": true, + "fee_msat": null + }, + "mocks": { + "breez": {}, + "corelightning": { + "ln": [ + { + "response": { + "listpays": [ + { + "description": "no data", + "request_type": "function", + "response_type": "json", + "response": {} + } + ] + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": {} + } + ], + "routerpc": [ + { + "description": "no HTLC", + "response": {} + } + ] + } + } + }, + { + "description": "failed", + "description1": "pending should be false in the 'expect', this is a bug", + "call_params": { + "checking_id": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + }, + "expect": { + "success": false, + "failed": true, + "pending": true, + "fee_msat": null, + "preimage": null + }, + "mocks": { + "breez": { + "sdk_services": [ + { + "description": "failed status", + "response_type": "data", + "response": { + "payment_by_hash": { + "request_type": "function", + "response_type": "data", + "response": { + "status": { + "value": 3 + }, + "payment_type": { + "value": 1 + } + } + } + } + } + ] + }, + "corelightning": { + "ln": [ + { + "response": { + "listpays": [ + { + "request_type": "function", + "response_type": "json", + "response": { + "pays": [ + { + "status": "failed", + "payment_hash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96" + } + ] + } + } + ] + } + } + ] + }, + "lndrpc": { + "rpc": [ + { + "response": {} + } + ], + "routerpc": [ + { + "description": "two HTLC", + "response": { + "TrackPaymentV2": { + "request_type": "function", + "request_data": { + "klass": "lnbits.wallets.lnd_grpc_files.router_pb2.TrackPaymentRequest", + "kwargs": { + "__eval__:payment_hash": "bytes.fromhex(\"e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96\")" + } + }, + "response_type": "__aiter__", + "response": [ + { + "status": 3, + "htlcs": [] + } + ] + } + } + } + ] + } + } + } + ] } + } }