//	Calculate the amount to be refunded if the the user wishes to leave early  
Calculate the amount to be refunded if the the user wishes to leave early
Calculate the amount to be refunded if the the user wishes to leave early
pub(super) fn calculate_ratio_start_end(
        start: T::BlockNumber,
        next_payment: T::BlockNumber,
        now: T::BlockNumber,
        curr_balance: BalanceOf<T>,
    ) -> Result<BalanceOf<T>, DispatchError> { 
        ensure!(next_payment != now, Error::<T>::MinCannotBeZero);
        //	Calculate the percent from start/ end 
        //	let ratio = Permill::from_rational(subscription_info.next_payment, subscription_info.start); 
        let elapsed_blocknumber = next_payment - start;
        let elapsed_time_u32: u32 = TryInto::try_into(elapsed_blocknumber).ok().expect("Failed To Convert");
        let remaining_ratio: u32 = 1u32 - elapsed_time_u32;
        Ok(curr_balance * remaining_ratio.into())
    }
pub ( super ) fn calculate_ratio_start_end ( start : T :: BlockNumber , next_payment : T :: BlockNumber , now : T :: BlockNumber , curr_balance : BalanceOf < T > , ) -> Result < BalanceOf < T > , DispatchError > { ensure ! ( next_payment now Error T MinCannotBeZero ) ; //	Calculate the percent from start/ end  //	let ratio = Permill::from_rational(subscription_info.next_payment, subscription_info.start);  let elapsed_blocknumber = next_payment - start ; let elapsed_time_u32 : u32 = TryInto :: try_into ( elapsed_blocknumber ) . ok ( ) . expect ( " " ) ; let remaining_ratio : u32 = 1u32 - elapsed_time_u32 ; Ok ( curr_balance * remaining_ratio . into ( ) ) }
Calculate the amount to be refunded if the the user wishes to leave early
Calculate the amount to be refunded if the the user wishes to leave early
start
T::BlockNumber
next_payment
T::BlockNumber
now
T::BlockNumber
curr_balance
BalanceOf<T>