feat: implement the reject and refund features#22
feat: implement the reject and refund features#22Bosun-Josh121 merged 1 commit intoLightForgeHub:mainfrom
Conversation
📝 WalkthroughWalkthroughThis PR implements an expert-initiated session rejection feature, allowing experts to decline pending bookings and refund the user's deposit instantly. It adds the reject_session logic, corresponding event emission, type definitions, comprehensive tests, and updates the BookingStatus enum with a new Rejected variant. Changes
Sequence DiagramsequenceDiagram
participant Expert
participant Contract as Payment Vault<br/>Contract
participant Storage as Booking<br/>Storage
participant User
Expert->>Contract: reject_session(booking_id)
Contract->>Contract: expert.require_auth()
Contract->>Storage: Load booking
Storage-->>Contract: booking data
Contract->>Contract: Verify caller == booking.expert
Contract->>Contract: Check booking.status == Pending
Contract->>User: Transfer total_deposit
User-->>Contract: Refund received
Contract->>Storage: Update status to Rejected
Storage-->>Contract: Status updated
Contract->>Contract: Emit session_rejected event
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@Bosun-Josh121 Please review PR |
SkillSphere Pull Request
cargo test(All tests passed)Tests added passed. General tests passed as well
Added 6 comprehensive test cases covering:
Successful rejection with refund
Authorization enforcement (user/wrong expert)
Status validation (Complete/Reclaimed sessions)
Error handling (non-existent bookings)
Images:
📌 Type of Change
📝 Changes Description
Better description of tasks
Added
reject_sessionfunctionality allowing experts to instantly decline pending consultation bookings with automatic full refunds to users.📸 Evidence
Closes #16
Thank you for contributing to SkillSphere! 🌍
We are glad you have chosen to help us democratize access to knowledge on the Stellar network. Your contribution brings us one step closer to a trustless, peer-to-peer consulting economy. Let's build the future together! 🚀
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.