Skip to content

Commit

Permalink
feat: add metadata property to pay_invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Nov 12, 2024
1 parent f590c6f commit 43e4f56
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 36 deletions.
4 changes: 2 additions & 2 deletions api/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (api *api) SendPayment(ctx context.Context, invoice string) (*SendPaymentRe
if api.svc.GetLNClient() == nil {
return nil, errors.New("LNClient not started")
}
transaction, err := api.svc.GetTransactionsService().SendPaymentSync(ctx, invoice, api.svc.GetLNClient(), nil, nil)
transaction, err := api.svc.GetTransactionsService().SendPaymentSync(ctx, invoice, nil, api.svc.GetLNClient(), nil, nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -131,7 +131,7 @@ func (api *api) TopupIsolatedApp(ctx context.Context, userApp *db.App, amountMsa
return err
}

_, err = api.svc.GetTransactionsService().SendPaymentSync(ctx, transaction.PaymentRequest, api.svc.GetLNClient(), nil, nil)
_, err = api.svc.GetTransactionsService().SendPaymentSync(ctx, transaction.PaymentRequest, nil, api.svc.GetLNClient(), nil, nil)
return err
}

Expand Down
3 changes: 2 additions & 1 deletion nip47/controllers/multi_pay_invoice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (controller *nip47Controller) HandleMultiPayInvoiceEvent(ctx context.Contex
go func(invoiceInfo multiPayInvoiceElement) {
defer wg.Done()
bolt11 := invoiceInfo.Invoice
metadata := invoiceInfo.Metadata
// Convert invoice to lowercase string
bolt11 = strings.ToLower(bolt11)
paymentRequest, err := decodepay.Decodepay(bolt11)
Expand Down Expand Up @@ -68,7 +69,7 @@ func (controller *nip47Controller) HandleMultiPayInvoiceEvent(ctx context.Contex
dTag := []string{"d", invoiceDTagValue}

controller.
pay(ctx, bolt11, &paymentRequest, nip47Request, requestEventId, app, publishResponse, nostr.Tags{dTag})
pay(ctx, bolt11, metadata, &paymentRequest, nip47Request, requestEventId, app, publishResponse, nostr.Tags{dTag})
}(invoiceInfo)
}

Expand Down
11 changes: 6 additions & 5 deletions nip47/controllers/pay_invoice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
)

type payInvoiceParams struct {
Invoice string `json:"invoice"`
Invoice string `json:"invoice"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}

func (controller *nip47Controller) HandlePayInvoiceEvent(ctx context.Context, nip47Request *models.Request, requestEventId uint, app *db.App, publishResponse publishFunc, tags nostr.Tags) {
Expand Down Expand Up @@ -47,23 +48,23 @@ func (controller *nip47Controller) HandlePayInvoiceEvent(ctx context.Context, ni
return
}

controller.pay(ctx, bolt11, &paymentRequest, nip47Request, requestEventId, app, publishResponse, tags)
controller.pay(ctx, bolt11, payParams.Metadata, &paymentRequest, nip47Request, requestEventId, app, publishResponse, tags)
}

func (controller *nip47Controller) pay(ctx context.Context, bolt11 string, paymentRequest *decodepay.Bolt11, nip47Request *models.Request, requestEventId uint, app *db.App, publishResponse publishFunc, tags nostr.Tags) {
func (controller *nip47Controller) pay(ctx context.Context, bolt11 string, metadata map[string]interface{}, paymentRequest *decodepay.Bolt11, nip47Request *models.Request, requestEventId uint, app *db.App, publishResponse publishFunc, tags nostr.Tags) {
logger.Logger.WithFields(logrus.Fields{
"request_event_id": requestEventId,
"app_id": app.ID,
"bolt11": bolt11,
}).Info("Sending payment")

transaction, err := controller.transactionsService.SendPaymentSync(ctx, bolt11, controller.lnClient, &app.ID, &requestEventId)
transaction, err := controller.transactionsService.SendPaymentSync(ctx, bolt11, metadata, controller.lnClient, &app.ID, &requestEventId)
if err != nil {
logger.Logger.WithFields(logrus.Fields{
"request_event_id": requestEventId,
"app_id": app.ID,
"bolt11": bolt11,
}).Infof("Failed to send payment: %v", err)
}).WithError(err).Error("Failed to send payment")
publishResponse(&models.Response{
ResultType: nip47Request.Method,
Error: mapNip47Error(err),
Expand Down
15 changes: 14 additions & 1 deletion nip47/controllers/pay_invoice_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const nip47PayInvoiceJson = `
{
"method": "pay_invoice",
"params": {
"invoice": "lntb1230n1pjypux0pp5xgxzcks5jtx06k784f9dndjh664wc08ucrganpqn52d0ftrh9n8sdqyw3jscqzpgxqyz5vqsp5rkx7cq252p3frx8ytjpzc55rkgyx2mfkzzraa272dqvr2j6leurs9qyyssqhutxa24r5hqxstchz5fxlslawprqjnarjujp5sm3xj7ex73s32sn54fthv2aqlhp76qmvrlvxppx9skd3r5ut5xutgrup8zuc6ay73gqmra29m"
"invoice": "lntb1230n1pjypux0pp5xgxzcks5jtx06k784f9dndjh664wc08ucrganpqn52d0ftrh9n8sdqyw3jscqzpgxqyz5vqsp5rkx7cq252p3frx8ytjpzc55rkgyx2mfkzzraa272dqvr2j6leurs9qyyssqhutxa24r5hqxstchz5fxlslawprqjnarjujp5sm3xj7ex73s32sn54fthv2aqlhp76qmvrlvxppx9skd3r5ut5xutgrup8zuc6ay73gqmra29m",
"metadata": {"a": 123}
}
}
`
Expand Down Expand Up @@ -72,6 +73,18 @@ func TestHandlePayInvoiceEvent(t *testing.T) {
HandlePayInvoiceEvent(ctx, nip47Request, dbRequestEvent.ID, app, publishResponse, nostr.Tags{})

assert.Equal(t, "123preimage", publishedResponse.Result.(payResponse).Preimage)

transactionType := constants.TRANSACTION_TYPE_OUTGOING
transaction, err := transactionsSvc.LookupTransaction(ctx, "320c2c5a1492ccfd5bc7aa4ad9b657d6aaec3cfcc0d1d98413a29af4ac772ccf", &transactionType, svc.LNClient, &app.ID)
assert.NoError(t, err)

type dummyMetadata struct {
A int `json:"a"`
}
var decodedMetadata dummyMetadata
err = json.Unmarshal(transaction.Metadata, &decodedMetadata)
assert.NoError(t, err)
assert.Equal(t, 123, decodedMetadata.A)
}

func TestHandlePayInvoiceEvent_MalformedInvoice(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions transactions/app_payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestSendPaymentSync_App_NoPermission(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.Equal(t, "app does not have pay_invoice scope", err.Error())
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestSendPaymentSync_App_WithPermission(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestSendPaymentSync_App_BudgetExceeded(t *testing.T) {
svc.EventPublisher.RegisterSubscriber(mockEventConsumer)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewQuotaExceededError())
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestSendPaymentSync_App_BudgetExceeded_SettledPayment(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewQuotaExceededError())
Expand Down Expand Up @@ -178,7 +178,7 @@ func TestSendPaymentSync_App_BudgetExceeded_UnsettledPayment(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewQuotaExceededError())
Expand Down Expand Up @@ -218,7 +218,7 @@ func TestSendPaymentSync_App_BudgetNotExceeded_FailedPayment(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down
14 changes: 7 additions & 7 deletions transactions/isolated_app_payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestSendPaymentSync_IsolatedApp_NoBalance(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -78,7 +78,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceInsufficient(t *testing.T) {
svc.EventPublisher.RegisterSubscriber(mockEventConsumer)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceSufficient(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -172,7 +172,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceInsufficient_OutstandingPayment(t *t
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -218,7 +218,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceInsufficient_SettledPayment(t *testi
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceSufficient_UnrelatedPayment(t *testi
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -311,7 +311,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceSufficient_FailedPayment(t *testing.
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down
41 changes: 37 additions & 4 deletions transactions/payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package transactions

import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"testing"
"time"

Expand All @@ -22,14 +25,44 @@ func TestSendPaymentSync_NoApp(t *testing.T) {
svc, err := tests.CreateTestService()
require.NoError(t, err)

metadata := map[string]interface{}{
"a": 123,
}

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, metadata, svc.LNClient, nil, nil)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
assert.Equal(t, constants.TRANSACTION_STATE_SETTLED, transaction.State)
assert.Zero(t, transaction.FeeReserveMsat)
assert.Equal(t, "123preimage", *transaction.Preimage)

type dummyMetadata struct {
A int `json:"a"`
}
var decodedMetadata dummyMetadata
err = json.Unmarshal(transaction.Metadata, &decodedMetadata)
assert.NoError(t, err)
assert.Equal(t, 123, decodedMetadata.A)
}

func TestSendPaymentSync_MetadataTooLarge(t *testing.T) {
ctx := context.TODO()

defer tests.RemoveTestService()
svc, err := tests.CreateTestService()
require.NoError(t, err)

metadata := make(map[string]interface{})
metadata["randomkey"] = strings.Repeat("a", constants.INVOICE_METADATA_MAX_LENGTH-15) // json encoding adds 16 characters

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, metadata, svc.LNClient, nil, nil)

assert.Error(t, err)
assert.Equal(t, fmt.Sprintf("encoded payment metadata provided is too large. Limit: %d Received: %d", constants.INVOICE_METADATA_MAX_LENGTH, constants.INVOICE_METADATA_MAX_LENGTH+1), err.Error())
assert.Nil(t, transaction)
}

func TestSendPaymentSync_Duplicate(t *testing.T) {
Expand All @@ -47,7 +80,7 @@ func TestSendPaymentSync_Duplicate(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, nil, nil)

assert.Error(t, err)
assert.Equal(t, "this invoice has already been paid", err.Error())
Expand Down Expand Up @@ -209,7 +242,7 @@ func TestSendPaymentSync_FailedRemovesFeeReserve(t *testing.T) {
svc.EventPublisher.RegisterSubscriber(mockEventConsumer)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, nil, nil)

assert.Error(t, err)
assert.Nil(t, transaction)
Expand Down Expand Up @@ -239,7 +272,7 @@ func TestSendPaymentSync_PendingHasFeeReserve(t *testing.T) {
svc.LNClient.(*tests.MockLn).PayInvoiceResponses = append(svc.LNClient.(*tests.MockLn).PayInvoiceResponses, nil)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, nil, nil)

assert.Error(t, err)
assert.Nil(t, transaction)
Expand Down
14 changes: 7 additions & 7 deletions transactions/self_payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestSendPaymentSync_SelfPayment_NoAppToNoApp(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, nil, svc.LNClient, nil, nil)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -85,7 +85,7 @@ func TestSendPaymentSync_SelfPayment_NoAppToIsolatedApp(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, nil, svc.LNClient, nil, nil)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestSendPaymentSync_SelfPayment_NoAppToApp(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, nil, svc.LNClient, nil, nil)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -207,7 +207,7 @@ func TestSendPaymentSync_SelfPayment_IsolatedAppToNoApp(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -282,7 +282,7 @@ func TestSendPaymentSync_SelfPayment_IsolatedAppToApp(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -364,7 +364,7 @@ func TestSendPaymentSync_SelfPayment_IsolatedAppToIsolatedApp(t *testing.T) {
svc.EventPublisher.RegisterSubscriber(mockEventConsumer)

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -449,7 +449,7 @@ func TestSendPaymentSync_SelfPayment_IsolatedAppToSelf(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB, svc.EventPublisher)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockInvoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down
Loading

0 comments on commit 43e4f56

Please sign in to comment.