upsertCreditLineageMapping creates or updates the lineage mapping for a credit transaction. Parameters: - ctx context.Context: The context for the operation. - destBalance *model.Balance: The destination balance. - provider string: The fund provider identifier. - shadowBalance *model.Balance: The s
(ctx context.Context, destBalance *model.Balance, provider string, shadowBalance, aggregateBalance *model.Balance, identityID string)
| 322 | // Returns: |
| 323 | // - error: An error if the mapping could not be created. |
| 324 | func (l *LedgerForge) upsertCreditLineageMapping(ctx context.Context, destBalance *model.Balance, provider string, shadowBalance, aggregateBalance *model.Balance, identityID string) error { |
| 325 | mapping := model.LineageMapping{ |
| 326 | BalanceID: destBalance.BalanceID, |
| 327 | Provider: provider, |
| 328 | ShadowBalanceID: shadowBalance.BalanceID, |
| 329 | AggregateBalanceID: aggregateBalance.BalanceID, |
| 330 | IdentityID: identityID, |
| 331 | } |
| 332 | |
| 333 | if err := l.datasource.UpsertLineageMapping(ctx, mapping); err != nil { |
| 334 | return fmt.Errorf("failed to upsert lineage mapping: %w", err) |
| 335 | } |
| 336 | |
| 337 | return nil |
| 338 | } |
| 339 | |
| 340 | // queueShadowCreditTransaction queues a shadow transaction to track credited funds from a provider. |
| 341 | // |
no test coverage detected