Code Monkey home page Code Monkey logo

whipround-paymentlog's Introduction

paymentlog

import "code.whipround.net/paymentlog"

Constants

const (
    SourceBalanced = "balanced"
    StatusPending  = "pending"
    CurrencyUSD    = "usd"
)

Variables

var (
    MissingID          = errors.New("Missing payment log ID.")
    MissingAmount      = errors.New("Missing payment log amount.")
    MissingSource      = errors.New("Missing payment log source.")
    MissingSourceID    = errors.New("Missing payment log source ID.")
    MissingCreated     = errors.New("Missing payment log created timestamp.")
    MissingStatus      = errors.New("Missing payment log status.")
    MissingCurrency    = errors.New("Missing payment log currency.")
    MissingProjectID   = errors.New("Missing payment log campaign ID.")
    MissingUserID      = errors.New("Missing payment log user ID.")
    MissingAccountType = errors.New("Missing payment log account type.")
    MissingAccountID   = errors.New("Missing payment log account ID.")

    AlreadyExists = errors.New("Payment log already exists.")
    LogNotFound   = errors.New("Payment log not found.")
)

func SortFailureLogs

func SortFailureLogs(logs []FailureLog) []FailureLog

func SortLogsByCreated

func SortLogsByCreated(logs []PaymentLog) []PaymentLog

type FailureLog

type FailureLog struct {
    ID                string
    PaymentLogID      string
    FailureReason     string
    FailureReasonCode string
    Timestamp         time.Time
}

type LogStore

type LogStore interface {
    StorePaymentLog(log PaymentLog) error
    UpdatePaymentLog(id string, change PaymentLogChange) error
    DeletePaymentLog(id string) error
    GetPaymentLog(id string) (PaymentLog, error)
    ListPaymentLogsByProject(campaignID string, num, offset int) ([]PaymentLog, error)
    ListPaymentLogsByUser(userID string, num, offset int) ([]PaymentLog, error)
    ListPaymentLogs(num, offset int) ([]PaymentLog, error)

    StoreFailureLog(failure FailureLog) error
    ListFailureLogs(num, offset int) ([]FailureLog, error)
    ListFailureLogsSince(timestamp time.Time) ([]FailureLog, error)
}

type MemoryStore

type MemoryStore struct {
    sync.Mutex
    // contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) DeletePaymentLog

func (store *MemoryStore) DeletePaymentLog(id string) error

func (*MemoryStore) GetPaymentLog

func (store *MemoryStore) GetPaymentLog(id string) (PaymentLog, error)

func (*MemoryStore) ListFailureLogs

func (store *MemoryStore) ListFailureLogs(num, offset int) ([]FailureLog, error)

func (*MemoryStore) ListFailureLogsSince

func (store *MemoryStore) ListFailureLogsSince(timestamp time.Time) ([]FailureLog, error)

func (*MemoryStore) ListPaymentLogs

func (store *MemoryStore) ListPaymentLogs(num, offset int) ([]PaymentLog, error)

func (*MemoryStore) ListPaymentLogsByProject

func (store *MemoryStore) ListPaymentLogsByProject(id string, num, offset int) ([]PaymentLog, error)

func (*MemoryStore) ListPaymentLogsByUser

func (store *MemoryStore) ListPaymentLogsByUser(id string, num, offset int) ([]PaymentLog, error)

func (*MemoryStore) StoreFailureLog

func (store *MemoryStore) StoreFailureLog(log FailureLog) error

func (*MemoryStore) StorePaymentLog

func (store *MemoryStore) StorePaymentLog(log PaymentLog) error

func (*MemoryStore) UpdatePaymentLog

func (store *MemoryStore) UpdatePaymentLog(id string, change PaymentLogChange) error

type PaymentLog

type PaymentLog struct {
    ID          string
    Amount      uint
    Description string
    Source      string
    SourceID    string
    Created     time.Time
    Updated     time.Time
    Status      string
    Currency    string
    ProjectID   string
    UserID      string
    AccountID   string
    AccountType string
}

func (PaymentLog) Validate

func (p PaymentLog) Validate() error

type PaymentLogChange

type PaymentLogChange struct {
    Amount      *uint
    Description *string
    Source      *string
    SourceID    *string
    Created     *time.Time
    Updated     *time.Time
    Status      *string
    Currency    *string
}

Generated by godoc2md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.