SaltDns. Registrar. Rules
(Salt v1.0.0)
The pure rules of the money path of SaltDns.Registrar, kept apart from the
database so that they are tested in the plain test run:
guard/2- the price ceiling and the premium rule;completed?/2- whether an order went through, going by what the registrar holds now (true,false, or:unknownwhen it cannot be shown either way: then nothing is ordered and the operation stays open);order_result/1,price_result/1,lookup_result/1,call_result/1- what an adapter answered, made well-formed: anything that is not what the behaviour promises becomes a non-final{:error, {:provider, message}}, so that a bad adapter leaves an operation open and never crashes the caller with a match error;definite?/1- whether an error kind is a final refusal (nothing was bought and asking again with the same reference cannot work).
Summary
Functions
Any other adapter answer: :ok, {:ok, term} or a well-formed error
({:error, {kind, message}}, the message a string or a map with a string
:message). Everything else is a provider error.
Did the order of operation (a map with :kind and, for a renewal,
:expires_before, the expiry the name had when it was ordered) go through,
going by found, the registrar's state of the name now?
The error kinds that are final refusals.
True for a final refusal. :rate_limited, :unauthorized and server trouble are not final.
True when the reference is burned: a new reference is needed to try again. That is a final refusal, or the reference having been used for another request.
The price guard. req has :ceiling_minor, :currency and
:allow_premium; price is what price/4 of the adapter answered.
A lookup answer: a state with a usable registrar id, or nil when the account
does not hold the name. A found name without an id is not a completion (the
same rule as order_result/1): the operation stays open.
The largest max_cost_minor accepted: far above any price, far below what the database holds.
A registration, transfer, renewal or restore answer: a state with a domain id and a state.
A price answer.
Types
Functions
Any other adapter answer: :ok, {:ok, term} or a well-formed error
({:error, {kind, message}}, the message a string or a map with a string
:message). Everything else is a provider error.
Did the order of operation (a map with :kind and, for a renewal,
:expires_before, the expiry the name had when it was ordered) go through,
going by found, the registrar's state of the name now?
A renewal is told by the expiry: later than before means it went through.
Without the expiry before, or without one in the registrar's answer, it
cannot be told, and the answer is :unknown.
@spec definite() :: [atom()]
The error kinds that are final refusals.
True for a final refusal. :rate_limited, :unauthorized and server trouble are not final.
True when the reference is burned: a new reference is needed to try again. That is a final refusal, or the reference having been used for another request.
The price guard. req has :ceiling_minor, :currency and
:allow_premium; price is what price/4 of the adapter answered.
A lookup answer: a state with a usable registrar id, or nil when the account
does not hold the name. A found name without an id is not a completion (the
same rule as order_result/1): the operation stays open.
@spec max_minor() :: pos_integer()
The largest max_cost_minor accepted: far above any price, far below what the database holds.
A registration, transfer, renewal or restore answer: a state with a domain id and a state.
A price answer.