defmodule DaProductApp.Transactions.FollowupRequest do @moduledoc """ ChkTxn / Reversal follow-up scheduling record. """ use Ecto.Schema import Ecto.Changeset schema "followup_requests" do field :kind, :string field :status, :string, default: "scheduled" field :attempt_no, :integer, default: 1 field :deadline_at, :utc_datetime field :sent_at, :utc_datetime field :response_code, :string field :response_payload, :map belongs_to :transaction, DaProductApp.Transactions.Transaction timestamps(updated_at: false) end @required ~w(kind status attempt_no deadline_at transaction_id)a @optional ~w(sent_at response_code response_payload)a def changeset(struct, attrs) do struct |> cast(attrs, @required ++ @optional) |> validate_required(@required) end end