Forge pricing module — depends on application-catalog for basket/order types. Sprint 60.
| Tier | application |
| Role | unclassified (baselined) |
| Path | crates/application/pricing |
| Edition | 2024 |
| Targets | application_pricing |
| Public items | 15 across 2 modules |
| Tests | 0 |
What it is for
application-pricing — Layer 3 module. Sprint 60. Depends on application-catalog.
B-009 Gate-0.5 investigation: this crate wraps no schema-owning library crate. Its Cargo.toml depends only on application-catalog (already wired for B-009, see application-catalog's own migrations()); there is no domain-pricing dependency at all. crates/domain/pricing (the crate literally named domain-pricing) ships no migrations/ directory — it is pure-compute Tier/TieredPrice/PriceBreak/ Discount/PricingCalculator logic with no sqlx/PgPool usage anywhere in its source, unrelated to this module's one DB table.
The one table services::pricing actually reads/writes (customer_role_tier_discounts, per that module's own doc comment) was authored directly in application-engine's central platform set (crates/application/engine/migrations/059_tier_discounts.sql) for Sprint 25.tier — it was never extracted into a standalone library crate crate with its own migrations/ directory, so there is nothing this module can vendor via include_str!. migrations() staying empty is correct, not an oversight; a host mounting application-pricing standalone (outside application-engine) must supply customer_role_tier_discounts itself.
Capabilities
PricingModule
application-pricing — Layer 3 module. Sprint 60. Depends on application-catalog.
| Item |
|---|
pub struct PricingModule |
PricingModule :: fn new() -> Self |
PricingModule :: fn name(& self) -> & 'static str |
PricingModule :: fn version(& self) -> & 'static str |
PricingModule :: fn migrations(& self) -> Vec <MigrationSet> |
PricingModule :: async fn migrate_pending(& self, _pool : & PgPool) -> Result <u32, MigrationError> |
services::pricing (other)
Pricing service.
| Item |
|---|
async fn set_role_discount(pool : & PgPool, role_slug : & str, discount_rate : Decimal,) -> Result <(), CatalogError> |
async fn get_role_discount(pool : & PgPool, role_slug : & str,) -> Result <Option <Decimal>, CatalogError> |
async fn list_role_discounts(pool : & PgPool) -> Result <Vec <(String, Decimal)>, CatalogError> |
async fn best_discount_for_party(pool : & PgPool, party_id : Uuid,) -> Result <Decimal, CatalogError> |
async fn checkout_for_party(pool : & PgPool, basket_id : Uuid, party_id : Uuid, quoted_total : Decimal,) -> Result <Order, CatalogError> |
PriceQuote
Pricing service.
| Item |
|---|
pub struct PriceQuote |
fn quote_basket(items : & BasketItem, currency : & str) -> Result <PriceQuote, CatalogError> |
async fn quote_for_party(pool : & PgPool, basket_id : Uuid, party_id : Uuid,) -> Result <PriceQuote, CatalogError> |
QuoteLine
Pricing service.
| Item |
|---|
pub struct QuoteLine |
How to use it
No examples/ target, no doctest, and no test. No executable usage of this crate exists in the repository to project.
Module structure
application_pricing
servicesservices::pricing
flowchart TD n_application_pricing["application_pricing"] n_application_pricing --> n_services["services"] n_services --> n_services__pricing["pricing"]
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct PricingModule | — |
PricingModule :: fn new() -> Self | — |
PricingModule :: fn name(& self) -> & 'static str | — |
PricingModule :: fn version(& self) -> & 'static str | — |
PricingModule :: fn migrations(& self) -> Vec <MigrationSet> | — |
PricingModule :: async fn migrate_pending(& self, _pool : & PgPool) -> Result <u32, MigrationError> | — |
`services::pricing`
| Item | What it is |
|---|---|
pub struct PriceQuote | Quote returned to the customer at /quote time |
pub struct QuoteLine | — |
fn quote_basket(items : & BasketItem, currency : & str) -> Result <PriceQuote, CatalogError> | Pure compute |
async fn set_role_discount(pool : & PgPool, role_slug : & str, discount_rate : Decimal,) -> Result <(), CatalogError> | Set (or replace) the discount rate for a customer-role slug |
async fn get_role_discount(pool : & PgPool, role_slug : & str,) -> Result <Option <Decimal>, CatalogError> | — |
async fn list_role_discounts(pool : & PgPool) -> Result <Vec <(String, Decimal)>, CatalogError> | — |
async fn best_discount_for_party(pool : & PgPool, party_id : Uuid,) -> Result <Decimal, CatalogError> | Resolve the best discount rate for the party |
async fn quote_for_party(pool : & PgPool, basket_id : Uuid, party_id : Uuid,) -> Result <PriceQuote, CatalogError> | Quote a basket for a specific party — DB-touching orchestrator that resolves the customer's best applicable discount, then applies it on top of the pure quote_basket subtotal |
async fn checkout_for_party(pool : & PgPool, basket_id : Uuid, party_id : Uuid, quoted_total : Decimal,) -> Result <Order, CatalogError> | Checkout a basket for a party, freezing the discount onto the order at placement time (D-US-25.tier.3) |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier application with 120 other crates: application-agreements, application-ai, application-analytics, application-approvals, application-assessments, application-audit-log, application-auth, application-billing, … (120 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | application |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/application/pricing |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `application-catalog` | application | no | always |
| `application-core` | application | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
axum | ^0.7 | multipart | no | always |
chrono | ^0.4 | serde | no | always |
rust_decimal | ^1 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
thiserror | ^2 | — | no | always |
tracing | ^0.1 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development. None.
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["application-pricing"] SELF -->|runtime| n_application_catalog["application-catalog"] SELF -->|runtime| n_application_core["application-core"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | application_pricing | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | none detected |
| database access | yes |
| network I/O | yes |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
CARGO_PKG_VERSION | src/lib.rs |
Related capabilities
No workspace crate depends on this one.
Verification
No test, example or doctest was found in this crate. Nothing here is proven by the crate itself.
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 6 | 15 |
Public modules with a //! block | 1 | 2 |
pie showData
title Public items with rustdoc
"Documented" : 6
"No rustdoc detected" : 9
Metrics
| Metric | Value |
|---|---|
| Rust source files | 3 |
| Source lines | 243 |
| Code lines | 162 |
| Public API items | 15 |
| Public modules | 2 |
| Tests | 0 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 12 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"function" : 7
"method" : 5
"struct" : 3
pie showData
title Rust source composition
"Code" : 162
"Blank or comment" : 81
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.