Class: TripletexRubyClient::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_ruby_client/models/payment.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Payment

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/tripletex_ruby_client/models/payment.rb', line 159

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'version')
    self.version = attributes[:'version']
  end

  if attributes.has_key?(:'changes')
    if (value = attributes[:'changes']).is_a?(Array)
      self.changes = value
    end
  end

  if attributes.has_key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.has_key?(:'paymentDate')
    self.payment_date = attributes[:'paymentDate']
  end

  if attributes.has_key?(:'bookingDate')
    self.booking_date = attributes[:'bookingDate']
  end

  if attributes.has_key?(:'valueDate')
    self.value_date = attributes[:'valueDate']
  end

  if attributes.has_key?(:'amountCurrency')
    self.amount_currency = attributes[:'amountCurrency']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'creditorBankName')
    self.creditor_bank_name = attributes[:'creditorBankName']
  end

  if attributes.has_key?(:'creditorBankAddress')
    self.creditor_bank_address = attributes[:'creditorBankAddress']
  end

  if attributes.has_key?(:'creditorBankPostalCode')
    self.creditor_bank_postal_code = attributes[:'creditorBankPostalCode']
  end

  if attributes.has_key?(:'creditorBankPostalCity')
    self.creditor_bank_postal_city = attributes[:'creditorBankPostalCity']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'statusId')
    self.status_id = attributes[:'statusId']
  end

  if attributes.has_key?(:'isFinalStatus')
    self.is_final_status = attributes[:'isFinalStatus']
  end

  if attributes.has_key?(:'isForeignPayment')
    self.is_foreign_payment = attributes[:'isForeignPayment']
  end

  if attributes.has_key?(:'isSalary')
    self.is_salary = attributes[:'isSalary']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'kid')
    self.kid = attributes[:'kid']
  end

  if attributes.has_key?(:'receiverReference')
    self.receiver_reference = attributes[:'receiverReference']
  end

  if attributes.has_key?(:'sourceVoucher')
    self.source_voucher = attributes[:'sourceVoucher']
  end

  if attributes.has_key?(:'postings')
    self.postings = attributes[:'postings']
  end

  if attributes.has_key?(:'account')
    self. = attributes[:'account']
  end

  if attributes.has_key?(:'amountInAccountCurrency')
    self. = attributes[:'amountInAccountCurrency']
  end
end

Instance Attribute Details

#accountObject

The payment account.



68
69
70
# File 'lib/tripletex_ruby_client/models/payment.rb', line 68

def 
  @account
end

#amount_currencyObject

In the specified currency.



30
31
32
# File 'lib/tripletex_ruby_client/models/payment.rb', line 30

def amount_currency
  @amount_currency
end

#amount_in_account_currencyObject

Amount specified in the currency of the bank agreements account.



71
72
73
# File 'lib/tripletex_ruby_client/models/payment.rb', line 71

def 
  @amount_in_account_currency
end

#booking_dateObject

Returns the value of attribute booking_date.



25
26
27
# File 'lib/tripletex_ruby_client/models/payment.rb', line 25

def booking_date
  @booking_date
end

#changesObject

Returns the value of attribute changes.



19
20
21
# File 'lib/tripletex_ruby_client/models/payment.rb', line 19

def changes
  @changes
end

#creditor_bank_addressObject

Returns the value of attribute creditor_bank_address.



36
37
38
# File 'lib/tripletex_ruby_client/models/payment.rb', line 36

def creditor_bank_address
  @creditor_bank_address
end

#creditor_bank_nameObject

Returns the value of attribute creditor_bank_name.



34
35
36
# File 'lib/tripletex_ruby_client/models/payment.rb', line 34

def creditor_bank_name
  @creditor_bank_name
end

#creditor_bank_postal_cityObject

Returns the value of attribute creditor_bank_postal_city.



40
41
42
# File 'lib/tripletex_ruby_client/models/payment.rb', line 40

def creditor_bank_postal_city
  @creditor_bank_postal_city
end

#creditor_bank_postal_codeObject

Returns the value of attribute creditor_bank_postal_code.



38
39
40
# File 'lib/tripletex_ruby_client/models/payment.rb', line 38

def creditor_bank_postal_code
  @creditor_bank_postal_code
end

#currencyObject

Returns the value of attribute currency.



32
33
34
# File 'lib/tripletex_ruby_client/models/payment.rb', line 32

def currency
  @currency
end

#descriptionObject

Returns the value of attribute description.



54
55
56
# File 'lib/tripletex_ruby_client/models/payment.rb', line 54

def description
  @description
end

#idObject

Returns the value of attribute id.



15
16
17
# File 'lib/tripletex_ruby_client/models/payment.rb', line 15

def id
  @id
end

#is_final_statusObject

Returns the value of attribute is_final_status.



48
49
50
# File 'lib/tripletex_ruby_client/models/payment.rb', line 48

def is_final_status
  @is_final_status
end

#is_foreign_paymentObject

Returns the value of attribute is_foreign_payment.



50
51
52
# File 'lib/tripletex_ruby_client/models/payment.rb', line 50

