Files
baclight/app/services/automation_service/member_update.rb
T
Jason Jordan 5a90ea6e14 beta build
2026-06-17 23:23:36 -04:00

22 lines
674 B
Ruby

module AutomationService
class MemberUpdate
def initialize(pl_plan_key, pb_entity_key)
@pl_plan_key = pl_plan_key
@pb_entity_key = pb_entity_key
end
def call
employer = Employer.includes(:id_card_setup).find_by(pl_plan_key: @pl_plan_key)
card_setup = employer.id_card_setup
member = UpdateMemberJob.perform_now(@pb_entity_key, employer.id, card_setup.has_divisions, card_setup.has_dental)
if member.present?
member.save
else
Member.find_by(pb_entity_key: @pb_entity_key).destroy
end
end
end
end