| 232 | } |
| 233 | |
| 234 | func (t *RecordTransaction) ToTransaction() *model.Transaction { |
| 235 | var scheduledFor time.Time |
| 236 | var inflightExpiryDate time.Time |
| 237 | var inflightCommitDate time.Time |
| 238 | |
| 239 | if t.ScheduledFor != "" { |
| 240 | scheduledTime, err := time.Parse("2006-01-02T15:04:05Z07:00", t.ScheduledFor) |
| 241 | if err != nil { |
| 242 | logrus.Error(err) |
| 243 | } |
| 244 | |
| 245 | scheduledFor = scheduledTime |
| 246 | |
| 247 | } |
| 248 | |
| 249 | if t.InflightExpiryDate != "" { |
| 250 | inflightExpiry, err := time.Parse("2006-01-02T15:04:05Z07:00", t.InflightExpiryDate) |
| 251 | if err != nil { |
| 252 | logrus.Error(err) |
| 253 | } |
| 254 | |
| 255 | inflightExpiryDate = inflightExpiry |
| 256 | |
| 257 | } |
| 258 | |
| 259 | if t.InflightCommitDate != "" { |
| 260 | inflightCommit, err := time.Parse("2006-01-02T15:04:05Z07:00", t.InflightCommitDate) |
| 261 | if err != nil { |
| 262 | logrus.Error(err) |
| 263 | } |
| 264 | |
| 265 | inflightCommitDate = inflightCommit |
| 266 | } |
| 267 | |
| 268 | return &model.Transaction{Currency: t.Currency, Source: t.Source, Description: t.Description, Reference: t.Reference, ScheduledFor: scheduledFor, Destination: t.Destination, Amount: t.Amount, AllowOverdraft: t.AllowOverDraft, MetaData: t.MetaData, Sources: t.Sources, Destinations: t.Destinations, Inflight: t.Inflight, Precision: t.Precision, InflightExpiryDate: inflightExpiryDate, InflightCommitDate: inflightCommitDate, Rate: t.Rate, SkipQueue: t.SkipQueue, EffectiveDate: t.EffectiveDate, OverdraftLimit: t.OverdraftLimit, PreciseAmount: t.PreciseAmount, Atomic: t.Atomic} |
| 269 | } |