Class: CyberSourceMergedSpec::AmountDetails60
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::AmountDetails60
- Defined in:
- lib/cyber_source_merged_spec/models/amount_details60.rb
Overview
Contains all of the amount-related fields.
Instance Attribute Summary collapse
-
#currency ⇒ String
Currency used for the order.
-
#discount_amount ⇒ String
Total discount amount applied to the order.
-
#discount_percent ⇒ String
The total discount percentage applied to the order.
-
#freight ⇒ Freight
Contains all of the shipping-related fields for the order.
-
#minimum_partial_amount ⇒ String
The minimum partial amount required to pay the invoice.
-
#sub_amount ⇒ String
Sub-amount of the order.
-
#tax_details ⇒ TaxDetails13
Contains all of the tax-related fields for the order.
-
#total_amount ⇒ String
Grand total for the order.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.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(total_amount:, currency:, discount_amount: SKIP, discount_percent: SKIP, sub_amount: SKIP, minimum_partial_amount: SKIP, tax_details: SKIP, freight: SKIP, additional_properties: nil) ⇒ AmountDetails60
constructor
A new instance of AmountDetails60.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ 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(total_amount:, currency:, discount_amount: SKIP, discount_percent: SKIP, sub_amount: SKIP, minimum_partial_amount: SKIP, tax_details: SKIP, freight: SKIP, additional_properties: nil) ⇒ AmountDetails60
Returns a new instance of AmountDetails60.
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 139 def initialize(total_amount:, currency:, discount_amount: SKIP, discount_percent: SKIP, sub_amount: SKIP, minimum_partial_amount: SKIP, tax_details: SKIP, freight: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @total_amount = total_amount @currency = currency @discount_amount = discount_amount unless discount_amount == SKIP @discount_percent = discount_percent unless discount_percent == SKIP @sub_amount = sub_amount unless sub_amount == SKIP @minimum_partial_amount = minimum_partial_amount unless minimum_partial_amount == SKIP @tax_details = tax_details unless tax_details == SKIP @freight = freight unless freight == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#currency ⇒ String
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.
82 83 84 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 82 def currency @currency end |
#discount_amount ⇒ String
Total discount amount applied to the order.
86 87 88 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 86 def discount_amount @discount_amount end |
#discount_percent ⇒ String
The total discount percentage applied to the order.
90 91 92 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 90 def discount_percent @discount_percent end |
#freight ⇒ Freight
Contains all of the shipping-related fields for the order.
106 107 108 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 106 def freight @freight end |
#minimum_partial_amount ⇒ String
The minimum partial amount required to pay the invoice.
98 99 100 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 98 def minimum_partial_amount @minimum_partial_amount end |
#sub_amount ⇒ String
Sub-amount of the order.
94 95 96 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 94 def sub_amount @sub_amount end |
#tax_details ⇒ TaxDetails13
Contains all of the tax-related fields for the order.
102 103 104 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 102 def tax_details @tax_details end |
#total_amount ⇒ String
Grand total for the order. This value cannot be negative. You can include a decimal point (.), but no other special characters. CyberSource truncates the amount to the correct number of decimal places. Note For CTV, FDCCompass, Paymentech processors, the maximum length for this field is 12. Important Some processors have specific requirements and limitations, such as maximum amounts and maximum field lengths. If your processor supports zero amount authorizations, you can set this field to 0 for the authorization to check if the card is lost or stolen.
Card Present
Required to include either this field or
orderInformation.lineItems[].unitPrice for the order.
Invoicing / Pay By Link
Required for creating a new invoice or payment link.
PIN Debit
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. 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; however, for all other processors, these fields are required.
DCC with a Third-Party Provider
Set this field to the converted amount that was returned by the DCC provider. You must include either this field or the 1st line item in the order and the specific line-order amount in your request.
DCC for First Data
Not used.
43 44 45 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 43 def total_amount @total_amount end |
Class Method Details
.from_element(root) ⇒ Object
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 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 193 def self.from_element(root) total_amount = XmlUtilities.from_element(root, 'totalAmount', String) currency = XmlUtilities.from_element(root, 'currency', String) discount_amount = XmlUtilities.from_element(root, 'discountAmount', String) discount_percent = XmlUtilities.from_element(root, 'discountPercent', String) sub_amount = XmlUtilities.from_element(root, 'subAmount', String) minimum_partial_amount = XmlUtilities.from_element(root, 'minimumPartialAmount', String) tax_details = XmlUtilities.from_element(root, 'TaxDetails13', TaxDetails13) freight = XmlUtilities.from_element(root, 'Freight', Freight) new(total_amount: total_amount, currency: currency, discount_amount: discount_amount, discount_percent: discount_percent, sub_amount: sub_amount, minimum_partial_amount: minimum_partial_amount, tax_details: tax_details, freight: freight, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 158 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : nil currency = hash.key?('currency') ? hash['currency'] : nil discount_amount = hash.key?('discountAmount') ? hash['discountAmount'] : SKIP discount_percent = hash.key?('discountPercent') ? hash['discountPercent'] : SKIP sub_amount = hash.key?('subAmount') ? hash['subAmount'] : SKIP minimum_partial_amount = hash.key?('minimumPartialAmount') ? hash['minimumPartialAmount'] : SKIP tax_details = TaxDetails13.from_hash(hash['taxDetails']) if hash['taxDetails'] freight = Freight.from_hash(hash['freight']) if hash['freight'] # 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. AmountDetails60.new(total_amount: total_amount, currency: currency, discount_amount: discount_amount, discount_percent: discount_percent, sub_amount: sub_amount, minimum_partial_amount: minimum_partial_amount, tax_details: tax_details, freight: freight, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 109 def self.names @_hash = {} if @_hash.nil? @_hash['total_amount'] = 'totalAmount' @_hash['currency'] = 'currency' @_hash['discount_amount'] = 'discountAmount' @_hash['discount_percent'] = 'discountPercent' @_hash['sub_amount'] = 'subAmount' @_hash['minimum_partial_amount'] = 'minimumPartialAmount' @_hash['tax_details'] = 'taxDetails' @_hash['freight'] = 'freight' @_hash end |
.nullables ⇒ Object
An array for nullable fields
135 136 137 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 135 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
123 124 125 126 127 128 129 130 131 132 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 123 def self.optionals %w[ discount_amount discount_percent sub_amount minimum_partial_amount tax_details freight ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
249 250 251 252 253 254 255 256 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 249 def inspect class_name = self.class.name.split('::').last "<#{class_name} total_amount: #{@total_amount.inspect}, currency: #{@currency.inspect},"\ " discount_amount: #{@discount_amount.inspect}, discount_percent:"\ " #{@discount_percent.inspect}, sub_amount: #{@sub_amount.inspect}, minimum_partial_amount:"\ " #{@minimum_partial_amount.inspect}, tax_details: #{@tax_details.inspect}, freight:"\ " #{@freight.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
240 241 242 243 244 245 246 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 240 def to_s class_name = self.class.name.split('::').last "<#{class_name} total_amount: #{@total_amount}, currency: #{@currency}, discount_amount:"\ " #{@discount_amount}, discount_percent: #{@discount_percent}, sub_amount: #{@sub_amount},"\ " minimum_partial_amount: #{@minimum_partial_amount}, tax_details: #{@tax_details}, freight:"\ " #{@freight}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/cyber_source_merged_spec/models/amount_details60.rb', line 219 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'totalAmount', total_amount) XmlUtilities.add_as_subelement(doc, root, 'currency', currency) XmlUtilities.add_as_subelement(doc, root, 'discountAmount', discount_amount) XmlUtilities.add_as_subelement(doc, root, 'discountPercent', discount_percent) XmlUtilities.add_as_subelement(doc, root, 'subAmount', sub_amount) XmlUtilities.add_as_subelement(doc, root, 'minimumPartialAmount', minimum_partial_amount) XmlUtilities.add_as_subelement(doc, root, 'TaxDetails13', tax_details) XmlUtilities.add_as_subelement(doc, root, 'Freight', freight) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |