shared

package
v1.119.0-add-fee-reduc... Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSourceSirius             = "opg.supervision.sirius"
	EventSourceFinanceAdmin       = "opg.supervision.finance.admin"
	DetailTypeDebtPositionChanged = "debt-position-changed"
	DetailTypeClientCreated       = "client-created"
	DetailTypeFinanceAdminUpload  = "finance-admin-upload"
)
View Source
const StatusActive string = "Active"
View Source
const StatusCancelled string = "Cancelled"
View Source
const StatusExpired string = "Expired"
View Source
const StatusPending string = "Pending"

Variables

View Source
var TransactionTypeMap = map[string]TransactionType{
	"CREDIT WRITE OFF":         TransactionTypeWriteOff,
	"CREDIT MEMO":              TransactionTypeCreditMemo,
	"DEBIT MEMO":               TransactionTypeDebitMemo,
	"WRITE OFF REVERSAL":       TransactionTypeWriteOffReversal,
	"EXEMPTION":                TransactionTypeExemption,
	"HARDSHIP":                 TransactionTypeHardship,
	"REMISSION":                TransactionTypeRemission,
	"CREDIT REAPPLY":           TransactionTypeReapply,
	"MOTO CARD PAYMENT":        TransactionTypeMotoCardPayment,
	"ONLINE CARD PAYMENT":      TransactionTypeOnlineCardPayment,
	"SUPERVISION BACS PAYMENT": TransactionTypeSupervisionBACSPayment,
	"OPG BACS PAYMENT":         TransactionTypeOPGBACSPayment,
}

Functions

func DecimalStringToInt

func DecimalStringToInt(s string) int

func IntToDecimalString

func IntToDecimalString(i int) string

Types

type AccountInformation

type AccountInformation struct {
	OutstandingBalance int    `json:"outstandingBalance"`
	CreditBalance      int    `json:"creditBalance"`
	PaymentMethod      string `json:"paymentMethod"`
}

type AddFeeReduction

type AddFeeReduction struct {
	FeeType       FeeReductionType `json:"feeType" validate:"required,valid-enum"`
	StartYear     string           `json:"startYear" validate:"required"`
	LengthOfAward int              `json:"lengthOfAward" validate:"required,gte=1,lte=3"`
	DateReceived  *Date            `json:"dateReceived,omitempty" validate:"required,date-in-the-past"`
	Notes         string           `json:"notes" validate:"required,thousand-character-limit"`
}

type AddInvoiceAdjustmentRequest

type AddInvoiceAdjustmentRequest struct {
	AdjustmentType  AdjustmentType `json:"adjustmentType" validate:"valid-enum"`
	AdjustmentNotes string         `json:"notes" validate:"required,thousand-character-limit"`
	Amount          int            `json:"amount,omitempty" validate:"required_if=AdjustmentType 2,required_if=AdjustmentType 3,omitempty,gt=0"`
}

type AddManualInvoice

type AddManualInvoice struct {
	InvoiceType      InvoiceType      `json:"invoiceType" validate:"required,valid-enum"`
	Amount           Nillable[int]    `json:"amount" validate:"nillable-int-gt=50,nillable-int-lte=32000"`
	RaisedDate       Nillable[Date]   `json:"raisedDate" validate:"nillable-date-required"`
	StartDate        Nillable[Date]   `json:"startDate" validate:"nillable-date-required"`
	EndDate          Nillable[Date]   `json:"endDate" validate:"nillable-date-required"`
	SupervisionLevel Nillable[string] `json:"supervisionLevel" validate:"nillable-string-oneof=GENERAL MINIMAL"`
}

type AdjustmentStatus

type AdjustmentStatus int
const (
	AdjustmentStatusUnknown AdjustmentStatus = iota
	AdjustmentStatusPending
	AdjustmentStatusApproved
	AdjustmentStatusRejected
)

func ParseAdjustmentStatus

func ParseAdjustmentStatus(s string) AdjustmentStatus

func (AdjustmentStatus) Key

func (i AdjustmentStatus) Key() string

func (AdjustmentStatus) MarshalJSON

func (i AdjustmentStatus) MarshalJSON() ([]byte, error)

func (AdjustmentStatus) String

func (i AdjustmentStatus) String() string

func (*AdjustmentStatus) UnmarshalJSON

