Class: PaypalServerSdk::SellerReceivableBreakdown

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

Overview

The detailed breakdown of the capture activity. This is not available for transactions that are in pending state.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(gross_amount:, paypal_fee: SKIP, paypal_fee_in_receivable_currency: SKIP, net_amount: SKIP, receivable_amount: SKIP, exchange_rate: SKIP, platform_fees: SKIP) ⇒ SellerReceivableBreakdown

Returns a new instance of SellerReceivableBreakdown.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 79

def initialize(gross_amount:, paypal_fee: SKIP,
               paypal_fee_in_receivable_currency: SKIP, net_amount: SKIP,
               receivable_amount: SKIP, exchange_rate: SKIP,
               platform_fees: SKIP)
  @gross_amount = gross_amount
  @paypal_fee = paypal_fee unless paypal_fee == SKIP
  unless paypal_fee_in_receivable_currency == SKIP
    @paypal_fee_in_receivable_currency =
      paypal_fee_in_receivable_currency
  end
  @net_amount = net_amount unless net_amount == SKIP
  @receivable_amount = receivable_amount unless receivable_amount == SKIP
  @exchange_rate = exchange_rate unless exchange_rate == SKIP
  @platform_fees = platform_fees unless platform_fees == SKIP
end

Instance Attribute Details

#exchange_rateExchangeRate

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

Returns:



41
42
43
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 41

def exchange_rate
  @exchange_rate
end

#gross_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/seller_receivable_breakdown.rb', line 16

def gross_amount
  @gross_amount
end

#net_amountMoney

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

Returns:



31
32
33
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 31

def net_amount
  @net_amount
end

#paypal_feeMoney

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/seller_receivable_breakdown.rb', line 21

def paypal_fee
  @paypal_fee
end

#paypal_fee_in_receivable_currencyMoney

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

Returns:



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

def paypal_fee_in_receivable_currency
  @paypal_fee_in_receivable_currency
end

#platform_feesArray[PlatformFee]

An array of platform or partner fees, commissions, or brokerage fees that associated with the captured payment.

Returns:



46
47
48
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 46

def platform_fees
  @platform_fees
end

#receivable_amountMoney

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

Returns:



36
37
38
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 36

def receivable_amount
  @receivable_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  gross_amount = Money.from_hash(hash['gross_amount']) if hash['gross_amount']
  paypal_fee = Money.from_hash(hash['paypal_fee']) if hash['paypal_fee']
  if hash['paypal_fee_in_receivable_currency']
    paypal_fee_in_receivable_currency = Money.from_hash(hash['paypal_fee_in_receivable_currency'])
  end
  net_amount = Money.from_hash(hash['net_amount']) if hash['net_amount']
  receivable_amount = Money.from_hash(hash['receivable_amount']) if hash['receivable_amount']
  exchange_rate = ExchangeRate.from_hash(hash['exchange_rate']) if hash['exchange_rate']
  # Parameter is an array, so we need to iterate through it
  platform_fees = nil
  unless hash['platform_fees'].nil?
    platform_fees = []
    hash['platform_fees'].each do |structure|
      platform_fees << (PlatformFee.from_hash(structure) if structure)
    end
  end

  platform_fees = SKIP unless hash.key?('platform_fees')

  # Create object from extracted values.
  SellerReceivableBreakdown.new(gross_amount: gross_amount,
                                paypal_fee: paypal_fee,
                                paypal_fee_in_receivable_currency: paypal_fee_in_receivable_currency,
                                net_amount: net_amount,
                                receivable_amount: receivable_amount,
                                exchange_rate: exchange_rate,
                                platform_fees: platform_fees)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['gross_amount'] = 'gross_amount'
  @_hash['paypal_fee'] = 'paypal_fee'
  @_hash['paypal_fee_in_receivable_currency'] =
    'paypal_fee_in_receivable_currency'
  @_hash['net_amount'] = 'net_amount'
  @_hash['receivable_amount'] = 'receivable_amount'
  @_hash['exchange_rate'] = 'exchange_rate'
  @_hash['platform_fees'] = 'platform_fees'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



63
64
65
66
67
68
69
70
71
72
# File 'lib/paypal_server_sdk/models/seller_receivable_breakdown.rb', line 63

def self.optionals
  %w[
    paypal_fee
    paypal_fee_in_receivable_currency
    net_amount
    receivable_amount
    exchange_rate
    platform_fees
  ]
end