Module: FidorApi::Transfer::Generic

Included in:
ACH, BankInternal, P2pAccountNumber, P2pPhone, P2pUsername, Swift, Utility
Defined in:
lib/fidor_api/transfer/generic.rb

Constant Summary collapse

ROUTING_INFO_ERROR_PREFIX =
"beneficiary.routing_info.".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fidor_api/transfer/generic.rb', line 6

def self.included(base)
  base.extend ModelAttribute
  base.extend AmountAttributes

  base.validates *required_attributes, presence: true
  base.validates :beneficiary_unique_name, presence: true, if: -> { create_beneficiary && !beneficiary_reference_passed? }

  base.attribute :id,                      :string
  base.attribute :account_id,              :string
  base.attribute :external_uid,            :string
  base.attribute :subject,                 :string
  base.attribute :currency,                :string
  base.attribute :exchange_rate,           :string
  base.attribute :subject,                 :string
  base.attribute :state,                   :string
  base.amount_attribute :amount

  base.attribute :beneficiary_unique_name, :string
  base.attribute :contact_name,            :string
  base.attribute :contact_address_line_1,  :string
  base.attribute :contact_address_line_2,  :string
  base.attribute :contact_city,            :string
  base.attribute :contact_country,         :string
  base.attribute :bank_name,               :string
  base.attribute :bank_address_line_1,     :string
  base.attribute :bank_address_line_2,     :string
  base.attribute :bank_city,               :string
  base.attribute :bank_country,            :string
  base.attribute :create_beneficiary,      :boolean

  base.attribute :beneficiary_id,          :string

  base.attribute :created_at,              :time
  base.attribute :updated_at,              :time
end

.required_attributesObject



42
43
44
# File 'lib/fidor_api/transfer/generic.rb', line 42

def self.required_attributes
  [ :account_id, :external_uid, :amount, :subject, :currency ]
end

Instance Method Details

#as_jsonObject



46
47
48
# File 'lib/fidor_api/transfer/generic.rb', line 46

def as_json
  transfer_json_params.merge(beneficiary_json_params)
end