Documentation
¶
Index ¶
- func SquareSupportedCurrencies() []currency.Type
- type Config
- type SquareProcessor
- func (sp *SquareProcessor) Authorize(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (sp *SquareProcessor) Capture(ctx context.Context, transactionID string, amount currency.Cents) (*processor.PaymentResult, error)
- func (sp *SquareProcessor) Charge(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
- func (sp *SquareProcessor) GetTransaction(ctx context.Context, txID string) (*processor.Transaction, error)
- func (sp *SquareProcessor) IsAvailable(ctx context.Context) bool
- func (sp *SquareProcessor) Refund(ctx context.Context, req processor.RefundRequest) (*processor.RefundResult, error)
- func (sp *SquareProcessor) Type() processor.ProcessorType
- func (sp *SquareProcessor) ValidateWebhook(ctx context.Context, payload []byte, signature string) (*processor.WebhookEvent, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SquareSupportedCurrencies ¶
SquareSupportedCurrencies returns currencies Square supports
Types ¶
type Config ¶
type Config struct {
AccessToken string
LocationID string
WebhookSecret string
Environment string // "sandbox" or "production"
}
Config holds Square processor configuration
type SquareProcessor ¶
type SquareProcessor struct {
*processor.BaseProcessor
// contains filtered or unexported fields
}
SquareProcessor implements the processor.PaymentProcessor interface
func NewProcessor ¶
func NewProcessor(cfg Config) *SquareProcessor
NewProcessor creates a new Square processor
func (*SquareProcessor) Authorize ¶
func (sp *SquareProcessor) Authorize(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
Authorize authorizes a payment without capturing
func (*SquareProcessor) Capture ¶
func (sp *SquareProcessor) Capture(ctx context.Context, transactionID string, amount currency.Cents) (*processor.PaymentResult, error)
Capture captures a previously authorized payment
func (*SquareProcessor) Charge ¶
func (sp *SquareProcessor) Charge(ctx context.Context, req processor.PaymentRequest) (*processor.PaymentResult, error)
Charge processes a payment
func (*SquareProcessor) GetTransaction ¶
func (sp *SquareProcessor) GetTransaction(ctx context.Context, txID string) (*processor.Transaction, error)
GetTransaction retrieves transaction details
func (*SquareProcessor) IsAvailable ¶
func (sp *SquareProcessor) IsAvailable(ctx context.Context) bool
IsAvailable checks if the processor is configured and available
func (*SquareProcessor) Refund ¶
func (sp *SquareProcessor) Refund(ctx context.Context, req processor.RefundRequest) (*processor.RefundResult, error)
Refund processes a refund
func (*SquareProcessor) Type ¶
func (sp *SquareProcessor) Type() processor.ProcessorType
Type returns the processor type
func (*SquareProcessor) ValidateWebhook ¶
func (sp *SquareProcessor) ValidateWebhook(ctx context.Context, payload []byte, signature string) (*processor.WebhookEvent, error)
ValidateWebhook validates an incoming webhook
Click to show internal directories.
Click to hide internal directories.