cover/Elixir.DaProductApp.Transactions.ReqPayEvent.html

1 defmodule DaProductApp.Transactions.ReqPayEvent do
2 @moduledoc """
3 Event rows for ReqPay lifecycle. Stores seq, event_type, payload and
4 hashed request/response XML for compact audit.
5 """
6
7 use Ecto.Schema
8 import Ecto.Changeset
9
10 280 schema "req_pay_events" do
11 field :req_pay_id, :integer
12 field :transaction_id, :integer
13 field :seq, :integer
14 field :event_type, :string
15 field :payload, :map
16 field :prev_hash, :binary
17 field :hash, :binary
18 field :req_xml_hash, :binary
19 field :resp_xml_hash, :binary
20
21 timestamps(type: :utc_datetime)
22 end
23
24 @required ~w(req_pay_id seq event_type hash)a
25 @optional ~w(transaction_id payload prev_hash req_xml_hash resp_xml_hash)a
26
27 def changeset(struct, attrs) do
28 struct
29 |> cast(attrs, @required ++ @optional)
30 27 |> validate_required(@required)
31 end
32 end
Line Hits Source