Skip to content

feat(fees): add a combined read view for a service's pricing state - #436

Merged
mikewheeleer merged 2 commits into
Agentpay-Org:mainfrom
Jagadeeshftw:feature/fees-01-view
Jul 29, 2026
Merged

feat(fees): add a combined read view for a service's pricing state#436
mikewheeleer merged 2 commits into
Agentpay-Org:mainfrom
Jagadeeshftw:feature/fees-01-view

Conversation

@Jagadeeshftw

Copy link
Copy Markdown
Contributor

Summary

A service's full pricing configuration is spread across four independent reads: get_service_price, get_price_tiers, get_min_service_price/get_max_service_price, and is_service_disabled. Adds get_service_pricing(service_id) -> ServicePricing, bundling all of it into one round trip — following the same convenience-snapshot pattern already used by get_admin_summary and get_billing_summary.

  • ServicePricing { price_stroops, tiers, min_bound, max_bound, disabled }.
  • Pure read — no require_auth, no pause gate, no storage writes.
  • Field docs cross-reference docs/escrow/pricing.md for the tiers-vs-bounds asymmetry so a caller reading this struct sees the caveat inline, not just in prose docs.

Tests added

  • test_get_service_pricing_defaults_for_never_configured_service
  • test_get_service_pricing_reflects_flat_price
  • test_get_service_pricing_reflects_tier_schedule
  • test_get_service_pricing_reflects_global_bounds
  • test_get_service_pricing_reflects_disabled_flag
  • test_get_service_pricing_matches_individual_getters — cross-checks every field against its dedicated getter for a service configured with all axes at once

Closes #293

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test -p escrow — 358 passed (6 new), 1 pre-existing failure unrelated to this change (test_transfer_service_ownership_genuine_transfer_emits_event, fails identically on main)

env.events().all() reflects only the most recent contract invocation, not
a running total across separate calls (consistent with every other event
test in this file). The test compared post-transfer event count against a
pre-transfer count captured after a *different* call (set_service_metadata),
expecting accumulation that never happens, so it failed on every run
regardless of contract behavior. Fixed to assert directly on this call's
own event count.
@Jagadeeshftw
Jagadeeshftw force-pushed the feature/fees-01-view branch from 7a03b44 to 3df6ba1 Compare July 28, 2026 21:19
@mikewheeleer

Copy link
Copy Markdown
Contributor

clean work @Jagadeeshftw — CI green, merging 🎉

@mikewheeleer
mikewheeleer merged commit e71a8bd into Agentpay-Org:main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a read-only view exposing the current fees state

2 participants