Class: ModernTreasury::PaymentFlow
- Defined in:
- lib/modern_treasury/models/payment_flow.rb
Overview
PaymentFlow Model.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
Value in specified currency’s smallest unit.
-
#client_token ⇒ String
The client token of the payment flow.
-
#counterparty_id ⇒ UUID | String
The ID of a counterparty associated with the payment.
-
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#currency ⇒ String
The currency of the payment.
-
#direction ⇒ Direction9
Describes the direction money is flowing in the transaction.
-
#id ⇒ UUID | String
TODO: Write general description for this method.
-
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#object ⇒ String
TODO: Write general description for this method.
-
#originating_account_id ⇒ UUID | String
The ID of one of your organization’s internal accounts.
-
#payment_order_id ⇒ UUID | String
If present, the ID of the payment order created using this flow.
-
#receiving_account_id ⇒ UUID | String
If present, the ID of the external account created using this flow.
-
#status ⇒ Status17
The current status of the payment flow.
-
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(id: SKIP, object: SKIP, live_mode: SKIP, created_at: SKIP, updated_at: SKIP, client_token: SKIP, status: SKIP, amount: SKIP, currency: SKIP, direction: SKIP, counterparty_id: SKIP, receiving_account_id: SKIP, originating_account_id: SKIP, payment_order_id: SKIP) ⇒ PaymentFlow
constructor
A new instance of PaymentFlow.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id: SKIP, object: SKIP, live_mode: SKIP, created_at: SKIP, updated_at: SKIP, client_token: SKIP, status: SKIP, amount: SKIP, currency: SKIP, direction: SKIP, counterparty_id: SKIP, receiving_account_id: SKIP, originating_account_id: SKIP, payment_order_id: SKIP) ⇒ PaymentFlow
Returns a new instance of PaymentFlow.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 128 def initialize(id: SKIP, object: SKIP, live_mode: SKIP, created_at: SKIP, updated_at: SKIP, client_token: SKIP, status: SKIP, amount: SKIP, currency: SKIP, direction: SKIP, counterparty_id: SKIP, receiving_account_id: SKIP, originating_account_id: SKIP, payment_order_id: SKIP) @id = id unless id == SKIP @object = object unless object == SKIP @live_mode = live_mode unless live_mode == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP @client_token = client_token unless client_token == SKIP @status = status unless status == SKIP @amount = amount unless amount == SKIP @currency = currency unless currency == SKIP @direction = direction unless direction == SKIP @counterparty_id = counterparty_id unless counterparty_id == SKIP @receiving_account_id = receiving_account_id unless receiving_account_id == SKIP @originating_account_id = originating_account_id unless originating_account_id == SKIP @payment_order_id = payment_order_id unless payment_order_id == SKIP end |
Instance Attribute Details
#amount ⇒ Integer
Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000. Can be any integer up to 36 digits.
49 50 51 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 49 def amount @amount end |
#client_token ⇒ String
The client token of the payment flow. This token can be used to embed a payment workflow in your client-side application.
39 40 41 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 39 def client_token @client_token end |
#counterparty_id ⇒ UUID | String
The ID of a counterparty associated with the payment. As part of the payment workflow an external account will be associated with this counterparty.
64 65 66 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 64 def counterparty_id @counterparty_id end |
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
29 30 31 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 29 def created_at @created_at end |
#currency ⇒ String
The currency of the payment.
53 54 55 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 53 def currency @currency end |
#direction ⇒ Direction9
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.
58 59 60 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 58 def direction @direction end |
#id ⇒ UUID | String
TODO: Write general description for this method
15 16 17 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 15 def id @id end |
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
24 25 26 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 24 def live_mode @live_mode end |
#object ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 19 def object @object end |
#originating_account_id ⇒ UUID | String
The ID of one of your organization’s internal accounts.
72 73 74 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 72 def originating_account_id @originating_account_id end |
#payment_order_id ⇒ UUID | String
If present, the ID of the payment order created using this flow.
76 77 78 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 76 def payment_order_id @payment_order_id end |
#receiving_account_id ⇒ UUID | String
If present, the ID of the external account created using this flow.
68 69 70 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 68 def receiving_account_id @receiving_account_id end |
#status ⇒ Status17
The current status of the payment flow. One of ‘pending`, `completed`, `expired`, or `cancelled`.
44 45 46 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 44 def status @status end |
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
34 35 36 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 34 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
150 151 152 153 154 155 156 157 158 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 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 150 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP object = hash.key?('object') ? hash['object'] : SKIP live_mode = hash.key?('live_mode') ? hash['live_mode'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) else SKIP end client_token = hash.key?('client_token') ? hash['client_token'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP direction = hash.key?('direction') ? hash['direction'] : SKIP counterparty_id = hash.key?('counterparty_id') ? hash['counterparty_id'] : SKIP receiving_account_id = hash.key?('receiving_account_id') ? hash['receiving_account_id'] : SKIP originating_account_id = hash.key?('originating_account_id') ? hash['originating_account_id'] : SKIP payment_order_id = hash.key?('payment_order_id') ? hash['payment_order_id'] : SKIP # Create object from extracted values. PaymentFlow.new(id: id, object: object, live_mode: live_mode, created_at: created_at, updated_at: updated_at, client_token: client_token, status: status, amount: amount, currency: currency, direction: direction, counterparty_id: counterparty_id, receiving_account_id: receiving_account_id, originating_account_id: originating_account_id, payment_order_id: payment_order_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 79 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['object'] = 'object' @_hash['live_mode'] = 'live_mode' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['client_token'] = 'client_token' @_hash['status'] = 'status' @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['direction'] = 'direction' @_hash['counterparty_id'] = 'counterparty_id' @_hash['receiving_account_id'] = 'receiving_account_id' @_hash['originating_account_id'] = 'originating_account_id' @_hash['payment_order_id'] = 'payment_order_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
119 120 121 122 123 124 125 126 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 119 def self.nullables %w[ counterparty_id receiving_account_id originating_account_id payment_order_id ] end |
.optionals ⇒ Object
An array for optional fields
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 99 def self.optionals %w[ id object live_mode created_at updated_at client_token status amount currency direction counterparty_id receiving_account_id originating_account_id payment_order_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
218 219 220 221 222 223 224 225 226 227 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 218 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ " #{@updated_at.inspect}, client_token: #{@client_token.inspect}, status:"\ " #{@status.inspect}, amount: #{@amount.inspect}, currency: #{@currency.inspect}, direction:"\ " #{@direction.inspect}, counterparty_id: #{@counterparty_id.inspect}, receiving_account_id:"\ " #{@receiving_account_id.inspect}, originating_account_id:"\ " #{@originating_account_id.inspect}, payment_order_id: #{@payment_order_id.inspect}>" end |
#to_custom_created_at ⇒ Object
198 199 200 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 198 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
202 203 204 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 202 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
207 208 209 210 211 212 213 214 215 |
# File 'lib/modern_treasury/models/payment_flow.rb', line 207 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, client_token: #{@client_token}, status:"\ " #{@status}, amount: #{@amount}, currency: #{@currency}, direction: #{@direction},"\ " counterparty_id: #{@counterparty_id}, receiving_account_id: #{@receiving_account_id},"\ " originating_account_id: #{@originating_account_id}, payment_order_id:"\ " #{@payment_order_id}>" end |