Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Payment ¶
type Payment struct { PaymentURL string MerchantData []byte Transactions []*wire.MsgTx RefundOutput Output Memo string }
Payment is an object that holds all information needed to POST a payment back to the merchant server. All fields except memo are required.
type PaymentProtocolClient ¶
type PaymentProtocolClient struct {
// contains filtered or unexported fields
}
PaymentProtocolClient is used to download payment requests and make payments. We use an object for this to make testing a little easier.
func NewPaymentProtocolClient ¶
func NewPaymentProtocolClient(params *chaincfg.Params, proxyDialer proxy.Dialer) *PaymentProtocolClient
NewPaymentProtocolClient returns a PaymentRequestDownloader that can be used to get the payment request.
func (*PaymentProtocolClient) DownloadBip0070PaymentRequest ¶
func (c *PaymentProtocolClient) DownloadBip0070PaymentRequest(uri string) (*PaymentRequest, error)
DownloadBip0070PaymentRequest will download a Bip70 (protobuf) payment request from the provided bitcoincash URI. Upon download it will validate the request is formatted correctly and signed with a valid X509 certificate. The cert will be checked against the OS's certificate store. A PaymentRequest object with the relevant data extracted is returned.
func (*PaymentProtocolClient) PostPayment ¶
func (c *PaymentProtocolClient) PostPayment(payment *Payment) (memo string, err error)
PostPayment sends a payment response back to the merchant's server. Any errors that are encountered in the process are returned along with an optional "memo" that the merchant can include in the ACK.
type PaymentRequest ¶
type PaymentRequest struct { PayToName string Outputs []Output Expires time.Time Memo string PaymentURL string MerchantData []byte }
PaymentRequest is returned by the DownloadBip0070PaymentRequest method. It contains all the relevant information from the downloaded payment request.