Class: EVSS::PPIU::PaymentAccount

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Serialization, ActiveModel::Validations
Defined in:
lib/evss/ppiu/payment_account.rb

Overview

Model for a user’s payment account

Constant Summary collapse

ACCOUNT_NUM_REGEX =
/\A\d*\z/
ROUTING_NUM_REGEX =
/\A\d{9}\z/

Instance Attribute Summary collapse

Instance Attribute Details

#account_numberString

Returns The account number; digits only.

Returns:

  • (String)

    The account number; digits only



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/evss/ppiu/payment_account.rb', line 19

class PaymentAccount
  include Virtus.model
  include ActiveModel::Validations
  include ActiveModel::Serialization

  ACCOUNT_NUM_REGEX = /\A\d*\z/
  ROUTING_NUM_REGEX = /\A\d{9}\z/

  attribute :account_type, String
  attribute :financial_institution_name, String
  attribute :account_number, String
  attribute :financial_institution_routing_number, String

  validates :account_type, inclusion: { in: %w[Checking Savings] }, presence: true
  validates :account_number, presence: true
  validates :financial_institution_routing_number, presence: true

  validates_format_of :account_number, with: ACCOUNT_NUM_REGEX
  validates_format_of :financial_institution_routing_number, with: ROUTING_NUM_REGEX
end

#account_typeString

Returns The type of account, i.e. “Checking” or “Savings”.

Returns:

  • (String)

    The type of account, i.e. “Checking” or “Savings”



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/evss/ppiu/payment_account.rb', line 19

class PaymentAccount
  include Virtus.model
  include ActiveModel::Validations
  include ActiveModel::Serialization

  ACCOUNT_NUM_REGEX = /\A\d*\z/
  ROUTING_NUM_REGEX = /\A\d{9}\z/

  attribute :account_type, String
  attribute :financial_institution_name, String
  attribute :account_number, String
  attribute :financial_institution_routing_number, String

  validates :account_type, inclusion: { in: %w[Checking Savings] }, presence: true
  validates :account_number, presence: true
  validates :financial_institution_routing_number, presence: true

  validates_format_of :account_number, with: ACCOUNT_NUM_REGEX
  validates_format_of :financial_institution_routing_number, with: ROUTING_NUM_REGEX
end

#financial_institution_nameString

Returns The name of the financial institution.

Returns:

  • (String)

    The name of the financial institution



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/evss/ppiu/payment_account.rb', line 19

class PaymentAccount
  include Virtus.model
  include ActiveModel::Validations
  include ActiveModel::Serialization

  ACCOUNT_NUM_REGEX = /\A\d*\z/
  ROUTING_NUM_REGEX = /\A\d{9}\z/

  attribute :account_type, String
  attribute :financial_institution_name, String
  attribute :account_number, String
  attribute :financial_institution_routing_number, String

  validates :account_type, inclusion: { in: %w[Checking Savings] }, presence: true
  validates :account_number, presence: true
  validates :financial_institution_routing_number, presence: true

  validates_format_of :account_number, with: ACCOUNT_NUM_REGEX
  validates_format_of :financial_institution_routing_number, with: ROUTING_NUM_REGEX
end

#financial_institution_routing_numberString

Returns The routing number of the financial institution; exactly 9 digits.

Returns:

  • (String)

    The routing number of the financial institution; exactly 9 digits



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/evss/ppiu/payment_account.rb', line 19

class PaymentAccount
  include Virtus.model
  include ActiveModel::Validations
  include ActiveModel::Serialization

  ACCOUNT_NUM_REGEX = /\A\d*\z/
  ROUTING_NUM_REGEX = /\A\d{9}\z/

  attribute :account_type, String
  attribute :financial_institution_name, String
  attribute :account_number, String
  attribute :financial_institution_routing_number, String

  validates :account_type, inclusion: { in: %w[Checking Savings] }, presence: true
  validates :account_number, presence: true
  validates :financial_institution_routing_number, presence: true

  validates_format_of :account_number, with: ACCOUNT_NUM_REGEX
  validates_format_of :financial_institution_routing_number, with: ROUTING_NUM_REGEX
end