Employers working - onboarding to card print
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
module SampleCard
|
||||
class DataFormatter
|
||||
|
||||
def initialize(process)
|
||||
@process = process
|
||||
def initialize(employer)
|
||||
@employer = employer
|
||||
end
|
||||
|
||||
def call
|
||||
@sample_card = BrittonWeb::SampleIdCard.new()
|
||||
@sample_card = SampleIdCard.new()
|
||||
|
||||
set_process_fields()
|
||||
set_employer_fields()
|
||||
set_generic_fields()
|
||||
set_rx_fields()
|
||||
set_network_fields()
|
||||
sample_cards = set_plan_fields()
|
||||
sample_cards.each(&:save!)
|
||||
@@ -18,13 +19,11 @@ module SampleCard
|
||||
|
||||
private
|
||||
|
||||
def set_process_fields
|
||||
def set_employer_fields
|
||||
selected_attributes = {
|
||||
employer_name: @process.employer_name,
|
||||
group_number: @process.group_number,
|
||||
medical_eff_date: @process.effective_date,
|
||||
network_image: @process.logo_filename,
|
||||
status: "imported"
|
||||
employer_name: @employer.name,
|
||||
group_number: @employer.group_number || "999999",
|
||||
medical_eff_date: @employer.effective_date
|
||||
}
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
@@ -32,7 +31,7 @@ module SampleCard
|
||||
|
||||
def set_plan_fields
|
||||
plans_sample_cards = []
|
||||
@process.plans.each do |plan|
|
||||
@employer.plans.each do |plan|
|
||||
plan_sample_card = @sample_card.dup
|
||||
plan_sample_card.family_id = plan.title
|
||||
plan.plan_benefits.each do |bene|
|
||||
@@ -47,33 +46,34 @@ module SampleCard
|
||||
def set_generic_fields
|
||||
selected_attributes = {
|
||||
full_name: "JANE DOE",
|
||||
primary_mb_member_key: "99999",
|
||||
rx_group: "99999"
|
||||
primary_mb_member_key: "888888",
|
||||
rx_group: @employer.group_number || "999999"
|
||||
}
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_network_fields
|
||||
provider_code = @process.network_provider.includes?("Cigna") ? "5" : "2"
|
||||
# if @process.network_provider.includes?("Cigna")
|
||||
# provider_code = "5"
|
||||
# network_image = "CignaLogo.png"
|
||||
# else
|
||||
# provider_code = "2"
|
||||
# network_image = "Logo_MC_PMS.png"
|
||||
# end
|
||||
provider_information = Vhcs::HLIDCardProvider.find_by(provider_code: provider_code)
|
||||
selected_attributes = provider_information.attributes.slice(
|
||||
selected_attributes = @employer.card_provider.attributes.with_indifferent_access.slice(
|
||||
:provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
|
||||
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11,
|
||||
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
|
||||
:claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
|
||||
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11
|
||||
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12
|
||||
)
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_rx_fields
|
||||
# fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
selected_attributes = @employer.card_rx.attributes.with_indifferent_access.slice(
|
||||
:customer_service,
|
||||
:web_url
|
||||
)
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_dependent_fields
|
||||
# Not needed for sample card
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user