Class: UnivapayClientSdk::RefundCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::RefundCreateRequest
- Defined in:
- lib/univapay_client_sdk/models/refund_create_request.rb
Overview
Request body for creating a refund against a successful charge. Konbini and bank transfer charges cannot be refunded.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
Amount to refund in the smallest currency unit.
-
#currency ⇒ String
ISO-4217 currency code.
-
#message ⇒ String
Optional free-text note about the reason for the refund.
-
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
-
#reason ⇒ RefundReasonRequest
The reason for the refund (merchant-settable values).
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:, currency:, reason: SKIP, message: SKIP, metadata: SKIP, additional_properties: nil) ⇒ RefundCreateRequest
constructor
A new instance of RefundCreateRequest.
-
#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:, currency:, reason: SKIP, message: SKIP, metadata: SKIP, additional_properties: nil) ⇒ RefundCreateRequest
Returns a new instance of RefundCreateRequest.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 63 def initialize(amount:, currency:, reason: SKIP, message: SKIP, metadata: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @amount = amount @currency = currency @reason = reason unless reason == SKIP @message = unless == SKIP @metadata = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Integer
Amount to refund in the smallest currency unit. Must be greater than 0 and not exceed the charged amount. Partial refunds are supported for most payment methods.
17 18 19 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 17 def amount @amount end |
#currency ⇒ String
ISO-4217 currency code. Must exactly match the currency of the original charge.
22 23 24 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 22 def currency @currency end |
#message ⇒ String
Optional free-text note about the reason for the refund.
32 33 34 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 32 def @message end |
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
36 37 38 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 36 def @metadata end |
#reason ⇒ RefundReasonRequest
The reason for the refund (merchant-settable values). duplicate: A
duplicate charge was made. fraud: The charge is fraudulent.
customer_request: The customer requested the refund.
28 29 30 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 28 def reason @reason end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 77 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 reason = hash.key?('reason') ? hash['reason'] : SKIP = hash.key?('message') ? hash['message'] : SKIP = GenericMetadata.from_hash(hash['metadata']) if hash['metadata'] # 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. RefundCreateRequest.new(amount: amount, currency: currency, reason: reason, message: , metadata: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['reason'] = 'reason' @_hash['message'] = 'message' @_hash['metadata'] = 'metadata' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 50 def self.optionals %w[ reason message metadata ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, currency: #{@currency.inspect}, reason:"\ " #{@reason.inspect}, message: #{@message.inspect}, metadata: #{@metadata.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
104 105 106 107 108 |
# File 'lib/univapay_client_sdk/models/refund_create_request.rb', line 104 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, currency: #{@currency}, reason: #{@reason}, message:"\ " #{@message}, metadata: #{@metadata}, additional_properties: #{@additional_properties}>" end |