def is_foreign_payment
  @is_foreign_payment
end

#is_salaryObject

Returns the value of attribute is_salary.



52
53
54
# File 'lib/tripletex_ruby_client/models/payment.rb', line 52

def is_salary
  @is_salary
end

#kidObject

KID - Kundeidentifikasjonsnummer.



57
58
59
# File 'lib/tripletex_ruby_client/models/payment.rb', line 57

def kid
  @kid
end

#payment_dateObject

Returns the value of attribute payment_date.



23
24
25
# File 'lib/tripletex_ruby_client/models/payment.rb', line 23

def payment_date
  @payment_date
end

#postingsObject

The payment posting.



65
66
67
# File 'lib/tripletex_ruby_client/models/payment.rb', line 65

def postings
  @postings
end

#receiver_referenceObject

Returns the value of attribute receiver_reference.



59
60
61
# File 'lib/tripletex_ruby_client/models/payment.rb', line 59

def receiver_reference
  @receiver_reference
end

#source_voucherObject

Vouchere that was paid.



62
63
64
# File 'lib/tripletex_ruby_client/models/payment.rb', line 62

def source_voucher
  @source_voucher
end

#statusObject

The payment status.NOT_APPROVED: Payment not approved yet.
APPROVED: Payment approved, but not yet sent to bank.
SENT_TO_AUTOPAY: Payment sent to bank.
RECEIVED_BY_BANK: Payment received by the bank.
ACCEPTED_BY_BANK: Payment that was accepted by the bank.
FAILED: Payment that failed.
CANCELLED: Cancelled payment.
SUCCESS: Payment that ended successfully.



43
44
45
# File 'lib/tripletex_ruby_client/models/payment.rb', line 43

def status
  @status
end

#status_idObject

The payment status Id. Usually all the payments in one batch have the same status ID, at least to the point of being received by bank.NEW: Payment is new.
PENDING_SIGNING: Payment is sent to AutoPay but not signed yet, requires re-approving.
CANCELLED: Payment was cancelled by ERP.
ERROR: Payment that failed.
RECEIVED_BY_BANK: Payment was received by the bank.
ACCEPTED_BY_BANK: Payment was accepted by bank.
CANCELLED_IN_BANK: Payment was cancelled in bank.
REJECTED_BY_BANK: Payment was rejected by bank.
PAID: Payment is paid.
OTHER: In case status in unknown. Will never be a final status.



46
47
48
# File 'lib/tripletex_ruby_client/models/payment.rb', line 46

def status_id
  @status_id
end

#urlObject

Returns the value of attribute url.



21
22
23
# File 'lib/tripletex_ruby_client/models/payment.rb', line 21

def url
  @url
end

#value_dateObject

Returns the value of attribute value_date.



27
28
29
# File 'lib/tripletex_ruby_client/models/payment.rb', line 27

def value_date
  @value_date
end

#versionObject

Returns the value of attribute version.



17
18
19
# File 'lib/tripletex_ruby_client/models/payment.rb', line 17

def version
  @version
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/tripletex_ruby_client/models/payment.rb', line 96