func (i *AdjustmentStatus) UnmarshalJSON(data []byte) (err error)

func (AdjustmentStatus) Valid

func (i AdjustmentStatus) Valid() bool

type AdjustmentType

type AdjustmentType int
const (
	AdjustmentTypeUnknown AdjustmentType = iota
	AdjustmentTypeWriteOff
	AdjustmentTypeCreditMemo
	AdjustmentTypeDebitMemo
	AdjustmentTypeWriteOffReversal
)

func ParseAdjustmentType

func ParseAdjustmentType(s string) AdjustmentType

func (AdjustmentType) AmountRequired

func (i AdjustmentType) AmountRequired() bool

func (AdjustmentType) Key

func (i AdjustmentType) Key() string

func (AdjustmentType) MarshalJSON

func (i AdjustmentType) MarshalJSON() ([]byte, error)

func (AdjustmentType) String

func (i AdjustmentType) String() string

func (AdjustmentType) Translation

func (i AdjustmentType) Translation() string

func (*AdjustmentType) UnmarshalJSON

func (i *AdjustmentType) UnmarshalJSON(data []byte) (err error)

func (AdjustmentType) Valid

func (i AdjustmentType) Valid() bool

type Assignee

type Assignee struct {
	Id          int      `json:"id"`
	DisplayName string   `json:"displayName"`
	Roles       []string `json:"roles"`
}

func (Assignee) GetRoles

func (m Assignee) GetRoles() string

type BaseBillingEvent

type BaseBillingEvent struct {
	Type BillingEventType `json:"type"`
}

func (BaseBillingEvent) GetType

func (d BaseBillingEvent) GetType() BillingEventType

type BillingEvent

type BillingEvent interface {
	GetType() BillingEventType
}

type BillingEventType

type BillingEventType int
const (
	EventTypeUnknown BillingEventType = iota
	EventTypeInvoiceGenerated
	EventTypeFeeReductionAwarded
	EventTypeFeeReductionCancelled
	EventTypeFeeReductionApplied
	EventTypeInvoiceAdjustmentApplied
	EventTypePaymentProcessed
	EventTypeInvoiceAdjustmentPending
	EventTypeReappliedCredit
)

func (BillingEventType) MarshalJSON

func (b BillingEventType) MarshalJSON() ([]byte, error)

func (BillingEventType) String

func (b BillingEventType) String() string

func (*BillingEventType) UnmarshalJSON

func (b *BillingEventType) UnmarshalJSON(data []byte) (err error)

type BillingHistory

type BillingHistory struct {
	User               int          `json:"user"`
	Date               Date         `json:"date"`
	Event              BillingEvent `json:"event"`
	OutstandingBalance int          `json:"outstanding_balance"`
	CreditBalance      int          `json:"credit_balance"`
}

func (*BillingHistory) UnmarshalJSON

func (b *BillingHistory) UnmarshalJSON(data []byte) (err error)

type CancelFeeReduction

type CancelFeeReduction struct {
	CancellationReason string `json:"cancellationReason" validate:"required,thousand-character-limit"`
}

type ClientCreatedEvent

type ClientCreatedEvent struct {
	ClientID int    `json:"clientId"`
	CourtRef string `json:"courtRef"`
}

type Date

type Date struct {
	Time time.Time
}

func NewDate

func NewDate(d string) Date

func (Date) After

func (d Date) After(d2 Date) bool

func (Date) Before

func (d Date) Before(d2 Date) bool

func (Date) IsNull

func (d Date) IsNull() bool

func (Date) IsSameFinancialYear

func (d Date) IsSameFinancialYear(d1 Date) bool

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

func (Date) String

func (d Date) String() string

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

type DebtPositionChangedEvent

type DebtPositionChangedEvent struct {
	ClientID int `json:"clientId"`
}

type Enum

type Enum interface {
	Valid() bool
	Key() string
}

type Event

type Event struct {
	Source       string      `json:"source"`
	EventBusName string      `json:"event-bus-name"`
	DetailType   string      `json:"detail-type"`
	Detail       interface{} `json:"detail"`
}

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

type FeeReduction

type FeeReduction struct {
	Id           int              `json:"id"`
	Type         FeeReductionType `json:"type"`
	StartDate    Date             `json:"startDate"`
	EndDate      Date             `json:"endDate"`
	DateReceived Date             `json:"dateReceived"`
	Status       string           `json:"status"`
	Notes        string           `json:"notes"`
}

