Class: CyberSourceMergedSpec::Bank14

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/bank14.rb

Overview

Customer's bank account details

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(account_number: SKIP, code: SKIP, country: SKIP, iban: SKIP, additional_properties: nil) ⇒ Bank14

Returns a new instance of Bank14.



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 66

def initialize(account_number: SKIP, code: SKIP, country: SKIP, iban: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_number =  unless  == SKIP
  @code = code unless code == SKIP
  @country = country unless country == SKIP
  @iban = iban unless iban == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_numberString

Customer's bank account number. You can use this field only when scoring a direct debit transaction. Use this field if you do not or are not allowed to provide the IBAN. Note Do not use the IBAN in this field. Use nly the traditional account number information. For the IBAN, use bank_iban.

Returns:

  • (String)


17
18
19
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 17

def 
  @account_number
end

#codeString

Country-specific code used to identify the customer’s bank. Required for some countries if you do not or are not allowed to provide the IBAN instead. You can use this field only when scoring a direct debit transaction. For specific requirements, see "Required Bank Account Information by Country,"

Returns:

  • (String)


25
26
27
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 25

def code
  @code
end

#countryString

Country where the bank is located. Use the two-character ISO codes. You can use this field only when scoring a direct debit transaction.

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 30

def country
  @country
end

#ibanString

International Bank Account Number (IBAN) for the bank account. For some countries you can provide this number instead of the traditional bank account information. You can use this field only when scoring a direct debit transaction. For specific requirements, see "Required Bank Account Information by Country,"

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 39

def iban
  @iban
end

Class Method Details

.from_element(root) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 103

def self.from_element(root)
   = XmlUtilities.from_element(root, 'accountNumber', String)
  code = XmlUtilities.from_element(root, 'code', String)
  country = XmlUtilities.from_element(root, 'country', String)
  iban = XmlUtilities.from_element(root, 'iban', String)

  new(account_number: ,
      code: code,
      country: country,
      iban: iban,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP
  code = hash.key?('code') ? hash['code'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  iban = hash.key?('iban') ? hash['iban'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Bank14.new(account_number: ,
             code: code,
             country: country,
             iban: iban,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_number'] = 'accountNumber'
  @_hash['code'] = 'code'
  @_hash['country'] = 'country'
  @_hash['iban'] = 'iban'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 52

def self.optionals
  %w[
    account_number
    code
    country
    iban
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number.inspect}, code: #{@code.inspect},"\
  " country: #{@country.inspect}, iban: #{@iban.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number}, code: #{@code}, country: #{@country},"\
  " iban: #{@iban}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/cyber_source_merged_spec/models/bank14.rb', line 116

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'accountNumber', )
  XmlUtilities.add_as_subelement(doc, root, 'code', code)
  XmlUtilities.add_as_subelement(doc, root, 'country', country)
  XmlUtilities.add_as_subelement(doc, root, 'iban', iban)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end