Skip to content

Improve Status Flags and Add Payment Actions#846

Open
zupzup wants to merge 1 commit intomasterfrom
682-status-falgs
Open

Improve Status Flags and Add Payment Actions#846
zupzup wants to merge 1 commit intomasterfrom
682-status-falgs

Conversation

@zupzup
Copy link
Collaborator

@zupzup zupzup commented Mar 5, 2026

📝 Description

This is an effort to improve the ergonomics of the E-Bill API for the frontend, so API users don't have to calculate on their own, which bill and payment actions there are, or in which state the bill is.

The implementation is mostly non-breaking, because bcr-common and ebill-service also depend on the data models, but unused/deprecated parts of the API will be phased out in a second step, once the new parts are used in the frontend and we know which parts are missing, or which are not used anymore.

  • Adds payment_actions
    • Pay for the payers of pay/sell/recourse
    • CheckPayment for receivers of pay/sell/recourse and for past payments
  • Add bill_state for payment and acceptance state

Relates to #682


✅ Checklist

Please ensure the following tasks are completed before requesting a review:

  • My code adheres to the coding guidelines of this project.
  • I have run cargo fmt.
  • I have run cargo clippy.
  • I have added or updated tests (if applicable).
  • All CI/CD steps were successful.
  • I have updated the documentation (if applicable).
  • I have checked that there are no console errors or warnings.
  • I have verified that the application builds without errors.
  • I've described the changes made to the API. (modification, addition, deletion).

🚀 Changes Made

See above.


💡 How to Test

Please provide clear instructions on how reviewers can test your changes:

  1. cargo test
  2. do payment and accept actions, make sure the actions and flags are correct

🤝 Related Issues

List any related issues, pull requests, or discussions:


📋 Review Guidelines

Please focus on the following while reviewing:

  • Does the code follow the repository's contribution guidelines?
  • Are there any potential bugs or performance issues?
  • Are there any typos or grammatical errors in the code or comments?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves frontend ergonomics by adding explicit bill state and caller-specific payment_actions to bill responses, and by standardizing payment status representation (PastPaymentStatusPaymentStatus) across core/API/WASM/persistence.

Changes:

  • Add BillState (mint/accept/payment) and payment_actions to BitcreditBillResult and propagate through persistence + WASM bindings.
  • Rename PastPaymentStatus to PaymentStatus and include a Requested variant for a unified status model.
  • Update service/WASM API call signatures to pass caller public data + keys instead of only NodeId.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
crates/bcr-ebill-wasm/src/data/bill.rs Exposes new state + payment_actions to TS/WASM and renames payment status web type.
crates/bcr-ebill-wasm/src/api/general.rs Updates calls to pass signer public data + keys into services.
crates/bcr-ebill-wasm/src/api/bill.rs Updates bill endpoints to pass signer public data + keys into bill service calls.
crates/bcr-ebill-persistence/src/tests/mod.rs Adjusts persistence tests to include new state and payment_actions fields.
crates/bcr-ebill-persistence/src/db/bill.rs Adds DB serialization for BillState and new payment-action types/status.
crates/bcr-ebill-core/src/protocol/blockchain/bill/mod.rs Renames PastPaymentStatus to PaymentStatus and adds Requested.
crates/bcr-ebill-core/src/protocol/blockchain/bill/chain.rs Updates chain helpers to return PaymentStatus instead of PastPaymentStatus.
crates/bcr-ebill-core/src/application/bill/mod.rs Adds BillState + payment-action domain types; wires them into BitcreditBillResult.
crates/bcr-ebill-api/src/service/search_service.rs Updates search API to accept caller public data + keys and validate network via caller participant.
crates/bcr-ebill-api/src/service/bill_service/tests.rs Updates tests for new signatures/status types; adds additional chain steps for sell flows.
crates/bcr-ebill-api/src/service/bill_service/test_utils.rs Updates cached bill fixtures to include new state and payment_actions.
crates/bcr-ebill-api/src/service/bill_service/service.rs Changes bill service API signatures to use caller participant + keys; refactors past payments fetching.
crates/bcr-ebill-api/src/service/bill_service/mod.rs Updates BillServiceApi trait signatures accordingly.
crates/bcr-ebill-api/src/service/bill_service/issue.rs Passes drawer public data + keys into recalculation/caching paths.
crates/bcr-ebill-api/src/service/bill_service/data_fetching.rs Computes new BillState and payment_actions; factors out fetch_past_payments.
crates/bcr-ebill-api/src/external/bitcoin.rs Minor refactor from unwrap() to expect() in descriptor generation.
Cargo.toml Bumps workspace version to 0.5.3.
CHANGELOG.md Adds a 0.5.3 entry describing the API/DB changes.

@zupzup zupzup force-pushed the 682-status-falgs branch from 5a44d90 to 2f73266 Compare March 5, 2026 14:17
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 69.21397% with 282 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.36%. Comparing base (548ddda) to head (2f73266).

Files with missing lines Patch % Lines
crates/bcr-ebill-persistence/src/db/bill.rs 26.88% 136 Missing ⚠️
crates/bcr-ebill-wasm/src/data/bill.rs 0.00% 92 Missing ⚠️
...bill-api/src/service/bill_service/data_fetching.rs 93.40% 26 Missing ⚠️
crates/bcr-ebill-wasm/src/api/bill.rs 0.00% 19 Missing ⚠️
crates/bcr-ebill-wasm/src/api/general.rs 0.00% 5 Missing ⚠️
crates/bcr-ebill-api/src/external/bitcoin.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #846      +/-   ##
==========================================
- Coverage   70.48%   70.36%   -0.12%     
==========================================
  Files         132      132              
  Lines       24821    25617     +796     
==========================================
+ Hits        17494    18026     +532     
- Misses       7327     7591     +264     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants