Class: PaypalServerSdk::CapturePaymentInstruction

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

Overview

Any additional payment instructions to be consider during payment processing. This processing instruction is applicable for Capturing an order or Authorizing an Order.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(platform_fees: SKIP, disbursement_mode: DisbursementMode::INSTANT, payee_receivable_fx_rate_id: SKIP) ⇒ CapturePaymentInstruction

Returns a new instance of CapturePaymentInstruction.



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

def initialize(platform_fees: SKIP,
               disbursement_mode: DisbursementMode::INSTANT,
               payee_receivable_fx_rate_id: SKIP)
  @platform_fees = platform_fees unless platform_fees == SKIP
  @disbursement_mode = disbursement_mode unless disbursement_mode == SKIP
  unless payee_receivable_fx_rate_id == SKIP
    @payee_receivable_fx_rate_id =
      payee_receivable_fx_rate_id
  end
end

Instance Attribute Details

#disbursement_modeDisbursementMode

The funds that are held on behalf of the merchant.

Returns:



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

def disbursement_mode
  @disbursement_mode
end

#payee_receivable_fx_rate_idString

FX identifier generated returned by PayPal to be used for payment processing in order to honor FX rate (for eligible integrations) to be used when amount is settled/received into the payee account.

Returns:

  • (String)


27
28
29
# File 'lib/paypal_server_sdk/models/capture_payment_instruction.rb', line 27

def payee_receivable_fx_rate_id
  @payee_receivable_fx_rate_id
end

#platform_feesArray[PlatformFee]

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

Returns:



17
18
19
# File 'lib/paypal_server_sdk/models/capture_payment_instruction.rb', line 17

def platform_fees
  @platform_fees
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/paypal_server_sdk/models/capture_payment_instruction.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # 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')
  disbursement_mode =
    hash['disbursement_mode'] ||= DisbursementMode::INSTANT
  payee_receivable_fx_rate_id =
    hash.key?('payee_receivable_fx_rate_id') ? hash['payee_receivable_fx_rate_id'] : SKIP

  # Create object from extracted values.
  CapturePaymentInstruction.new(platform_fees: platform_fees,
                                disbursement_mode: disbursement_mode,
                                payee_receivable_fx_rate_id: payee_receivable_fx_rate_id)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['platform_fees'] = 'platform_fees'
  @_hash['disbursement_mode'] = 'disbursement_mode'
  @_hash['payee_receivable_fx_rate_id'] = 'payee_receivable_fx_rate_id'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/paypal_server_sdk/models/capture_payment_instruction.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    platform_fees
    disbursement_mode
    payee_receivable_fx_rate_id
  ]
end