acupedia-api/README.md

3.9 KiB

Acupedia API - Backend Services

FastAPI Backend Platform for Acupedia Learning Content, Subscriptions, Pricing, and Payments.

Tests Coverage

Metric Status
Test Suite PASSED
Tests Passing 93
Tests Failing 0
Core Coverage 100%
Last Updated 2026-10-19 06:13:19 UTC

Features & Services

  • Authentication & Security: JWT tokens, bcrypt password hashing, password strength validation, OTP flow.
  • Cart & Pricing Engine: Dynamic currency resolution (INR / USD), multi-unit volume discounts, returning user loyalty discounts, coupon redemption rules, and convenience fee calculations.
  • Content & Curriculum: Acupoints, channels, topics, clinical modules with preview capabilities.
  • Checkout & Payments: Razorpay orders, automatic invoice creation, payment status verification.
  • Webhooks: Cryptographically validated Razorpay webhook listener for real-time payment captures and failures.
  • Administrative Portal: Role-Based Access Control (super_admin, admin, finance_admin), refund processing, catalog status toggles.
  • Search System: Faceted multi-scope search with typeahead and category filtering.

Test Suite & Automation

The test suite is powered by pytest with asynchronous testing via httpx.AsyncClient and mocked dependencies for rapid execution (under 4 seconds) without external live service dependencies.

Running Tests

# Run all tests
.venv/bin/pytest

# Run tests with verbose output
.venv/bin/pytest -v

# Run tests with code coverage report
.venv/bin/pytest --cov=app --cov-report=term-missing

Note: Running pytest automatically updates the test status table and badges above in this README.md.


Appendix: Legacy Seed Plans Reference
{
    "version": 1,
    "plans": [
    {
      "code": "POINTS_ACU",
      "name": "Acu Points Module (1 Yr)",
      "plan_type": "one_time",
      "billing_period": "yearly",
      "module_fee": "300.00",
      "currency_code": "INR",
      "country": "India",
      "is_active": true,
      "sort_order": 10,
      "modules": [
        { "module_code": "M0001" }
      ]
    },
    {
      "code": "POINTS_SCALP",
      "name": "Scalp Points Module (1 Yr)",
      "plan_type": "one_time",
      "billing_period": "yearly",
      "module_fee": "100.00",
      "currency_code": "INR",
      "country": "India",
      "is_active": true,
      "sort_order": 20,
      "modules": [
        { "module_code": "M0003" }
      ]
    },
    {
      "code": "POINTS_EAR",
      "name": "Ear Points Module (1 Yr)",
      "plan_type": "one_time",
      "billing_period": "yearly",
      "module_fee": "200.00",
      "currency_code": "INR",
      "country": "India",
      "is_active": true,
      "sort_order": 30,
      "modules": [
        { "module_code": "M0002" }
      ]
    },
    {
      "code": "POINTS_TUNG",
      "name": "Tung Points Module (1 Yr)",
      "plan_type": "one_time",
      "billing_period": "yearly",
      "module_fee": "300.00",
      "currency_code": "INR",
      "country": "India",
      "is_active": false,
      "sort_order": 40,
      "modules": [
        { "module_code": "M0004" }
      ]
    },
    {
      "code": "LIFETIME_ALL_USD",
      "name": "Lifetime All-Access Plan (USD)",
      "plan_type": "bundle",
      "billing_period": "lifetime",
      "module_fee": "350.00",
      "currency_code": "USD",
      "country": "USA",
      "is_active": true,
      "sort_order": 310,
      "modules": [
        { "module_code": "M0001" },
        { "module_code": "M0002" },
        { "module_code": "M0003" }
      ]
    }
  ]
}