Skip to content

Commit 4e50d8a

Browse files
committed
docs: add comments for payment calculations and headers
1 parent bf443ca commit 4e50d8a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/internal/payctx/payment_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
// Payment holds information about a processed payment stored in the request context
10-
type Payment struct { //nolint: revive // Ignore that struct starts with package name
10+
type Payment struct {
1111
// SatoshisPaid is the amount paid in satoshis
1212
SatoshisPaid int
1313
// Accepted indicates whether the payment was accepted

pkg/middleware/payment_middleware.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
)
1111

1212
const (
13+
// HeaderPaymentPaid is the name of the header with confirmation of the payed amount.
1314
HeaderPaymentPaid = payment.HeaderSatoshisPaid
1415
)
1516

@@ -28,6 +29,7 @@ func WithPaymentLogger(logger *slog.Logger) func(*PaymentMiddlewareConfig) {
2829
}
2930
}
3031

32+
// WithRequestPriceCalculator sets a custom function to calculate the price of a request in satoshis for a payment middleware.
3133
func WithRequestPriceCalculator(calculator func(r *http.Request) (int, error)) func(*PaymentMiddlewareConfig) {
3234
if calculator == nil {
3335
panic("calculator must be provided")

0 commit comments

Comments
 (0)