Skip to main content

Reusable Django financing, repayment schedule, statement, and settlement workflow app powered by repaykit.

Project description

django-repaykit

Reusable Django financing, repayment schedule, statement, and settlement workflow app powered by repaykit.

repaykit is the pure Python calculation engine. django-repaykit is the reusable Django app that owns financing accounts, repayments, settlement requests, default UI, admin, permissions, selectors, exports, and service adapters. Host projects own origination workflows, approvals, tenancy, payment gateways, compliance rules, accounting, notifications, and external integrations.

The package is service-first: views, forms, admin actions, APIs, batch imports, payment gateways, and workflows should call services instead of putting business logic in forms or templates.

Installation

pip install django-repaykit

Add the app:

INSTALLED_APPS = [
    # ...
    "django_repaykit",
]

Add URLs:

from django.urls import include, path

urlpatterns = [
    path("financing/", include("django_repaykit.urls")),
]

Run migrations:

python manage.py migrate

Optional demo data:

python manage.py repaykit_seed_demo

Service-First Creation

from datetime import date
from decimal import Decimal

from django_repaykit.services import FinancingAccountService

account = FinancingAccountService().create_financing(
    user=user,
    borrower_name="Ali Bin Abu",
    principal=Decimal("10000.00"),
    annual_rate=Decimal("0.08"),
    term_value=24,
    term_unit="months",
    payment_frequency="monthly",
    repayment_method="flat_rate",
    start_date=date.today(),
    source="ao_workflow",
    external_reference="APP-000123",
)

Recording Repayment From An External System

from datetime import date
from decimal import Decimal

from django_repaykit.services import RepaymentService

RepaymentService().record_repayment(
    account=account,
    amount=Decimal("500.00"),
    paid_at=date.today(),
    source="billplz",
    external_reference="BILL-123",
    status="confirmed",
)

Gateway signature verification, idempotency policy, and webhook security belong in the host project. Once verified, call RepaymentService.

Generating Statement

from datetime import date

from django_repaykit.services import StatementService

statement = StatementService().get_statement(account, as_of=date.today())

Only confirmed repayments affect statements. Pending, failed, reversed, and cancelled repayments remain visible as repayment records but are ignored by repaykit ledger calculations.

Settlement Quote

from datetime import date

from django_repaykit.services import SettlementService

quote = SettlementService().quote_full_settlement(account=account, as_of=date.today())

Settlement payments are recorded with RepaymentService(source="settlement"); the package does not implement payment gateway settlement collection.

Template Override

DJANGO_REPAYKIT = {
    "BASE_TEMPLATE": "base.html",
}

You can also override any package template by placing a matching file under templates/django_repaykit/ in the host project.

Permission Override

DJANGO_REPAYKIT = {
    "PERMISSION_CLASS": "myapp.permissions.MyPermission",
}

The default policy is secure:

  • staff can manage all accounts
  • account owners can view their schedule and statement
  • account owners can request settlement
  • repayment recording is staff-only
  • anonymous users are denied

Service Override

DJANGO_REPAYKIT = {
    "REPAYMENT_SERVICE_CLASS": "myapp.services.MyRepaymentService",
}

Supported service settings:

  • FINANCING_ACCOUNT_SERVICE_CLASS
  • REPAYMENT_SERVICE_CLASS
  • STATEMENT_SERVICE_CLASS
  • SETTLEMENT_SERVICE_CLASS

Default Settings

DJANGO_REPAYKIT = {
    "BASE_TEMPLATE": "django_repaykit/base.html",
    "LOGIN_REQUIRED": True,
    "DEFAULT_CURRENCY": "MYR",
    "DEFAULT_REPAYMENT_METHOD": "flat_rate",
    "DEFAULT_PAYMENT_FREQUENCY": "monthly",
    "PERMISSION_CLASS": "django_repaykit.permissions.DefaultRepayKitPermission",
    "FINANCING_ACCOUNT_SERVICE_CLASS": "django_repaykit.services.FinancingAccountService",
    "REPAYMENT_SERVICE_CLASS": "django_repaykit.services.RepaymentService",
    "STATEMENT_SERVICE_CLASS": "django_repaykit.services.StatementService",
    "SETTLEMENT_SERVICE_CLASS": "django_repaykit.services.SettlementService",
    "ENABLE_SETTLEMENT_REQUESTS": True,
    "ENABLE_REPAYMENT_RECORDING": True,
}

Security Notes

Public URLs use UUIDs and never expose integer primary keys. UUID URLs are not authorization: views still enforce permissions through selectors and the permission class. Host projects must validate business rules, compliance rules, product policies, and payment gateway signatures.

Disclaimer

django-repaykit is a software integration package for repayment and financing calculations. It does not provide legal, accounting, Shariah, lending, tax, regulatory, or financial advice. Users are responsible for validating all policies and calculations for their own products, jurisdictions, and compliance requirements.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_repaykit-0.1.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_repaykit-0.1.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file django_repaykit-0.1.0.tar.gz.

File metadata

  • Download URL: django_repaykit-0.1.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_repaykit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64b5b872552278fc60a6410aa58ccb9d2a98ac189d92186472252a9b1dbab2a7
MD5 dbbaaea10ee129d671d019a3f4f6eb0c
BLAKE2b-256 7036d949b5064669aa5c348705399d39d5c2817f052e96e6a582476b171a65c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_repaykit-0.1.0.tar.gz:

Publisher: publish.yml on finsure-techlab/django-repaykit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_repaykit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_repaykit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_repaykit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1244429462d3b9baa7ece55a44b848005c73f9c0905806dc3d165e733a84468f
MD5 1b0dc851cb79574f8f54329e9ff03783
BLAKE2b-256 f9cbf1b6291699d6d063b4540dc611e96a9e2266a7aa6dcb07172329dee88b94

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_repaykit-0.1.0-py3-none-any.whl:

Publisher: publish.yml on finsure-techlab/django-repaykit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page