Interest rules and base rate rows — endpoints and rules

Saving and deleting an interest rule, handling the default flag, and saving base rate rows through the master model.

Four endpoints sit under the rule function right: saverule, ruledelete, savebaserate, deletebaserate. Base rate rows are written by the masterdata/baserate master model, not by the settlement model.

Rules

  1. Saving an interest rule: the name is required (error_rule_name); with is_default the default flag of every other rule is cleared.
  2. Deletion only if no invoice refers to it (invoice.interest_rule_id); otherwise error_rule_used with the count.
  3. Saving a base rate row: date, rate > 0 (error_base_rate), three-letter currency (error_base_rate_currency); deletion through the master model.

Data model

Table names carry the installation's own prefix in the database.

TableRoleRelation
interest_ruleinterest rule (name, source, manual rate, margin, recovery fee, default)invoice.interest_rule_id
base_ratecentral bank base rate row (valid from, rate, currency)masterdata/baserate model

Permissions

  • Layer 1: core modify.
  • Layer 2: rule (legacy permission table only, interest_v1.sql).
  • Content scope: these endpoints check no content scope.
Related topics: default interest permissions