# 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