~singpolyma/sgx-jmp

ref: 3b7abebd4df7b8508edd310704b098095c3e17a7 sgx-jmp/lib/db_notification.rb -rw-r--r-- 410 bytes
3b7abebdStephen Paul Weber Allow the DB to notify us to bill a customer 2 years 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