Class: FdxV660Api::DepositTransactionEntity

Inherits:
Transaction show all
Defined in:
lib/fdx_v660_api/models/deposit_transaction_entity.rb

Overview

A transaction on a deposit account type

Instance Attribute Summary collapse

Attributes inherited from Transaction

#account_category, #account_id, #amount, #card_number_display, #category, #category_code, #category_type, #debit_credit_memo, #description, #fi_attributes, #foreign_amount, #foreign_currency, #image_ids, #line_item, #links, #memo, #posted_timestamp, #reference, #reference_transaction_id, #remittance, #reward, #rewards, #status, #sub_category, #transaction_id, #transaction_payee, #transaction_timestamp

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Transaction

discriminators, #to_custom_posted_timestamp, #to_custom_transaction_timestamp

Methods inherited from BaseModel

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

Constructor Details

#initialize(transaction_type: SKIP, payee: SKIP, check_number: SKIP, account_id: SKIP, transaction_id: SKIP, posted_timestamp: SKIP, transaction_timestamp: SKIP, description: SKIP, transaction_payee: SKIP, debit_credit_memo: SKIP, status: SKIP, amount: SKIP, reward: SKIP, rewards: SKIP, fi_attributes: SKIP, links: SKIP, account_category: 'Deposit Transaction entity', reference_transaction_id: SKIP, card_number_display: SKIP, memo: SKIP, category: SKIP, sub_category: SKIP, category_code: SKIP, category_type: SKIP, reference: SKIP, remittance: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, image_ids: SKIP, line_item: SKIP, additional_properties: nil) ⇒ DepositTransactionEntity

Returns a new instance of DepositTransactionEntity.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 57

def initialize(transaction_type: SKIP, payee: SKIP, check_number: SKIP,
               account_id: SKIP, transaction_id: SKIP,
               posted_timestamp: SKIP, transaction_timestamp: SKIP,
               description: SKIP, transaction_payee: SKIP,
               debit_credit_memo: SKIP, status: SKIP, amount: SKIP,
               reward: SKIP, rewards: SKIP, fi_attributes: SKIP,
               links: SKIP, account_category: 'Deposit Transaction entity',
               reference_transaction_id: SKIP, card_number_display: SKIP,
               memo: SKIP, category: SKIP, sub_category: SKIP,
               category_code: SKIP, category_type: SKIP, reference: SKIP,
               remittance: SKIP, foreign_amount: SKIP,
               foreign_currency: SKIP, image_ids: SKIP, line_item: SKIP,
               additional_properties: nil)
  @transaction_type = transaction_type unless transaction_type == SKIP
  @payee = payee unless payee == SKIP
  @check_number = check_number unless check_number == SKIP
  @additional_properties = additional_properties

  # Call the constructor of the base class
  super(account_id: ,
        transaction_id: transaction_id,
        posted_timestamp: posted_timestamp,
        transaction_timestamp: transaction_timestamp,
        description: description,
        transaction_payee: transaction_payee,
        debit_credit_memo: debit_credit_memo,
        status: status,
        amount: amount,
        reward: reward,
        rewards: rewards,
        fi_attributes: fi_attributes,
        links: links,
        account_category: ,
        reference_transaction_id: reference_transaction_id,
        card_number_display: card_number_display,
        memo: memo,
        category: category,
        sub_category: sub_category,
        category_code: category_code,
        category_type: category_type,
        reference: reference,
        remittance: remittance,
        foreign_amount: foreign_amount,
        foreign_currency: foreign_currency,
        image_ids: image_ids,
        line_item: line_item,
        additional_properties: additional_properties)
end

Instance Attribute Details

#check_numberInteger

Check number, or cheque number on Canadian accounts

Returns:

  • (Integer)


29
30
31
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 29

def check_number
  @check_number
end

#payeeString

Payee name. This is deprecated and will be removed in a future major release in place of transactionPayee which provides detailed information of a payee's name and place of business on the Transaction entity

Returns:

  • (String)


25
26
27
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 25

def payee
  @payee
end

#transaction_typeDepositTransactionType3

The type of the deposit transaction: ADJUSTMENT, ATMDEPOSIT, ATMWITHDRAWAL, BILLPAYMENT, CASHIERSCHECK, CHECK, DEPOSIT, DIRECTDEPOSIT, DIVIDEND, FEE, INTEREST, PERSONTOPERSON, POSCREDIT, POSDEBIT, PREAUTHORIZEDDEPOSIT, PREAUTHORIZEDWITHDRAWAL, TRANSFER, WITHDRAWAL. Canadian accounts will also use these for chequing account transactions to ensure interoperability



19
20
21
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 19