type FeeReductionApplied

type FeeReductionApplied struct {
	TransactionEvent
}

type FeeReductionAwarded

type FeeReductionAwarded struct {
	ReductionType FeeReductionType `json:"reduction_type"`
	StartDate     Date             `json:"start_date"`
	EndDate       Date             `json:"end_date"`
	DateReceived  Date             `json:"date_received"`
	Notes         string           `json:"notes"`
	BaseBillingEvent
}

type FeeReductionCancelled

type FeeReductionCancelled struct {
	ReductionType      FeeReductionType `json:"reduction_type"`
	CancellationReason string           `json:"cancellation_reason"`
	BaseBillingEvent
}

type FeeReductionType

type FeeReductionType int
const (
	FeeReductionTypeUnknown FeeReductionType = iota
	FeeReductionTypeExemption
	FeeReductionTypeHardship
	FeeReductionTypeRemission
)

func ParseFeeReductionType

func ParseFeeReductionType(s string) FeeReductionType

func (FeeReductionType) Key

func (f FeeReductionType) Key() string

func (FeeReductionType) MarshalJSON

func (f FeeReductionType) MarshalJSON() ([]byte, error)

func (FeeReductionType) String

func (f FeeReductionType) String() string

func (*FeeReductionType) UnmarshalJSON

func (f *FeeReductionType) UnmarshalJSON(data []byte) (err error)

func (FeeReductionType) Valid

func (f FeeReductionType) Valid() bool

type FeeReductions

type FeeReductions []FeeReduction

type FinanceAdminUploadEvent

type FinanceAdminUploadEvent struct {
	EmailAddress string `json:"emailAddress"`
	Filename     string `json:"filename"`
	UploadType   string `json:"uploadType"`
	UploadDate   Date   `json:"uploadDate"`
}

type Invoice

type Invoice struct {
	Id                 int                `json:"id"`
	Ref                string             `json:"ref"`
	Status             string             `json:"status"`
	Amount             int                `json:"amount"`
	RaisedDate         Date               `json:"raisedDate"`
	Received           int                `json:"received"`
	OutstandingBalance int                `json:"outstandingBalance"`
	Ledgers            []Ledger           `json:"ledgers"`
	SupervisionLevels  []SupervisionLevel `json:"supervisionLevels"`
}

type InvoiceAdjustment

type InvoiceAdjustment struct {
	Id             int            `json:"id"`
	InvoiceRef     string         `json:"invoiceRef"`
	RaisedDate     Date           `json:"raisedDate"`
	AdjustmentType AdjustmentType `json:"adjustmentType"`
	Amount         int            `json:"amount"`
	Status         string         `json:"status"`
	Notes          string         `json:"notes"`
}

type InvoiceAdjustmentApplied

type InvoiceAdjustmentApplied struct {
	TransactionEvent
}

type InvoiceAdjustmentPending

type InvoiceAdjustmentPending struct {
	AdjustmentType   AdjustmentType `json:"adjustment_type"`
	ClientId         int            `json:"client_id"`
	Notes            string         `json:"notes"`
	PaymentBreakdown `json:"payment_breakdown"`
	BaseBillingEvent
}

type InvoiceAdjustments

type InvoiceAdjustments []InvoiceAdjustment

type InvoiceEvent

type InvoiceEvent struct {
	ID        int    `json:"id"`
	Reference string `json:"reference"`
}

type InvoiceGenerated

type InvoiceGenerated struct {
	ClientId         int          `json:"client_id"`
	InvoiceReference InvoiceEvent `json:"invoice_reference"`
	InvoiceType      InvoiceType  `json:"invoice_type"`
	Amount           int          `json:"amount"`
	BaseBillingEvent
}

type InvoiceReference

type InvoiceReference struct {
	InvoiceRef string
}

type InvoiceType

type InvoiceType int
const (
	InvoiceTypeUnknown InvoiceType = iota
	InvoiceTypeAD
	InvoiceTypeS2
	InvoiceTypeS3
	InvoiceTypeB2
	InvoiceTypeB3
	InvoiceTypeSF
	InvoiceTypeSE
	InvoiceTypeSO
	InvoiceTypeGA
	InvoiceTypeGS
	InvoiceTypeGT
)

