lib/subscription.rb
# extends the paid_through period according to how much money was received.
# when possible, avoids the days-per-month problem by checking if the money
# received is a multiple of the plan's rate.
#
# really, i expect the case where the received payment does not match the
# subscription plan's rate to be very much an edge case.
extends the paid_through period according to how much money was received.
when possible, avoids the days-per-month problem by checking if the money
received is a multiple of the plan's rate.

really, i expect the case where the received payment does not match the
subscription plan's rate to be very much an edge case.
extends the paid_through period according to how much money was received . when possible avoids the days - per - month problem by checking if the money received is a multiple of the plan ' s rate . really i expect the case where the received payment does not match the subscription plan ' s rate to be very much an edge case .
def receive_payment(value)
    self.paid_through = if value.cents % subscription_plan.rate.cents == 0
      months_per_multiple = subscription_plan.yearly? ? 12 : 1
      self.paid_through >> months_per_multiple * value.cents / subscription_plan.rate.cents
    else
      self.paid_through + (value.cents / subscription_plan.daily_rate.cents)
    end
    self.expire_on = nil
    Freemium.activity_log[self] << "now paid through #{self.paid_through}" if Freemium.log?
    send_invoice(value)
  end
def receive_payment ( value ) self . paid_through = if value . cents % subscription_plan . rate . cents == 0 months_per_multiple = subscription_plan . yearly? ? 12 : 1 self . paid_through >> months_per_multiple * value . cents / subscription_plan . rate . cents else self . paid_through + ( value . cents / subscription_plan . daily_rate . cents ) end self . expire_on = nil Freemium . activity_log [ self ] << "now paid through #{self.paid_through}" if Freemium . log? send_invoice ( value ) end
extends the paid_through period according to how much money was received.
extends the paid_through period according to how much money was received .
# edge case # if they've paid again, then reset expiration
value
<not_specific>