Problem
Refund conditions for cancelled bookings are not codified in the contract layer. Refund calculations happen ad hoc on the backend with no on-chain enforceability.
Proposed Solution
Create contracts/cntr/escrow_refund.rs implementing pub fn calculate_refund_amount(booking_amount_stroops: i128, cancellation_hours_before_start: u64) -> i128. Refund rules: 100% refund if cancelled 48h or more before start, 50% refund if 24–47h before, 0% refund if less than 24h before. Integer arithmetic only — no floating point. All implementation must live inside contracts/cntr/.
Acceptance Criteria
Problem
Refund conditions for cancelled bookings are not codified in the contract layer. Refund calculations happen ad hoc on the backend with no on-chain enforceability.
Proposed Solution
Create
contracts/cntr/escrow_refund.rsimplementingpub fn calculate_refund_amount(booking_amount_stroops: i128, cancellation_hours_before_start: u64) -> i128. Refund rules: 100% refund if cancelled 48h or more before start, 50% refund if 24–47h before, 0% refund if less than 24h before. Integer arithmetic only — no floating point. All implementation must live insidecontracts/cntr/.Acceptance Criteria
contracts/cntr/escrow_refund.rsbooking_amount_stroopsfor cancellations at or beyond 48 hoursbooking_amount_stroops / 2(integer division) for 24–47 hours0for less than 24 hourscargo test