Class: PaypalServerSdk::SellerPayableBreakdown

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

Overview

The breakdown of the refund.

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: SKIP, paypal_fee: SKIP, paypal_fee_in_receivable_currency: SKIP, net_amount: SKIP, net_amount_in_receivable_currency: SKIP, platform_fees: SKIP, net_amount_breakdown: SKIP, total_refunded_amount: SKIP) ⇒ SellerPayableBreakdown

Returns a new instance of SellerPayableBreakdown.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 88

def initialize(gross_amount: SKIP, paypal_fee: SKIP,
               paypal_fee_in_receivable_currency: SKIP, net_amount: SKIP,
               net_amount_in_receivable_currency: SKIP, platform_fees: SKIP,
               net_amount_breakdown: SKIP, total_refunded_amount: SKIP)
  @gross_amount = gross_amount unless gross_amount == SKIP
  @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
  unless net_amount_in_receivable_currency == SKIP
    @net_amount_in_receivable_currency =
      net_amount_in_receivable_currency
  end
  @platform_fees = platform_fees unless platform_fees == SKIP
  @net_amount_breakdown = net_amount_breakdown unless net_amount_breakdown == SKIP
  @total_refunded_amount = total_refunded_amount unless total_refunded_amount == SKIP
end

Instance Attribute Details

#gross_amountMoney

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

Returns:



15
16
17
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 15

def gross_amount
  @gross_amount
end

#net_amountMoney

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

Returns:



30
31
32
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 30

def net_amount
  @net_amount
end

#net_amount_breakdownArray[NetAmountBreakdownItem]

An array of breakdown values for the net amount. Returned when the currency of the refund is different from the currency of the PayPal account where the payee holds their funds.

Returns:



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

def net_amount_breakdown
  @net_amount_breakdown
end

#net_amount_in_receivable_currencyMoney

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

Returns:



35
36
37
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 35

def net_amount_in_receivable_currency
  @net_amount_in_receivable_currency
end

#paypal_feeMoney

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

Returns:



20
21
22
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 20

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:



25
26
27
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 25

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 for the refund.

Returns:



40
41
42
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 40

def platform_fees
  @platform_fees
end

#total_refunded_amountMoney

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

Returns:



51
52
53
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 51

def total_refunded_amount
  @total_refunded_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 109

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']
  if hash['net_amount_in_receivable_currency']
    net_amount_in_receivable_currency = Money.from_hash(hash['net_amount_in_receivable_currency'])
  end
  # 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')
  # Parameter is an array, so we need to iterate through it
  net_amount_breakdown = nil
  unless hash['net_amount_breakdown'].nil?
    net_amount_breakdown = []
    hash['net_amount_breakdown'].each do |structure|
      net_amount_breakdown << (NetAmountBreakdownItem.from_hash(structure) if structure)
    end
  end

  net_amount_breakdown = SKIP unless hash.key?('net_amount_breakdown')
  total_refunded_amount = Money.from_hash(hash['total_refunded_amount']) if
    hash['total_refunded_amount']

  # Create object from extracted values.
  SellerPayableBreakdown.new(gross_amount: gross_amount,
                             paypal_fee: paypal_fee,
                             paypal_fee_in_receivable_currency: paypal_fee_in_receivable_currency,
                             net_amount: net_amount,
                             net_amount_in_receivable_currency: net_amount_in_receivable_currency,
                             platform_fees: platform_fees,
                             net_amount_breakdown: net_amount_breakdown,
                             total_refunded_amount: total_refunded_amount)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 54

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['net_amount_in_receivable_currency'] =
    'net_amount_in_receivable_currency'
  @_hash['platform_fees'] = 'platform_fees'
  @_hash['net_amount_breakdown'] = 'net_amount_breakdown'
  @_hash['total_refunded_amount'] = 'total_refunded_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



84
85
86
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 84

def self.nullables
  []
end

.optionalsObject

An array for optional fields



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/paypal_server_sdk/models/seller_payable_breakdown.rb', line 70

def self.optionals
  %w[
    gross_amount
    paypal_fee
    paypal_fee_in_receivable_currency
    net_amount
    net_amount_in_receivable_currency
    platform_fees
    net_amount_breakdown
    total_refunded_amount
  ]
end