Class: PaymentsApi::PaymentDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/payments_api/models/payment_details.rb

Overview

Payment Information Data

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(purpose_of_payment = nil, memo = nil, payment_reference = nil) ⇒ PaymentDetails

Returns a new instance of PaymentDetails.



30
31
32
33
34
35
36
# File 'lib/payments_api/models/payment_details.rb', line 30

def initialize(purpose_of_payment = nil,
               memo = nil,
               payment_reference = nil)
  @purpose_of_payment = purpose_of_payment
  @memo = memo
  @payment_reference = payment_reference
end

Instance Attribute Details

#memoString

Memo from Originator to Beneficiary

Returns:

  • (String)


15
16
17
# File 'lib/payments_api/models/payment_details.rb', line 15

def memo
  @memo
end

#payment_referenceString

Payment Reference Information. Typically includes FI to FI notes

Returns:

  • (String)


19
20
21
# File 'lib/payments_api/models/payment_details.rb', line 19

def payment_reference
  @payment_reference
end

#purpose_of_paymentString

Purpose of payment

Returns:

  • (String)


11
12
13
# File 'lib/payments_api/models/payment_details.rb', line 11

def purpose_of_payment
  @purpose_of_payment
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/payments_api/models/payment_details.rb', line 39

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  purpose_of_payment = hash['purposeOfPayment']
  memo = hash['memo']
  payment_reference = hash['paymentReference']

  # Create object from extracted values.

  PaymentDetails.new(purpose_of_payment,
                     memo,
                     payment_reference)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
28
# File 'lib/payments_api/models/payment_details.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['purpose_of_payment'] = 'purposeOfPayment'
  @_hash['memo'] = 'memo'
  @_hash['payment_reference'] = 'paymentReference'
  @_hash
end