github.com/chain5j/chain5j-pkg@v1.0.7/crypto/icap/types.go (about) 1 // Package icap 2 // 3 // @author: xwc1125 4 package icap 5 6 import "strings" 7 8 type Customer struct { 9 currency string `json:"currency"` // 资产标识符 10 orgCode string `json:"orgCode"` // 机构标识符 11 resultLen int `json:"resultLen"` // 机构客户标识符base36的标准长度+currencyLen+orgCodeLen+2位校验码 如果长度不足时,base36会进行补0 12 customer []byte `json:"customer"` // 机构客户标识符[16进制] 13 } 14 15 type IBanInfo struct { 16 currencyLen int `json:"currencyLen"` // 资产标识符长度 17 orgCodeLen int `json:"orgCodeLen"` // 机构标识符长度 18 customerLen int `json:"customerLen"` // 机构客户标识符的标准长度 19 iban string `json:"iban"` // iban标识 20 } 21 22 func NewCustomer(currency, orgCode string, resultLen int, customer []byte) *Customer { 23 return &Customer{ 24 currency: currency, 25 orgCode: orgCode, 26 resultLen: resultLen, 27 customer: customer, 28 } 29 } 30 func NewIBanInfo(currencyLen, orgCodeLen, customerLen int, iban string) *IBanInfo { 31 return &IBanInfo{ 32 currencyLen: currencyLen, 33 orgCodeLen: orgCodeLen, 34 customerLen: customerLen, 35 iban: iban, 36 } 37 } 38 39 func (c *Customer) Currency() string { 40 return strings.ToUpper(c.currency) 41 } 42 43 func (c *Customer) OrgCode() string { 44 return strings.ToUpper(c.orgCode) 45 } 46 47 func (c *Customer) ResultLen() int { 48 return c.resultLen 49 } 50 51 func (c *Customer) Customer() []byte { 52 return c.customer 53 } 54 55 func (b *IBanInfo) CurrencyLen() int { 56 return b.currencyLen 57 } 58 59 func (b *IBanInfo) OrgCodeLen() int { 60 return b.orgCodeLen 61 } 62 63 func (b *IBanInfo) CustomerLen() int { 64 return b.customerLen 65 } 66 67 func (b *IBanInfo) Iban() string { 68 return strings.ToUpper(b.iban) 69 }