application capa

application-pricing

Forge pricing module — depends on application-catalog for basket/order types. Sprint 60.

Forge pricing module — depends on application-catalog for basket/order types. Sprint 60.

Tierapplication
Roleunclassified (baselined)
Pathcrates/application/pricing
Edition2024
Targetsapplication_pricing
Public items15 across 2 modules
Tests0

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

flowchart TD
  n_application_pricing["application_pricing"]
  n_application_pricing --> n_services["services"]
  n_services --> n_services__pricing["pricing"]

Public surface

`crate root`

ItemWhat 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`

ItemWhat it is
pub struct PriceQuoteQuote 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)
Locationcrates/application/pricing
Vocabulary in force (lexicon)current

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`application-catalog`applicationnoalways
`application-core`applicationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
async-trait^0.1noalways
axum^0.7multipartnoalways
chrono^0.4serdenoalways
rust_decimal^1serdenoalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
thiserror^2noalways
tracing^0.1noalways
uuid^1v4, v7, serde, jsnoalways

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

KindNameSource
libapplication_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

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessyes
network I/Oyes
unsafe codenone detected
environment variablesyes

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

VariableRead in
CARGO_PKG_VERSIONsrc/lib.rs

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

MeasureDocumentedTotal
Public items with rustdoc615
Public modules with a //! block12
pie showData
    title Public items with rustdoc
    "Documented" : 6
    "No rustdoc detected" : 9

Metrics

MetricValue
Rust source files3
Source lines243
Code lines162
Public API items15
Public modules2
Tests0
Examples0
Cargo features0
Direct runtime dependencies12
Workspace reverse dependencies0
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.

Todas las application · Manual