func (b *BalanceTag) Unmarshal(value []byte) error {
	elements, err := extractTagElements(value)
	if err != nil {
		return err
	}
	if len(elements) != 2 {
		return fmt.Errorf("%T: Malformed marshaled value", b)
	}
	b.Tag = string(elements[0])
	buf := bytes.NewBuffer(elements[1])
	b.DebitCreditIndicator = string(buf.Next(1))
	dateBytes := buf.Next(6)
	date, err := parseDate(dateBytes, time.Now().Year())
	if err != nil {
		return errors.WithMessage(err, "unmarshal balance tag: parsing booking date")
	}
	b.BookingDate = domain.NewShortDate(date)
	b.Currency = string(buf.Next(3))
	amountString := strings.Replace(buf.String(), ",", ".", 1)
	amount, err := strconv.ParseFloat(amountString, 64)
	if err != nil {
		return errors.Wrap(err, "MT940 Balance tag: error unmarshaling amount")
	}
	b.Amount = amount
	return nil
}
// Unmarshal unmarshals value into b
Unmarshal unmarshals value into b
// Unmarshal unmarshals value into b
func (b *BalanceTag) Unmarshal(value []byte) error {
	elements, err := extractTagElements(value)
	if err != nil {
		return err
	}
	if len(elements) != 2 {
		return fmt.Errorf("%T: Malformed marshaled value", b)
	}
	b.Tag = string(elements[0])
	buf := bytes.NewBuffer(elements[1])
	b.DebitCreditIndicator = string(buf.Next(1))
	dateBytes := buf.Next(6)
	date, err := parseDate(dateBytes, time.Now().Year())
	if err != nil {
		return errors.WithMessage(err, "unmarshal balance tag: parsing booking date")
	}
	b.BookingDate = domain.NewShortDate(date)
	b.Currency = string(buf.Next(3))
	amountString := strings.Replace(buf.String(), ",", ".", 1)
	amount, err := strconv.ParseFloat(amountString, 64)
	if err != nil {
		return errors.Wrap(err, "MT940 Balance tag: error unmarshaling amount")
	}
	b.Amount = amount
	return nil
}
func ( b * BalanceTag ) Unmarshal ( value [ ] byte ) error { elements , err := extractTagElements ( value ) if err != nil { return err } if len ( elements ) != 2 { return fmt . Errorf ( " " , b ) } b . Tag = string ( elements [ 0 ] ) buf := bytes . NewBuffer ( elements [ 1 ] ) b . DebitCreditIndicator = string ( buf . Next ( 1 ) ) dateBytes := buf . Next ( 6 ) date , err := parseDate ( dateBytes , time . Now ( ) . Year ( ) ) if err != nil { return errors . WithMessage ( err , " " ) } b . BookingDate = domain . NewShortDate ( date ) b . Currency = string ( buf . Next ( 3 ) ) amountString := strings . Replace ( buf . String ( ) , " " , " " , 1 ) amount , err := strconv . ParseFloat ( amountString , 64 ) if err != nil { return errors . Wrap ( err , " " ) } b . Amount = amount return nil }
Unmarshal unmarshals value into b
Unmarshal unmarshals value into b