Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) CreatePaymentRequest(ctx context.Context, req *PaymentRequest) (*PaymentRequest, error)
- func (c *Client) CreateRefundRequest(ctx context.Context, req *PaymentRequest) (*PaymentRequest, error)
- func (c *Client) PaymentRequest(ctx context.Context, id string) (*PaymentRequest, error)
- func (c *Client) RefundRequest(ctx context.Context, id string) (*PaymentRequest, error)
- func (s *Client) URL() string
- type Error
- type Options
- type PaymentRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoLocationHeader is the error when no location header exists in the response from Swish API. ErrNoLocationHeader = errors.New("Error: No location header from Swish API") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*Options
}
Client represents a Swish client.
func (*Client) CreatePaymentRequest ¶
func (c *Client) CreatePaymentRequest(ctx context.Context, req *PaymentRequest) (*PaymentRequest, error)
CreatePaymentRequest will create a payment request to Swish and return a payment request containing the ID of the request and the data sent to Swish or a error.
func (*Client) CreateRefundRequest ¶
func (c *Client) CreateRefundRequest(ctx context.Context, req *PaymentRequest) (*PaymentRequest, error)
CreateRefundRequest will create a refund request to Swish and return a refund request containing the ID of the request and the data sent to Swish or a error.
func (*Client) PaymentRequest ¶
PaymentRequest will return a payment request or a error for the given id.
func (*Client) RefundRequest ¶
RefundRequest will return a payment request or a error for the given id.
type Error ¶
type Error struct { AdditionalInformation string `json:"additionalInformation,omitempty"` ErrorCode string `json:"errorCode,omitempty"` ErrorMessage string `json:"errorMessage,omitempty"` }
Error represents a error object from Swish API.
type Options ¶
type Options struct { Env string P12 string P12Data []byte Passphrase string Root string RootData []byte Client *http.Client }
Options represents Swish client options.
type PaymentRequest ¶
type PaymentRequest struct { AdditionalInformation string `json:"additionalInformation,omitempty"` Amount string `json:"amount,omitempty"` CallbackURL string `json:"callbackUrl,omitempty"` Currency string `json:"currency,omitempty"` DateCreated string `json:"dateCreated,omitempty"` DatePaid string `json:"datePaid,omitempty"` ErrorCode string `json:"errorCode,omitempty"` ErrorMessage string `json:"errorMessage,omitempty"` ID string `json:"id,omitempty"` Message string `json:"message,omitempty"` PayeeAlias string `json:"payeeAlias,omitempty"` PayeePaymentReference string `json:"payeePaymentReference,omitempty"` PayerPaymentReference string `json:"payerPaymentReference,omitempty"` PayerAlias string `json:"payerAlias,omitempty"` PaymentReference string `json:"paymentReference,omitempty"` OriginalPaymentReference string `json:"originalPaymentReference,omitempty"` Status string `json:"status,omitempty"` }
PaymentRequest represents a payment request from Swish API.
Click to show internal directories.
Click to hide internal directories.