def self.attribute_map
  {
    :'id' => :'id',
    :'version' => :'version',
    :'changes' => :'changes',
    :'url' => :'url',
    :'payment_date' => :'paymentDate',
    :'booking_date' => :'bookingDate',
    :'value_date' => :'valueDate',
    :'amount_currency' => :'amountCurrency',
    :'currency' => :'currency',
    :'creditor_bank_name' => :'creditorBankName',
    :'creditor_bank_address' => :'creditorBankAddress',
    :'creditor_bank_postal_code' => :'creditorBankPostalCode',
    :'creditor_bank_postal_city' => :'creditorBankPostalCity',
    :'status' => :'status',
    :'status_id' => :'statusId',
    :'is_final_status' => :'isFinalStatus',
    :'is_foreign_payment' => :'isForeignPayment',
    :'is_salary' => :'isSalary',
    :'description' => :'description',
    :'kid' => :'kid',
    :'receiver_reference' => :'receiverReference',
    :'source_voucher' => :'sourceVoucher',
    :'postings' => :'postings',
    :'account' => :'account',
    :'amount_in_account_currency' => :'amountInAccountCurrency'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/tripletex_ruby_client/models/payment.rb', line 127

def self.swagger_types
  {
    :'id' => :'Integer',
    :'version' => :'Integer',
    :'changes' => :'Array<Change>',
    :'url' => :'String',
    :'payment_date' => :'String',
    :'booking_date' => :'String',
    :'value_date' => :'String',
    :'amount_currency' => :'Float',
    :'currency' => :'Currency',
    :'creditor_bank_name' => :'String',
    :'creditor_bank_address' => :'String',
    :'creditor_bank_postal_code' => :'String',
    :'creditor_bank_postal_city' => :'String',
    :'status' => :'String',
    :'status_id' => :'String',
    :'is_final_status' => :'BOOLEAN',
    :'is_foreign_payment' => :'BOOLEAN',
    :'is_salary' => :'BOOLEAN',
    :'description' => :'String',
    :'kid' => :'String',
    :'receiver_reference' => :'String',
    :'source_voucher' => :'Voucher',
    :'postings' => :'Posting',
    :'account' => :'Account',
    :'amount_in_account_currency' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/tripletex_ruby_client/models/payment.rb', line 412

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      version == o.version &&
      changes == o.changes &&
      url == o.url &&
      payment_date == o.payment_date &&
      booking_date == o.booking_date &&
      value_date == o.value_date &&
      amount_currency == o.amount_currency &&
      currency == o.currency &&
      creditor_bank_name == o.creditor_bank_name &&
      creditor_bank_address == o.creditor_bank_address &&
      creditor_bank_postal_code == o.creditor_bank_postal_code &&
      creditor_bank_postal_city == o.creditor_bank_postal_city &&
      status == o.status &&
      status_id == o.status_id &&
      is_final_status == o.is_final_status &&
      is_foreign_payment == o.is_foreign_payment &&
      is_salary == o.is_salary &&
      description == o.description &&
      kid == o.kid &&
      receiver_reference == o.receiver_reference &&
      source_voucher == o.source_voucher &&
      postings == o.postings &&
       == o. &&
       == o.
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/tripletex_ruby_client/models/payment.rb', line 478

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = TripletexRubyClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/tripletex_ruby_client/models/payment.rb', line 544

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/tripletex_ruby_client/models/payment.rb', line 457

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


444
445
446
# File 'lib/tripletex_ruby_client/models/payment.rb', line 444

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



450
451
452
# File 'lib/tripletex_ruby_client/models/payment.rb', line 450

def hash
  [id, version, changes, url, payment_date, booking_date, value_date, amount_currency, currency, creditor_bank_name, creditor_bank_address, creditor_bank_postal_code, creditor_bank_postal_city, status, status_id, is_final_status, is_foreign_payment, is_salary, description, kid, receiver_reference, source_voucher, postings, , ].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/tripletex_ruby_client/models/payment.rb', line 270

def list_invalid_properties
  invalid_properties = Array.new
  if !@creditor_bank_name.nil? && @creditor_bank_name.to_s.length > 255
    invalid_properties.push('invalid value for "creditor_bank_name", the character length must be smaller than or equal to 255.')
  end

  if !@creditor_bank_address.nil? && @creditor_bank_address.to_s.length > 255
    invalid_properties.push('invalid value for "creditor_bank_address", the character length must be smaller than or equal to 255.')
  end

  if !@creditor_bank_postal_code.nil? && @creditor_bank_postal_code.to_s.length > 255
    invalid_properties.push('invalid value for "creditor_bank_postal_code", the character length must be smaller than or equal to 255.')
  end

  if !@creditor_bank_postal_city.nil? && @creditor_bank_postal_city.to_s.length > 255
    invalid_properties.push('invalid value for "creditor_bank_postal_city", the character length must be smaller than or equal to 255.')
  end

  if !@description.nil? && @description.to_s.length > 255
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 255.')
  end

  if !@kid.nil? && @kid.to_s.length > 25
    invalid_properties.push('invalid value for "kid", the character length must be smaller than or equal to 25.')
  end

  if !@receiver_reference.nil? && @receiver_reference.to_s.length > 250
    invalid_properties.push('invalid value for "receiver_reference", the character length must be smaller than or equal to 250.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



524
525
526
# File 'lib/tripletex_ruby_client/models/payment.rb', line 524

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



530
531
532
533
534
535
536
537
538
# File 'lib/tripletex_ruby_client/models/payment.rb', line 530

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



518
519
520
# File 'lib/tripletex_ruby_client/models/payment.rb', line 518

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/tripletex_ruby_client/models/payment.rb', line 305

def valid?
  return false if !@creditor_bank_name.nil? && @creditor_bank_name.to_s.length > 255
  return false if !@creditor_bank_address.nil? && @creditor_bank_address.to_s.length > 255
  return false if !@creditor_bank_postal_code.nil? && @creditor_bank_postal_code.to_s.length > 255
  return false if !@creditor_bank_postal_city.nil? && @creditor_bank_postal_city.to_s.length > 255
  status_validator = EnumAttributeValidator.new('String', ['NOT_APPROVED', 'APPROVED', 'SENT_TO_AUTOPAY', 'RECEIVED_BY_BANK', 'ACCEPTED_BY_BANK', 'FAILED', 'CANCELLED', 'SUCCESS'])
  return false unless status_validator.valid?(@status)
  status_id_validator = EnumAttributeValidator.new('String', ['NEW', 'PENDING_SIGNING', 'CANCELLED', 'ERROR', 'RECEIVED_BY_BANK', 'ACCEPTED_BY_BANK', 'CANCELLED_IN_BANK', 'REJECTED_BY_BANK', 'PAID', 'OTHER'])
  return false unless status_id_validator.valid?(@status_id)
  return false if !@description.nil? && @description.to_s.length > 255
  return false if !@kid.nil? && @kid.to_s.length > 25
  return false if !@receiver_reference.nil? && @receiver_reference.to_s.length > 250
  true
end