~singpolyma/sgx-jmp

ref: 8fd61ce689c290b5bd47253f1e0b9b6d67cc6eba sgx-jmp/lib/db_notification.rb -rw-r--r-- 410 bytes
8fd61ce6Stephen Paul Weber Merge branch 'monthly-billing' 1 year, 1 day ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require_relative "dummy_command"

module DbNotification
	def self.for(notify, customer)
		case notify[:relname]
		when "low_balance"
			LowBalance.for(customer).then { |lb| lb.method(:notify!) }
		when "possible_renewal"
			Command.execution = DummyCommand.new(customer)
			BillPlanCommand.for(customer)
		else
			raise "Unknown notification: #{notify[:relname]}"
		end
	end
end