cover/Elixir.DaProductApp.Transactions.FollowupRequest.html

1 defmodule DaProductApp.Transactions.FollowupRequest do
2 @moduledoc """
3 ChkTxn / Reversal follow-up scheduling record.
4 """
5 use Ecto.Schema
6 import Ecto.Changeset
7
8
:-(
schema "followup_requests" do
9 field :kind, :string
10 field :status, :string, default: "scheduled"
11 field :attempt_no, :integer, default: 1
12 field :deadline_at, :utc_datetime
13 field :sent_at, :utc_datetime
14 field :response_code, :string
15 field :response_payload, :map
16 belongs_to :transaction, DaProductApp.Transactions.Transaction
17 timestamps(updated_at: false)
18 end
19
20 @required ~w(kind status attempt_no deadline_at transaction_id)a
21 @optional ~w(sent_at response_code response_payload)a
22
23 def changeset(struct, attrs) do
24 struct
25 |> cast(attrs, @required ++ @optional)
26
:-(
|> validate_required(@required)
27 end
28 end
Line Hits Source