scene

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Scene provides well structured template contexts and functionality for HTML template rendering. We chose the word "scene" to represent the context since "context" is an overloaded term and milieu was too hard to spell.

Index

Constants

View Source
const (
	Version         = "Version"
	ShortVersion    = "ShortVersion"
	Page            = "Page"
	IsAuthenticated = "IsAuthenticated"
	User            = "User"
	APIData         = "APIData"
	Parent          = "Parent"
	ToastMsgsKey    = "ToastMessages"
	Organization    = "Organization"
	TRISAEnabled    = "TRISAEnabled"
	TRPEnabled      = "TRPEnabled"
	SunriseEnabled  = "SunriseEnabled"
	DaybreakEnabled = "DaybreakEnabled"
)

Keys for default Scene context items

View Source
const (
	RoleAdmin      = "Admin"
	RoleCompliance = "Compliance"
	RoleObserver   = "Observer"
)

Role string constants

View Source
const ToastCookie = "toast_messages"

Variables

This section is empty.

Functions

func WithConf added in v0.28.0

func WithConf(conf *config.Config)

Types

type Account added in v1.0.0

type Account struct {
	ID            string
	CustomerID    string
	FirstName     string
	LastName      string
	TravelAddress string
	IVMSRecord    Person
	HasIVMSRecord bool
	NumAddresses  int64
	Created       time.Time
	Modified      time.Time
}

Account is used instead of api.Account here to ensure we don't serialize and deserialize the IVMSRecord field in the API response. It does add a bit of duplication wrt the API code, but hopefully that will not be too onerous to maintain.

func (Account) CustomerNumber added in v1.0.0

func (a Account) CustomerNumber() string

type AddressComponents added in v0.28.0

type AddressComponents struct {
	AddressType    string
	AddressLine0   string
	AddressLine1   string
	AddressLine2   string
	AddressCountry string
}

func (AddressComponents) AddressLabel added in v1.0.0

func (a AddressComponents) AddressLabel() string

type Company added in v1.0.0

type Company struct {
	AddressComponents
	LegalName             string
	LegalNameType         string
	PrimaryAddress        *ivms101.Address
	PrimaryAddressLines   []string
	CustomerNumber        string
	CountryOfRegistration string
	NationalIdentifier    NationalIdentifier
	// contains filtered or unexported fields
}

func (Company) JSON added in v1.0.0

func (c Company) JSON() string

func (Company) MarshalJSON added in v1.0.0

func (c Company) MarshalJSON() ([]byte, error)

type Entities added in v1.0.0

type Entities []Entity

func (Entities) JSON added in v1.0.0

func (e Entities) JSON() string

func (Entities) Plural added in v1.0.0

func (e Entities) Plural() bool

type Entity added in v1.0.0

type Entity struct {
	Person  *Person
	Company *Company
}

func (Entity) JSON added in v1.0.0

func (e Entity) JSON() string

type Envelope added in v1.0.0

type Envelope struct {
	api.Envelope
}

Wraps an *api.Envelope to provide additional UI-specific functionality.

func (*Envelope) Identity added in v1.0.0

func (e *Envelope) Identity() *IVMS101

func (*Envelope) ReceivedAtRepr added in v1.0.0

func (e *Envelope) ReceivedAtRepr() string

func (*Envelope) SentAtRepr added in v1.0.0

func (e *Envelope) SentAtRepr() string

func (*Envelope) Transaction added in v1.0.0

func (e *Envelope) Transaction() *generic.Transaction

func (*Envelope) TransactionJSON added in v1.0.0

func (e *Envelope) TransactionJSON() string

type Error added in v1.0.0

type Error struct {
	Scene
	Error        string
	SupportEmail string
	Support      string
}

func (*Error) WithEmail added in v1.0.0

func (s *Error) WithEmail(email string) *Error

type IVMS101 added in v0.28.0

type IVMS101 struct {
	Originator      Entities
	OriginatorVASP  Company
	Beneficiary     Entities
	BeneficiaryVASP Company
}

IVMS101 is a struct that represents the complex IVMS101 data as a flattened struct with only the data that is required by our web application.

func NewIVMS101 added in v1.0.0

func NewIVMS101(envelope *Envelope) *IVMS101

type LocalpartyScene added in v1.1.0

type LocalpartyScene struct {
	Localparty *api.Counterparty
	Error      error
}

func (*LocalpartyScene) Company added in v1.1.0

func (s *LocalpartyScene) Company() Company

