Class: UnivapayClientSdk::Charge
- Defined in:
- lib/univapay_client_sdk/models/charge.rb
Overview
Charge resource returned by the payments API.
Instance Attribute Summary collapse
-
#capture_at ⇒ DateTime
Timestamp when capture should occur.
-
#charged_amount ⇒ Integer
Charged amount in the smallest currency unit.
-
#charged_amount_formatted ⇒ Float
Charged amount formatted for display.
-
#charged_currency ⇒ String
Charged ISO-4217 currency code.
-
#created_on ⇒ DateTime
Timestamp when the resource was created.
-
#descriptor ⇒ String
Billing descriptor.
-
#descriptor_phone_number ⇒ String
Billing descriptor phone number.
-
#error ⇒ PaymentError
Payment error details, or null if successful.
-
#fee_amount ⇒ Integer
Fee amount in the smallest currency unit.
-
#fee_amount_formatted ⇒ Float
Fee amount formatted for display.
-
#fee_currency ⇒ String
Fee ISO-4217 currency code.
-
#id ⇒ UUID | String
Unique identifier.
-
#merchant_name ⇒ String
Merchant display name.
-
#merchant_transaction_id ⇒ String
Merchant-defined transaction identifier.
-
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
-
#mode ⇒ ChargeMode
Charge Mode schema.
-
#only_direct_currency ⇒ TrueClass | FalseClass
Whether only direct currency processing is allowed.
-
#redirect ⇒ ChargeRedirect
Charge Redirect schema.
-
#requested_amount ⇒ Integer
Requested amount in the smallest currency unit.
-
#requested_amount_formatted ⇒ Float
Requested amount formatted for display.
-
#requested_currency ⇒ String
Requested ISO-4217 currency code.
-
#status ⇒ ChargeStatus
Charge Status schema.
-
#store_id ⇒ UUID | String
Store identifier.
-
#store_name ⇒ String
Store display name.
-
#subscription_id ⇒ UUID | String
Subscription identifier.
-
#three_ds ⇒ ChargeThreeDs
Charge Three Ds schema.
-
#transaction_token_id ⇒ UUID | String
Transaction token identifier.
-
#transaction_token_type ⇒ ChargeTransactionTokenType
Charge Transaction Token Type schema.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(id: SKIP, store_id: SKIP, transaction_token_id: SKIP, transaction_token_type: SKIP, subscription_id: SKIP, merchant_transaction_id: SKIP, requested_amount: SKIP, requested_currency: SKIP, requested_amount_formatted: SKIP, charged_amount: SKIP, charged_currency: SKIP, charged_amount_formatted: SKIP, fee_amount: SKIP, fee_currency: SKIP, fee_amount_formatted: SKIP, only_direct_currency: SKIP, capture_at: SKIP, descriptor: SKIP, descriptor_phone_number: SKIP, status: SKIP, error: SKIP, metadata: SKIP, mode: SKIP, created_on: SKIP, merchant_name: SKIP, store_name: SKIP, redirect: SKIP, three_ds: SKIP, additional_properties: nil) ⇒ Charge
constructor
A new instance of Charge.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_capture_at ⇒ Object
- #to_custom_created_on ⇒ 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, store_id: SKIP, transaction_token_id: SKIP, transaction_token_type: SKIP, subscription_id: SKIP, merchant_transaction_id: SKIP, requested_amount: SKIP, requested_currency: SKIP, requested_amount_formatted: SKIP, charged_amount: SKIP, charged_currency: SKIP, charged_amount_formatted: SKIP, fee_amount: SKIP, fee_currency: SKIP, fee_amount_formatted: SKIP, only_direct_currency: SKIP, capture_at: SKIP, descriptor: SKIP, descriptor_phone_number: SKIP, status: SKIP, error: SKIP, metadata: SKIP, mode: SKIP, created_on: SKIP, merchant_name: SKIP, store_name: SKIP, redirect: SKIP, three_ds: SKIP, additional_properties: nil) ⇒ Charge
Returns a new instance of Charge.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 211 def initialize(id: SKIP, store_id: SKIP, transaction_token_id: SKIP, transaction_token_type: SKIP, subscription_id: SKIP, merchant_transaction_id: SKIP, requested_amount: SKIP, requested_currency: SKIP, requested_amount_formatted: SKIP, charged_amount: SKIP, charged_currency: SKIP, charged_amount_formatted: SKIP, fee_amount: SKIP, fee_currency: SKIP, fee_amount_formatted: SKIP, only_direct_currency: SKIP, capture_at: SKIP, descriptor: SKIP, descriptor_phone_number: SKIP, status: SKIP, error: SKIP, metadata: SKIP, mode: SKIP, created_on: SKIP, merchant_name: SKIP, store_name: SKIP, redirect: SKIP, three_ds: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @store_id = store_id unless store_id == SKIP @transaction_token_id = transaction_token_id unless transaction_token_id == SKIP @transaction_token_type = transaction_token_type unless transaction_token_type == SKIP @subscription_id = subscription_id unless subscription_id == SKIP @merchant_transaction_id = merchant_transaction_id unless merchant_transaction_id == SKIP @requested_amount = requested_amount unless requested_amount == SKIP @requested_currency = requested_currency unless requested_currency == SKIP unless requested_amount_formatted == SKIP @requested_amount_formatted = requested_amount_formatted end @charged_amount = charged_amount unless charged_amount == SKIP @charged_currency = charged_currency unless charged_currency == SKIP @charged_amount_formatted = charged_amount_formatted unless charged_amount_formatted == SKIP @fee_amount = fee_amount unless fee_amount == SKIP @fee_currency = fee_currency unless fee_currency == SKIP @fee_amount_formatted = fee_amount_formatted unless fee_amount_formatted == SKIP @only_direct_currency = only_direct_currency unless only_direct_currency == SKIP @capture_at = capture_at unless capture_at == SKIP @descriptor = descriptor unless descriptor == SKIP @descriptor_phone_number = descriptor_phone_number unless descriptor_phone_number == SKIP @status = status unless status == SKIP @error = error unless error == SKIP @metadata = unless == SKIP @mode = mode unless mode == SKIP @created_on = created_on unless created_on == SKIP @merchant_name = merchant_name unless merchant_name == SKIP @store_name = store_name unless store_name == SKIP @redirect = redirect unless redirect == SKIP @three_ds = three_ds unless three_ds == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#capture_at ⇒ DateTime
Timestamp when capture should occur.
79 80 81 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 79 def capture_at @capture_at end |
#charged_amount ⇒ Integer
Charged amount in the smallest currency unit.
51 52 53 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 51 def charged_amount @charged_amount end |
#charged_amount_formatted ⇒ Float
Charged amount formatted for display.
59 60 61 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 59 def charged_amount_formatted @charged_amount_formatted end |
#charged_currency ⇒ String
Charged ISO-4217 currency code.
55 56 57 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 55 def charged_currency @charged_currency end |
#created_on ⇒ DateTime
Timestamp when the resource was created.
107 108 109 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 107 def created_on @created_on end |
#descriptor ⇒ String
Billing descriptor.
83 84 85 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 83 def descriptor @descriptor end |
#descriptor_phone_number ⇒ String
Billing descriptor phone number.
87 88 89 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 87 def descriptor_phone_number @descriptor_phone_number end |
#error ⇒ PaymentError
Payment error details, or null if successful.
95 96 97 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 95 def error @error end |
#fee_amount ⇒ Integer
Fee amount in the smallest currency unit.
63 64 65 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 63 def fee_amount @fee_amount end |
#fee_amount_formatted ⇒ Float
Fee amount formatted for display.
71 72 73 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 71 def fee_amount_formatted @fee_amount_formatted end |
#fee_currency ⇒ String
Fee ISO-4217 currency code.
67 68 69 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 67 def fee_currency @fee_currency end |
#id ⇒ UUID | String
Unique identifier.
15 16 17 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 15 def id @id end |
#merchant_name ⇒ String
Merchant display name.
111 112 113 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 111 def merchant_name @merchant_name end |
#merchant_transaction_id ⇒ String
Merchant-defined transaction identifier.
35 36 37 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 35 def merchant_transaction_id @merchant_transaction_id end |
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
99 100 101 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 99 def @metadata end |
#mode ⇒ ChargeMode
Charge Mode schema.
103 104 105 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 103 def mode @mode end |
#only_direct_currency ⇒ TrueClass | FalseClass
Whether only direct currency processing is allowed.
75 76 77 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 75 def only_direct_currency @only_direct_currency end |
#redirect ⇒ ChargeRedirect
Charge Redirect schema.
119 120 121 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 119 def redirect @redirect end |
#requested_amount ⇒ Integer
Requested amount in the smallest currency unit.
39 40 41 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 39 def requested_amount @requested_amount end |
#requested_amount_formatted ⇒ Float
Requested amount formatted for display.
47 48 49 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 47 def requested_amount_formatted @requested_amount_formatted end |
#requested_currency ⇒ String
Requested ISO-4217 currency code.
43 44 45 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 43 def requested_currency @requested_currency end |
#status ⇒ ChargeStatus
Charge Status schema.
91 92 93 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 91 def status @status end |
#store_id ⇒ UUID | String
Store identifier.
19 20 21 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 19 def store_id @store_id end |
#store_name ⇒ String
Store display name.
115 116 117 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 115 def store_name @store_name end |
#subscription_id ⇒ UUID | String
Subscription identifier.
31 32 33 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 31 def subscription_id @subscription_id end |
#three_ds ⇒ ChargeThreeDs
Charge Three Ds schema.
123 124 125 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 123 def three_ds @three_ds end |
#transaction_token_id ⇒ UUID | String
Transaction token identifier.
23 24 25 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 23 def transaction_token_id @transaction_token_id end |
#transaction_token_type ⇒ ChargeTransactionTokenType
Charge Transaction Token Type schema.
27 28 29 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 27 def transaction_token_type @transaction_token_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 261 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP store_id = hash.key?('store_id') ? hash['store_id'] : SKIP transaction_token_id = hash.key?('transaction_token_id') ? hash['transaction_token_id'] : SKIP transaction_token_type = hash.key?('transaction_token_type') ? hash['transaction_token_type'] : SKIP subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : SKIP merchant_transaction_id = hash.key?('merchant_transaction_id') ? hash['merchant_transaction_id'] : SKIP requested_amount = hash.key?('requested_amount') ? hash['requested_amount'] : SKIP requested_currency = hash.key?('requested_currency') ? hash['requested_currency'] : SKIP requested_amount_formatted = hash.key?('requested_amount_formatted') ? hash['requested_amount_formatted'] : SKIP charged_amount = hash.key?('charged_amount') ? hash['charged_amount'] : SKIP charged_currency = hash.key?('charged_currency') ? hash['charged_currency'] : SKIP charged_amount_formatted = hash.key?('charged_amount_formatted') ? hash['charged_amount_formatted'] : SKIP fee_amount = hash.key?('fee_amount') ? hash['fee_amount'] : SKIP fee_currency = hash.key?('fee_currency') ? hash['fee_currency'] : SKIP fee_amount_formatted = hash.key?('fee_amount_formatted') ? hash['fee_amount_formatted'] : SKIP only_direct_currency = hash.key?('only_direct_currency') ? hash['only_direct_currency'] : SKIP capture_at = if hash.key?('capture_at') (DateTimeHelper.from_rfc3339(hash['capture_at']) if hash['capture_at']) else SKIP end descriptor = hash.key?('descriptor') ? hash['descriptor'] : SKIP descriptor_phone_number = hash.key?('descriptor_phone_number') ? hash['descriptor_phone_number'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP error = PaymentError.from_hash(hash['error']) if hash['error'] = GenericMetadata.from_hash(hash['metadata']) if hash['metadata'] mode = hash.key?('mode') ? hash['mode'] : SKIP created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) else SKIP end merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : SKIP store_name = hash.key?('store_name') ? hash['store_name'] : SKIP redirect = ChargeRedirect.from_hash(hash['redirect']) if hash['redirect'] three_ds = ChargeThreeDs.from_hash(hash['three_ds']) if hash['three_ds'] # 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. Charge.new(id: id, store_id: store_id, transaction_token_id: transaction_token_id, transaction_token_type: transaction_token_type, subscription_id: subscription_id, merchant_transaction_id: merchant_transaction_id, requested_amount: requested_amount, requested_currency: requested_currency, requested_amount_formatted: requested_amount_formatted, charged_amount: charged_amount, charged_currency: charged_currency, charged_amount_formatted: charged_amount_formatted, fee_amount: fee_amount, fee_currency: fee_currency, fee_amount_formatted: fee_amount_formatted, only_direct_currency: only_direct_currency, capture_at: capture_at, descriptor: descriptor, descriptor_phone_number: descriptor_phone_number, status: status, error: error, metadata: , mode: mode, created_on: created_on, merchant_name: merchant_name, store_name: store_name, redirect: redirect, three_ds: three_ds, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 126 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['store_id'] = 'store_id' @_hash['transaction_token_id'] = 'transaction_token_id' @_hash['transaction_token_type'] = 'transaction_token_type' @_hash['subscription_id'] = 'subscription_id' @_hash['merchant_transaction_id'] = 'merchant_transaction_id' @_hash['requested_amount'] = 'requested_amount' @_hash['requested_currency'] = 'requested_currency' @_hash['requested_amount_formatted'] = 'requested_amount_formatted' @_hash['charged_amount'] = 'charged_amount' @_hash['charged_currency'] = 'charged_currency' @_hash['charged_amount_formatted'] = 'charged_amount_formatted' @_hash['fee_amount'] = 'fee_amount' @_hash['fee_currency'] = 'fee_currency' @_hash['fee_amount_formatted'] = 'fee_amount_formatted' @_hash['only_direct_currency'] = 'only_direct_currency' @_hash['capture_at'] = 'capture_at' @_hash['descriptor'] = 'descriptor' @_hash['descriptor_phone_number'] = 'descriptor_phone_number' @_hash['status'] = 'status' @_hash['error'] = 'error' @_hash['metadata'] = 'metadata' @_hash['mode'] = 'mode' @_hash['created_on'] = 'created_on' @_hash['merchant_name'] = 'merchant_name' @_hash['store_name'] = 'store_name' @_hash['redirect'] = 'redirect' @_hash['three_ds'] = 'three_ds' @_hash end |
.nullables ⇒ Object
An array for nullable fields
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 194 def self.nullables %w[ subscription_id merchant_transaction_id charged_amount charged_currency charged_amount_formatted fee_amount fee_currency fee_amount_formatted capture_at descriptor descriptor_phone_number error ] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 160 def self.optionals %w[ id store_id transaction_token_id transaction_token_type subscription_id merchant_transaction_id requested_amount requested_currency requested_amount_formatted charged_amount charged_currency charged_amount_formatted fee_amount fee_currency fee_amount_formatted only_direct_currency capture_at descriptor descriptor_phone_number status error metadata mode created_on merchant_name store_name redirect three_ds ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
364 365 366 367 368 369 370 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 364 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 391 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, store_id: #{@store_id.inspect}, transaction_token_id:"\ " #{@transaction_token_id.inspect}, transaction_token_type:"\ " #{@transaction_token_type.inspect}, subscription_id: #{@subscription_id.inspect},"\ " merchant_transaction_id: #{@merchant_transaction_id.inspect}, requested_amount:"\ " #{@requested_amount.inspect}, requested_currency: #{@requested_currency.inspect},"\ " requested_amount_formatted: #{@requested_amount_formatted.inspect}, charged_amount:"\ " #{@charged_amount.inspect}, charged_currency: #{@charged_currency.inspect},"\ " charged_amount_formatted: #{@charged_amount_formatted.inspect}, fee_amount:"\ " #{@fee_amount.inspect}, fee_currency: #{@fee_currency.inspect}, fee_amount_formatted:"\ " #{@fee_amount_formatted.inspect}, only_direct_currency: #{@only_direct_currency.inspect},"\ " capture_at: #{@capture_at.inspect}, descriptor: #{@descriptor.inspect},"\ " descriptor_phone_number: #{@descriptor_phone_number.inspect}, status: #{@status.inspect},"\ " error: #{@error.inspect}, metadata: #{@metadata.inspect}, mode: #{@mode.inspect},"\ " created_on: #{@created_on.inspect}, merchant_name: #{@merchant_name.inspect}, store_name:"\ " #{@store_name.inspect}, redirect: #{@redirect.inspect}, three_ds: #{@three_ds.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_capture_at ⇒ Object
354 355 356 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 354 def to_custom_capture_at DateTimeHelper.to_rfc3339(capture_at) end |
#to_custom_created_on ⇒ Object
358 359 360 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 358 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/univapay_client_sdk/models/charge.rb', line 373 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, store_id: #{@store_id}, transaction_token_id:"\ " #{@transaction_token_id}, transaction_token_type: #{@transaction_token_type},"\ " subscription_id: #{@subscription_id}, merchant_transaction_id:"\ " #{@merchant_transaction_id}, requested_amount: #{@requested_amount}, requested_currency:"\ " #{@requested_currency}, requested_amount_formatted: #{@requested_amount_formatted},"\ " charged_amount: #{@charged_amount}, charged_currency: #{@charged_currency},"\ " charged_amount_formatted: #{@charged_amount_formatted}, fee_amount: #{@fee_amount},"\ " fee_currency: #{@fee_currency}, fee_amount_formatted: #{@fee_amount_formatted},"\ " only_direct_currency: #{@only_direct_currency}, capture_at: #{@capture_at}, descriptor:"\ " #{@descriptor}, descriptor_phone_number: #{@descriptor_phone_number}, status: #{@status},"\ " error: #{@error}, metadata: #{@metadata}, mode: #{@mode}, created_on: #{@created_on},"\ " merchant_name: #{@merchant_name}, store_name: #{@store_name}, redirect: #{@redirect},"\ " three_ds: #{@three_ds}, additional_properties: #{@additional_properties}>" end |