Class: UnivapayClientSdk::ChargeCaptureRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::ChargeCaptureRequest
- Defined in:
- lib/univapay_client_sdk/models/charge_capture_request.rb
Overview
Request payload for capturing an authorized charge. Both fields are optional; omit the entire body to capture the full outstanding amount.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
The amount to capture.
-
#currency ⇒ String
ISO-4217 currency code.
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(amount: SKIP, currency: SKIP, additional_properties: nil) ⇒ ChargeCaptureRequest
constructor
A new instance of ChargeCaptureRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(amount: SKIP, currency: SKIP, additional_properties: nil) ⇒ ChargeCaptureRequest
Returns a new instance of ChargeCaptureRequest.
45 46 47 48 49 50 51 52 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 45 def initialize(amount: SKIP, currency: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @amount = amount unless amount == SKIP @currency = currency unless currency == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Integer
The amount to capture. Must be less than or equal to the authorized amount. If omitted, the full outstanding authorized amount is captured.
16 17 18 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 16 def amount @amount end |
#currency ⇒ String
ISO-4217 currency code. Must exactly match the currency used during authorization. If omitted, defaults to the currency originally requested on the charge.
22 23 24 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 22 def currency @currency end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP # 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. ChargeCaptureRequest.new(amount: amount, currency: currency, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 36 37 38 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 33 def self.optionals %w[ amount currency ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
83 84 85 86 87 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 83 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, currency: #{@currency.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
76 77 78 79 80 |
# File 'lib/univapay_client_sdk/models/charge_capture_request.rb', line 76 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, currency: #{@currency}, additional_properties:"\ " #{@additional_properties}>" end |