def transaction_type
  @transaction_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 107

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  transaction_type =
    hash.key?('transactionType') ? hash['transactionType'] : SKIP
  payee = hash.key?('payee') ? hash['payee'] : SKIP
  check_number = hash.key?('checkNumber') ? hash['checkNumber'] : SKIP
   = hash.key?('accountId') ? hash['accountId'] : SKIP
  transaction_id = hash.key?('transactionId') ? hash['transactionId'] : SKIP
  posted_timestamp = if hash.key?('postedTimestamp')
                       (DateTimeHelper.from_rfc3339(hash['postedTimestamp']) if hash['postedTimestamp'])
                     else
                       SKIP
                     end
  transaction_timestamp = if hash.key?('transactionTimestamp')
                            (DateTimeHelper.from_rfc3339(hash['transactionTimestamp']) if hash['transactionTimestamp'])
                          else
                            SKIP
                          end
  description = hash.key?('description') ? hash['description'] : SKIP
  transaction_payee = TransactionPayeeEntity3.from_hash(hash['transactionPayee']) if
    hash['transactionPayee']
  debit_credit_memo =
    hash.key?('debitCreditMemo') ? hash['debitCreditMemo'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  reward = TransactionRewardEntity.from_hash(hash['reward']) if hash['reward']
  # Parameter is an array, so we need to iterate through it
  rewards = nil
  unless hash['rewards'].nil?
    rewards = []
    hash['rewards'].each do |structure|
      rewards << (TransactionRewardEntity.from_hash(structure) if structure)
    end
  end

  rewards = SKIP unless hash.key?('rewards')
  # Parameter is an array, so we need to iterate through it
  fi_attributes = nil
  unless hash['fiAttributes'].nil?
    fi_attributes = []
    hash['fiAttributes'].each do |structure|
      fi_attributes << (FiAttributeEntity.from_hash(structure) if structure)
    end
  end

  fi_attributes = SKIP unless hash.key?('fiAttributes')
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (HateoasLink.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')
   =
    hash['accountCategory'] ||= 'Deposit Transaction entity'
  reference_transaction_id =
    hash.key?('referenceTransactionId') ? hash['referenceTransactionId'] : SKIP
  card_number_display =
    hash.key?('cardNumberDisplay') ? hash['cardNumberDisplay'] : SKIP
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  category = hash.key?('category') ? hash['category'] : SKIP
  sub_category = hash.key?('subCategory') ? hash['subCategory'] : SKIP
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP
  category_type = hash.key?('categoryType') ? hash['categoryType'] : SKIP
  reference = hash.key?('reference') ? hash['reference'] : SKIP
  remittance = Remittance2.from_hash(hash['remittance']) if hash['remittance']
  foreign_amount = hash.key?('foreignAmount') ? hash['foreignAmount'] : SKIP
  foreign_currency =
    hash.key?('foreignCurrency') ? hash['foreignCurrency'] : SKIP
  image_ids = hash.key?('imageIds') ? hash['imageIds'] : SKIP
  # Parameter is an array, so we need to iterate through it
  line_item = nil
  unless hash['lineItem'].nil?
    line_item = []
    hash['lineItem'].each do |structure|
      line_item << (LineItemEntity.from_hash(structure) if structure)
    end
  end

  line_item = SKIP unless hash.key?('lineItem')

  # 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.
  DepositTransactionEntity.new(transaction_type: transaction_type,
                               payee: payee,
                               check_number: check_number,
                               account_id: ,
                               transaction_id: transaction_id,
                               posted_timestamp: posted_timestamp,
                               transaction_timestamp: transaction_timestamp,
                               description: description,
                               transaction_payee: transaction_payee,
                               debit_credit_memo: debit_credit_memo,
                               status: status,
                               amount: amount,
                               reward: reward,
                               rewards: rewards,
                               fi_attributes: fi_attributes,
                               links: links,
                               account_category: ,
                               reference_transaction_id: reference_transaction_id,
                               card_number_display: card_number_display,
                               memo: memo,
                               category: category,
                               sub_category: sub_category,
                               category_code: category_code,
                               category_type: category_type,
                               reference: reference,
                               remittance: remittance,
                               foreign_amount: foreign_amount,
                               foreign_currency: foreign_currency,
                               image_ids: image_ids,
                               line_item: line_item,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transaction_type'] = 'transactionType'
  @_hash['payee'] = 'payee'
  @_hash['check_number'] = 'checkNumber'
  @_hash = super().merge(@_hash)
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
55
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 52

def self.nullables
  _arr = []
  (_arr << super()).flatten!
end

.optionalsObject

An array for optional fields



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

def self.optionals
  _arr = %w[
    transaction_type
    payee
    check_number
  ]
  (_arr << super()).flatten!
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



236
237
238
239
240
241
242
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 236

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



253
254
255
256
257
258
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 253

def inspect
  class_name = self.class.name.split('::').last
  super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '')
  "<#{class_name} #{super_string}, transaction_type: #{@transaction_type.inspect}, payee:"\
  " #{@payee.inspect}, check_number: #{@check_number.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



245
246
247
248
249
250
# File 'lib/fdx_v660_api/models/deposit_transaction_entity.rb', line 245

def to_s
  class_name = self.class.name.split('::').last
  super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '')
  "<#{class_name} #{super_string}, transaction_type: #{@transaction_type}, payee: #{@payee},"\
  " check_number: #{@check_number}>"
end