Implement subscription credit system and account balance
Description
Context: Subscribers may have account credits from refunds, promotions, or overpayments that should apply to future charges.
Current Limitation: No credit balance system exists.
Expected Outcome: Implement credit system with balance tracking and automatic application.
Acceptance Criteria
Technical Scope
Files Likely Affected:
contracts/credit/src/lib.rs - New credit module
app/stores/creditStore.ts - Credit state
app/screens/CreditBalanceScreen.tsx
APIs/Contracts Involved:
issue_credit(subscriber: Address, amount: i128, reason: String)
apply_credit(subscription_id: SubscriptionId) -> CreditApplied
get_credit_balance(subscriber: Address) -> i128
Edge Cases to Consider:
- Credit expiration
- Negative balance
Implement subscription credit system and account balance
Description
Context: Subscribers may have account credits from refunds, promotions, or overpayments that should apply to future charges.
Current Limitation: No credit balance system exists.
Expected Outcome: Implement credit system with balance tracking and automatic application.
Acceptance Criteria
Technical Scope
Files Likely Affected:
contracts/credit/src/lib.rs- New credit moduleapp/stores/creditStore.ts- Credit stateapp/screens/CreditBalanceScreen.tsxAPIs/Contracts Involved:
issue_credit(subscriber: Address, amount: i128, reason: String)apply_credit(subscription_id: SubscriptionId) -> CreditAppliedget_credit_balance(subscriber: Address) -> i128Edge Cases to Consider: