-
Notifications
You must be signed in to change notification settings - Fork 5
/
envelopes.go
25 lines (20 loc) · 655 Bytes
/
envelopes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package payd
import (
"context"
"github.com/libsv/go-bc/spv"
"github.com/libsv/go-dpp"
validator "github.com/theflyingcodr/govalidator"
)
// EnvelopeArgs identify where an envelope is being paid to.
type EnvelopeArgs struct {
PayToURL string `json:"payToURL"`
}
// Validate will ensure that the args supplied are valid.
func (e EnvelopeArgs) Validate() error {
return validator.New().
Validate("payToURL", validator.NotEmpty(e.PayToURL))
}
// EnvelopeService will create an spv envelope from a paymentRequest.
type EnvelopeService interface {
Envelope(ctx context.Context, args EnvelopeArgs, req dpp.PaymentRequest) (*spv.Envelope, error)
}