Class: VisaAcceptanceMergedSpec::Balance

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

Overview

Balance 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(account_type: SKIP, amount: SKIP, amount_type: SKIP, currency: SKIP, additional_properties: nil) ⇒ Balance

Returns a new instance of Balance.



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 76

def initialize(account_type: SKIP, amount: SKIP, amount_type: SKIP,
               currency: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_type =  unless  == SKIP
  @amount = amount unless amount == SKIP
  @amount_type = amount_type unless amount_type == SKIP
  @currency = currency unless currency == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_typeString

Type of account. This value is returned only if you request a balance inquiry. Possible values:

  • 00: Not applicable or not specified
  • 10: Savings account
  • 20: Checking account
  • 30: Credit card account
  • 40: Universal account Balance Account Types returned on EBT Debit card transactions:
  • 96: Cash Benefits Account (PIN Debit Gateway EBT only)
  • 98: Food Stamp Account (PIN Debit Gateway EBT only)

Returns:

  • (String)


24
25
26
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 24

def 
  @account_type
end

#amountString

Remaining balance on the account. If the processor returns the sign, positive or negative, this sign is prefixed to the amount value as (+/-).

Returns:

  • (String)


30
31
32
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 30

def amount
  @amount
end

#amount_typeString

Type of amount. This value is returned only if you request a balance inquiry. The issuer determines the value that is returned. Possible values for deposit accounts:

  • 01: Current ledger (posted) balance.
  • 02: Current available balance, which is typically the ledger balance minus outstanding authorizations. Some depository institutions also include pending deposits and the credit or overdraft line associated with the account. Possible values for credit card accounts:
  • 01: Credit amount remaining for customer (open to buy).
  • 02: Credit limit.

Returns:

  • (String)


45
46
47
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 45

def amount_type
  @amount_type
end

#currencyString

Currency of the remaining balance on the account.

Returns:

  • (String)


49
50
51
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 49

def currency
  @currency
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountType') ? hash['accountType'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  amount_type = hash.key?('amountType') ? hash['amountType'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : 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.
  Balance.new(account_type: ,
              amount: amount,
              amount_type: amount_type,
              currency: currency,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_type'] = 'accountType'
  @_hash['amount'] = 'amount'
  @_hash['amount_type'] = 'amountType'
  @_hash['currency'] = 'currency'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 62

def self.optionals
  %w[
    account_type
    amount
    amount_type
    currency
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_type: #{@account_type.inspect}, amount: #{@amount.inspect},"\
  " amount_type: #{@amount_type.inspect}, currency: #{@currency.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/visa_acceptance_merged_spec/models/balance.rb', line 114

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_type: #{@account_type}, amount: #{@amount}, amount_type:"\
  " #{@amount_type}, currency: #{@currency}, additional_properties:"\
  " #{@additional_properties}>"
end