type NationalIdentifier added in v0.28.0

type NationalIdentifier struct {
	Identifier            string
	TypeRepr              string
	TypeCode              string
	CountryOfIssue        string
	RegistrationAuthority string
}

type Person added in v0.28.0

type Person struct {
	AddressComponents
	Forename            string
	Surname             string
	NameType            string
	PrimaryAddress      *ivms101.Address
	PrimaryAddressLines []string
	CustomerNumber      string
	NationalIdentifier  NationalIdentifier
	DateOfBirth         string
	PlaceOfBirth        string
	CountryOfResidence  string
	// contains filtered or unexported fields
}

func (Person) FullName added in v1.0.0

func (p Person) FullName() string

func (Person) JSON added in v1.0.0

func (p Person) JSON() string

func (Person) MarshalJSON added in v1.0.0

func (p Person) MarshalJSON() ([]byte, error)

type Prepared added in v1.0.0

type Prepared struct {
	Routing *api.Routing
	// contains filtered or unexported fields
}

func (Prepared) Beneficiary added in v1.0.0

func (s Prepared) Beneficiary() Person

func (Prepared) BeneficiaryVASP added in v1.0.0

func (s Prepared) BeneficiaryVASP() Company

func (Prepared) IdentityJSON added in v1.0.0

func (s Prepared) IdentityJSON() string

func (Prepared) OriginatingVASP added in v1.0.0

func (s Prepared) OriginatingVASP() Company

func (Prepared) Originator added in v1.0.0

func (s Prepared) Originator() Person

func (Prepared) RoutingJSON added in v1.0.0

func (s Prepared) RoutingJSON() string

func (Prepared) TransactionJSON added in v1.0.0

func (s Prepared) TransactionJSON() string

func (Prepared) Transfer added in v1.0.0

func (s Prepared) Transfer() Transfer

type Rejection added in v1.0.0

type Rejection struct {
	api.Rejection
}

Wraps a *trisa.Error to provide additional UI-specific functionality.

type Scene

type Scene map[string]interface{}

func New

func New(c *gin.Context) Scene

func (Scene) APIKeyDetail added in v0.24.1

func (s Scene) APIKeyDetail() *api.APIKey

func (Scene) APIKeysList added in v0.24.1

func (s Scene) APIKeysList() *api.APIKeyList

func (Scene) AccountDetail added in v0.19.0

func (s Scene) AccountDetail() *Account

func (Scene) AccountPerson added in v1.0.0

func (s Scene) AccountPerson() Person

func (Scene) AccountsList

func (s Scene) AccountsList() *api.AccountsList

func (Scene) ComplianceAuditLogDetail added in v1.2.0

func (s Scene) ComplianceAuditLogDetail() *api.ComplianceAuditLog

func (Scene) ComplianceAuditLogList added in v1.2.0

func (s Scene) ComplianceAuditLogList() *api.ComplianceAuditLogList

func (Scene) CounterpartyDetail added in v0.25.0

func (s Scene) CounterpartyDetail() *api.Counterparty

func (Scene) CounterpartyList

func (s Scene) CounterpartyList() *api.CounterpartyList

func (Scene) CreateAPIKey added in v0.24.1

func (s Scene) CreateAPIKey() *api.APIKey

func (Scene) CryptoAddressList added in v1.0.0

func (s Scene) CryptoAddressList() *api.CryptoAddressList

func (Scene) Envelope added in v0.28.0

func (s Scene) Envelope() *Envelope

func (Scene) EnvelopeList added in v1.0.0

func (s Scene) EnvelopeList() *api.EnvelopesList

func (Scene) Error added in v1.0.0

func (s Scene) Error(err error) *Error

Return the simplified/flattened IVMS101 identity representation if an Envelope has been set as the APIData in the Scene.

func (Scene) GetUser

func (s Scene) GetUser() *auth.Claims

func (Scene) HasRole

func (s Scene) HasRole(role string) bool

func (Scene) IVMS101 added in v0.28.0

func (s Scene) IVMS101() *IVMS101

Return the simplified/flattened IVMS101 identity representation if an Envelope has been set as the APIData in the Scene.

func (Scene) IsAdmin

func (s Scene) IsAdmin() bool

func (Scene) IsAuthenticated

func (s Scene) IsAuthenticated() bool

func (Scene) IsViewOnly

func (s Scene) IsViewOnly() bool

func (Scene) Localparty added in v1.1.0

func (s Scene) Localparty() *LocalpartyScene

