payment

package
v0.0.0-...-53f8b62 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package payment is a generated GoMock package.

Index

Constants

View Source
const AuthorizationHeader = "Authorization"
View Source
const AuthorizationHeaderPrefix = "Bearer "
View Source
const IdempotencyKeyHeader = "Idempotency-Key"

Variables

This section is empty.

Functions

This section is empty.

Types

type MockVerifier

type MockVerifier struct {
	// contains filtered or unexported fields
}

MockVerifier is a mock of Verifier interface.

func NewMockVerifier

func NewMockVerifier(ctrl *gomock.Controller) *MockVerifier

NewMockVerifier creates a new mock instance.

func (*MockVerifier) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVerifier) Verify

func (m *MockVerifier) Verify(p *Payment) Status

Verify mocks base method.

type MockVerifierMockRecorder

type MockVerifierMockRecorder struct {
	// contains filtered or unexported fields
}

MockVerifierMockRecorder is the mock recorder for MockVerifier.

func (*MockVerifierMockRecorder) Verify

Verify indicates an expected call of Verify.

type MockVerifierVerifyCall

type MockVerifierVerifyCall struct {
	*gomock.Call
}

MockVerifierVerifyCall wrap *gomock.Call

func (*MockVerifierVerifyCall) Do

Do rewrite *gomock.Call.Do

func (*MockVerifierVerifyCall) DoAndReturn

func (c *MockVerifierVerifyCall) DoAndReturn(f func(*Payment) Status) *MockVerifierVerifyCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockVerifierVerifyCall) Return

Return rewrite *gomock.Call.Return

type Payment

type Payment struct {
	IdempotencyKey string
	Token          string
	Amount         int
	Status         Status
	// contains filtered or unexported fields
}

func NewPayment

func NewPayment(idk string) *Payment

type PostPaymentRequest

type PostPaymentRequest struct {
	Amount int `json:"amount"`
}

func (*PostPaymentRequest) IsSamePayload

func (r *PostPaymentRequest) IsSamePayload(token string, p *Payment) bool

type ResponsePayment

type ResponsePayment struct {
	Amount int    `json:"amount"`
	Status string `json:"status"`
}

func NewResponsePayment

func NewResponsePayment(p *Payment) ResponsePayment

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(verifier Verifier, processTime time.Duration, errChan chan error) *Server

func (*Server) Close

func (s *Server) Close()

func (*Server) GetPaymentsHandler

func (s *Server) GetPaymentsHandler(w http.ResponseWriter, r *http.Request)

func (*Server) PostPaymentsHandler

func (s *Server) PostPaymentsHandler(w http.ResponseWriter, r *http.Request)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Status

type Status struct {
	Type StatusType
	Err  error
}

type StatusType

type StatusType int
const (
	StatusInitial StatusType = iota
	StatusSuccess
	StatusInvalidAmount
	StatusInvalidToken
)

func (StatusType) String

func (s StatusType) String() string

type Verifier

type Verifier interface {
	Verify(p *Payment) Status
}

Jump to

Keyboard shortcuts

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