Module: Nfe::FlowStatus

Defined in:
lib/nfe/flow_status.rb,
sig/nfe/flow_status.rbs

Overview

Lifecycle status of an asynchronously-processed fiscal document.

Terminal states stop polling; non-terminal states mean processing is still in flight. The discriminated 202 Pending/Issued contract (modeled in the resource changes) uses FlowStatus.terminal? to decide when a document is settled.

Constant Summary collapse

TERMINAL =

States in which processing has finished (success or failure).

Returns:

  • (Array[String])
%w[Issued IssueFailed Cancelled CancelFailed].freeze
NON_TERMINAL =

States in which processing is still in progress.

Returns:

  • (Array[String])
%w[
  PullFromCityHall
  WaitingCalculateTaxes
  WaitingDefineRpsNumber
  WaitingSend
  WaitingSendCancel
  WaitingReturn
  WaitingDownload
].freeze
ALL =

Every known flow status.

Returns:

  • (Array[String])
(TERMINAL + NON_TERMINAL).freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.terminal?(status) ⇒ Boolean

Returns true when status is a terminal flow state.

Returns:

  • (Boolean)


31
32
33
# File 'lib/nfe/flow_status.rb', line 31

def terminal?(status)
  TERMINAL.include?(status.to_s)
end

Instance Method Details

#self?.terminal?Boolean

Parameters:

  • status (Object)

Returns:

  • (Boolean)


7
# File 'sig/nfe/flow_status.rbs', line 7

def self?.terminal?: (untyped status) -> bool