373 Commits

Author SHA1 Message Date
Michael Bumann
bf7a25a7de cleanup 2024-07-31 00:58:58 +02:00
Michael Bumann
4a63e057a3 Remove some no longer useful logging
This info is not very useful
2024-07-27 19:44:33 +02:00
Michael Bumann
fc4fe444ad Add custom rate limit deny handler
This returns a proper JSON error for rate limit errors.
The error handler was not enough.
2024-06-21 14:31:55 +02:00
Michael Bumann
d552238f16 Publish invoice service and routing fees to the rabbitmq/webhook 2024-06-14 13:41:50 +02:00
Michael Bumann
ba5057cb74 Merge pull request #487 from getAlby/limit-logs
Add logs to outgoing/incoming limit checks
2024-06-07 12:35:27 +03:00
Michael Bumann
0b8c8e0cc2 Use proper JSON response for rate limit error 2024-04-17 15:53:18 +02:00
Michael Bumann
806e8477b1 tmp fix for alby limits 2024-04-07 01:51:12 +02:00
Michael Bumann
a239f23749 Log JWT details 2024-04-06 22:00:45 +02:00
Michael Bumann
8704dd1a07 Add logs to outgoing/incoming limit checks
this helps debugging potential issues
2024-04-06 20:58:58 +02:00
Adithya Vardhan
badb700837 chore: allow 0 limits for send/receive amount/volume (#486)
* chore: allow 0 limits for send/receive amount/volume

* fix: use pointers for claims

* fix: tests to set default as -1

* chore: add 0 check in outgoing exceeded tests

* chore: also default max account balance to -1

* chore: remove dbUri :P

* chore: remove print statements

* chore: add more tests for limits
2024-04-05 09:21:08 +02:00
Michael Bumann
8deabc56be Add support for service fees (#474)
* Add support for service fees

This introduces a new transaction type "service_fee"
Each outgoing payment is charged a service fee of x/1000.
The service fee entries is added with the routing fee reserve entry.
For failed payments the service fee is reversed.

* Add service_fee migration

* No service fee by default

* Fee reserve and service fee is optional

ignore NoRows errors

* Update Makefile

* Unify setting the fee on the invoice

* Proper error check

* ups

* Add service fee tests to outgoing payment tests

* Save parant id to fee tx entries

* Optionally load test DB from env variable

* Add config for free transactions

payment amounts up to NO_SERVICE_FEE_UP_TO_AMOUNT don't get a service fee charged

* Update readme

* cleanup

* fix: only charge service fees for amounts > free limit

* fix: format

* Save service fee on invoice

* naming

* Also save the payment hash where we save the preimage

we already do exactly that when in the normal PayInvoice flow.
Normally the RHash is already set here, but I guess it does not hurt to have
it consistent everywhere.

* Use the invoice routing fee field to check if a routing fee must be charged

It feels a bit indirect to check if we have set a FeeReserve.
We save the routing fee on the invoice thus we should be able to use that information

* remove nullzero from fee columns

we want those to be 0 by default

* add columns only if not existent

---------

Co-authored-by: René Aaron <rene@twentyuno.net>
2024-01-13 14:07:11 +00:00
Michael Bumann
e33693398e Soft delete users (#476)
* Update Makefile

* Optionally load test DB from env variable

* Add option to soft-delete a user

This allows users to be marked as deleted.
An additional middleware checks if a user is deleted or deactivated and rejects
requests for those as StatusUnauthorized.

note: the middelware adds an additional DB query to load the user.
2024-01-09 19:38:01 +02:00
René Aaron
7c965305fb fix: migrating payment failed errors to json logging 2023-12-30 12:35:50 +01:00
René Aaron
4eb9f0923a fix: exclude erroneous payments (#467)
* fix: exclude errorneous payments

* fix: add invoicesfor in tests

---------

Co-authored-by: im-adithya <imadithyavardhan@gmail.com>
2023-12-12 17:47:55 +01:00
kiwiidb
478bc3b93d move limits struct out of lnd package 2023-12-08 12:07:54 +01:00
im-adithya
b494219071 chore: further refactoring 2023-12-07 16:44:47 +05:30
im-adithya
0385c17d2b Merge branch 'task-refactor-checks' into task-limits-jwt 2023-12-07 14:56:27 +05:30
im-adithya
5fd0d66a54 chore: further refactoring 2023-12-07 14:46:12 +05:30
im-adithya
d3208f2bb1 chore: refactor 2023-12-07 14:29:18 +05:30
im-adithya
bd92e6ff85 chore: remove check volume allowed function 2023-12-07 14:15:47 +05:30
im-adithya
e681e69fa2 chore: use limits from JWT if available 2023-12-05 15:58:45 +05:30
im-adithya
62d7ffb7fe fix: outgoing exceeding tests 2023-12-05 12:29:49 +05:30
im-adithya
f542466811 chore: split volume for send and receive 2023-12-05 12:22:38 +05:30
im-adithya
401cd4a458 chore: refactor payment checks 2023-12-04 16:21:06 +05:30
kiwiidb
c5812503c7 Merge pull request #463 from getAlby/task-out-exceeding-checks
chore(addoutgoinginvoice): add exceeding checks for send
2023-12-01 14:40:07 +01:00
im-adithya
29957edad0 chore(addoutgoinginvoice): add exceeding checks for send 2023-12-01 16:01:56 +05:30
im-adithya
fb8c4784d6 chore(addincominginvoice): add exceeding checks for volume, balance, receive 2023-12-01 00:25:38 +05:30
kiwiidb
a64cd2d184 move log line 2023-11-07 16:09:53 +09:00
kiwiidb
1482240d0a add timestamp 2023-11-07 16:03:46 +09:00
kiwiidb
1b067a751f write new func for finding payments 2023-11-07 16:01:55 +09:00
kiwiidb
8477a22f04 more flexible checkpending func signature 2023-11-07 15:57:08 +09:00
kiwiidb
fbef78f311 Merge pull request #432 from getAlby/feature/add-max-volume
Feature/add max volume
2023-09-28 15:50:38 +02:00
kiwiidb
ab14adf965 remove redundant settle state in query 2023-09-28 14:58:31 +02:00
kiwiidb
1e80b25012 Merge pull request #430 from getAlby/task-add-rhash
chore: add rhash and preimage to invoice before failure
2023-09-28 14:31:43 +02:00
kiwiidb
8505f05b38 disable volume check by default 2023-09-27 13:44:07 +02:00
im-adithya
da3adf75d2 fix: add r_hash and preimage to keysend invoices 2023-09-25 19:56:46 +05:30
im-adithya
846f3c09d5 chore: publish invoice data before executing payment 2023-09-25 18:40:11 +05:30
kiwiidb
4f11e62d2b add sentry capture 2023-09-25 14:53:39 +02:00
kiwiidb
b650b4e396 add max fee test 2023-09-25 14:01:38 +02:00
kiwiidb
2a2614d77b fix existing tests 2023-09-25 13:55:18 +02:00
kiwiidb
a043f26b1d fix bug in allowed check 2023-09-25 10:51:20 +02:00
kiwiidb
d6cd58f8af implement volume check 2023-09-25 10:24:38 +02:00
kiwiidb
afbbca8b45 refactor balance check 2023-09-25 10:04:34 +02:00
kiwiidb
d085a95028 Merge pull request #431 from getAlby/chore/refactor-structure
Chore/refactor structure
2023-09-22 16:21:34 +02:00
kiwiidb
08e5b6fc54 more refactoring 2023-09-22 10:43:42 +02:00
Michael Bumann
a1227e37e3 Merge pull request #392 from getAlby/add-max-fee
Add global max fee amount
2023-09-22 12:17:19 +04:00
kiwiidb
b5240fd7fd move main command, extract lnd config 2023-09-22 10:12:26 +02:00
Lucas Rouckhout
4b32ba6c77 Merge branch 'main' into feature/rabbitmq-reconnect 2023-07-14 13:59:33 +02:00
Lucas Rouckhout
8f6aee5750 Make binary decision; either use rabbit for everything or dont 2023-07-14 13:52:29 +02:00
kiwiidb
5a264de92e fix migration issue 2023-07-07 10:50:09 +02:00