Class: IncomingPayments

Inherits:
CommonPayment show all
Defined in:
lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb

Instance Attribute Summary collapse

Attributes inherited from CommonPayment

#initiation_time, #status

Attributes inherited from K2Transaction

#callback_url, #id, #links_self, #metadata, #type

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ IncomingPayments

Returns a new instance of IncomingPayments.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 18

def initialize(payload)
  super
  # Event details
  @event = payload.dig('data', 'attributes', 'event')
  @event_type = payload.dig('data', 'attributes', 'event', 'type')
  # Resource details
  @resource_id = payload.dig('data', 'attributes', 'event', 'resource', 'id')
  @transaction_reference = payload.dig('data', 'attributes', 'event', 'resource', 'reference')
  @origination_time = payload.dig('data', 'attributes', 'event', 'resource', 'origination_time')
  @sender_phone_number = payload.dig('data', 'attributes', 'event', 'resource', 'sender_phone_number')
  @amount = payload.dig('data', 'attributes', 'event', 'resource', 'amount')
  @currency = payload.dig('data', 'attributes', 'event', 'resource', 'currency')
  @till_number = payload.dig('data', 'attributes', 'event', 'resource', 'till_number')
  @system = payload.dig('data', 'attributes', 'event', 'resource', 'system')
  @resource_status = payload.dig('data', 'attributes', 'event', 'resource', 'status')
  @sender_first_name = payload.dig('data', 'attributes', 'event', 'resource', 'sender_first_name')
  @sender_middle_name = payload.dig('data', 'attributes', 'event', 'resource', 'sender_middle_name')
  @sender_last_name = payload.dig('data', 'attributes', 'event', 'resource', 'sender_last_name')
  # Errors
  @errors = payload.dig('data', 'attributes', 'event', 'errors')
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def currency
  @currency
end

#errorsObject (readonly)

Returns the value of attribute errors.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def errors
  @errors
end

#eventObject (readonly)

Returns the value of attribute event.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def event
  @event
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def event_type
  @event_type
end

#origination_timeObject (readonly)

Returns the value of attribute origination_time.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def origination_time
  @origination_time
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def resource_id
  @resource_id
end

#resource_statusObject (readonly)

Returns the value of attribute resource_status.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def resource_status
  @resource_status
end

#sender_first_nameObject (readonly)

Returns the value of attribute sender_first_name.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def sender_first_name
  @sender_first_name
end

#sender_last_nameObject (readonly)

Returns the value of attribute sender_last_name.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def sender_last_name
  @sender_last_name
end

#sender_middle_nameObject (readonly)

Returns the value of attribute sender_middle_name.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def sender_middle_name
  @sender_middle_name
end

#sender_phone_numberObject (readonly)

Returns the value of attribute sender_phone_number.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def sender_phone_number
  @sender_phone_number
end

#systemObject (readonly)

Returns the value of attribute system.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def system
  @system
end

#till_numberObject (readonly)

Returns the value of attribute till_number.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def till_number
  @till_number
end

#transaction_referenceObject (readonly)

Returns the value of attribute transaction_reference.



2
3
4
# File 'lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb', line 2

def transaction_reference
  @transaction_reference
end