}
// TODO: this is a hack
oldcert, err := document.ToCert(iv)
+ if err != nil {
+ // internal error
+ return nil, err
+ }
// TODO: sanity checks? oldcert.Holder == draft.Drawer
cert.Serial = oldcert.Serial + 1
cert.Balance = oldcert.Balance + cert.Difference
}
cert.LastDebitSerial = oldcert.LastDebitSerial
cert.LastCreditSerial = oldcert.LastCreditSerial
- if oldcert.IsDebit {
+ if _,ok := iv.(*document.DebitCert); ok {
cert.LastDebitSerial = oldcert.Serial
} else {
cert.LastCreditSerial = oldcert.Serial
}
cert.LastDebitSerial = oldcert.LastDebitSerial
cert.LastCreditSerial = oldcert.LastCreditSerial
- if oldcert.IsDebit {
+ if _,ok := iv.(*document.DebitCert); ok {
cert.LastDebitSerial = oldcert.Serial
} else {
cert.LastCreditSerial = oldcert.Serial