-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpayment_request.go
39 lines (33 loc) · 1.3 KB
/
payment_request.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package payd
import (
"context"
"time"
"github.com/libsv/go-bt/v2"
validator "github.com/theflyingcodr/govalidator"
)
// PaymentRequestArgs are used to create a new paymentRequest.
type PaymentRequestArgs struct {
InvoiceID string `param:"invoiceID"`
}
// Validate will check that invoice arguments match expectations.
func (p *PaymentRequestArgs) Validate() error {
return validator.New().
Validate("invoiceID", validator.StrLength(p.InvoiceID, 1, 30)).
Err()
}
// PaymentRequestResponse a payment request from dpp.
type PaymentRequestResponse struct {
Network string `json:"network"`
Destinations DPPDestination `json:"destinations"`
CreationTimestamp time.Time `json:"creationTimestamp"`
ExpirationTimestamp time.Time `json:"expirationTimestamp"`
PaymentURL string `json:"paymentURL"`
Memo string `json:"memo"`
MerchantData User `json:"merchantData"`
Fee *bt.FeeQuote `json:"fees"`
AncestryRequired bool `json:"ancestryRequired" example:"true"`
}
// PaymentRequestService will create and return a paymentRequest using the args provided.
type PaymentRequestService interface {
PaymentRequest(ctx context.Context, args PaymentRequestArgs) (*PaymentRequestResponse, error)
}