func ParseInvoiceType

func ParseInvoiceType(s string) InvoiceType

func (InvoiceType) Key

func (i InvoiceType) Key() string

func (InvoiceType) MarshalJSON

func (i InvoiceType) MarshalJSON() ([]byte, error)

func (InvoiceType) RequiresDateValidation

func (i InvoiceType) RequiresDateValidation() bool

func (InvoiceType) RequiresSameFinancialYearValidation added in v1.112.0

func (i InvoiceType) RequiresSameFinancialYearValidation() bool

func (InvoiceType) String

func (i InvoiceType) String() string

func (InvoiceType) Translation

func (i InvoiceType) Translation() string

func (*InvoiceType) UnmarshalJSON

func (i *InvoiceType) UnmarshalJSON(data []byte) (err error)

func (InvoiceType) Valid

func (i InvoiceType) Valid() bool

type Invoices

type Invoices []Invoice

type Ledger

type Ledger struct {
	Amount          int    `json:"amount"`
	ReceivedDate    Date   `json:"receivedDate"`
	TransactionType string `json:"transactionType"`
	Status          string `json:"status"`
}

type Nillable

type Nillable[T any] struct {
	Value T
	Valid bool
}

func TransformNillableDate

func TransformNillableDate(stringPointer *string) Nillable[Date]

func TransformNillableInt

func TransformNillableInt(stringPointer *string) Nillable[int]

func TransformNillableString

func TransformNillableString(stringPointer *string) Nillable[string]

type PaymentBreakdown

type PaymentBreakdown struct {
	InvoiceReference InvoiceEvent `json:"invoice_reference"`
	Amount           int          `json:"amount"`
	Status           string       `json:"status"`
}

type PaymentProcessed

type PaymentProcessed struct {
	TransactionEvent
}

type Person

type Person struct {
	ID        int    `json:"id"`
	FirstName string `json:"firstname"`
	Surname   string `json:"surname"`
	CourtRef  string `json:"courtRef"`
}

type ReappliedCredit

type ReappliedCredit struct {
	TransactionEvent
}

type SupervisionLevel

type SupervisionLevel struct {
	Level  string `json:"level"`
	Amount int    `json:"amount"`
	From   Date   `json:"from"`
	To     Date   `json:"to"`
}

type Task

type Task struct {
	ClientId int    `json:"personId"`
	Type     string `json:"type"`
	DueDate  Date   `json:"dueDate"`
	Assignee int    `json:"assigneeId"`
	Notes    string `json:"description"`
}

type TransactionEvent

type TransactionEvent struct {
	ClientId        int                `json:"client_id"`
	TransactionType TransactionType    `json:"transaction_type"`
	Amount          int                `json:"amount"` // the amount that triggered the transaction, excluding unapplies
	Breakdown       []PaymentBreakdown `json:"breakdown"`
	BaseBillingEvent
}

type TransactionType

type TransactionType int
const (
	TransactionTypeUnknown TransactionType = iota
	TransactionTypeWriteOff
	TransactionTypeCreditMemo
	TransactionTypeDebitMemo
	TransactionTypeWriteOffReversal
	TransactionTypeExemption
	TransactionTypeHardship
	TransactionTypeRemission
	TransactionTypeReapply
	TransactionTypeMotoCardPayment
	TransactionTypeOnlineCardPayment
	TransactionTypeSupervisionBACSPayment
	TransactionTypeOPGBACSPayment
)

func ParseTransactionType

func ParseTransactionType(s string) TransactionType

func (TransactionType) Key

func (t TransactionType) Key() string

func (TransactionType) MarshalJSON

func (t TransactionType) MarshalJSON() ([]byte, error)

func (TransactionType) String

func (t TransactionType) String() string

func (*TransactionType) UnmarshalJSON

func (t *TransactionType) UnmarshalJSON(data []byte) (err error)

func (TransactionType) Valid

func (t TransactionType) Valid() bool

type UnknownEvent

type UnknownEvent struct {
	BaseBillingEvent
}

type UpdateInvoiceAdjustment

type UpdateInvoiceAdjustment struct {
	Status AdjustmentStatus `json:"status" validate:"valid-enum,oneof=2 3"` // APPROVED, REJECTED
}

Jump to

Keyboard shortcuts

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