Class: K2ConnectRuby::K2Services::Payloads::Webhooks::TransferWebhook
- Inherits:
-
K2CommonEvents
- Object
- K2Webhooks
- K2CommonEvents
- K2ConnectRuby::K2Services::Payloads::Webhooks::TransferWebhook
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb
Constant Summary
Constants inherited from K2CommonEvents
K2CommonEvents::REFERENCE_EXCEPTIONS
Instance Attribute Summary collapse
-
#destination_account_name ⇒ Object
readonly
Returns the value of attribute destination_account_name.
-
#destination_account_number ⇒ Object
readonly
Returns the value of attribute destination_account_number.
-
#destination_bank_branch_ref ⇒ Object
readonly
Returns the value of attribute destination_bank_branch_ref.
-
#destination_first_name ⇒ Object
readonly
Returns the value of attribute destination_first_name.
-
#destination_last_name ⇒ Object
readonly
Returns the value of attribute destination_last_name.
-
#destination_network ⇒ Object
readonly
Returns the value of attribute destination_network.
-
#destination_phone_number ⇒ Object
readonly
Returns the value of attribute destination_phone_number.
-
#destination_reference ⇒ Object
readonly
Returns the value of attribute destination_reference.
-
#destination_transfer_method ⇒ Object
readonly
Returns the value of attribute destination_transfer_method.
-
#destination_type ⇒ Object
readonly
Returns the value of attribute destination_type.
-
#disbursements ⇒ Object
readonly
Returns the value of attribute disbursements.
Attributes inherited from K2CommonEvents
#amount, #currency, #origination_time, #reference, #status
Attributes inherited from K2Webhooks
#created_at, #event_resource, #event_type, #id, #links_resource, #links_self, #resource_id, #topic
Instance Method Summary collapse
- #destination_assets(payload) ⇒ Object
-
#initialize(payload) ⇒ TransferWebhook
constructor
A new instance of TransferWebhook.
Constructor Details
#initialize(payload) ⇒ TransferWebhook
Returns a new instance of TransferWebhook.
24 25 26 27 28 29 30 31 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 24 def initialize(payload) super # Destination @disbursements = payload.dig("event", "resource", "disbursements") @destination_type = payload.dig("event", "resource", "destination", "type") @destination_reference = payload.dig("event", "resource", "destination", "resource", "reference") destination_assets(payload) end |
Instance Attribute Details
#destination_account_name ⇒ Object (readonly)
Returns the value of attribute destination_account_name.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_account_name @destination_account_name end |
#destination_account_number ⇒ Object (readonly)
Returns the value of attribute destination_account_number.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_account_number @destination_account_number end |
#destination_bank_branch_ref ⇒ Object (readonly)
Returns the value of attribute destination_bank_branch_ref.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_bank_branch_ref @destination_bank_branch_ref end |
#destination_first_name ⇒ Object (readonly)
Returns the value of attribute destination_first_name.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_first_name @destination_first_name end |
#destination_last_name ⇒ Object (readonly)
Returns the value of attribute destination_last_name.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_last_name @destination_last_name end |
#destination_network ⇒ Object (readonly)
Returns the value of attribute destination_network.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_network @destination_network end |
#destination_phone_number ⇒ Object (readonly)
Returns the value of attribute destination_phone_number.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_phone_number @destination_phone_number end |
#destination_reference ⇒ Object (readonly)
Returns the value of attribute destination_reference.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_reference @destination_reference end |
#destination_transfer_method ⇒ Object (readonly)
Returns the value of attribute destination_transfer_method.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_transfer_method @destination_transfer_method end |
#destination_type ⇒ Object (readonly)
Returns the value of attribute destination_type.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def destination_type @destination_type end |
#disbursements ⇒ Object (readonly)
Returns the value of attribute disbursements.
12 13 14 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 12 def disbursements @disbursements end |
Instance Method Details
#destination_assets(payload) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb', line 33 def destination_assets(payload) if @destination_type.eql?("Mobile Wallet") @destination_network = payload.dig("event", "resource", "destination", "resource", "network") @destination_last_name = payload.dig("event", "resource", "destination", "resource", "last_name") @destination_first_name = payload.dig("event", "resource", "destination", "resource", "first_name") @destination_phone_number = payload.dig("event", "resource", "destination", "resource", "phone_number") elsif @destination_type.eql?("Bank Account") @destination_account_name = payload.dig("event", "resource", "destination", "resource", "account_name") @destination_account_number = payload.dig("event", "resource", "destination", "resource", "account_number") @destination_bank_branch_ref = payload.dig("event", "resource", "destination", "resource", "bank_branch_ref") @destination_transfer_method = payload.dig("event", "resource", "destination", "resource", "transfer_method") end end |