refactor buyer and insured and add more policy types
All checks were successful
Build and Publish / build-release (push) Successful in 1m38s
All checks were successful
Build and Publish / build-release (push) Successful in 1m38s
This commit is contained in:
@@ -8,7 +8,10 @@ defmodule PolicyService.Events do
|
||||
defmacro __using__(_opts) do
|
||||
quote do
|
||||
defimpl Commanded.Serialization.JsonDecoder do
|
||||
def decode(%{id: %{org_id: org_id, policy_type: policy_type, application_id: application_id}} = event) do
|
||||
def decode(
|
||||
%{id: %{org_id: org_id, policy_type: policy_type, application_id: application_id}} =
|
||||
event
|
||||
) do
|
||||
%{event | id: PolicyId.new(org_id, policy_type, application_id)}
|
||||
end
|
||||
|
||||
@@ -26,19 +29,45 @@ defmodule PolicyService.Events.Policy do
|
||||
defmodule PolicyApplicationSubmitted do
|
||||
use PolicyService.Events
|
||||
@derive Jason.Encoder
|
||||
defstruct [:id, :submitted_by, :applicant_info, :policy_details, :selected_providers, :submitted_at]
|
||||
defstruct [
|
||||
:id,
|
||||
:submitted_by,
|
||||
:insured,
|
||||
:buyer,
|
||||
:policy_details,
|
||||
:selected_providers,
|
||||
:submitted_at
|
||||
]
|
||||
end
|
||||
|
||||
defmodule QuoteRequestSent do
|
||||
use PolicyService.Events
|
||||
@derive Jason.Encoder
|
||||
defstruct [:id, :provider_id, :provider_email, :applicant_info, :policy_details, :requested_at]
|
||||
defstruct [
|
||||
:id,
|
||||
:provider_id,
|
||||
:provider_email,
|
||||
:insured,
|
||||
:buyer,
|
||||
:policy_details,
|
||||
:requested_at
|
||||
]
|
||||
end
|
||||
|
||||
defmodule ProviderQuoteReceived do
|
||||
use PolicyService.Events
|
||||
@derive Jason.Encoder
|
||||
defstruct [:id, :recorded_by, :provider_id, :quote_id, :premium, :coverage_details, :valid_until, :plans, :received_at]
|
||||
defstruct [
|
||||
:id,
|
||||
:recorded_by,
|
||||
:provider_id,
|
||||
:quote_id,
|
||||
:premium,
|
||||
:coverage_details,
|
||||
:valid_until,
|
||||
:plans,
|
||||
:received_at
|
||||
]
|
||||
end
|
||||
|
||||
defmodule AllQuotesReceived do
|
||||
@@ -53,11 +82,11 @@ defmodule PolicyService.Events.Policy do
|
||||
defstruct [:id, :accepted_by, :quote, :plan, :provider]
|
||||
end
|
||||
|
||||
defmodule SolicitationRequestSent do
|
||||
use PolicyService.Events
|
||||
@derive Jason.Encoder
|
||||
defstruct [:id, :plan, :provider_id]
|
||||
end
|
||||
defmodule SolicitationRequestSent do
|
||||
use PolicyService.Events
|
||||
@derive Jason.Encoder
|
||||
defstruct [:id, :plan, :provider_id]
|
||||
end
|
||||
|
||||
defmodule PolicyIssued do
|
||||
use PolicyService.Events
|
||||
|
||||
Reference in New Issue
Block a user