revamp aggregate and use typestruct
All checks were successful
Build and Publish / build-release (push) Successful in 1m41s
All checks were successful
Build and Publish / build-release (push) Successful in 1m41s
This commit is contained in:
@@ -155,9 +155,8 @@ defmodule PolicyServiceWeb.PolicyController do
|
||||
"car" ->
|
||||
%CarPolicy.AcceptQuoteAndSolicit{
|
||||
id: PolicyId.new(org_id, policy.policy_type, application_id),
|
||||
quote_id: params["quote_id"],
|
||||
plan_id: params["plan_id"],
|
||||
solicitation_fields: params["solicitation_fields"] || %{}
|
||||
accepted_by: params["accepted_by"] || "system",
|
||||
accepted_plan_id: params["accepted_plan_id"]
|
||||
}
|
||||
end
|
||||
|
||||
@@ -166,9 +165,6 @@ defmodule PolicyServiceWeb.PolicyController do
|
||||
{:ok, updated} = PolicyQueries.get_by_application_id(org_id, application_id)
|
||||
conn |> put_status(:ok) |> json(%{data: policy_detail(updated)})
|
||||
|
||||
{:error, :quote_not_found} ->
|
||||
conn |> put_status(:not_found) |> json(%{error: "quote not found"})
|
||||
|
||||
{:error, :plan_not_found} ->
|
||||
conn |> put_status(:not_found) |> json(%{error: "plan not found"})
|
||||
|
||||
@@ -192,7 +188,7 @@ defmodule PolicyServiceWeb.PolicyController do
|
||||
status: p.status,
|
||||
applicant_info: p.applicant_info,
|
||||
policy_details: p.policy_details,
|
||||
policy_number: p.policy_number,
|
||||
provider_policy_number: p.provider_policy_number,
|
||||
submitted_at: p.submitted_at
|
||||
}
|
||||
end
|
||||
@@ -208,13 +204,9 @@ defmodule PolicyServiceWeb.PolicyController do
|
||||
policy_details: p.policy_details,
|
||||
selected_providers: p.selected_providers,
|
||||
quotes: p.quotes,
|
||||
accepted_quote_id: p.accepted_quote_id,
|
||||
accepted_plan_id: p.accepted_plan_id,
|
||||
accepted_provider_id: p.accepted_provider_id,
|
||||
accepted_at: p.accepted_at,
|
||||
solicitation_id: p.solicitation_id,
|
||||
solicitation_s3_key: p.solicitation_s3_key,
|
||||
policy_number: p.policy_number,
|
||||
accepted_by: p.accepted_by,
|
||||
provider_policy_number: p.provider_policy_number,
|
||||
premium: p.premium,
|
||||
effective_date: p.effective_date,
|
||||
expiry_date: p.expiry_date,
|
||||
|
||||
@@ -227,16 +227,10 @@ defmodule PolicyServiceWeb.Schemas.Policy do
|
||||
OpenApiSpex.schema(%{
|
||||
title: "AcceptQuoteRequest",
|
||||
type: :object,
|
||||
required: [:quote_id, :plan_id],
|
||||
required: [:accepted_plan_id],
|
||||
properties: %{
|
||||
quote_id: %Schema{type: :string},
|
||||
plan_id: %Schema{type: :string},
|
||||
solicitation_fields: %Schema{
|
||||
type: :object,
|
||||
additionalProperties: %Schema{type: :string},
|
||||
description: "Optional flat map of AcroForm field names to values",
|
||||
nullable: true
|
||||
}
|
||||
plan_id: %Schema{type: :string}
|
||||
}
|
||||
})
|
||||
end
|
||||
@@ -266,7 +260,6 @@ defmodule PolicyServiceWeb.Schemas.Policy do
|
||||
type: :object,
|
||||
properties: %{
|
||||
download_url: %Schema{type: :string},
|
||||
s3_key: %Schema{type: :string},
|
||||
version: %Schema{type: :integer}
|
||||
}
|
||||
})
|
||||
@@ -283,11 +276,11 @@ defmodule PolicyServiceWeb.Schemas.Policy do
|
||||
policy_type: %Schema{type: :string, enum: ["car", "life", "fire"]},
|
||||
status: %Schema{
|
||||
type: :string,
|
||||
enum: ["quote_requested", "quotes_received", "solicitation_sent", "issued"]
|
||||
enum: ["quote_requested", "quotes_received", "awaiting_policy", "issued"]
|
||||
},
|
||||
applicant_info: ApplicantInfo,
|
||||
policy_details: PolicyDetails,
|
||||
policy_number: %Schema{type: :string, nullable: true},
|
||||
provider_policy_number: %Schema{type: :string, nullable: true},
|
||||
submitted_at: %Schema{type: :string, format: :"date-time"}
|
||||
}
|
||||
})
|
||||
@@ -306,19 +299,15 @@ defmodule PolicyServiceWeb.Schemas.Policy do
|
||||
policy_type: %Schema{type: :string, enum: ["car", "life", "fire"]},
|
||||
status: %Schema{
|
||||
type: :string,
|
||||
enum: ["quote_requested", "quotes_received", "solicitation_sent", "issued"]
|
||||
enum: ["quote_requested", "quotes_received", "awaiting_policy", "issued"]
|
||||
},
|
||||
applicant_info: ApplicantInfo,
|
||||
policy_details: PolicyDetails,
|
||||
selected_providers: %Schema{type: :array, items: %Schema{type: :string}},
|
||||
quotes: %Schema{type: :object, additionalProperties: QuoteData},
|
||||
accepted_quote_id: %Schema{type: :string, nullable: true},
|
||||
accepted_plan_id: %Schema{type: :string, nullable: true},
|
||||
accepted_provider_id: %Schema{type: :string, nullable: true},
|
||||
accepted_at: %Schema{type: :string, format: :"date-time", nullable: true},
|
||||
solicitation_id: %Schema{type: :string, nullable: true},
|
||||
solicitation_s3_key: %Schema{type: :string, nullable: true},
|
||||
policy_number: %Schema{type: :string, nullable: true},
|
||||
accepted_by: %Schema{type: :string, nullable: true},
|
||||
provider_policy_number: %Schema{type: :string, nullable: true},
|
||||
premium: %Schema{type: :number, nullable: true},
|
||||
effective_date: %Schema{type: :string, format: :date, nullable: true},
|
||||
expiry_date: %Schema{type: :string, format: :date, nullable: true},
|
||||
|
||||
Reference in New Issue
Block a user