Class: VisaAcceptanceMergedSpec::Account

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/account.rb

Overview

Account Model.

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(type: SKIP, number: SKIP, encoder_id: SKIP, check_number: SKIP, check_image_reference_number: SKIP, iban: SKIP, additional_properties: nil) ⇒ Account

Returns a new instance of Account.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 82

def initialize(type: SKIP, number: SKIP, encoder_id: SKIP,
               check_number: SKIP, check_image_reference_number: SKIP,
               iban: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @number = number unless number == SKIP
  @encoder_id = encoder_id unless encoder_id == SKIP
  @check_number = check_number unless check_number == SKIP
  unless check_image_reference_number == SKIP
    @check_image_reference_number =
      check_image_reference_number
  end
  @iban = iban unless iban == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#check_image_reference_numberString

Image reference number associated with the check. You cannot include any special characters.

Returns:

  • (String)


44
45
46
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 44

def check_image_reference_number
  @check_image_reference_number
end

#check_numberString

Check number. Chase Paymentech Solutions - Optional. Visa Acceptance ACH Service - Not used. RBS WorldPay Atlanta - Optional on debits. Required on credits. TeleCheck - Strongly recommended on debit requests. Optional on credits.

Returns:

  • (String)


39
40
41
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 39

def check_number
  @check_number
end

#encoder_idString

Identifier for the bank that provided the customer’s encoded account number. To obtain the bank identifier, contact your processor.

Returns:

  • (String)


31
32
33
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 31

def encoder_id
  @encoder_id
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.

Returns:

  • (String)


51
52
53
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 51

def iban
  @iban
end

#numberString

Account number. When processing encoded account numbers, use this field for the encoded account number.

Returns:

  • (String)


25
26
27
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 25

def number
  @number
end

#typeString

Account type. Possible values:

  • C: Checking.
  • G: General ledger. This value is supported only on Wells Fargo ACH.
  • S: Savings (U.S. dollars only).
  • X: Corporate checking (U.S. dollars only).

Returns:

  • (String)


19
20
21
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 19

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 101

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  number = hash.key?('number') ? hash['number'] : SKIP
  encoder_id = hash.key?('encoderId') ? hash['encoderId'] : SKIP
  check_number = hash.key?('checkNumber') ? hash['checkNumber'] : SKIP
  check_image_reference_number =
    hash.key?('checkImageReferenceNumber') ? hash['checkImageReferenceNumber'] : 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.
  Account.new(type: type,
              number: number,
              encoder_id: encoder_id,
              check_number: check_number,
              check_image_reference_number: check_image_reference_number,
              iban: iban,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['number'] = 'number'
  @_hash['encoder_id'] = 'encoderId'
  @_hash['check_number'] = 'checkNumber'
  @_hash['check_image_reference_number'] = 'checkImageReferenceNumber'
  @_hash['iban'] = 'iban'
  @_hash
end

.nullablesObject

An array for nullable fields



78
79
80
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 78

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    type
    number
    encoder_id
    check_number
    check_image_reference_number
    iban
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



140
141
142
143
144
145
146
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 140

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, number: #{@number.inspect}, encoder_id:"\
  " #{@encoder_id.inspect}, check_number: #{@check_number.inspect},"\
  " check_image_reference_number: #{@check_image_reference_number.inspect}, iban:"\
  " #{@iban.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



131
132
133
134
135
136
137
# File 'lib/visa_acceptance_merged_spec/models/account.rb', line 131

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, number: #{@number}, encoder_id: #{@encoder_id},"\
  " check_number: #{@check_number}, check_image_reference_number:"\
  " #{@check_image_reference_number}, iban: #{@iban}, additional_properties:"\
  " #{@additional_properties}>"
end