~singpolyma/jmp-pay

a56128b7fa5ae6cd587019dd291f02e95cb4811d — Stephen Paul Weber 29 days ago 68ed9c3
Only try to bill if expired for under a month
1 files changed, 3 insertions(+), 1 deletions(-)

M bin/billing_monthly_cronjob
M bin/billing_monthly_cronjob => bin/billing_monthly_cronjob +3 -1
@@ 86,7 86,9 @@ EM::Iterator.new(db.exec(
	<<-SQL
	SELECT customer_id
	FROM customer_plans
	WHERE expires_at <= LOCALTIMESTAMP + '4 days'
	WHERE
		expires_at <= LOCALTIMESTAMP + '4 days' AND
		expires_at > LOCALTIMESTAMP - INTERVAL '1 month'
	SQL
), 3).each(nil, -> { one << :done }) do |row, iter|
	customer = ExpiringCustomer.new(row["customer_id"])