feat: added reactivate_policy plus a get_deactivated_policies paginat…#1059
Open
DTech-Wiz1 wants to merge 1 commit into
Open
feat: added reactivate_policy plus a get_deactivated_policies paginat…#1059DTech-Wiz1 wants to merge 1 commit into
DTech-Wiz1 wants to merge 1 commit into
Conversation
…ed query for the one-way deactivation gap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Completes the insurance policy lifecycle by introducing policy reactivation support and visibility into deactivated policies.
Previously,
deactivate_policyremoved a policy fromActivePoliciesand marked it inactive, but the underlying policy record remained stored indefinitely with no way to reactivate it or enumerate inactive policies. This created a one-way state transition that forced integrators to create entirely new policies to recover from suspensions or administrative mistakes, resulting in lost continuity and reduced auditability.This change introduces:
reactivate_policy(env, caller, policy_id)to restore an inactive policy.get_deactivated_policies(env, owner, cursor, limit)for paginated retrieval of inactive policies owned by a specific user.PolicyReactivatedEventfor lifecycle observability.Additional behavior:
active = true, refreshesnext_payment_date, and safely re-adds the policy toActivePolicies.MAX_POLICIESusingMaxPoliciesReached.EVENTS.mdwithPolicyReactivatedEventdocumentation.Closes #822
Type of Change
How Has This Been Tested?
cargo test --workspacepassescargo fmt --all -- --checkpassescargo clippy --workspace --all-targets --all-features -- -D warningspassescargo llvm-cov --package <crate> --fail-under-lines 95)cargo test -p credence_bond fuzz::test_bond_fuzz -- --nocapture)cargo test -p credence_errors error_codes_wire)cargo build --release)