func (Scene) Prepared added in v1.0.0

func (s Scene) Prepared() Prepared

func (Scene) Rejection added in v1.0.0

func (s Scene) Rejection() *Rejection

func (Scene) SecureEnvelope added in v1.0.0

func (s Scene) SecureEnvelope() *api.SecureEnvelope

func (Scene) SendEnabledForProtocol added in v1.0.0

func (s Scene) SendEnabledForProtocol(protocol string) bool

func (Scene) SunriseError added in v1.0.0

func (s Scene) SunriseError(err error) *SunriseError

func (Scene) TransactionCounts added in v1.0.0

func (s Scene) TransactionCounts() *models.TransactionCounts

func (Scene) TransactionDetail added in v0.19.0

func (s Scene) TransactionDetail() *Transaction

func (Scene) TransactionPayload added in v1.0.0

func (s Scene) TransactionPayload() *TransactionPayload

func (Scene) TransactionsList added in v0.19.0

func (s Scene) TransactionsList() *TransactionList

func (Scene) Update

func (s Scene) Update(o Scene) Scene

func (Scene) UserDetail added in v1.0.0

func (s Scene) UserDetail() *api.User

func (Scene) UserList

func (s Scene) UserList() *api.UserList

func (Scene) With added in v1.0.0

func (s Scene) With(key string, val interface{}) Scene

func (Scene) WithAPIData

func (s Scene) WithAPIData(data interface{}) Scene

func (Scene) WithEmail added in v1.0.0

func (s Scene) WithEmail(prefix, email string) Scene

func (Scene) WithLocalparty added in v1.1.0

func (s Scene) WithLocalparty(localparty *models.Counterparty, err error) Scene

WithLocalparty returns a new scene with the local party information

func (Scene) WithParent added in v1.0.0

func (s Scene) WithParent(parent ulid.ULID) Scene

func (Scene) WithToastMessages added in v1.0.0

func (s Scene) WithToastMessages(c *gin.Context) Scene

type Status added in v1.0.0

type Status struct {
	Color   string
	Tooltip string
	// contains filtered or unexported fields
}

Status wraps a Transaction status to provide additional information such as class, tooltip, color, icons, etc for the UI.

func NewStatus added in v1.0.0

func NewStatus(text string) Status

func (Status) Accepted added in v1.0.0

func (s Status) Accepted() bool

func (Status) ActionRequired added in v1.0.0

func (s Status) ActionRequired() bool

func (Status) Opacity added in v1.0.0

func (s Status) Opacity() string

func (Status) Repair added in v1.0.0

func (s Status) Repair() bool

func (Status) Review added in v1.0.0

func (s Status) Review() bool

func (Status) String added in v1.0.0

func (s Status) String() string

func (Status) Wait added in v1.0.0

func (s Status) Wait() bool

type SunriseError added in v1.0.0

type SunriseError struct {
	Scene
	Error           string
	SupportEmail    string
	Support         string
	ComplianceEmail string
	Compliance      string
}

func (*SunriseError) WithEmail added in v1.0.0

func (s *SunriseError) WithEmail(support, compliance string) *SunriseError

type ToastMessage added in v1.0.0

type ToastMessage struct {
	Heading string `json:"heading"`
	Message string `json:"message"`
	Type    string `json:"type"` // success, error, info, warning
}

type ToastMessages added in v1.0.0

type ToastMessages []ToastMessage

func (ToastMessages) MarshalCookie added in v1.0.0

func (t ToastMessages) MarshalCookie() string

func (*ToastMessages) UnmarshalCookie added in v1.0.0

func (t *ToastMessages) UnmarshalCookie(cookie string)

type Transaction added in v1.0.0

type Transaction struct {
	api.Transaction
	Status Status
}

Wraps an *api.Transaction to provide additional UI-specific functionality.

type TransactionList added in v1.0.0

type TransactionList struct {
	Page         *api.TransactionListQuery
	Transactions []*Transaction
}

Converted from an *api.TransactionList to provide additional UI-specific functionality.

type TransactionPayload added in v1.0.0

type TransactionPayload struct {
	generic.Transaction
}

Wraps a *generic.Transaction to provide additional UI-specific functionality.

type Transfer added in v1.0.0

type Transfer struct {
	Originator   string
	Beneficiary  string
	Amount       float64
	VirtualAsset string
	AssetType    string
	TxID         string
	Tag          string
}

Jump to

Keyboard shortcuts

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