~singpolyma/sgx-jmp

ref: 8dd92b96258d14d431e9966d0534631c7fdc0214 sgx-jmp/lib/admin_actions/cancel.rb -rw-r--r-- 463 bytes
8dd92b96Stephen Paul Weber Merge branch 'admin-actions' 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class AdminAction
	class CancelCustomer
		def self.call(customer, customer_repo:, **)
			m = Blather::Stanza::Message.new
			m.from = CONFIG[:notify_from]
			m.body = "Your JMP account has been cancelled."
			customer.stanza_to(m).then {
				EMPromise.all([
					customer.stanza_to(Blather::Stanza::Iq::IBR.new(:set).tap(&:remove!)),
					customer.deregister!,
					customer_repo.disconnect_tel(customer)
				])
			}
		end
	end
end