payment

package
v0.0.0-...-8f31e64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PaymentFailed        PaymentStatus = "failed"
	PaymentPaid                        = "paid"
	PaymentRefunded                    = "refunded"
	PaymentStarted                     = "started"
	PaymentStatusUnknown               = "unknown"
)
View Source
const TestTransferMethod = "test"

Variables

This section is empty.

Functions

func RequirePaymentStatus

func RequirePaymentStatus(
	t *testing.T,
	s paymentGetter,
	paymendID string,
	status PaymentStatus,
)

Types

type Account

type Account string

type Address

type Address string

type Payment

type Payment struct {
	PaymentID    string
	Status       PaymentStatus
	Amount       *librefund.Money
	RefundAmount *librefund.Money
}

type PaymentGateway

type PaymentGateway interface {
	TransferMethod() string
	StartPayment(req *PaymentRequest) (*PaymentResponse, error)
	GetLastPayments(int, int) ([]*Payment, error)
	PaymentURL(paymentID string) (string, error)
	RefundPayment(
		paymentID string,
		req *RefundRequest,
	) (*RefundResponse, error)
}

type PaymentRequest

type PaymentRequest struct {
	Amount *librefund.Money
	// FulfillmentURL is where the user is redirected on completion.
	FulfillmentURL *string
	Summary        string
	// RefundDeadline is the latest the order can be refunded.
	RefundDeadline *time.Time
	PaymentID      *string
	Params         map[string][]string
}

type PaymentResponse

type PaymentResponse struct {
	PaymentID string
}

Taler responds with OrderID and 'token'. Is the token required for us?

type PaymentStatus

type PaymentStatus string

type RefundRequest

type RefundRequest struct {
	// Amount to be refunded.
	Amount *librefund.Money
	// Human readable reason for refund.
	Reason string
}

type RefundResponse

type RefundResponse struct {
}

type TestPaymentGateway

type TestPaymentGateway struct {
	Config librefund.Config
	// contains filtered or unexported fields
}

func NewTestPaymentGateway

func NewTestPaymentGateway(
	cfg librefund.Config,
) *TestPaymentGateway

func (*TestPaymentGateway) GetLastPayments

func (s *TestPaymentGateway) GetLastPayments(from int, amount int) ([]*Payment, error)

func (*TestPaymentGateway) GetPayment

func (s *TestPaymentGateway) GetPayment(paymentID string) (*Payment, error)

func (*TestPaymentGateway) PaymentURL

func (s *TestPaymentGateway) PaymentURL(paymentID string) (string, error)

PaymentURL redirects back to the payment fulfillmentURL

func (*TestPaymentGateway) RefundPayment

func (s *TestPaymentGateway) RefundPayment(
	paymentID string,
	req *RefundRequest,
) (*RefundResponse, error)

func (*TestPaymentGateway) StartPayment

func (s *TestPaymentGateway) StartPayment(
	req *PaymentRequest,
) (*PaymentResponse, error)

func (*TestPaymentGateway) TransferMethod

func (s *TestPaymentGateway) TransferMethod() string

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL