Class: ModernTreasury::PaymentFlowCreateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/modern_treasury/models/payment_flow_create_request.rb

Overview

PaymentFlowCreateRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

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

Constructor Details

#initialize(amount:, currency:, direction:, counterparty_id:, originating_account_id:, additional_properties: nil) ⇒ PaymentFlowCreateRequest

Returns a new instance of PaymentFlowCreateRequest.



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 58

def initialize(amount:, currency:, direction:, counterparty_id:,
               originating_account_id:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @amount = amount
  @currency = currency
  @direction = direction
  @counterparty_id = counterparty_id
  @originating_account_id = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountInteger

Required. Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000. Can be any integer up to 36 digits.

Returns:

  • (Integer)


15
16
17
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 15

def amount
  @amount
end

#counterparty_idUUID | String

Required. The ID of a counterparty associated with the payment. As part of the payment workflow an external account will be associated with this model.

Returns:

  • (UUID | String)


31
32
33
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 31

def counterparty_id
  @counterparty_id
end

#currencyString

Required. The currency of the payment.

Returns:

  • (String)


19
20
21
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 19

def currency
  @currency
end

#directionDirection10

Required. Describes the direction money is flowing in the transaction. Can only be ‘debit`. A `debit` pulls money from someone else’s account to your own.

Returns:



25
26
27
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 25

def direction
  @direction
end

#originating_account_idUUID | String

Required. The ID of one of your organization’s internal accounts.

Returns:

  • (UUID | String)


35
36
37
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 35

def 
  @originating_account_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash.key?('amount') ? hash['amount'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  direction = hash.key?('direction') ? hash['direction'] : nil
  counterparty_id =
    hash.key?('counterparty_id') ? hash['counterparty_id'] : nil
   =
    hash.key?('originating_account_id') ? hash['originating_account_id'] : nil

  # 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.
  PaymentFlowCreateRequest.new(amount: amount,
                               currency: currency,
                               direction: direction,
                               counterparty_id: counterparty_id,
                               originating_account_id: ,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['direction'] = 'direction'
  @_hash['counterparty_id'] = 'counterparty_id'
  @_hash['originating_account_id'] = 'originating_account_id'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 49

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
115
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount.inspect}, currency: #{@currency.inspect}, direction:"\
  " #{@direction.inspect}, counterparty_id: #{@counterparty_id.inspect},"\
  " originating_account_id: #{@originating_account_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
106
# File 'lib/modern_treasury/models/payment_flow_create_request.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount}, currency: #{@currency}, direction: #{@direction},"\
  " counterparty_id: #{@counterparty_id}, originating_account_id: #{@originating_account_id},"\
  " additional_properties: #{@additional_properties}>"
end