Registry Mirror
Skip to content

Repository files navigation

Python + C# order-pricing app (one project, two languages)

OrderKit (C# / .NET 8) is the order domain and client. It calls the pricing-service (Python 3.12) over HTTP to get the tier/volume/promo discount and the channel/region tax of an order. The two languages are one working app, built and tested from the repository root.

Architecture

 C# OrderKit (csharp/)                              Python pricing-service (python/)
 ┌───────────────────────────┐   POST /quote (JSON)  ┌────────────────────────────────┐
 │ Order, OrderLine, ...     │ ────────────────────▶ │ pricing_service.server         │
 │ PythonPricingClient       │ ◀──────────────────── │  -> PricingRules + TaxTable    │
 │ (Services/OrderKit.Pricing)│   quote JSON          │    (packages/domain/orderlab)  │
 └───────────────────────────┘   GET /health          └────────────────────────────────┘
                  contract: contracts/pricing-quote.schema.json
  • Who calls whom: C# → Python, over HTTP. PythonPricingClient.QuoteAsync(order, channel, region, promo) (csharp/src/Services/OrderKit.Pricing/PythonPricingClient.cs) sends tier, units, channel, region and subtotal; the Python service (python/services/pricing_service/src/pricing_service/server.py) answers with discount rate, net, tax and total. OrderKit tier platinum maps to Python gold.
  • Contract: contracts/pricing-quote.schema.json (request and response fields). Both test suites check it.
  • Start the service by hand: make serve-pricing (port 8081) or python python/serve_pricing.py [port].

Build and test

make build   # python venv + pinned deps + editable install, then dotnet restore/build of OrderKit.sln
make test    # pytest (python/), then dotnet test (csharp/)

make test includes the cross-language tests:

Test What it exercises
csharp/tests/OrderKit.Tests/PythonPricingIntegrationTests.cs Spawns the real Python service as a subprocess and calls it through PythonPricingClient (gold/platinum tier, promo stacking, 422 error path)
python/tests/test_pricing_http_integration.py Runs the real HTTP server and checks the response against the shared contract, plus 400/422 error paths

The C# integration tests find Python through the PYTHON variable (the Makefile points it at the venv); REQUIRE_PYTHON=1 makes them fail instead of skip when Python is missing.

Requirements: Python 3.12, .NET SDK 8 (csharp/global.json), GNU make.

Layout

.
├── Makefile, README.md, dataset.json, contracts/
├── .github/workflows/ci.yml        one workflow: builds and tests both languages, then runs the tool audits
├── python/    pyproject.toml, packages/, services/, tests/, infra/, Tool-Triggering-Synthetic-Data/
└── csharp/    OrderKit.sln, src/, tests/, infra/, Tool-Triggering-Synthetic-Data/

Each language keeps its own folder and its own planted tool triggers and version pins (Python 3.12 pins in python/, .NET 8 / planted NuGet CVEs in csharp/).

Datasets

dataset.json at the root is the one dataset for the repository: it covers both languages and the integration. python/dataset.json and csharp/dataset.json are sub-datasets (per-language tool maps) that the language tool runners read; they are not separate projects.

Notes

  • The Tool-Triggering-Synthetic-Data folder name has no spaces or parentheses; audit scripts and ToolRunner reference it by this exact name.
  • The C# tool runner is not vendored: CI checks it out separately and runs it with REPO_ROOT=csharp.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages