Class: PaypalServerSdk::NetAmountBreakdownItem

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/net_amount_breakdown_item.rb

Overview

The net amount. Returned when the currency of the refund is different from the currency of the PayPal account where the merchant holds their funds.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(payable_amount: SKIP, converted_amount: SKIP, exchange_rate: SKIP) ⇒ NetAmountBreakdownItem

Returns a new instance of NetAmountBreakdownItem.



51
52
53
54
55
56
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 51

def initialize(payable_amount: SKIP, converted_amount: SKIP,
               exchange_rate: SKIP)
  @payable_amount = payable_amount unless payable_amount == SKIP
  @converted_amount = converted_amount unless converted_amount == SKIP
  @exchange_rate = exchange_rate unless exchange_rate == SKIP
end

Instance Attribute Details

#converted_amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



21
22
23
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 21

def converted_amount
  @converted_amount
end

#exchange_rateExchangeRate

The exchange rate that determines the amount to convert from one currency to another currency.

Returns:



26
27
28
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 26

def exchange_rate
  @exchange_rate
end

#payable_amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



16
17
18
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 16

def payable_amount
  @payable_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 59

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payable_amount = Money.from_hash(hash['payable_amount']) if hash['payable_amount']
  converted_amount = Money.from_hash(hash['converted_amount']) if hash['converted_amount']
  exchange_rate = ExchangeRate.from_hash(hash['exchange_rate']) if hash['exchange_rate']

  # Create object from extracted values.
  NetAmountBreakdownItem.new(payable_amount: payable_amount,
                             converted_amount: converted_amount,
                             exchange_rate: exchange_rate)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payable_amount'] = 'payable_amount'
  @_hash['converted_amount'] = 'converted_amount'
  @_hash['exchange_rate'] = 'exchange_rate'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



38
39
40
41
42
43
44
# File 'lib/paypal_server_sdk/models/net_amount_breakdown_item.rb', line 38

def self.optionals
  %w[
    payable_amount
    converted_amount
    exchange_rate
  ]
end