payment

package
v0.0.0-...-9a5c20e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 5 Imported by: 1

README

payment

import "github.com/blueprint-uservices/blueprint/examples/train_ticket/workflow/payment"

package payment implements ts-payment-service from the original train ticket application

Index

type Money

type Money struct {
    ID     string
    UserID string
    Price  string
}

type Payment

type Payment struct {
    ID      string
    OrderID string
    UserID  string
    Price   string
}

type PaymentService

PaymentService manages payments in the application

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
}

type PaymentServiceImpl

Implementation of PaymentService

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

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

func (*PaymentServiceImpl) Pay
func (p *PaymentServiceImpl) Pay(ctx context.Context, payment Payment) error

func (*PaymentServiceImpl) Query
func (p *PaymentServiceImpl) Query(ctx context.Context) ([]Payment, error)

Generated by gomarkdoc

Documentation

Overview

package payment implements ts-payment-service from the original train ticket application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Money

type Money struct {
	ID     string
	UserID string
	Price  string
}

type Payment

type Payment struct {
	ID      string
	OrderID string
	UserID  string
	Price   string
}

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

func (*PaymentServiceImpl) Pay

func (p *PaymentServiceImpl) Pay(ctx context.Context, payment Payment) error

func (*PaymentServiceImpl) Query

func (p *PaymentServiceImpl) Query(ctx context.Context) ([]Payment, error)

Jump to

Keyboard shortcuts

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