createReconciler creates a reconciler function based on the specified strategy, group criteria, and matching rules. Parameters: - strategy: The reconciliation strategy (e.g., one-to-one, one-to-many). - groupCriteria: Criteria for grouping transactions (optional). - matchingRules: A list of matching
(strategy string, uploadID string, groupCriteria string, matchingRules []model.MatchingRule)
| 404 | // Returns: |
| 405 | // - reconciler: A function that performs reconciliation according to the specified strategy. |
| 406 | func (s *LedgerForge) createReconciler(strategy string, uploadID string, groupCriteria string, matchingRules []model.MatchingRule) reconciler { |
| 407 | return func(ctx context.Context, txns []*model.Transaction) ([]model.Match, []string) { |
| 408 | switch strategy { |
| 409 | case "one_to_one": |
| 410 | // Perform one-to-one reconciliation. |
| 411 | return s.oneToOneReconciliation(ctx, txns, matchingRules) |
| 412 | case "one_to_many": |
| 413 | // Perform one-to-many reconciliation. |
| 414 | return s.oneToManyReconciliation(ctx, txns, groupCriteria, matchingRules, false) |
| 415 | case "many_to_one": |
| 416 | // Perform many-to-one reconciliation. |
| 417 | return s.manyToOneReconciliation(ctx, txns, uploadID, groupCriteria, matchingRules, true) |
| 418 | default: |
| 419 | logrus.WithField("strategy", strategy).Warn("unsupported reconciliation strategy") |
| 420 | return nil, nil |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | // createTransactionProcessor creates a new transaction processor for the reconciliation. |
| 426 | // Parameters: |
no test coverage detected