Class: PaypalServerSdk::AmountWithBreakdown
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::AmountWithBreakdown
- Defined in:
- lib/paypal_server_sdk/models/amount_with_breakdown.rb
Overview
The total order amount with an optional breakdown that provides details, such as the total item amount, total tax amount, shipping, handling, insurance, and discounts, if any.<br/>If you specify ‘amount.breakdown`, the amount equals `item_total` plus `tax_total` plus `shipping` plus `handling` plus `insurance` minus `shipping_discount` minus discount.<br/>The amount must be a positive number. For listed of supported currencies and decimal precision, see the PayPal REST APIs <a href=“/docs/integration/direct/rest/currency-codes/”>Currency Codes</a>.
Instance Attribute Summary collapse
-
#breakdown ⇒ AmountBreakdown
The breakdown of the amount.
-
#currency_code ⇒ String
The [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) that identifies the currency.
-
#value ⇒ String
The value, which might be:<ul><li>An integer for currencies like ‘JPY` that are not typically fractional.</li><li>A decimal fraction for currencies like `TND` that are subdivided into thousandths.</li></ul>For the required number of decimal places for a currency code, see [Currency Codes](/api/rest/reference/currency-codes/).
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(currency_code:, value:, breakdown: SKIP) ⇒ AmountWithBreakdown
constructor
A new instance of AmountWithBreakdown.
Methods inherited from BaseModel
Constructor Details
#initialize(currency_code:, value:, breakdown: SKIP) ⇒ AmountWithBreakdown
Returns a new instance of AmountWithBreakdown.
59 60 61 62 63 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 59 def initialize(currency_code:, value:, breakdown: SKIP) @currency_code = currency_code @value = value @breakdown = breakdown unless breakdown == SKIP end |
Instance Attribute Details
#breakdown ⇒ AmountBreakdown
The breakdown of the amount. Breakdown provides details such as total item amount, total tax amount, shipping, handling, insurance, and discounts, if any.
36 37 38 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 36 def breakdown @breakdown end |
#currency_code ⇒ String
The [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) that identifies the currency.
22 23 24 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 22 def currency_code @currency_code end |
#value ⇒ String
The value, which might be:<ul><li>An integer for currencies like ‘JPY` that are not typically fractional.</li><li>A decimal fraction for currencies like `TND` that are subdivided into thousandths.</li></ul>For the required number of decimal places for a currency code, see [Currency Codes](/api/rest/reference/currency-codes/).
30 31 32 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 30 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. currency_code = hash.key?('currency_code') ? hash['currency_code'] : nil value = hash.key?('value') ? hash['value'] : nil breakdown = AmountBreakdown.from_hash(hash['breakdown']) if hash['breakdown'] # Create object from extracted values. AmountWithBreakdown.new(currency_code: currency_code, value: value, breakdown: breakdown) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['currency_code'] = 'currency_code' @_hash['value'] = 'value' @_hash['breakdown'] = 'breakdown' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
48 49 50 51 52 |
# File 'lib/paypal_server_sdk/models/amount_with_breakdown.rb', line 48 def self.optionals %w[ breakdown ] end |