Class: PaypalServerSdk::PlatformFee

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

Overview

The platform or partner fee, commission, or brokerage fee that is associated with the transaction. Not a separate or isolated transaction leg from the external perspective. The platform fee is limited in scope and is always associated with the original payment for the purchase unit.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(amount:, payee: SKIP) ⇒ PlatformFee

Returns a new instance of PlatformFee.



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

def initialize(amount:, payee: SKIP)
  @amount = amount
  @payee = payee unless payee == SKIP
end

Instance Attribute Details

#amountMoney

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

Returns:



18
19
20
# File 'lib/paypal_server_sdk/models/platform_fee.rb', line 18

def amount
  @amount
end

#payeePayeeBase

The details for the merchant who receives the funds and fulfills the order. The merchant is also known as the payee.

Returns:



23
24
25
# File 'lib/paypal_server_sdk/models/platform_fee.rb', line 23

def payee
  @payee
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = Money.from_hash(hash['amount']) if hash['amount']
  payee = PayeeBase.from_hash(hash['payee']) if hash['payee']

  # Create object from extracted values.
  PlatformFee.new(amount: amount,
                  payee: payee)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
# File 'lib/paypal_server_sdk/models/platform_fee.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['payee'] = 'payee'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
# File 'lib/paypal_server_sdk/models/platform_fee.rb', line 34

def self.optionals
  %w[
    payee
  ]
end