Problem
The payment validation logic in the manage_hub contract accepts any payment amount. There is no check against the expected subscription price, allowing underpayment to silently succeed.
Proposed Solution
Create contracts/cntr/payment_validator.rs implementing pub fn validate_payment_amount(received_stroops: i128, expected_stroops: i128, tolerance_stroops: i128) -> Result<(), &'static str>. The payment is valid when received_stroops >= expected_stroops - tolerance_stroops. Also validates that expected_stroops > 0. All implementation must live inside contracts/cntr/.
Acceptance Criteria
Problem
The payment validation logic in the manage_hub contract accepts any payment amount. There is no check against the expected subscription price, allowing underpayment to silently succeed.
Proposed Solution
Create
contracts/cntr/payment_validator.rsimplementingpub fn validate_payment_amount(received_stroops: i128, expected_stroops: i128, tolerance_stroops: i128) -> Result<(), &'static str>. The payment is valid whenreceived_stroops >= expected_stroops - tolerance_stroops. Also validates thatexpected_stroops > 0. All implementation must live insidecontracts/cntr/.Acceptance Criteria
contracts/cntr/payment_validator.rsOk(())when received is within tolerance of expectedErr("Payment amount insufficient")when received is below the tolerance thresholdErr("Expected amount must be positive")whenexpected_stroops <= 0cargo test