Current section
Files
Jump to
Current section
Files
lib/nombaone/tenant_settings.ex
defmodule Nombaone.TenantSettings.PlatformFee do
@moduledoc "Platform fee configuration. `min_in_kobo`/`max_in_kobo` are integer kobo."
use Nombaone.Model, fields: [:bps, :min_in_kobo, :max_in_kobo]
end
defmodule Nombaone.TenantSettings.Grace do
@moduledoc "Grace defaults: `grace_period_hours`, `dunning_max_attempts`."
use Nombaone.Model, fields: [:grace_period_hours, :dunning_max_attempts]
end
defmodule Nombaone.TenantSettings.Branding do
@moduledoc "Tenant branding: `display_name`, `support_email`, `logo_url`, `primary_color_hex`."
use Nombaone.Model, fields: [:display_name, :support_email, :logo_url, :primary_color_hex]
end
defmodule Nombaone.TenantSettings.Billing do
@moduledoc """
Org billing configuration: limits, settlement mode, platform fee, grace, and
branding. `settlement_mode` is `split_at_collection` or `collect_then_payout`.
"""
use Nombaone.Model,
fields: [
:rate_limit_per_minute,
:monthly_request_quota,
:settlement_mode,
{:platform_fee, Nombaone.TenantSettings.PlatformFee},
{:grace, Nombaone.TenantSettings.Grace},
{:branding, Nombaone.TenantSettings.Branding}
]
end
defmodule Nombaone.TenantSettings.Webhook do
@moduledoc "Org webhook config: `url`, `signing_secret_prefix`, `configured`."
use Nombaone.Model, fields: [:url, :signing_secret_prefix, :configured]
end
defmodule Nombaone.TenantSettings.NombaAccount do
@moduledoc "The linked Nomba account: `account_ref`, `status`."
use Nombaone.Model, fields: [:account_ref, :status]
end
defmodule Nombaone.TenantSettings do
@moduledoc """
Org-level configuration: limits, settlement mode, branding, and webhook +
Nomba-account status. Nested config is fully modeled — `billing` is a
`Nombaone.TenantSettings.Billing`, `webhook` a `Nombaone.TenantSettings.Webhook`,
`nomba_account` a `Nombaone.TenantSettings.NombaAccount`.
"""
use Nombaone.Model,
fields: [
:domain,
{:billing, Nombaone.TenantSettings.Billing},
{:webhook, Nombaone.TenantSettings.Webhook},
{:nomba_account, Nombaone.TenantSettings.NombaAccount}
]
end