|
|
@ -15,6 +15,31 @@ type DrctDbtTxInf struct { |
|
|
Info RmtInf `xml:"RmtInf"` |
|
|
Info RmtInf `xml:"RmtInf"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func NewDirectDebitTransaction(debtor Dbtr, account DbtrAcct, mandateInfo MndtRltdInf, amount float64, additionalInfo string) DrctDbtTxInf { |
|
|
|
|
|
e2eid := fmt.Sprintf("%v%4d", time.Now().Format("20060102"), 4) // TODO: inform this function of current number of transactions
|
|
|
|
|
|
return DrctDbtTxInf{ |
|
|
|
|
|
Id: PaymentId{ |
|
|
|
|
|
InstrumentId: "asdfasdf", |
|
|
|
|
|
EndToEndId: e2eid, |
|
|
|
|
|
}, |
|
|
|
|
|
Amount: CurrencyWithAmount{ |
|
|
|
|
|
Currency: "EUR", |
|
|
|
|
|
Value: fmt.Sprintf("%.2f", amount), |
|
|
|
|
|
}, |
|
|
|
|
|
Transaction: DrctDbtTx{ |
|
|
|
|
|
MandateRelatedInfo: mandateInfo, |
|
|
|
|
|
}, |
|
|
|
|
|
Agent: DbtrAgt{ |
|
|
|
|
|
InstitutionId: FinInstnId{ |
|
|
|
|
|
BIC: "KNABNL2H", // fixme
|
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
Debtor: debtor, |
|
|
|
|
|
Account: account, |
|
|
|
|
|
Info: additionalInfo, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func (d *DrctDbtTxInf) Valid() error { |
|
|
func (d *DrctDbtTxInf) Valid() error { |
|
|
var err []string |
|
|
var err []string |
|
|
if e := d.Id.Valid(); e != nil { |
|
|
if e := d.Id.Valid(); e != nil { |
|
|
|