Documentation ¶
Overview ¶
package payment implements ts-payment-service from the original train ticket application
Index ¶
- type Money
- type Payment
- type PaymentService
- type PaymentServiceImpl
- func (p *PaymentServiceImpl) AddMoney(ctx context.Context, payment Payment) error
- func (p *PaymentServiceImpl) Cleanup(ctx context.Context) error
- func (p *PaymentServiceImpl) InitPayment(ctx context.Context, payment Payment) error
- func (p *PaymentServiceImpl) Pay(ctx context.Context, payment Payment) error
- func (p *PaymentServiceImpl) Query(ctx context.Context) ([]Payment, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaymentService ¶
type PaymentService interface { // Pay `payment` Pay(ctx context.Context, payment Payment) error // Adds Money to an existing user's account AddMoney(ctx context.Context, payment Payment) error // Get all payments Query(ctx context.Context) ([]Payment, error) // Create an initial payment InitPayment(ctx context.Context, payment Payment) error // Remove all payments; Only used in testing Cleanup(ctx context.Context) error }
PaymentService manages payments in the application
type PaymentServiceImpl ¶
type PaymentServiceImpl struct {
// contains filtered or unexported fields
}
Implementation of PaymentService
func NewPaymentServiceImpl ¶
func NewPaymentServiceImpl(ctx context.Context, payDB backend.NoSQLDatabase, moneyDB backend.NoSQLDatabase) (*PaymentServiceImpl, error)
Creates a new PaymentService object
func (*PaymentServiceImpl) AddMoney ¶
func (p *PaymentServiceImpl) AddMoney(ctx context.Context, payment Payment) error
func (*PaymentServiceImpl) Cleanup ¶
func (p *PaymentServiceImpl) Cleanup(ctx context.Context) error
func (*PaymentServiceImpl) InitPayment ¶
func (p *PaymentServiceImpl) InitPayment(ctx context.Context, payment Payment) error
Click to show internal directories.
Click to hide internal directories.