Let users donate sats via BTCPay Server #176

Merged
raucao merged 9 commits from feature/donations_btcpay into master 2024-03-13 16:31:54 +00:00
Owner

Introducing the first option for accepting donations in akkounts: one-time donations via BTCPay.

Supports both on-chain and Lightning options. For on-chain donations, the donation is shown as pending until confirmed, while Lightning donations are confirmed instantly, of course. There is also an email notification once on-chain donations have been confirmed, so you don't have to remember to follow up on it.

Furthermore, you can choose the amount either in EUR, USD, or sats. When choosing an amount in sats, the exchange rate will be fetched after receiving the payment notification from BTCPay and added to the donation record then. When choosing a fiat amount, the conversion is already done by BTCPay, so we just add the amount of sats we see from the payment notification already.

In order to test the functionality directly against https://btcpay.kosmos.org, please DM me for a testing API key.

(This PR already includes a small refactoring commit that will make it easier to integrate the next option, which is sats directly from one's Kosmos LndHub account, which can then also be done as a monthly subscription that is automatically debited.)

refs #31

Introducing the first option for accepting donations in akkounts: one-time donations via BTCPay. Supports both on-chain and Lightning options. For on-chain donations, the donation is shown as pending until confirmed, while Lightning donations are confirmed instantly, of course. There is also an email notification once on-chain donations have been confirmed, so you don't have to remember to follow up on it. Furthermore, you can choose the amount either in EUR, USD, or sats. When choosing an amount in sats, the exchange rate will be fetched after receiving the payment notification from BTCPay and added to the donation record then. When choosing a fiat amount, the conversion is already done by BTCPay, so we just add the amount of sats we see from the payment notification already. In order to test the functionality directly against https://btcpay.kosmos.org, please DM me for a testing API key. (This PR already includes a small refactoring commit that will make it easier to integrate the next option, which is sats directly from one's Kosmos LndHub account, which can then also be done as a monthly subscription that is automatically debited.) refs #31
raucao added the
kredits-2
label 2024-03-02 13:56:16 +00:00
raucao added 5 commits 2024-03-02 13:56:17 +00:00
Removing initialize methods from the main/manager class also allows for
different iniitalizers in specific task services
Send email confirmation when BTC payment is confirmed
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
54220019bb
raucao added 1 commit 2024-03-02 14:07:45 +00:00
Merge branch 'master' into feature/donations_btcpay
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
c36cf5eee6
raucao added 1 commit 2024-03-03 11:50:28 +00:00
Merge branch 'master' into feature/donations_btcpay
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
e3b96d5cff
raucao added the
feature
label 2024-03-03 17:10:06 +00:00
galfert reviewed 2024-03-05 21:31:31 +00:00
@ -10,0 +27,4 @@
def create
if params[:currency] == "sats"
fiat_amount = nil
fiat_currency = nil
Owner

Isn't a amount_sats = params[:amount_sats] missing here?

I couldn't see the amount_sats being assigned anywhere other than to nil when a different currency is selected, but it is being used further down in this action.

Isn't a `amount_sats = params[:amount_sats]` missing here? I couldn't see the `amount_sats` being assigned anywhere other than to `nil` when a different currency is selected, but it is being used further down in this action.
Author
Owner

Good catch! Since I did actual donations using sats for the amount, it must have gotten lost for the commit somehow. Added a spec to catch that, since that spec was missing in the first place.

Good catch! Since I did actual donations using sats for the amount, it must have gotten lost for the commit somehow. Added a spec to catch that, since that spec was missing in the first place.
raucao marked this conversation as resolved
raucao added 1 commit 2024-03-06 10:21:21 +00:00
Add spec for reported regression
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
da22a9d448
raucao added 1 commit 2024-03-06 10:24:09 +00:00
Fix donation record for amounts given in sats
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 4s
7f2df3b025
Author
Owner

@galfert Want to give it your stamp of approval?

@galfert Want to give it your stamp of approval?
Owner

When trying to create a contribution I'm getting an error (see screenshot).

I'm in the Zerotier network and when I GET http://10.1.1.163:23001/api/v1/health from my computer directly, I get a correct response of

{
  "synchronized": true
}

When I do the same from within the web container, the request times out.

When trying to create a contribution I'm getting an error (see screenshot). I'm in the Zerotier network and when I GET `http://10.1.1.163:23001/api/v1/health` from my computer directly, I get a correct response of ```json { "synchronized": true } ``` When I do the same from within the web container, the request times out.
galfert approved these changes 2024-03-09 12:11:23 +00:00
galfert left a comment
Owner

Code looks alright. Wasn't able to test it yet, because of the error I commented above.

Code looks alright. Wasn't able to test it yet, because of the error I commented above.
Author
Owner

As discussed during the last call, we'll merge this and test in production, since I am unable to debug macOS Docker issues and connecting to our private network in dev should not be a prerequisite.

As discussed during the last call, we'll merge this and test in production, since I am unable to debug macOS Docker issues and connecting to our private network in dev should not be a prerequisite.
raucao merged commit 8b897168cc into master 2024-03-13 16:31:54 +00:00
raucao deleted branch feature/donations_btcpay 2024-03-13 16:31:54 +00:00
Sign in to join this conversation.
No description provided.