Class: FdxV660Api::PaymentEntity
- Defined in:
- lib/fdx_v660_api/models/payment_entity.rb
Overview
Represents a payment
Instance Attribute Summary collapse
-
#amount ⇒ Float
Amount for the payment.
-
#cancelled_timestamp ⇒ DateTime
When the payment was cancelled.
-
#description ⇒ String
The purpose of the payment as provided by consumer or payment-requesting app.
-
#due_date ⇒ Date
Date that the funds are scheduled to be delivered.
-
#failed_timestamp ⇒ DateTime
When the payment failed.
-
#from_account_id ⇒ String
ID of the account used to source funds for payment.
-
#links ⇒ Array[HateoasLink]
Links to related payment entities.
-
#merchant_account_id ⇒ String
User's account identifier with the merchant.
-
#payment_id ⇒ String
Uniquely identifies a payment.
-
#processed_timestamp ⇒ DateTime
When the payment was processed.
-
#recurring_payment_id ⇒ String
The recurring payment that spawned this payment.
-
#scheduled_timestamp ⇒ DateTime
When the payment was scheduled.
-
#started_processing_timestamp ⇒ DateTime
When the payment execution started.
-
#status ⇒ PaymentStatus3
Defines the status of the payment.
-
#to_payee_id ⇒ String
ID of the payee to receive funds for the payment.
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(from_account_id:, to_payee_id:, amount:, due_date:, payment_id:, status:, description: SKIP, merchant_account_id: SKIP, recurring_payment_id: SKIP, scheduled_timestamp: SKIP, processed_timestamp: SKIP, failed_timestamp: SKIP, cancelled_timestamp: SKIP, started_processing_timestamp: SKIP, links: SKIP, additional_properties: nil) ⇒ PaymentEntity
constructor
A new instance of PaymentEntity.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_cancelled_timestamp ⇒ Object
- #to_custom_failed_timestamp ⇒ Object
- #to_custom_processed_timestamp ⇒ Object
- #to_custom_scheduled_timestamp ⇒ Object
- #to_custom_started_processing_timestamp ⇒ 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(from_account_id:, to_payee_id:, amount:, due_date:, payment_id:, status:, description: SKIP, merchant_account_id: SKIP, recurring_payment_id: SKIP, scheduled_timestamp: SKIP, processed_timestamp: SKIP, failed_timestamp: SKIP, cancelled_timestamp: SKIP, started_processing_timestamp: SKIP, links: SKIP, additional_properties: nil) ⇒ PaymentEntity
Returns a new instance of PaymentEntity.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 117 def initialize(from_account_id:, to_payee_id:, amount:, due_date:, payment_id:, status:, description: SKIP, merchant_account_id: SKIP, recurring_payment_id: SKIP, scheduled_timestamp: SKIP, processed_timestamp: SKIP, failed_timestamp: SKIP, cancelled_timestamp: SKIP, started_processing_timestamp: SKIP, links: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @from_account_id = from_account_id @to_payee_id = to_payee_id @description = description unless description == SKIP @amount = amount @merchant_account_id = merchant_account_id unless merchant_account_id == SKIP @due_date = due_date @payment_id = payment_id @recurring_payment_id = recurring_payment_id unless recurring_payment_id == SKIP @scheduled_timestamp = unless == SKIP @processed_timestamp = unless == SKIP @failed_timestamp = unless == SKIP @cancelled_timestamp = unless == SKIP unless == SKIP @started_processing_timestamp = end @status = status @links = links unless links == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
Amount for the payment. Must be positive
28 29 30 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 28 def amount @amount end |
#cancelled_timestamp ⇒ DateTime
When the payment was cancelled
62 63 64 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 62 def @cancelled_timestamp end |
#description ⇒ String
The purpose of the payment as provided by consumer or payment-requesting app
24 25 26 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 24 def description @description end |
#due_date ⇒ Date
Date that the funds are scheduled to be delivered
36 37 38 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 36 def due_date @due_date end |
#failed_timestamp ⇒ DateTime
When the payment failed. Includes when the payment was determined to lack sufficient funds
58 59 60 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 58 def @failed_timestamp end |
#from_account_id ⇒ String
ID of the account used to source funds for payment
15 16 17 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 15 def from_account_id @from_account_id end |
#links ⇒ Array[HateoasLink]
Links to related payment entities
74 75 76 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 74 def links @links end |
#merchant_account_id ⇒ String
User's account identifier with the merchant
32 33 34 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 32 def merchant_account_id @merchant_account_id end |
#payment_id ⇒ String
Uniquely identifies a payment. Used within the API to reference a payment
40 41 42 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 40 def payment_id @payment_id end |
#processed_timestamp ⇒ DateTime
When the payment was processed
53 54 55 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 53 def @processed_timestamp end |
#recurring_payment_id ⇒ String
The recurring payment that spawned this payment. Null if payment is not associated with a recurring payment
45 46 47 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 45 def recurring_payment_id @recurring_payment_id end |
#scheduled_timestamp ⇒ DateTime
When the payment was scheduled
49 50 51 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 49 def @scheduled_timestamp end |
#started_processing_timestamp ⇒ DateTime
When the payment execution started
66 67 68 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 66 def @started_processing_timestamp end |
#status ⇒ PaymentStatus3
Defines the status of the payment
70 71 72 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 70 def status @status end |
#to_payee_id ⇒ String
ID of the payee to receive funds for the payment
19 20 21 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 19 def to_payee_id @to_payee_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
149 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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 149 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. from_account_id = hash.key?('fromAccountId') ? hash['fromAccountId'] : nil to_payee_id = hash.key?('toPayeeId') ? hash['toPayeeId'] : nil amount = hash.key?('amount') ? hash['amount'] : nil due_date = hash.key?('dueDate') ? hash['dueDate'] : nil payment_id = hash.key?('paymentId') ? hash['paymentId'] : nil status = hash.key?('status') ? hash['status'] : nil description = hash.key?('description') ? hash['description'] : SKIP merchant_account_id = hash.key?('merchantAccountId') ? hash['merchantAccountId'] : SKIP recurring_payment_id = hash.key?('recurringPaymentId') ? hash['recurringPaymentId'] : SKIP = if hash.key?('scheduledTimestamp') (DateTimeHelper.from_rfc3339(hash['scheduledTimestamp']) if hash['scheduledTimestamp']) else SKIP end = if hash.key?('processedTimestamp') (DateTimeHelper.from_rfc3339(hash['processedTimestamp']) if hash['processedTimestamp']) else SKIP end = if hash.key?('failedTimestamp') (DateTimeHelper.from_rfc3339(hash['failedTimestamp']) if hash['failedTimestamp']) else SKIP end = if hash.key?('cancelledTimestamp') (DateTimeHelper.from_rfc3339(hash['cancelledTimestamp']) if hash['cancelledTimestamp']) else SKIP end = if hash.key?('startedProcessingTimestamp') (DateTimeHelper.from_rfc3339(hash['startedProcessingTimestamp']) if hash['startedProcessingTimestamp']) else SKIP end # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (HateoasLink.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') # 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. PaymentEntity.new(from_account_id: from_account_id, to_payee_id: to_payee_id, amount: amount, due_date: due_date, payment_id: payment_id, status: status, description: description, merchant_account_id: merchant_account_id, recurring_payment_id: recurring_payment_id, scheduled_timestamp: , processed_timestamp: , failed_timestamp: , cancelled_timestamp: , started_processing_timestamp: , links: links, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 77 def self.names @_hash = {} if @_hash.nil? @_hash['from_account_id'] = 'fromAccountId' @_hash['to_payee_id'] = 'toPayeeId' @_hash['description'] = 'description' @_hash['amount'] = 'amount' @_hash['merchant_account_id'] = 'merchantAccountId' @_hash['due_date'] = 'dueDate' @_hash['payment_id'] = 'paymentId' @_hash['recurring_payment_id'] = 'recurringPaymentId' @_hash['scheduled_timestamp'] = 'scheduledTimestamp' @_hash['processed_timestamp'] = 'processedTimestamp' @_hash['failed_timestamp'] = 'failedTimestamp' @_hash['cancelled_timestamp'] = 'cancelledTimestamp' @_hash['started_processing_timestamp'] = 'startedProcessingTimestamp' @_hash['status'] = 'status' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
113 114 115 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 113 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 98 def self.optionals %w[ description merchant_account_id recurring_payment_id scheduled_timestamp processed_timestamp failed_timestamp cancelled_timestamp started_processing_timestamp links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 260 def inspect class_name = self.class.name.split('::').last "<#{class_name} from_account_id: #{@from_account_id.inspect}, to_payee_id:"\ " #{@to_payee_id.inspect}, description: #{@description.inspect}, amount: #{@amount.inspect},"\ " merchant_account_id: #{@merchant_account_id.inspect}, due_date: #{@due_date.inspect},"\ " payment_id: #{@payment_id.inspect}, recurring_payment_id:"\ " #{@recurring_payment_id.inspect}, scheduled_timestamp: #{@scheduled_timestamp.inspect},"\ " processed_timestamp: #{@processed_timestamp.inspect}, failed_timestamp:"\ " #{@failed_timestamp.inspect}, cancelled_timestamp: #{@cancelled_timestamp.inspect},"\ " started_processing_timestamp: #{@started_processing_timestamp.inspect}, status:"\ " #{@status.inspect}, links: #{@links.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_cancelled_timestamp ⇒ Object
238 239 240 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 238 def DateTimeHelper.to_rfc3339() end |
#to_custom_failed_timestamp ⇒ Object
234 235 236 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 234 def DateTimeHelper.to_rfc3339() end |
#to_custom_processed_timestamp ⇒ Object
230 231 232 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 230 def DateTimeHelper.to_rfc3339() end |
#to_custom_scheduled_timestamp ⇒ Object
226 227 228 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 226 def DateTimeHelper.to_rfc3339() end |
#to_custom_started_processing_timestamp ⇒ Object
242 243 244 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 242 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/fdx_v660_api/models/payment_entity.rb', line 247 def to_s class_name = self.class.name.split('::').last "<#{class_name} from_account_id: #{@from_account_id}, to_payee_id: #{@to_payee_id},"\ " description: #{@description}, amount: #{@amount}, merchant_account_id:"\ " #{@merchant_account_id}, due_date: #{@due_date}, payment_id: #{@payment_id},"\ " recurring_payment_id: #{@recurring_payment_id}, scheduled_timestamp:"\ " #{@scheduled_timestamp}, processed_timestamp: #{@processed_timestamp}, failed_timestamp:"\ " #{@failed_timestamp}, cancelled_timestamp: #{@cancelled_timestamp},"\ " started_processing_timestamp: #{@started_processing_timestamp}, status: #{@status}, links:"\ " #{@links}, additional_properties: #{@additional_properties}>" end |