MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / upsertCreditLineageMapping

Method upsertCreditLineageMapping

lineage.go:324–338  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

322// Returns:
323// - error: An error if the mapping could not be created.
324func (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//

Callers 1

processLineageCreditMethod · 0.95

Calls 1

UpsertLineageMappingMethod · 0.65

Tested by

no test coverage detected