Class: PaypalServerSdk::PaymentInstruction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/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_pricing_tier_id: SKIP, payee_receivable_fx_rate_id: SKIP) ⇒ PaymentInstruction

Returns a new instance of PaymentInstruction.



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

def initialize(platform_fees: SKIP,
               disbursement_mode: DisbursementMode::INSTANT,
               payee_pricing_tier_id: SKIP,
               payee_receivable_fx_rate_id: SKIP)
  @platform_fees = platform_fees unless platform_fees == SKIP
  @disbursement_mode = disbursement_mode unless disbursement_mode == SKIP
  @payee_pricing_tier_id = payee_pricing_tier_id unless payee_pricing_tier_id == 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:



22
23
24
# File 'lib/paypal_server_sdk/models/payment_instruction.rb', line 22

def disbursement_mode
  @disbursement_mode
end

#payee_pricing_tier_idString

This field is only enabled for selected merchants/partners to use and provides the ability to trigger a specific pricing rate/plan for a payment transaction. The list of eligible ‘payee_pricing_tier_id’ would be provided to you by your Account Manager. Specifying values other than the one provided to you by your account manager would result in an error.

Returns:

  • (String)


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

def payee_pricing_tier_id
  @payee_pricing_tier_id
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)


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

def payee_receivable_fx_rate_id
  @payee_receivable_fx_rate_id
end

#platform_feesArray[PlatformFee]

An array of various fees, commissions, tips, or donations. This field is only applicable to merchants that been enabled for PayPal Complete Payments Platform for Marketplaces and Platforms capability.

Returns:



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

def platform_fees
  @platform_fees
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/paypal_server_sdk/models/payment_instruction.rb', line 77

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_pricing_tier_id =
    hash.key?('payee_pricing_tier_id') ? hash['payee_pricing_tier_id'] : SKIP
  payee_receivable_fx_rate_id =
    hash.key?('payee_receivable_fx_rate_id') ? hash['payee_receivable_fx_rate_id'] : SKIP

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/paypal_server_sdk/models/payment_instruction.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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