Documentation
¶
Index ¶
- Constants
- Variables
- func StringIsBIC(str string) bool
- func StringIsIBAN(str string) bool
- type Account
- type AccountType
- type BIC
- func (bic BIC) CountryCode() country.Code
- func (bic BIC) IsPassiveSWIFT() bool
- func (bic BIC) IsTestBIC() bool
- func (bic BIC) Normalized() (BIC, error)
- func (bic BIC) NormalizedOrNull() NullableBIC
- func (bic BIC) NormalizedShort() (BIC, error)
- func (bic BIC) Nullable() NullableBIC
- func (bic BIC) Parse() (bankCode string, countryCode country.Code, branchCode string, isValid bool)
- func (bic BIC) ReceiverPaisFees() bool
- func (bic *BIC) Scan(value any) error
- func (bic *BIC) ScanString(source string, validate bool) error
- func (bic BIC) TrimBranchCode() BIC
- func (bic BIC) Valid() bool
- func (bic BIC) Validate() error
- func (bic BIC) Value() (driver.Value, error)
- type BICParser
- type CAMT53
- type CAMT53Amount
- type CAMT53Balance
- type CAMT53Entry
- type IBAN
- func (iban *IBAN) BankAndAccountNumbers() (bankNo, accountNo string, err error)
- func (iban IBAN) CountryCode() country.Code
- func (iban IBAN) Normalized() (IBAN, error)
- func (iban IBAN) NormalizedOrNull() NullableIBAN
- func (iban IBAN) NormalizedWithSpaces() (IBAN, error)
- func (iban IBAN) Nullable() NullableIBAN
- func (iban *IBAN) Scan(value any) error
- func (iban *IBAN) ScanString(source string, validate bool) error
- func (iban IBAN) String() string
- func (iban IBAN) Valid() bool
- func (iban IBAN) ValidAndNormalized() bool
- func (iban IBAN) Validate() error
- func (iban IBAN) Value() (driver.Value, error)
- type IBANParser
- type NullableBIC
- func (bic NullableBIC) Get() BIC
- func (bic NullableBIC) GetOr(defaultBIC BIC) BIC
- func (bic NullableBIC) IsNotNull() bool
- func (bic NullableBIC) IsNull() bool
- func (bic NullableBIC) MarshalJSON() ([]byte, error)
- func (bic NullableBIC) Normalized() (NullableBIC, error)
- func (bic NullableBIC) NormalizedOrNull() NullableBIC
- func (bic *NullableBIC) Scan(value any) error
- func (bic *NullableBIC) ScanString(source string, validate bool) error
- func (bic *NullableBIC) Set(id BIC)
- func (bic *NullableBIC) SetNull()
- func (bic NullableBIC) StringOr(defaultString string) string
- func (bic NullableBIC) Valid() bool
- func (bic NullableBIC) ValidAndNotNull() bool
- func (bic NullableBIC) Validate() error
- func (bic NullableBIC) Value() (driver.Value, error)
- type NullableIBAN
- func (iban NullableIBAN) CountryCode() country.Code
- func (iban NullableIBAN) Get() IBAN
- func (iban NullableIBAN) GetOr(defaultIBAN IBAN) IBAN
- func (iban NullableIBAN) IsNotNull() bool
- func (iban NullableIBAN) IsNull() bool
- func (iban NullableIBAN) MarshalJSON() ([]byte, error)
- func (iban NullableIBAN) Normalized() (NullableIBAN, error)
- func (iban NullableIBAN) NormalizedOrNull() NullableIBAN
- func (iban NullableIBAN) NormalizedWithSpaces() (NullableIBAN, error)
- func (iban *NullableIBAN) Scan(value any) error
- func (iban *NullableIBAN) ScanString(source string, validate bool) error
- func (iban *NullableIBAN) Set(id IBAN)
- func (iban *NullableIBAN) SetNull()
- func (iban NullableIBAN) String() string
- func (iban NullableIBAN) StringOr(defaultString string) string
- func (iban NullableIBAN) Valid() bool
- func (iban NullableIBAN) ValidAndNormalized() bool
- func (iban NullableIBAN) ValidAndNotNull() bool
- func (iban NullableIBAN) Validate() error
- func (iban NullableIBAN) Value() (driver.Value, error)
- type PaymentStatus
- type TransactionType
Constants ¶
const ( BICMinLength = 8 BICMaxLength = 11 )
const ( IBANMinLength = 15 IBANMaxLength = 32 )
Variables ¶
var BICFinder bicFinder
var IBANFinder ibanFinder
Functions ¶
func StringIsBIC ¶
func StringIsIBAN ¶
StringIsIBAN returns if a string can be parsed as IBAN.
Types ¶
type Account ¶
type Account struct { IBAN IBAN `json:"iban"` BIC NullableBIC `json:"bic,omitempty"` Currency money.NullableCurrency `json:"currency,omitempty"` Holder nullable.TrimmedString `json:"holder,omitempty"` }
Account identifies a bank account by its IBAN and optionally BIC.
func (*Account) String ¶
String returns a string representation of the Account usabled for debugging.
func (*Account) UnmarshalJSON ¶
UnmarshalJSON implements encoding/json.Unmarshaler
func (*Account) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. The account can be unmarshalled from a JSON object or a IBAN string.
type AccountType ¶
type AccountType string
AccountType holds the type of a bank account. AccountType implements the database/sql.Scanner and database/sql/driver.Valuer interfaces, and will treat an empty string AccountType as SQL NULL value.
var ( // AccountTypeCurrent is a checking account type AccountTypeCurrent AccountType = "CURRENT" // AccountTypeSavings is a savings account type AccountTypeSavings AccountType = "SAVINGS" )
func (*AccountType) Scan ¶
func (t *AccountType) Scan(value any) error
Scan implements the database/sql.Scanner interface.
func (AccountType) Valid ¶
func (t AccountType) Valid() bool
type BIC ¶
type BIC string
BIC is a SWIFT Business Identifier Code (also know as SWIFT-Code). BIC implements the database/sql.Scanner and database/sql/driver.Valuer interfaces and will treat an empty BIC string as SQL NULL value.
func NormalizeBIC ¶
NormalizeBIC returns the passed string as BIC normalized to a length of 11 characters by removing spaces and appending "XXX" in case of a valid length of 8 charaters. Returns the string unchanged as BIC in case of an error.
func (BIC) CountryCode ¶
CountryCode of the BIC. May be invalid if the BIC is invalid.
func (BIC) IsPassiveSWIFT ¶
func (BIC) Normalized ¶
Normalized returns the BIC normalized to a length of 11 characters by removing spaces and appending "XXX" in case of a valid length of 8 charaters. Returns the BIC unchanged in case of an error.
func (BIC) NormalizedOrNull ¶
func (bic BIC) NormalizedOrNull() NullableBIC
func (BIC) NormalizedShort ¶
NormalizedShort returns the BIC normalized to a length of 8 or 11 characters by removing spaces trimming the "XXX" suffix in case of a valid length of 8 charaters. Returns the BIC unchanged in case of an error.
func (BIC) ReceiverPaisFees ¶
func (*BIC) ScanString ¶
ScanString tries to parse and assign the passed source string as value of the implementing type.
If validate is true, the source string is checked for validity before it is assigned to the type.
If validate is false and the source string can still be assigned in some non-normalized way it will be assigned without returning an error.
func (BIC) TrimBranchCode ¶
type CAMT53 ¶
type CAMT53 struct { MessageID string `xml:"BkToCstmrStmt>GrpHdr>MsgId"` Created time.Time `xml:"BkToCstmrStmt>GrpHdr>CreDtTm"` StatementID string `xml:"BkToCstmrStmt>Stmt>Id"` ElectronicSequenceNr string `xml:"BkToCstmrStmt>Stmt>ElctrncSeqNb,omitempty"` LegalSequenceNr string `xml:"BkToCstmrStmt>Stmt>LglSeqNb,omitempty"` FromDate time.Time `xml:"BkToCstmrStmt>Stmt>FrToDt>FrDtTm"` ToDate time.Time `xml:"BkToCstmrStmt>Stmt>FrToDt>ToDtTm"` IBAN IBAN `xml:"BkToCstmrStmt>Stmt>Acct>Id>IBAN"` Currency money.Currency `xml:"BkToCstmrStmt>Stmt>Acct>Ccy"` BankName string `xml:"BkToCstmrStmt>Stmt>Acct>Svcr>FinInstnId>Nm,omitempty"` BIC BIC `xml:"BkToCstmrStmt>Stmt>Acct>Svcr>FinInstnId>BIC"` Balance []CAMT53Balance `xml:"BkToCstmrStmt>Stmt>Bal"` Entries []CAMT53Entry `xml:"BkToCstmrStmt>Stmt>Ntry"` }
type CAMT53Amount ¶
type CAMT53Balance ¶
type CAMT53Balance struct { Type string `xml:"Tp>CdOrPrtry>Cd"` // PRCD: Endsaldo gebucht vorheriger Auszug "MSIN" "CNFA" "DNFA" "CINV" "CREN" "DEBN" "HIRI" "SBIN" "CMCN" "SOAC" "DISP" "BOLD" "VCHR" "AROI" "TSUT" Proprietary string `xml:"Tp>CdOrPrtry>Prtry"` Amount CAMT53Amount `xml:"Amt"` CreditOrDebit string `xml:"CdtDbtInd"` // Soll (DBIT) oder Haben (CRDT) Date date.Date `xml:"Dt>Dt"` }
type CAMT53Entry ¶
type CAMT53Entry struct { Amount CAMT53Amount `xml:"Amt"` CreditOrDebit string `xml:"CdtDbtInd"` // Soll (DBIT) oder Haben (CRDT) Status string `xml:"Sts"` // BOOK, PDNG, INFO BookingDate date.Date `xml:"BookgDt>Dt"` ValueDate date.Date `xml:"ValDt>Dt"` ReferenceCode string `xml:"AcctSvcrRef"` // BkTxCd DebitorName string `xml:"NtryDtls>TxDtls>RltdPties>Dbtr>Nm"` DebitorAddr []string `xml:"NtryDtls>TxDtls>RltdPties>Dbtr>PstlAdr>AdrLine,omitempty"` DebitorIBAN IBAN `xml:"NtryDtls>TxDtls>RltdPties>DbtrAcct>Id>IBAN"` CreditorName string `xml:"NtryDtls>TxDtls>RltdPties>Cdtr>Nm"` CreditorAddr []string `xml:"NtryDtls>TxDtls>RltdPties>Cdtr>PstlAdr>AdrLine,omitempty"` CreditorIBAN IBAN `xml:"NtryDtls>TxDtls>RltdPties>CdtrAcct>Id>IBAN"` DebitorBIC BIC `xml:"NtryDtls>TxDtls>RltdAgts>DbtrAgt>FinInstnId>BIC"` CreditorBIC BIC `xml:"NtryDtls>TxDtls>RltdAgts>CdtrAgt>FinInstnId>BIC"` Reference string `xml:"NtryDtls>TxDtls>RmtInf>Strd>CdtrRefInf>Ref"` }
type IBAN ¶
type IBAN string
IBAN is a International Bank Account Number. IBAN implements the database/sql.Scanner and database/sql/driver.Valuer interfaces, and will treat an empty IBAN string as SQL NULL value.
func NormalizeIBAN ¶
NormalizeIBAN returns str as normalized IBAN or an error.
func (*IBAN) BankAndAccountNumbers ¶
func (IBAN) CountryCode ¶
CountryCode returns the country code of the IBAN. May be invalid if the IBAN is invalid.
func (IBAN) Normalized ¶
Normalized returns the iban in normalized form, or an error if the format can't be detected. Returns the IBAN unchanged in case of an error.
func (IBAN) NormalizedOrNull ¶
func (iban IBAN) NormalizedOrNull() NullableIBAN
func (IBAN) NormalizedWithSpaces ¶
NormalizedWithSpaces returns the iban in normalized form with spaces every 4 characters, or an error if the format can't be detected. Returns the IBAN unchanged in case of an error.
func (IBAN) Nullable ¶
func (iban IBAN) Nullable() NullableIBAN
Nullable returns the IBAN as NullableIBAN
func (*IBAN) ScanString ¶
ScanString tries to parse and assign the passed source string as value of the implementing type.
If validate is true, the source string is checked for validity before it is assigned to the type.
If validate is false and the source string can still be assigned in some non-normalized way it will be assigned without returning an error.
func (IBAN) String ¶
String returns the normalized IBAN string if possible, else it will be returned unchanged as string. String implements the fmt.Stringer interface.
func (IBAN) ValidAndNormalized ¶
type IBANParser ¶
type IBANParser struct{}
IBANParser implements the strfmt.Parser interface for IBANs.
type NullableBIC ¶
type NullableBIC string
NullableBIC is a BIC value which can hold an emtpy string ("") as the null value.
const BICNull NullableBIC = ""
BICNull is an empty string and will be treatet as SQL NULL.
func (NullableBIC) Get ¶
func (bic NullableBIC) Get() BIC
Get returns the non nullable BIC value or panics if the NullableBIC is null. Note: check with IsNull before using Get!
func (NullableBIC) GetOr ¶
func (bic NullableBIC) GetOr(defaultBIC BIC) BIC
GetOr returns the non nullable BIC value or the passed defaultBIC if the NullableBIC is null.
func (NullableBIC) IsNotNull ¶
func (bic NullableBIC) IsNotNull() bool
func (NullableBIC) IsNull ¶
func (bic NullableBIC) IsNull() bool
IsNull returns true if the NullableBIC is null. IsNull implements the nullable.Nullable interface.
func (NullableBIC) MarshalJSON ¶
func (bic NullableBIC) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.Marshaler by returning the JSON null value for an empty (null) string.
func (NullableBIC) Normalized ¶
func (bic NullableBIC) Normalized() (NullableBIC, error)
func (NullableBIC) NormalizedOrNull ¶
func (bic NullableBIC) NormalizedOrNull() NullableBIC
func (*NullableBIC) Scan ¶
func (bic *NullableBIC) Scan(value any) error
Scan implements the database/sql.Scanner interface.
func (*NullableBIC) ScanString ¶
func (bic *NullableBIC) ScanString(source string, validate bool) error
ScanString tries to parse and assign the passed source string as value of the implementing type.
If validate is true, the source string is checked for validity before it is assigned to the type.
If validate is false and the source string can still be assigned in some non-normalized way it will be assigned without returning an error.
func (*NullableBIC) SetNull ¶
func (bic *NullableBIC) SetNull()
SetNull sets the NullableBIC to null
func (NullableBIC) StringOr ¶
func (bic NullableBIC) StringOr(defaultString string) string
StringOr returns the NullableBIC as string or the passed defaultString if the NullableBIC is null.
func (NullableBIC) Valid ¶
func (bic NullableBIC) Valid() bool
Valid returns true if bic is null or a valid SWIFT Business Identifier Code
func (NullableBIC) ValidAndNotNull ¶
func (bic NullableBIC) ValidAndNotNull() bool
ValidAndNotNull returns true if bic is not null and a valid SWIFT Business Identifier Code
func (NullableBIC) Validate ¶
func (bic NullableBIC) Validate() error
Validate returns an error if this is not a valid SWIFT Business Identifier Code
type NullableIBAN ¶
type NullableIBAN string
NullableIBAN is a IBAN value which can hold an emtpy string ("") as the null value.
const IBANNull NullableIBAN = ""
IBANNull is an empty string and will be treatet as SQL NULL.
func (NullableIBAN) CountryCode ¶
func (iban NullableIBAN) CountryCode() country.Code
CountryCode returns the country code of the IBAN
func (NullableIBAN) Get ¶
func (iban NullableIBAN) Get() IBAN
Get returns the non nullable IBAN value or panics if the NullableIBAN is null. Note: check with IsNull before using Get!
func (NullableIBAN) GetOr ¶
func (iban NullableIBAN) GetOr(defaultIBAN IBAN) IBAN
GetOr returns the non nullable IBAN value or the passed defaultIBAN if the NullableIBAN is null.
func (NullableIBAN) IsNotNull ¶
func (iban NullableIBAN) IsNotNull() bool
func (NullableIBAN) IsNull ¶
func (iban NullableIBAN) IsNull() bool
IsNull returns true if the NullableIBAN is null. IsNull implements the nullable.Nullable interface.
func (NullableIBAN) MarshalJSON ¶
func (iban NullableIBAN) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.Marshaler by returning the JSON null value for an empty (null) string.
func (NullableIBAN) Normalized ¶
func (iban NullableIBAN) Normalized() (NullableIBAN, error)
Normalized returns the iban in normalized form, or an error if the format can't be detected. Returns the NullableIBAN unchanged in case of an error.
func (NullableIBAN) NormalizedOrNull ¶
func (iban NullableIBAN) NormalizedOrNull() NullableIBAN
func (NullableIBAN) NormalizedWithSpaces ¶
func (iban NullableIBAN) NormalizedWithSpaces() (NullableIBAN, error)
NormalizedWithSpaces returns the iban in normalized form with spaces every 4 characters, or an error if the format can't be detected. Returns the NullableIBAN unchanged in case of an error.
func (*NullableIBAN) Scan ¶
func (iban *NullableIBAN) Scan(value any) error
Scan implements the database/sql.Scanner interface.
func (*NullableIBAN) ScanString ¶
func (iban *NullableIBAN) ScanString(source string, validate bool) error
ScanString tries to parse and assign the passed source string as value of the implementing type.
If validate is true, the source string is checked for validity before it is assigned to the type.
If validate is false and the source string can still be assigned in some non-normalized way it will be assigned without returning an error.
func (*NullableIBAN) Set ¶
func (iban *NullableIBAN) Set(id IBAN)
Set sets an IBAN for this NullableIBAN
func (*NullableIBAN) SetNull ¶
func (iban *NullableIBAN) SetNull()
SetNull sets the NullableIBAN to null
func (NullableIBAN) String ¶
func (iban NullableIBAN) String() string
String returns the normalized IBAN string if possible, else it will be returned unchanged as string. String implements the fmt.Stringer interface.
func (NullableIBAN) StringOr ¶
func (iban NullableIBAN) StringOr(defaultString string) string
StringOr returns the NullableIBAN as string or the passed defaultString if the NullableIBAN is null.
func (NullableIBAN) Valid ¶
func (iban NullableIBAN) Valid() bool
Valid returns true if iban is null or a valid International Bank Account Number
func (NullableIBAN) ValidAndNormalized ¶
func (iban NullableIBAN) ValidAndNormalized() bool
func (NullableIBAN) ValidAndNotNull ¶
func (iban NullableIBAN) ValidAndNotNull() bool
ValidAndNotNull returns true if iban is not null and a valid International Bank Account Number
func (NullableIBAN) Validate ¶
func (iban NullableIBAN) Validate() error
Validate returns an error if this is not null and not a valid International Bank Account Number
type PaymentStatus ¶
type PaymentStatus string
const ( PaymentStatusCreated PaymentStatus = "CREATED" PaymentStatusFinished PaymentStatus = "FINISHED" PaymentStatusFailed PaymentStatus = "FAILED" )
type TransactionType ¶
type TransactionType string
const ( TransactionTypeIncoming TransactionType = "INCOMING" TransactionTypeOutgoing TransactionType = "OUTGOING" )