service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PaymentRepository

type PaymentRepository struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PaymentRepository stores a collection of payment resources that is safe for concurrent use

func NewPaymentRepository

func NewPaymentRepository() *PaymentRepository

NewPaymentRepository creates a freshly brewed PaymentRepository

func (*PaymentRepository) Add

func (pr *PaymentRepository) Add(payment *models.Payment) error

Add adds a new payment resource to the repository

Add returns an error if a payment with the same ID as the one to be added already exists

func (*PaymentRepository) Delete

func (pr *PaymentRepository) Delete(paymentID strfmt.UUID) error

Delete deletes the payment resource associated to the given paymentID

Delete returns an error if the paymentID is not present in the respository

func (*PaymentRepository) Get

func (pr *PaymentRepository) Get(paymentID strfmt.UUID) (*models.Payment, error)

Get returns the payment resource associated with the given paymentID

Get returns an error if the paymentID does not exist in the collection

func (*PaymentRepository) List

func (pr *PaymentRepository) List(offset, limit int64) ([]*models.Payment, error)

List returns a slice of payment resources. An empty slice will be returned if no payment exists.

List implements basic pagination by means of offset and limit parameters. List will return an error if offset is beyond the number of elements available. A limit of 0 will return all elements available. Both parameters default to 0.

func (*PaymentRepository) Update

func (pr *PaymentRepository) Update(paymentID strfmt.UUID, payment *models.Payment) error

Update updates the details associated with the given paymentID

Update returns an error if the paymentID does not exist in the collection

type PaymentsService

type PaymentsService struct {
	// Repo is a repository for payments
	Repo *PaymentRepository
}

PaymentsService implements the business logic needed to fulfill the API's requirements

func (*PaymentsService) CreatePayment

CreatePayment Adds a new payment with the data included in params

func (*PaymentsService) DeletePayment

DeletePayment Deletes a payment identified by its ID

func (*PaymentsService) GetPayment

GetPayment Returns details of a payment identified by its ID

func (*PaymentsService) ListPayments

ListPayments Returns details of a collection of payments

func (*PaymentsService) UpdatePayment

UpdatePayment Adds a new payment with the data included in params

Jump to

Keyboard shortcuts

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