Class: CyberSourceMergedSpec::VoidAmountDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/void_amount_details.rb

Overview

VoidAmountDetails Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(void_amount: SKIP, original_transaction_amount: SKIP, currency: SKIP, additional_properties: nil) ⇒ VoidAmountDetails

Returns a new instance of VoidAmountDetails.



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 85

def initialize(void_amount: SKIP, original_transaction_amount: SKIP,
               currency: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @void_amount = void_amount unless void_amount == SKIP
  unless original_transaction_amount == SKIP
    @original_transaction_amount =
      original_transaction_amount
  end
  @currency = currency unless currency == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#currencyString

Currency used for the order. Use the three-character [ISO Standard Currency Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cur rencies.pdf)

Used by

Authorization Required field. Authorization Reversal For an authorization reversal (reversalInformation) or a capture (processingOptions.capture is set to true), you must use the same currency that you used in your payment authorization request.

PIN Debit

Currency for the amount you requested for the PIN debit purchase. This value is returned for partial authorizations. The issuing bank can approve a partial amount if the balance on the debit card is less than the requested transaction amount. For the possible values, see the [ISO Standard Currency Codes](https://developer.cybersource.com/library/documentation/sbc/quickre f/currencies.pdf). Returned by PIN debit purchase. For PIN debit reversal requests, you must use the same currency that was used for the PIN debit purchase or PIN debit credit that you are reversing. For the possible values, see the [ISO Standard Currency Codes](https://developer.cybersource.com/library/documentation/sbc/quickre f/currencies.pdf). Required field for PIN Debit purchase and PIN Debit credit requests. Optional field for PIN Debit reversal requests.

GPX

This field is optional for reversing an authorization or credit.

DCC for First Data

Your local currency.

Tax Calculation

Required for international tax and value added tax only. Optional for U.S. and Canadian taxes. Your local currency.

Returns:

  • (String)


60
61
62
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 60

def currency
  @currency
end

#original_transaction_amountString

Amount of the original transaction.

Returns:

  • (String)


21
22
23
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 21

def original_transaction_amount
  @original_transaction_amount
end

#void_amountString

Total amount of the void.

PIN Debit

Amount of the reversal. Returned by PIN debit reversal.

Returns:

  • (String)


17
18
19
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 17

def void_amount
  @void_amount
end

Class Method Details

.from_element(root) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 123

def self.from_element(root)
  void_amount = XmlUtilities.from_element(root, 'voidAmount', String)
  original_transaction_amount = XmlUtilities.from_element(
    root, 'originalTransactionAmount', String
  )
  currency = XmlUtilities.from_element(root, 'currency', String)

  new(void_amount: void_amount,
      original_transaction_amount: original_transaction_amount,
      currency: currency,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  void_amount = hash.key?('voidAmount') ? hash['voidAmount'] : SKIP
  original_transaction_amount =
    hash.key?('originalTransactionAmount') ? hash['originalTransactionAmount'] : 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.
  VoidAmountDetails.new(void_amount: void_amount,
                        original_transaction_amount: original_transaction_amount,
                        currency: currency,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['void_amount'] = 'voidAmount'
  @_hash['original_transaction_amount'] = 'originalTransactionAmount'
  @_hash['currency'] = 'currency'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



72
73
74
75
76
77
78
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 72

def self.optionals
  %w[
    void_amount
    original_transaction_amount
    currency
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



158
159
160
161
162
163
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 158

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} void_amount: #{@void_amount.inspect}, original_transaction_amount:"\
  " #{@original_transaction_amount.inspect}, currency: #{@currency.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



150
151
152
153
154
155
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 150

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} void_amount: #{@void_amount}, original_transaction_amount:"\
  " #{@original_transaction_amount}, currency: #{@currency}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/cyber_source_merged_spec/models/void_amount_details.rb', line 136

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'voidAmount', void_amount)
  XmlUtilities.add_as_subelement(doc, root, 'originalTransactionAmount',
                                 original_transaction_amount)
  XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end